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 //------------------------------------------------------------------------
25 //------------------------------------------------------------------------
26 
27 #ifndef _RTL_STRING_CONST_H_
28 #define _RTL_STRING_CONST_H_
29 
30 #ifndef _RTL_STRING_UTILS_HXX_
31     #include <rtl_String_Utils.hxx>
32 #endif
33 
34 //------------------------------------------------------------------------
35 //------------------------------------------------------------------------
36 
37 #include <limits.h>
38 
39 //------------------------------------------------------------------------
40 //------------------------------------------------------------------------
41 
42 #ifndef _SAL_TYPES_H_
43 	#include <sal/types.h>
44 #endif
45 
46 #ifndef _RTL_TEXTENC_H
47 	#include <rtl/textenc.h>
48 #endif
49 
50 #ifndef _RTL_USTRING_H_
51 	#include <rtl/ustring.h>
52 #endif
53 
54 //------------------------------------------------------------------------
55 //------------------------------------------------------------------------
56 
57 #ifdef __cplusplus
58 extern "C"
59 {
60 #endif
61 
62 //------------------------------------------------------------------------
63 //------------------------------------------------------------------------
64 
65 static const rtl_TextEncoding kEncodingRTLTextUSASCII = RTL_TEXTENCODING_ASCII_US;
66 
67 //------------------------------------------------------------------------
68 //------------------------------------------------------------------------
69 
70 static const sal_uInt32 kConvertFlagsOUStringToOString = OUSTRING_TO_OSTRING_CVTFLAGS;
71 static const sal_uInt32 kConvertFlagsOStringToOUString = OSTRING_TO_OUSTRING_CVTFLAGS;
72 
73 //------------------------------------------------------------------------
74 //------------------------------------------------------------------------
75 
76 static const sal_Char *kTestStr1  = "Sun Microsystems";
77 static const sal_Char *kTestStr2  = "Sun Microsystems Java Technology";
78 static const sal_Char *kTestStr3  = "Sun microsystems";
79 static const sal_Char *kTestStr4  = "SUN MICROSYSTEMS";
80 static const sal_Char *kTestStr5  = "sun microsystems";
81 static const sal_Char *kTestStr6  = "Java Technology";
82 static const sal_Char *kTestStr7  = "Sun ";
83 static const sal_Char *kTestStr8  = "Microsystems";
84 static const sal_Char *kTestStr9  = "sun microsystems java technology";
85 static const sal_Char *kTestStr10 = " Sun Microsystems";
86 static const sal_Char *kTestStr11 = "Sun Microsystems ";
87 static const sal_Char *kTestStr12 = " Sun Microsystems ";
88 static const sal_Char *kTestStr13 = "Sun Microsystems   ";
89 static const sal_Char *kTestStr14 = "   Sun Microsystems";
90 static const sal_Char *kTestStr15 = "   Sun Microsystems ";
91 static const sal_Char *kTestStr16 = " Sun Microsystems   ";
92 static const sal_Char *kTestStr17 = "   Sun Microsystems   ";
93 static const sal_Char *kTestStr18 = "sUN MICROsYsTEMs";
94 static const sal_Char *kTestStr19 = "---Sun-Microsystems---";
95 static const sal_Char *kTestStr20 = "sun";
96 static const sal_Char *kTestStr21 = "SUN";
97 static const sal_Char *kTestStr22 = "SUN MICROSYSTEMS JAVA TECHNOLOGY";
98 static const sal_Char *kTestStr23  = " Java Technology";
99 static const sal_Char *kTestStr24 = "Sun Microsystems Java Technolog";
100 static const sal_Char *kTestStr25 = "";
101 static const sal_Char *kTestStr26 = " Mic";
102 static const sal_Char *kTestStr27 = "s";
103 static const sal_Char *kTestStr28 = "\50\3\5\7\11\13\15\17sun";
104 static const sal_Char *kTestStr29 = "\50\3\5\7\11\13\15\17sun\21\23\25\27\31\33\50";
105 static const sal_Char *kTestStr30 = "sun\21\23\25\27\31\33\50";
106 static const sal_Char *kTestStr31 = "sun Microsystems";
107 static const sal_Char *kTestStr32 = "Sun Microsystem ";
108 static const sal_Char *kTestStr33 = " ";
109 static const sal_Char *kTestStr34 = "\50\5\5\7\11\13\15\17sun";
110 static const sal_Char *kTestStr35 = "\50\373\5\7\11\13\15\17sun";
111 static const sal_Char *kTestStr36 = "Microsystems Java Technology";
112 static const sal_Char *kTestStr37 = "Sun  Java Technology";
113 static const sal_Char *kTestStr38 = "\21\23\25\27\31\33\50";
114 static const sal_Char *kTestStr39 = "\50\3\5\7\11\13\15\17sun   Sun Microsystems   ";
115 static const sal_Char *kTestStr40 = "\50\3\5\7\11\13\15\17sunsun Microsystems";
116 static const sal_Char *kTestStr41 = "Sun";
117 static const sal_Char *kTestStr42 = "\50\3\5\7\11\13\15\17su";
118 static const sal_Char *kTestStr43 = "\50\3\5\7\11\13\15\17sun\256\345";
119 static const sal_Char *kTestStr44 = "\256\345";
120 static const sal_Char *kTestStr45  = "Sun true";
121 static const sal_Char *kTestStr46  = "Sun false";
122 static const sal_Char *kTestStr47  = "true";
123 static const sal_Char *kTestStr48  = "false";
124 static const sal_Char *kTestStr49 = "\50\3\5\7\11\13\15\17suntrue";
125 static const sal_Char *kTestStr50 = "\50\3\5\7\11\13\15\17sunfalse";
126 static const sal_Char *kTestStr51  = "Sun M";
127 //static const sal_Char *kTestStr52  = "Sun \077777";
128 //static const sal_Char *kTestStr53  = "Sun \100000";
129 //static const sal_Char *kTestStr54  = "\77777";
130 //static const sal_Char *kTestStr55  = "\100000";
131 static const sal_Char *kTestStr56 = "\50\3\5\7\11\13\15\17suns";
132 //static const sal_Char *kTestStr57 = "\50\3\5\7\11\13\15\17sun\77777";
133 //static const sal_Char *kTestStr58 = "\50\3\5\7\11\13\15\17sun\10000";
134 static const sal_Char *kTestStr1PlusStr6  = "Sun Microsystems" "Java Technology";
135 //------------------------------------------------------------------------
136 //------------------------------------------------------------------------
137 
138 static const sal_Int32 kTestStr1Len  = 16;
139 static const sal_Int32 kTestStr2Len  = 32;
140 static const sal_Int32 kTestStr3Len  = 16;
141 static const sal_Int32 kTestStr4Len  = 16;
142 static const sal_Int32 kTestStr5Len  = 16;
143 static const sal_Int32 kTestStr6Len  = 15;
144 static const sal_Int32 kTestStr7Len  = 4;
145 static const sal_Int32 kTestStr8Len  = 12;
146 static const sal_Int32 kTestStr9Len  = 32;
147 static const sal_Int32 kTestStr10Len = 17;
148 static const sal_Int32 kTestStr11Len = 17;
149 static const sal_Int32 kTestStr12Len = 18;
150 static const sal_Int32 kTestStr13Len = 19;
151 static const sal_Int32 kTestStr14Len = 19;
152 static const sal_Int32 kTestStr15Len = 20;
153 static const sal_Int32 kTestStr16Len = 20;
154 static const sal_Int32 kTestStr17Len = 22;
155 static const sal_Int32 kTestStr18Len = 16;
156 static const sal_Int32 kTestStr19Len = 22;
157 static const sal_Int32 kTestStr20Len = 3;
158 static const sal_Int32 kTestStr21Len = 3;
159 static const sal_Int32 kTestStr22Len = 32;
160 static const sal_Int32 kTestStr23Len = 16;
161 static const sal_Int32 kTestStr24Len = 31;
162 static const sal_Int32 kTestStr25Len = 0;
163 static const sal_Int32 kTestStr26Len = 4;
164 static const sal_Int32 kTestStr27Len = 1;
165 static const sal_Int32 kTestStr28Len = 11;
166 static const sal_Int32 kTestStr29Len = 18;
167 static const sal_Int32 kTestStr30Len = 10;
168 static const sal_Int32 kTestStr31Len = 16;
169 static const sal_Int32 kTestStr32Len = 16;
170 static const sal_Int32 kTestStr33Len = 1;
171 static const sal_Int32 kTestStr34Len = 11;
172 static const sal_Int32 kTestStr35Len = 11;
173 static const sal_Int32 kTestStr36Len = 28;
174 static const sal_Int32 kTestStr37Len = 20;
175 static const sal_Int32 kTestStr38Len = 7;
176 static const sal_Int32 kTestStr39Len = 33;
177 static const sal_Int32 kTestStr40Len = 27;
178 static const sal_Int32 kTestStr41Len = 3;
179 static const sal_Int32 kTestStr42Len = 10;
180 static const sal_Int32 kTestStr43Len = 13;
181 static const sal_Int32 kTestStr44Len = 2;
182 static const sal_Int32 kTestStr45Len = 8;
183 static const sal_Int32 kTestStr46Len = 9;
184 static const sal_Int32 kTestStr47Len = 4;
185 static const sal_Int32 kTestStr48Len = 5;
186 static const sal_Int32 kTestStr49Len = 15;
187 static const sal_Int32 kTestStr50Len = 16;
188 static const sal_Int32 kTestStr51Len = 5;
189 static const sal_Int32 kTestStr52Len = 5;
190 static const sal_Int32 kTestStr53Len = 5;
191 static const sal_Int32 kTestStr54Len = 1;
192 static const sal_Int32 kTestStr55Len = 1;
193 static const sal_Int32 kTestStr56Len = 12;
194 static const sal_Int32 kTestStr57Len = 12;
195 static const sal_Int32 kTestStr58Len = 12;
196 static const sal_Int32 kTestStr1PlusStr6Len = kTestStr1Len + kTestStr6Len;
197 
198 //------------------------------------------------------------------------
199 //------------------------------------------------------------------------
200  static sal_Unicode aUStr1[kTestStr1Len+1];
201  static sal_Unicode aUStr2[kTestStr2Len+1];
202  static sal_Unicode aUStr3[kTestStr3Len+1];
203  static sal_Unicode aUStr4[kTestStr4Len+1];
204  static sal_Unicode aUStr5[kTestStr5Len+1];
205  static sal_Unicode aUStr6[kTestStr6Len+1];
206  static sal_Unicode aUStr7[kTestStr7Len+1];
207  static sal_Unicode aUStr8[kTestStr8Len+1];
208  static sal_Unicode aUStr9[kTestStr9Len+1];
209  static sal_Unicode aUStr10[kTestStr10Len+1];
210  static sal_Unicode aUStr11[kTestStr11Len+1];
211  static sal_Unicode aUStr12[kTestStr12Len+1];
212  static sal_Unicode aUStr13[kTestStr13Len+1];
213  static sal_Unicode aUStr14[kTestStr14Len+1];
214  static sal_Unicode aUStr15[kTestStr15Len+1];
215  static sal_Unicode aUStr16[kTestStr16Len+1];
216  static sal_Unicode aUStr17[kTestStr17Len+1];
217  static sal_Unicode aUStr18[kTestStr18Len+1];
218  static sal_Unicode aUStr19[kTestStr19Len+1];
219  static sal_Unicode aUStr20[kTestStr20Len+1];
220  static sal_Unicode aUStr21[kTestStr21Len+1];
221  static sal_Unicode aUStr22[kTestStr22Len+1];
222  static sal_Unicode aUStr23[kTestStr23Len+1];
223  static sal_Unicode aUStr24[kTestStr24Len+1];
224  static sal_Unicode aUStr25[kTestStr25Len+1];
225  static sal_Unicode aUStr26[kTestStr26Len+1];
226  static sal_Unicode aUStr27[kTestStr27Len+1];
227  static sal_Unicode aUStr28[kTestStr28Len+1];
228  static sal_Unicode aUStr29[kTestStr29Len+1];
229  static sal_Unicode aUStr30[kTestStr30Len+1];
230  static sal_Unicode aUStr31[kTestStr31Len+1];
231  static sal_Unicode aUStr32[kTestStr32Len+1];
232  static sal_Unicode aUStr33[kTestStr33Len+1];
233  static sal_Unicode aUStr34[kTestStr34Len+1];
234  static sal_Unicode aUStr35[kTestStr35Len+1];
235  static sal_Unicode aUStr36[kTestStr36Len+1];
236  static sal_Unicode aUStr37[kTestStr37Len+1];
237  static sal_Unicode aUStr38[kTestStr38Len+1];
238  static sal_Unicode aUStr39[kTestStr39Len+1];
239  static sal_Unicode aUStr40[kTestStr40Len+1];
240  static sal_Unicode aUStr41[kTestStr41Len+1];
241  static sal_Unicode aUStr42[kTestStr42Len+1];
242  static sal_Unicode aUStr43[kTestStr43Len+1];
243  static sal_Unicode aUStr44[kTestStr44Len+1];
244  static sal_Unicode aUStr45[kTestStr45Len+1];
245  static sal_Unicode aUStr46[kTestStr46Len+1];
246  static sal_Unicode aUStr47[kTestStr47Len+1];
247  static sal_Unicode aUStr48[kTestStr48Len+1];
248  static sal_Unicode aUStr49[kTestStr49Len+1];
249  static sal_Unicode aUStr50[kTestStr50Len+1];
250  static sal_Unicode aUStr51[kTestStr51Len+1];
251 // static sal_Unicode aUStr52[kTestStr52Len+1]={83,117,110,32,32767};
252 // static sal_Unicode aUStr53[kTestStr53Len+1]={83,117,110,32,SAL_MIN_INT16 /*-32768*/};
253 // static sal_Unicode aUStr54[kTestStr54Len+1]={32767};
254 // static sal_Unicode aUStr55[kTestStr55Len+1]={SAL_MIN_INT16 /*-32768*/};
255  static sal_Unicode aUStr56[kTestStr56Len+1];
256 // static sal_Unicode aUStr57[kTestStr57Len+1]={40,3,5,7,9,11,13,15,115,117,110,32767};
257 // static sal_Unicode aUStr58[kTestStr58Len+1]={40,3,5,7,9,11,13,15,115,117,110,SAL_MIN_INT16 /*-32768*/};
258  static sal_Unicode aUStr1PlusUStr6[kTestStr1Len + kTestStr6Len + 1];
259 
260 // we are already in "C"
261 
test_ini_uString()262 static sal_Bool SAL_CALL test_ini_uString()
263 {
264 
265 	sal_Bool iniResult= sal_True;
266 
267 	iniResult &=AStringToUStringNCopy( aUStr1, kTestStr1, kTestStr1Len );
268 
269 	iniResult &=AStringToUStringNCopy( aUStr2, kTestStr2, kTestStr2Len );
270 
271 	iniResult &=AStringToUStringNCopy( aUStr3, kTestStr3, kTestStr3Len );
272 
273 	iniResult &=AStringToUStringNCopy( aUStr4, kTestStr4, kTestStr4Len );
274 
275 	iniResult &=AStringToUStringNCopy( aUStr5, kTestStr5, kTestStr5Len );
276 
277 	iniResult &=AStringToUStringNCopy( aUStr6, kTestStr6, kTestStr6Len );
278 
279         iniResult &=AStringToUStringNCopy( aUStr7, kTestStr7, kTestStr7Len );
280 
281         iniResult &=AStringToUStringNCopy( aUStr8, kTestStr8, kTestStr8Len );
282 
283 	iniResult &=AStringToUStringNCopy( aUStr9, kTestStr9, kTestStr9Len );
284 
285 	iniResult &=AStringToUStringNCopy( aUStr10, kTestStr10, kTestStr10Len );
286 
287 	iniResult &=AStringToUStringNCopy( aUStr11, kTestStr11, kTestStr11Len );
288 
289         iniResult &=AStringToUStringNCopy( aUStr12, kTestStr12, kTestStr12Len );
290 
291         iniResult &=AStringToUStringNCopy( aUStr13, kTestStr13, kTestStr13Len );
292 
293         iniResult &=AStringToUStringNCopy( aUStr14, kTestStr14, kTestStr14Len );
294 
295         iniResult &=AStringToUStringNCopy( aUStr15, kTestStr15, kTestStr15Len );
296 
297         iniResult &=AStringToUStringNCopy( aUStr16, kTestStr16, kTestStr16Len );
298 
299         iniResult &=AStringToUStringNCopy( aUStr17, kTestStr17, kTestStr17Len );
300 
301         iniResult &=AStringToUStringNCopy( aUStr18, kTestStr18, kTestStr18Len );
302 
303         iniResult &=AStringToUStringNCopy( aUStr19, kTestStr19, kTestStr19Len );
304 
305         iniResult &=AStringToUStringNCopy( aUStr20, kTestStr20, kTestStr20Len );
306 
307         iniResult &=AStringToUStringNCopy( aUStr21, kTestStr21, kTestStr21Len );
308 
309 	iniResult &=AStringToUStringNCopy( aUStr22, kTestStr22, kTestStr22Len );
310 
311 	iniResult &=AStringToUStringNCopy( aUStr23, kTestStr23, kTestStr23Len );
312 
313 	iniResult &=AStringToUStringNCopy( aUStr1PlusUStr6, kTestStr1PlusStr6, kTestStr1PlusStr6Len );
314 
315         iniResult &=AStringToUStringNCopy( aUStr24, kTestStr24, kTestStr24Len );
316 
317         iniResult &=AStringToUStringNCopy( aUStr25, kTestStr25, kTestStr25Len );
318 
319         iniResult &=AStringToUStringNCopy( aUStr26, kTestStr26, kTestStr26Len );
320 
321         iniResult &=AStringToUStringNCopy( aUStr27, kTestStr27, kTestStr27Len );
322 
323         iniResult &=AStringToUStringNCopy( aUStr28, kTestStr28, kTestStr28Len );
324 
325         iniResult &=AStringToUStringNCopy( aUStr29, kTestStr29, kTestStr29Len );
326 
327         iniResult &=AStringToUStringNCopy( aUStr30, kTestStr30, kTestStr30Len );
328 
329         iniResult &=AStringToUStringNCopy( aUStr31, kTestStr31, kTestStr31Len );
330 
331         iniResult &=AStringToUStringNCopy( aUStr32, kTestStr32, kTestStr32Len );
332 
333         iniResult &=AStringToUStringNCopy( aUStr33, kTestStr33, kTestStr33Len );
334 
335         iniResult &=AStringToUStringNCopy( aUStr34, kTestStr34, kTestStr34Len );
336 
337         iniResult &=AStringToUStringNCopy( aUStr35, kTestStr35, kTestStr35Len );
338 
339         iniResult &=AStringToUStringNCopy( aUStr36, kTestStr36, kTestStr36Len );
340 
341         iniResult &=AStringToUStringNCopy( aUStr37, kTestStr37, kTestStr37Len );
342 
343         iniResult &=AStringToUStringNCopy( aUStr38, kTestStr38, kTestStr38Len );
344 
345         iniResult &=AStringToUStringNCopy( aUStr39, kTestStr39, kTestStr39Len );
346 
347         iniResult &=AStringToUStringNCopy( aUStr40, kTestStr40, kTestStr40Len );
348 
349         iniResult &=AStringToUStringNCopy( aUStr41, kTestStr41, kTestStr41Len );
350 
351         iniResult &=AStringToUStringNCopy( aUStr42, kTestStr42, kTestStr42Len );
352 
353         iniResult &=AStringToUStringNCopy( aUStr43, kTestStr43, kTestStr43Len );
354 
355         iniResult &=AStringToUStringNCopy( aUStr44, kTestStr44, kTestStr44Len );
356 
357         iniResult &=AStringToUStringNCopy( aUStr45, kTestStr45, kTestStr45Len );
358 
359         iniResult &=AStringToUStringNCopy( aUStr46, kTestStr46, kTestStr46Len );
360 
361         iniResult &=AStringToUStringNCopy( aUStr47, kTestStr47, kTestStr47Len );
362 
363         iniResult &=AStringToUStringNCopy( aUStr48, kTestStr48, kTestStr48Len );
364 
365         iniResult &=AStringToUStringNCopy( aUStr49, kTestStr49, kTestStr49Len );
366 
367         iniResult &=AStringToUStringNCopy( aUStr50, kTestStr50, kTestStr50Len );
368 
369         iniResult &=AStringToUStringNCopy( aUStr51, kTestStr51, kTestStr51Len );
370 
371         //iniResult &=AStringToUStringNCopy( aUStr52, kTestStr52, kTestStr52Len );
372 
373        // iniResult &=AStringToUStringNCopy( aUStr53, kTestStr53, kTestStr53Len );
374 
375         //iniResult &=AStringToUStringNCopy( aUStr54, kTestStr54, kTestStr54Len );
376 
377         //iniResult &=AStringToUStringNCopy( aUStr55, kTestStr55, kTestStr55Len );
378 
379         iniResult &=AStringToUStringNCopy( aUStr56, kTestStr56, kTestStr56Len );
380 
381        // iniResult &=AStringToUStringNCopy( aUStr57, kTestStr57, kTestStr57Len );
382 
383         //iniResult &=AStringToUStringNCopy( aUStr58, kTestStr58, kTestStr58Len );
384 	return iniResult;
385 
386 }
387 
388 
389 
390 
391 static const sal_Int32 uTestStr1Len  = 16;
392 static const sal_Int32 uTestStr2Len  = 32;
393 static const sal_Int32 uTestStr3Len  = 16;
394 static const sal_Int32 uTestStr4Len  = 16;
395 static const sal_Int32 uTestStr5Len  = 16;
396 static const sal_Int32 uTestStr9Len  = 32;
397 static const sal_Int32 uTestStr22Len = 32;
398 
399 
400 
401 //------------------------------------------------------------------------
402 //------------------------------------------------------------------------
403 const sal_Unicode uTestStr31[]= {0x400,0x410,0x4DF};
404 const sal_Unicode uTestStr32[]= {0x9F9F,0xA000,0x8F80,0x9AD9};
405 
406 
407 
408 //------------------------------------------------------------------------
409 //------------------------------------------------------------------------
410 
411 static const sal_Int32 uTestStr31Len  = 3;
412 static const sal_Int32 uTestStr32Len  = 4;
413 
414 //------------------------------------------------------------------------
415 //------------------------------------------------------------------------
416 
417 static const sal_Int16 kRadixBinary     = 2;
418 static const sal_Int16 kRadixOctol      = 8;
419 static const sal_Int16 kRadixDecimal    = 10;
420 static const sal_Int16 kRadixHexdecimal = 16;
421 static const sal_Int16 kRadixBase36     = 36;
422 
423 //------------------------------------------------------------------------
424 //------------------------------------------------------------------------
425 
426 static const sal_Int8  kSInt8Max  = SCHAR_MAX;
427 static const sal_Int16 kUInt8Max  = UCHAR_MAX;
428 static const sal_Int16 kSInt16Max = SHRT_MAX;
429 static const sal_Int32 kUInt16Max = USHRT_MAX;
430 static const sal_Int32 kSInt32Max = INT_MAX;
431 static const sal_Int64 kUInt32Max = UINT_MAX;
432 #if (defined UNX) || (defined OS2)
433 static const sal_Int64 kSInt64Max = 9223372036854775807LL;
434 #else
435 static const sal_Int64 kSInt64Max = 9223372036854775807;
436 #endif
437 //------------------------------------------------------------------------
438 
439 static const sal_Int32 kInt32MaxNumsCount = 5;
440 
441 static const sal_Int32 kInt32MaxNums[kInt32MaxNumsCount] =
442                         {
443                             kSInt8Max,  kUInt8Max,
444                             kSInt16Max, kUInt16Max,
445                             kSInt32Max
446                         };
447 
448 static const sal_Int32 kInt64MaxNumsCount = 7;
449 
450 static const sal_Int64 kInt64MaxNums[kInt64MaxNumsCount] =
451                         {
452                             kSInt8Max,  kUInt8Max,
453                             kSInt16Max, kUInt16Max,
454                             kSInt32Max, kUInt32Max,
455                             kSInt64Max
456                         };
457 
458 //------------------------------------------------------------------------
459 //------------------------------------------------------------------------
460 
461 static const sal_Char *kSInt8MaxBinaryStr  = "1111111";
462 static const sal_Char *kUInt8MaxBinaryStr  = "11111111";
463 static const sal_Char *kSInt16MaxBinaryStr = "111111111111111";
464 static const sal_Char *kUInt16MaxBinaryStr = "1111111111111111";
465 static const sal_Char *kSInt32MaxBinaryStr =
466                                         "1111111111111111111111111111111";
467 static const sal_Char *kUInt32MaxBinaryStr =
468                                         "11111111111111111111111111111111";
469 static const sal_Char *kSInt64MaxBinaryStr =
470             "111111111111111111111111111111111111111111111111111111111111111";
471 
472 //------------------------------------------------------------------------
473 
474 static const sal_Char *kSInt8MaxOctolStr  = "177";
475 static const sal_Char *kUInt8MaxOctolStr  = "377";
476 static const sal_Char *kSInt16MaxOctolStr = "77777";
477 static const sal_Char *kUInt16MaxOctolStr = "177777";
478 static const sal_Char *kSInt32MaxOctolStr = "17777777777";
479 static const sal_Char *kUInt32MaxOctolStr = "37777777777";
480 static const sal_Char *kSInt64MaxOctolStr = "777777777777777777777";
481 
482 //------------------------------------------------------------------------
483 
484 static const sal_Char *kSInt8MaxDecimalStr  = "127";
485 static const sal_Char *kUInt8MaxDecimalStr  = "255";
486 static const sal_Char *kSInt16MaxDecimalStr = "32767";
487 static const sal_Char *kUInt16MaxDecimalStr = "65535";
488 static const sal_Char *kSInt32MaxDecimalStr = "2147483647";
489 static const sal_Char *kUInt32MaxDecimalStr = "4294967295";
490 static const sal_Char *kSInt64MaxDecimalStr = "9223372036854775807";
491 
492 //------------------------------------------------------------------------
493 
494 static const sal_Char *kSInt8MaxHexDecimalStr  = "7f";
495 static const sal_Char *kUInt8MaxHexDecimalStr  = "ff";
496 static const sal_Char *kSInt16MaxHexDecimalStr = "7fff";
497 static const sal_Char *kUInt16MaxHexDecimalStr = "ffff";
498 static const sal_Char *kSInt32MaxHexDecimalStr = "7fffffff";
499 static const sal_Char *kUInt32MaxHexDecimalStr = "ffffffff";
500 static const sal_Char *kSInt64MaxHexDecimalStr = "7fffffffffffffff";
501 
502 //------------------------------------------------------------------------
503 
504 static const sal_Char *kSInt8MaxBase36Str  = "3j";
505 static const sal_Char *kUInt8MaxBase36Str  = "73";
506 static const sal_Char *kSInt16MaxBase36Str = "pa7";
507 static const sal_Char *kUInt16MaxBase36Str = "1ekf";
508 static const sal_Char *kSInt32MaxBase36Str = "zik0zj";
509 static const sal_Char *kUInt32MaxBase36Str = "1z141z3";
510 static const sal_Char *kSInt64MaxBase36Str = "1y2p0ij32e8e7";
511 
512 //------------------------------------------------------------------------
513 //------------------------------------------------------------------------
514 
515 static const sal_Int32 kBinaryNumsCount = 16;
516 
517 static const sal_Char *kBinaryNumsStr[kBinaryNumsCount] =
518                         {
519                             "0",   "1",    "10",   "11",
520                             "100",  "101",  "110",  "111",
521                             "1000", "1001", "1010", "1011",
522                             "1100", "1101", "1110", "1111"
523                         };
524 
525 static const sal_Int32 kBinaryMaxNumsCount = 7;
526 
527 static const sal_Char *kBinaryMaxNumsStr[kBinaryMaxNumsCount] =
528                         {
529                             kSInt8MaxBinaryStr,
530                             kUInt8MaxBinaryStr,
531                             kSInt16MaxBinaryStr,
532                             kUInt16MaxBinaryStr,
533                             kSInt32MaxBinaryStr,
534                             kUInt32MaxBinaryStr,
535                             kSInt64MaxBinaryStr
536                         };
537 
538 //------------------------------------------------------------------------
539 
540 static const sal_Int32 kOctolNumsCount = 16;
541 
542 static const sal_Char *kOctolNumsStr[kOctolNumsCount] =
543                         {
544                             "0",  "1",  "2",  "3",
545                             "4",  "5",  "6",  "7",
546                             "10", "11", "12", "13",
547                             "14", "15", "16", "17"
548                         };
549 
550 static const sal_Int32 kOctolMaxNumsCount = 7;
551 
552 static const sal_Char *kOctolMaxNumsStr[kOctolMaxNumsCount] =
553                         {
554                             kSInt8MaxOctolStr,
555                             kUInt8MaxOctolStr,
556                             kSInt16MaxOctolStr,
557                             kUInt16MaxOctolStr,
558                             kSInt32MaxOctolStr,
559                             kUInt32MaxOctolStr,
560                             kSInt64MaxOctolStr
561                         };
562 
563 //------------------------------------------------------------------------
564 
565 static const sal_Int32 kDecimalNumsCount = 16;
566 
567 static const sal_Char *kDecimalNumsStr[kDecimalNumsCount] =
568                         {
569                             "0",  "1",  "2",  "3",
570                             "4",  "5",  "6",  "7",
571                             "8",  "9", "10", "11",
572                             "12", "13", "14", "15"
573                         };
574 
575 static const sal_Int32 kDecimalMaxNumsCount = 7;
576 
577 static const sal_Char *kDecimalMaxNumsStr[kDecimalMaxNumsCount] =
578                         {
579                             kSInt8MaxDecimalStr,
580                             kUInt8MaxDecimalStr,
581                             kSInt16MaxDecimalStr,
582                             kUInt16MaxDecimalStr,
583                             kSInt32MaxDecimalStr,
584                             kUInt32MaxDecimalStr,
585                             kSInt64MaxDecimalStr
586                         };
587 
588 //------------------------------------------------------------------------
589 
590 static const sal_Int32 kHexDecimalNumsCount = 16;
591 
592 static const sal_Char *kHexDecimalNumsStr[kHexDecimalNumsCount] =
593                         {
594                             "0", "1", "2", "3",
595                             "4", "5", "6", "7",
596                             "8", "9", "a", "b",
597                             "c", "d", "e", "f"
598                         };
599 
600 static const sal_Int32 kHexDecimalMaxNumsCount = 7;
601 
602 static const sal_Char *kHexDecimalMaxNumsStr[kHexDecimalMaxNumsCount] =
603                         {
604                             kSInt8MaxHexDecimalStr,
605                             kUInt8MaxHexDecimalStr,
606                             kSInt16MaxHexDecimalStr,
607                             kUInt16MaxHexDecimalStr,
608                             kSInt32MaxHexDecimalStr,
609                             kUInt32MaxHexDecimalStr,
610                             kSInt64MaxHexDecimalStr
611                         };
612 
613 //------------------------------------------------------------------------
614 
615 static const sal_Int32 kBase36NumsCount = 36;
616 
617 static const sal_Char *kBase36NumsStr[kBase36NumsCount] =
618                         {
619                             "0", "1", "2", "3",
620                             "4", "5", "6", "7",
621                             "8", "9", "a", "b",
622                             "c", "d", "e", "f",
623                             "g", "h", "i", "j",
624                             "k", "l", "m", "n",
625                             "o", "p", "q", "r",
626                             "s", "t", "u", "v",
627                             "w", "x", "y", "z"
628                         };
629 
630 static const sal_Int32 kBase36MaxNumsCount = 7;
631 
632 static const sal_Char *kBase36MaxNumsStr[kBase36MaxNumsCount] =
633                         {
634                             kSInt8MaxBase36Str,
635                             kUInt8MaxBase36Str,
636                             kSInt16MaxBase36Str,
637                             kUInt16MaxBase36Str,
638                             kSInt32MaxBase36Str,
639                             kUInt32MaxBase36Str,
640                             kSInt64MaxBase36Str
641                         };
642 
643 //------------------------------------------------------------------------
644 //------------------------------------------------------------------------
645 static const sal_Int32 nDoubleCount=24;
646 // static const sal_Char *inputDouble[nDoubleCount] =
647 // 	{
648 //             "3","3.1","3.1415","3.1415926535","3.141592653589793",
649 //             "3.1415926535897932","3.14159265358979323","+3.1",
650 //             "3.141592653589793238462643","9.1096e-31","2.997925e8","6.241e18","5.381e+18",
651 //             "1.7e-309","6.5822e-16","1.7e+307","2.2e30","03.1"," 3.1","-3.1",
652 //             "-0.0","0.0","","1.00e308"
653 // 	};
654 static const double   expValDouble[nDoubleCount]=
655 	{
656             3.0,3.1,3.1415,3.1415926535,3.141592653589793,
657             3.1415926535897932,3.14159265358979323,3.1,
658             3.141592653589793238462643,9.1096e-31,2.997925e8,6.241e18,5.381e18,
659             1.7e-309,6.5822e-16,1.7e+307,2.2e30,3.1,3.1,-3.1,
660             0.0,0.0,0.0,1.00e+308
661 	};
662 //------------------------------------------------------------------------
663 static const sal_Int32 nFloatCount=22;
664 // static const sal_Char *inputFloat[nFloatCount] =
665 //         {
666 //             "3",
667 //             "3.1",
668 //             "3.1415",
669 //             "3.14159",
670 //             "3.141592",
671 //             "3.1415926",
672 //             "3.14159265",
673 //             "3.141592653589793238462643",
674 //             "6.5822e-16",
675 //             "9.1096e-31",
676 //             "2.997925e8",
677 //             "6.241e18",
678 //             "1.00e38",
679 //             "6.241e-37",
680 //             "6.241e37",
681 //             "03.1",
682 //             " 3.1",
683 //             "-3.1",
684 //             "+3.1",
685 //             "-0.0",
686 //             "0.0",
687 //             ""
688 //         };
689 static const float  expValFloat[nFloatCount] =
690         {
691             3.0f,
692             3.1f,
693             3.1415f,
694             3.14159f,
695             3.141592f,
696             3.1415926f,
697             3.14159265f,
698             3.141592653589793238462643f,
699             6.5822e-16f,
700             9.1096e-31f,
701             2.997925e8f,
702             6.241e18f,
703             1.00e38f,
704             6.241e-37f,
705             6.241e37f,
706             3.1f,
707             3.1f,
708             -3.1f,
709             3.1f,
710             0.0f,
711             0.0f,
712             0.0f
713         };
714 static const float  fPrecision[nFloatCount] =
715         {
716             3e-7f,
717             3e-7f,
718             3e-7f,
719             3e-7f,
720             3e-7f,
721             3e-7f,
722             3e-7f,
723             3e-7f,
724             6e-16f * 1e-7f,
725             9e-31f * 1e-7f,
726             3e8f   * 1e-7f,
727             6e18f  * 1e-7f,
728             1e38f  * 1e-7f,
729             6e-37f * 1e-7f,
730             6e37f  * 1e-7f,
731             3e-7f,
732             3e-7f,
733             3e-7f,
734             3e-7f,
735             1e-7f,
736             1e-7f,
737             1e-7f
738         };
739 //------------------------------------------------------------------------
740 static const sal_Int32 nCharCount=15;
741 static const sal_Char *inputChar[nCharCount] =
742         {
743             "A","a","0","-","_",
744             "\25","\33","\35",
745             "@","\n","\'","\"",
746             "\0","","Sun Microsystems"
747         };
748 static const sal_Unicode  expValChar[nCharCount] =
749         {
750             65,97,48,45,95,
751             21,27,29,
752             64,10,39,34,
753             0,0,83
754         };
755 //------------------------------------------------------------------------
756 static const sal_Int32 nDefaultCount=6;
757 static const sal_Unicode input1Default[nDefaultCount] =
758         {
759             77,115,85,119,32,0
760         };
761 static const sal_Int32 input2Default[nDefaultCount] =
762         {
763             0,0,0,0,0,0
764         };
765 static const sal_Int32  expValDefault[nDefaultCount] =
766         {
767             4,9,-1,-1,3,-1
768         };
769 //------------------------------------------------------------------------
770 static const sal_Int32 nNormalCount=10;
771 static const sal_Unicode input1Normal[nNormalCount] =
772         {
773             77,77,77,115,115,115,119,119,0,0
774         };
775 static const sal_Int32 input2Normal[nNormalCount] =
776         {
777             0,32,80,0,13,20,0,80,0,32
778         };
779 static const sal_Int32  expValNormal[nNormalCount] =
780         {
781             4,-1,-1,9,15,-1,-1,-1,-1,-1
782         };
783 //------------------------------------------------------------------------
784 static const sal_Int32 nlastDefaultCount=5;
785 static const sal_Unicode input1lastDefault[nlastDefaultCount] =
786         {
787             77,115,119,32,0
788         };
789 static const sal_Int32 input2lastDefault[nlastDefaultCount] =
790         {
791             31,31,31,31,31
792         };
793 static const sal_Int32  expVallastDefault[nlastDefaultCount] =
794         {
795             4,15,-1,21,-1
796         };
797 //------------------------------------------------------------------------
798 static const sal_Int32 nlastNormalCount=8;
799 static const sal_Unicode input1lastNormal[nlastNormalCount] =
800         {
801             77,77,77,115,115,119,119,0
802         };
803 static const sal_Int32 input2lastNormal[nlastNormalCount] =
804         {
805             29,0,80,31,3,31,80,31
806         };
807 static const sal_Int32  expVallastNormal[nlastNormalCount] =
808         {
809             4,-1,4,15,-1,-1,-1,-1
810         };
811 //------------------------------------------------------------------------
812 static const sal_Int32 nStrDefaultCount=6;
813 static const sal_Unicode *input1StrDefault[nStrDefaultCount] =
814         {
815             aUStr7,aUStr8,aUStr21,
816             aUStr30,aUStr25,aUStr26
817         };
818 static const sal_Int32 input2StrDefault[nStrDefaultCount] =
819         {
820             0,0,0,0,0,0
821         };
822 static const sal_Int32 expValStrDefault[nStrDefaultCount] =
823         {
824             0,4,-1,-1,-1,3
825         };
826 //------------------------------------------------------------------------
827 static const sal_Int32 nStrNormalCount=9;
828 static const sal_Unicode *input1StrNormal[nStrNormalCount] =
829         {
830             aUStr7,aUStr7,aUStr8,aUStr8,aUStr21,aUStr30,aUStr25,aUStr25,aUStr26
831         };
832 static const sal_Int32 input2StrNormal[nStrNormalCount] =
833         {
834             0,32,0,30,0,0,0,32,0
835         };
836 static const sal_Int32 expValStrNormal[nStrNormalCount] =
837         {
838             0,-1,4,-1,-1,-1,-1,-1,3
839         };
840 //------------------------------------------------------------------------
841 static const sal_Int32 nStrLastDefaultCount=6;
842 static const sal_Unicode *input1StrLastDefault[nStrLastDefaultCount] =
843         {
844             aUStr7,aUStr8,aUStr21,aUStr30,aUStr25,aUStr26
845         };
846 static const sal_Int32 input2StrLastDefault[nStrLastDefaultCount] =
847         {
848             31,31,31,31,31,31
849         };
850 static const sal_Int32  expValStrLastDefault[nStrLastDefaultCount] =
851         {
852             0,4,-1,-1,-1,3
853         };
854 //------------------------------------------------------------------------
855 static const sal_Int32 nStrLastNormalCount=12;
856 static const sal_Unicode *input1StrLastNormal[nStrLastNormalCount] =
857         {
858             aUStr7,aUStr7,aUStr7,aUStr8,aUStr8,aUStr21,aUStr30,
859             aUStr25,aUStr25,aUStr26,aUStr27,aUStr27
860         };
861 static const sal_Int32 input2StrLastNormal[nStrLastNormalCount] =
862         {
863             31,0,80,31,2,31,31,31,0,31,31,14
864         };
865 static const sal_Int32  expValStrLastNormal[nStrLastNormalCount] =
866         {
867             0,-1,0,4,-1,-1,-1,-1,-1,3,15,11
868         };
869 //------------------------------------------------------------------------
870 static const sal_Int32 kNonSInt32Max = INT_MIN;
871 static const sal_Int32 kNonSInt16Max = SHRT_MIN;
872 //------------------------------------------------------------------------
873 #ifdef __cplusplus
874 }
875 #endif
876 
877 //------------------------------------------------------------------------
878 //------------------------------------------------------------------------
879 
880 #endif /* _RTL_STRING_CONST_H_ */
881 
882