OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * Copyright (C) 2011-2013, International Business Machines | 3 * Copyright (C) 2011-2014, International Business Machines |
4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
5 ******************************************************************************* | 5 ******************************************************************************* |
6 * file name: ppucd.cpp | 6 * file name: ppucd.cpp |
7 * encoding: US-ASCII | 7 * encoding: US-ASCII |
8 * tab size: 8 (not used) | 8 * tab size: 8 (not used) |
9 * indentation:4 | 9 * indentation:4 |
10 * | 10 * |
11 * created on: 2011dec11 | 11 * created on: 2011dec11 |
12 * created by: Markus W. Scherer | 12 * created by: Markus W. Scherer |
13 */ | 13 */ |
14 | 14 |
15 #include "unicode/utypes.h" | 15 #include "unicode/utypes.h" |
16 #include "unicode/uchar.h" | 16 #include "unicode/uchar.h" |
17 #include "charstr.h" | 17 #include "charstr.h" |
18 #include "cstring.h" | 18 #include "cstring.h" |
19 #include "ppucd.h" | 19 #include "ppucd.h" |
20 #include "uassert.h" | 20 #include "uassert.h" |
21 #include "uparse.h" | 21 #include "uparse.h" |
22 | 22 |
23 #include <stdio.h> | 23 #include <stdio.h> |
24 #include <string.h> | 24 #include <string.h> |
25 | 25 |
26 #define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) | |
27 | |
28 U_NAMESPACE_BEGIN | 26 U_NAMESPACE_BEGIN |
29 | 27 |
30 PropertyNames::~PropertyNames() {} | 28 PropertyNames::~PropertyNames() {} |
31 | 29 |
32 int32_t | 30 int32_t |
33 PropertyNames::getPropertyEnum(const char *name) const { | 31 PropertyNames::getPropertyEnum(const char *name) const { |
34 return u_getPropertyEnum(name); | 32 return u_getPropertyEnum(name); |
35 } | 33 } |
36 | 34 |
37 int32_t | 35 int32_t |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 } else { | 289 } else { |
292 binaryValue=-1; | 290 binaryValue=-1; |
293 // Copy out the property name rather than modifying the field (writing a
NUL). | 291 // Copy out the property name rather than modifying the field (writing a
NUL). |
294 pBuffer.append(p, (int32_t)(v-p), errorCode); | 292 pBuffer.append(p, (int32_t)(v-p), errorCode); |
295 p=pBuffer.data(); | 293 p=pBuffer.data(); |
296 ++v; | 294 ++v; |
297 } | 295 } |
298 int32_t prop=pnames->getPropertyEnum(p); | 296 int32_t prop=pnames->getPropertyEnum(p); |
299 if(prop<0) { | 297 if(prop<0) { |
300 for(int32_t i=0;; ++i) { | 298 for(int32_t i=0;; ++i) { |
301 if(i==LENGTHOF(ppucdProperties)) { | 299 if(i==UPRV_LENGTHOF(ppucdProperties)) { |
302 // Ignore unknown property names. | 300 // Ignore unknown property names. |
303 return TRUE; | 301 return TRUE; |
304 } | 302 } |
305 if(0==uprv_stricmp(p, ppucdProperties[i].name)) { | 303 if(0==uprv_stricmp(p, ppucdProperties[i].name)) { |
306 prop=ppucdProperties[i].prop; | 304 prop=ppucdProperties[i].prop; |
307 U_ASSERT(prop>=0); | 305 U_ASSERT(prop>=0); |
308 break; | 306 break; |
309 } | 307 } |
310 } | 308 } |
311 } | 309 } |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 break; | 565 break; |
568 } | 566 } |
569 } | 567 } |
570 if(scx.isEmpty()) { | 568 if(scx.isEmpty()) { |
571 fprintf(stderr, "error in preparsed UCD: empty scx= on line %ld\n", (lon
g)lineNumber); | 569 fprintf(stderr, "error in preparsed UCD: empty scx= on line %ld\n", (lon
g)lineNumber); |
572 errorCode=U_PARSE_ERROR; | 570 errorCode=U_PARSE_ERROR; |
573 } | 571 } |
574 } | 572 } |
575 | 573 |
576 U_NAMESPACE_END | 574 U_NAMESPACE_END |
OLD | NEW |