xref: /aoo42x/main/autodoc/inc/cosv/csv_env.hxx (revision 8a106958)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef CSV_CSV_ENV_HXX
25 #define	CSV_CSV_ENV_HXX
26 
27 
28 
29 //*******       Include c-language-types        ************//
30 // size_t, wchar_t
31 #include <stdlib.h>
32 
33 
34 
35 //*******       Builtin types of exact length        ************//
36 
37 // Exact length builtin types
38 typedef signed char     INT8;
39 typedef unsigned char   UINT8;
40 typedef short           INT16;
41 typedef unsigned short  UINT16;
42 typedef long            INT32;
43 typedef unsigned long   UINT32;
44 typedef float		    REAL32;
45 typedef double		    REAL64;
46 
47 
48 // Additional builtin types
49 typedef INT32		 intt;		// standard sized integer.
50 typedef UINT32		 uintt;		// standard sized unsigned integer.
51 typedef REAL64 		 real;      // standard sized real.
52 
53 //  Constants
54 //  ---------
55 // Zero-pointer for use in ellipsed (...) parameter lists which expect a
56 //   pointer which may have another size than an int.
57 // 	 Must be a define to be used in precompiled headers:
58 #define NIL   ((void*)0)
59 // char '\0'
60 #define NULCH '\0'
61 
62 
63 
64 // Boolesche Operatoren
65 #define AND &&
66 #define OR  ||
67 #define NOT !
68 
69 // Macro for distinguishing dynamic allocated pointers from
70 //   referencing pointers
71 #define DYN		// Exact specification: DYN has to be used if and only if:
72 				//	1. DYN specifies a class member pointer or reference variable and
73 				//     the class must free the referenced memory.
74 				//  2. DYN specifies a pointer or reference (return-) parameter of a function
75 				//     and for in-parameters the function or its class
76 				//     must free the referenced memory, the parameter is then called
77 				//     a let-parameter.
78 				//     For out- and inout-parameters
79 				//	   or return values the caller of the function hast to
80 				//     free the referenced memory.
81 				//
82 				//     It is irrelevant who allocated the memory!
83 				//
84 				//     DYN - variables use the prefixes "dp" or "dr" instead of "p" or "r".
85 
86 
87 //******        Assertions          ******//
88 
89 namespace csv
90 {
91 void                PerformAssertion(
92                         const char *        condition,
93                         const char *        file,
94                         unsigned            line );
95 }
96 
97 // Programming by contract
98 #ifndef CSV_NO_ASSERTIONS
99 
100 #ifdef CSV_USE_CSV_ASSERTIONS
101 #define csv_assert(x)	 	( (x) ? (void)(0) : ::csv::PerformAssertion( #x, __FILE__, __LINE__) )
102 #else
103 
104 // Save NDEBUG state
105 #ifdef NDEBUG
106 #define CSV_CSV_ENV_HXX_HAD_NDEBUG
107 #undef NDEBUG
108 #endif
109 
110 #if OSL_DEBUG_LEVEL == 0
111 #define NDEBUG
112 #endif
113 #include <assert.h>
114 
115 #define csv_assert(x)	 	assert(x);
116 
117 // Restore NDEBUG state
118 #ifdef CSV_CSV_ENV_HXX_HAD_NDEBUG
119 #define NDEBUG
120 #else
121 #undef NDEBUG
122 #endif
123 
124 #endif
125 
126 #else // #ifndef CSV_NO_ASSERTIONS else
127 
128 #define csv_assert(x)
129 
130 #endif	// end ifndef CSV_NO_ASSERTIONS else
131 
132 
133 
134 /* Additional Programming Conventions
135 
136 1. see above at "#define DYN"
137 2. function parameters get one of these prefixes:
138 	- i_	 := Function uses only the value, but must not change a referenced variable.
139 	- o_	 := Parameter is undefined until function has set it.
140 				Parametere must be set by the function.
141 	- io_	 := Function may use and change the referenced variable.
142 	- pass_	 := Funktion may use and change the referenced variable and HAS TO free the
143 				associated memory.
144 3. Global constants get the prefix 'C_', global variables the prefix 'G_'.
145 4. Static members end with an underscore '_'.
146 
147 */
148 
149 
150 #endif
151