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