• Home
  • Raw
  • Download

Lines Matching full:string

2  * Implementation of the ANTLR3 string and string factory classes
42 static pANTLR3_STRING newPtr8 (pANTLR3_STRING_FACTORY factory, pANTLR3_UINT8 string, ANTLR3_U…
43 static pANTLR3_STRING newPtrUTF16_8 (pANTLR3_STRING_FACTORY factory, pANTLR3_UINT8 string, AN…
44 static pANTLR3_STRING newPtrUTF16_UTF16 (pANTLR3_STRING_FACTORY factory, pANTLR3_UINT8 string
45 static pANTLR3_STRING newStr8 (pANTLR3_STRING_FACTORY factory, pANTLR3_UINT8 string);
46 static pANTLR3_STRING newStrUTF16_8 (pANTLR3_STRING_FACTORY factory, pANTLR3_UINT8 string);
47 static pANTLR3_STRING newStrUTF16_UTF16 (pANTLR3_STRING_FACTORY factory, pANTLR3_UINT8 string
48 static void destroy (pANTLR3_STRING_FACTORY factory, pANTLR3_STRING string);
49 static pANTLR3_STRING printable8 (pANTLR3_STRING_FACTORY factory, pANTLR3_STRING string);
50 static pANTLR3_STRING printableUTF16 (pANTLR3_STRING_FACTORY factory, pANTLR3_STRING string);
53 /* String API
55 static pANTLR3_UINT8 set8 (pANTLR3_STRING string, const char * chars);
56 static pANTLR3_UINT8 setUTF16_8 (pANTLR3_STRING string, const char * chars);
57 static pANTLR3_UINT8 setUTF16_UTF16 (pANTLR3_STRING string, const char * chars);
58 static pANTLR3_UINT8 append8 (pANTLR3_STRING string, const char * newbit);
59 static pANTLR3_UINT8 appendUTF16_8 (pANTLR3_STRING string, const char * newbit);
60 static pANTLR3_UINT8 appendUTF16_UTF16 (pANTLR3_STRING string, const char * newbit);
61 static pANTLR3_UINT8 insert8 (pANTLR3_STRING string, ANTLR3_UINT32 point, const char * newbit…
62 static pANTLR3_UINT8 insertUTF16_8 (pANTLR3_STRING string, ANTLR3_UINT32 point, const char * …
63 static pANTLR3_UINT8 insertUTF16_UTF16 (pANTLR3_STRING string, ANTLR3_UINT32 point, const cha…
65 static pANTLR3_UINT8 setS (pANTLR3_STRING string, pANTLR3_STRING chars);
66 static pANTLR3_UINT8 appendS (pANTLR3_STRING string, pANTLR3_STRING newbit);
67 static pANTLR3_UINT8 insertS (pANTLR3_STRING string, ANTLR3_UINT32 point, pANTLR3_STRING newb…
69 static pANTLR3_UINT8 addc8 (pANTLR3_STRING string, ANTLR3_UINT32 c);
70 static pANTLR3_UINT8 addcUTF16 (pANTLR3_STRING string, ANTLR3_UINT32 c);
71 static pANTLR3_UINT8 addi8 (pANTLR3_STRING string, ANTLR3_INT32 i);
72 static pANTLR3_UINT8 addiUTF16 (pANTLR3_STRING string, ANTLR3_INT32 i);
73 static pANTLR3_UINT8 inserti8 (pANTLR3_STRING string, ANTLR3_UINT32 point, ANTLR3_INT32 i);
74 static pANTLR3_UINT8 insertiUTF16 (pANTLR3_STRING string, ANTLR3_UINT32 point, ANTLR3_INT32 i…
76 static ANTLR3_UINT32 compare8 (pANTLR3_STRING string, const char * compStr);
77 static ANTLR3_UINT32 compareUTF16_8 (pANTLR3_STRING string, const char * compStr);
78 static ANTLR3_UINT32 compareUTF16_UTF16(pANTLR3_STRING string, const char * compStr);
79 static ANTLR3_UINT32 compareS (pANTLR3_STRING string, pANTLR3_STRING compStr);
80 static ANTLR3_UCHAR charAt8 (pANTLR3_STRING string, ANTLR3_UINT32 offset);
81 static ANTLR3_UCHAR charAtUTF16 (pANTLR3_STRING string, ANTLR3_UINT32 offset);
82 static pANTLR3_STRING subString8 (pANTLR3_STRING string, ANTLR3_UINT32 startIndex, ANTLR3_UIN…
83 static pANTLR3_STRING subStringUTF16 (pANTLR3_STRING string, ANTLR3_UINT32 startIndex, ANTLR3…
84 static ANTLR3_INT32 toInt32_8 (pANTLR3_STRING string);
85 static ANTLR3_INT32 toInt32_UTF16 (pANTLR3_STRING string);
86 static pANTLR3_STRING to8_8 (pANTLR3_STRING string);
87 static pANTLR3_STRING to8_UTF16 (pANTLR3_STRING string);
88 static pANTLR3_STRING toUTF8_8 (pANTLR3_STRING string);
89 static pANTLR3_STRING toUTF8_UTF16 (pANTLR3_STRING string);
93 static void stringInit8 (pANTLR3_STRING string);
94 static void stringInitUTF16 (pANTLR3_STRING string);
95 static void ANTLR3_CDECL stringFree (pANTLR3_STRING string);
125 // UTF16 and 8Bit if I am going to support those encodings in the STRING stuff. in antlr3StringFactoryNew()
126 // The STRING stuff was intended as a quick and dirty hack for people that did not in antlr3StringFactoryNew()
130 // directly, so I am not implementing the string stuff for the newer encodings. in antlr3StringFactoryNew()
188 pANTLR3_STRING string; in newRaw8() local
190 string = (pANTLR3_STRING) ANTLR3_MALLOC(sizeof(ANTLR3_STRING)); in newRaw8()
192 if (string == NULL) in newRaw8()
199 stringInit8(string); in newRaw8()
200 string->factory = factory; in newRaw8()
202 /* Add the string into the allocated list in newRaw8()
204 …factory->strings->set(factory->strings, factory->index, (void *) string, (void (ANTLR3_CDECL *)(vo… in newRaw8()
205 string->index = factory->index++; in newRaw8()
207 return string; in newRaw8()
217 pANTLR3_STRING string; in newRawUTF16() local
219 string = (pANTLR3_STRING) ANTLR3_MALLOC(sizeof(ANTLR3_STRING)); in newRawUTF16()
221 if (string == NULL) in newRawUTF16()
228 stringInitUTF16(string); in newRawUTF16()
229 string->factory = factory; in newRawUTF16()
231 /* Add the string into the allocated list in newRawUTF16()
233 …factory->strings->set(factory->strings, factory->index, (void *) string, (void (ANTLR3_CDECL *)(vo… in newRawUTF16()
234 string->index = factory->index++; in newRawUTF16()
236 return string; in newRawUTF16()
239 void ANTLR3_CDECL stringFree (pANTLR3_STRING string) in stringFree() argument
241 /* First free the string itself if there was anything in it in stringFree()
243 if (string->chars) in stringFree()
245 ANTLR3_FREE(string->chars); in stringFree()
248 /* Now free the space for this string in stringFree()
250 ANTLR3_FREE(string); in stringFree()
256 * \param string
260 stringInit8 (pANTLR3_STRING string) in stringInit8() argument
262 string->len = 0; in stringInit8()
263 string->size = 0; in stringInit8()
264 string->chars = NULL; in stringInit8()
265 string->encoding = ANTLR3_ENC_8BIT ; in stringInit8()
269 string->set = set8; in stringInit8()
270 string->set8 = set8; in stringInit8()
271 string->append = append8; in stringInit8()
272 string->append8 = append8; in stringInit8()
273 string->insert = insert8; in stringInit8()
274 string->insert8 = insert8; in stringInit8()
275 string->addi = addi8; in stringInit8()
276 string->inserti = inserti8; in stringInit8()
277 string->addc = addc8; in stringInit8()
278 string->charAt = charAt8; in stringInit8()
279 string->compare = compare8; in stringInit8()
280 string->compare8 = compare8; in stringInit8()
281 string->subString = subString8; in stringInit8()
282 string->toInt32 = toInt32_8; in stringInit8()
283 string->to8 = to8_8; in stringInit8()
284 string->toUTF8 = toUTF8_8; in stringInit8()
285 string->compareS = compareS; in stringInit8()
286 string->setS = setS; in stringInit8()
287 string->appendS = appendS; in stringInit8()
288 string->insertS = insertS; in stringInit8()
293 * \param string
297 stringInitUTF16 (pANTLR3_STRING string) in stringInitUTF16() argument
299 string->len = 0; in stringInitUTF16()
300 string->size = 0; in stringInitUTF16()
301 string->chars = NULL; in stringInitUTF16()
302 string->encoding = ANTLR3_ENC_8BIT; in stringInitUTF16()
306 string->set = setUTF16_UTF16; in stringInitUTF16()
307 string->set8 = setUTF16_8; in stringInitUTF16()
308 string->append = appendUTF16_UTF16; in stringInitUTF16()
309 string->append8 = appendUTF16_8; in stringInitUTF16()
310 string->insert = insertUTF16_UTF16; in stringInitUTF16()
311 string->insert8 = insertUTF16_8; in stringInitUTF16()
312 string->addi = addiUTF16; in stringInitUTF16()
313 string->inserti = insertiUTF16; in stringInitUTF16()
314 string->addc = addcUTF16; in stringInitUTF16()
315 string->charAt = charAtUTF16; in stringInitUTF16()
316 string->compare = compareUTF16_UTF16; in stringInitUTF16()
317 string->compare8 = compareUTF16_8; in stringInitUTF16()
318 string->subString = subStringUTF16; in stringInitUTF16()
319 string->toInt32 = toInt32_UTF16; in stringInitUTF16()
320 string->to8 = to8_UTF16; in stringInitUTF16()
321 string->toUTF8 = toUTF8_UTF16; in stringInitUTF16()
323 string->compareS = compareS; in stringInitUTF16()
324 string->setS = setS; in stringInitUTF16()
325 string->appendS = appendS; in stringInitUTF16()
326 string->insertS = insertS; in stringInitUTF16()
330 * \param string
335 stringInitUTF8 (pANTLR3_STRING string) in stringInitUTF8() argument
337 string->len = 0; in stringInitUTF8()
338 string->size = 0; in stringInitUTF8()
339 string->chars = NULL; in stringInitUTF8()
345 // Convert an 8 bit string into a UTF8 representation, which is in fact just the string itself
349 toUTF8_8 (pANTLR3_STRING string) in toUTF8_8() argument
351 return string->factory->newPtr(string->factory, (pANTLR3_UINT8)(string->chars), string->len); in toUTF8_8()
354 // Convert a UTF16 string into a UTF8 representation using the Unicode.org
360 toUTF8_UTF16 (pANTLR3_STRING string) in toUTF8_UTF16() argument
372 utf8String = string->factory->newStr8(string->factory, (pANTLR3_UINT8)""); in toUTF8_UTF16()
382 utf8String->size = string->len *3; in toUTF8_UTF16()
387 inputEnd = (UTF16 *) (string->chars); in toUTF8_UTF16()
395 ((const UTF16 *)(string->chars)) + string->len, in toUTF8_UTF16()
414 * Creates a new string with enough capacity for size 8 bit characters plus a terminator.
416 * \param[in] factory - Pointer to the string factory that owns strings
418 * \return pointer to the new string.
423 pANTLR3_STRING string; in newSize8() local
425 string = factory->newRaw(factory); in newSize8()
427 if (string == NULL) in newSize8()
429 return string; in newSize8()
434 string->chars = (pANTLR3_UINT8) ANTLR3_MALLOC((size_t)(sizeof(ANTLR3_UINT8) * (size+1))); in newSize8()
435 if (string->chars != NULL) in newSize8()
437 *(string->chars) = '\0'; in newSize8()
438 string->size = size + 1; in newSize8()
441 return string; in newSize8()
444 * Creates a new string with enough capacity for size UTF16 characters plus a terminator.
446 * \param[in] factory - Pointer to the string factory that owns strings
448 * \return pointer to the new string.
453 pANTLR3_STRING string; in newSizeUTF16() local
455 string = factory->newRaw(factory); in newSizeUTF16()
457 if (string == NULL) in newSizeUTF16()
459 return string; in newSizeUTF16()
464 string->chars = (pANTLR3_UINT8) ANTLR3_MALLOC((size_t)(sizeof(ANTLR3_UINT16) * (size+1))); in newSizeUTF16()
465 if (string->chars != NULL) in newSizeUTF16()
467 *(string->chars) = '\0'; in newSizeUTF16()
468 string->size = size+1; /* Size is always in characters, as is len */ in newSizeUTF16()
471 return string; in newSizeUTF16()
474 /** Creates a new 8 bit string initialized with the 8 bit characters at the
476 * \param[in] factory - Pointer to the string factory that owns the strings
478 * \return pointer to the new string
483 pANTLR3_STRING string; in newPtr8() local
485 string = factory->newSize(factory, size); in newPtr8()
487 if (string == NULL) in newPtr8()
494 return string; in newPtr8()
499 ANTLR3_MEMMOVE(string->chars, (const void *)ptr, size); in newPtr8()
500 …*(string->chars + size) = '\0'; /* Terminate, these strings are usually used for Token streams… in newPtr8()
501 string->len = size; in newPtr8()
504 return string; in newPtr8()
507 /** Creates a new UTF16 string initialized with the 8 bit characters at the
509 * \param[in] factory - Pointer to the string factory that owns the strings
511 * \return pointer to the new string
516 pANTLR3_STRING string; in newPtrUTF16_8() local
520 string = factory->newSize(factory, size); in newPtrUTF16_8()
522 if (string == NULL) in newPtrUTF16_8()
529 return string; in newPtrUTF16_8()
537 out = (pANTLR3_UINT16)(string->chars); in newPtrUTF16_8()
547 *(((pANTLR3_UINT16)(string->chars)) + size) = '\0'; in newPtrUTF16_8()
549 string->len = size; in newPtrUTF16_8()
552 return string; in newPtrUTF16_8()
555 /** Creates a new UTF16 string initialized with the UTF16 characters at the
557 * \param[in] factory - Pointer to the string factory that owns the strings
559 * \return pointer to the new string
564 pANTLR3_STRING string; in newPtrUTF16_UTF16() local
566 string = factory->newSize(factory, size); in newPtrUTF16_UTF16()
568 if (string == NULL) in newPtrUTF16_UTF16()
575 return string; in newPtrUTF16_UTF16()
580 ANTLR3_MEMMOVE(string->chars, (const void *)ptr, (size * sizeof(ANTLR3_UINT16))); in newPtrUTF16_UTF16()
584 *(((pANTLR3_UINT16)(string->chars)) + size) = '\0'; in newPtrUTF16_UTF16()
585 string->len = size; in newPtrUTF16_UTF16()
588 return string; in newPtrUTF16_UTF16()
591 /** Create a new 8 bit string from the supplied, null terminated, 8 bit string pointer.
592 * \param[in] factory - Pointer to the string factory that owns strings.
593 * \param[in] ptr - Pointer to the 8 bit encoded string
594 * \return Pointer to the newly initialized string
602 /** Create a new UTF16 string from the supplied, null terminated, 8 bit string pointer.
603 * \param[in] factory - Pointer to the string factory that owns strings.
604 * \param[in] ptr - Pointer to the 8 bit encoded string
605 * \return POinter to the newly initialized string
613 /** Create a new UTF16 string from the supplied, null terminated, UTF16 string pointer.
614 * \param[in] factory - Pointer to the string factory that owns strings.
615 * \param[in] ptr - Pointer to the UTF16 encoded string
616 * \return Pointer to the newly initialized string
624 /** First, determine the length of the input string in newStrUTF16_UTF16()
637 destroy (pANTLR3_STRING_FACTORY factory, pANTLR3_STRING string) in destroy() argument
639 // Record which string we are deleting in destroy()
641 ANTLR3_UINT32 strIndex = string->index; in destroy()
643 // Ensure that the string was not factory made, or we would try in destroy()
646 // Remove the specific indexed string from the vector in destroy()
650 // One less string in the vector, so decrement the factory index in destroy()
651 // so that the next string allocated is indexed correctly with in destroy()
676 // The string has been destroyed and the elements of the factory are reindexed. in destroy()
684 pANTLR3_STRING string; in printable8() local
693 string = factory->newSize(factory, instr->len *2 + 1); in printable8()
698 scannedText = string->chars; in printable8()
723 string->len = (ANTLR3_UINT32)(scannedText - string->chars); in printable8()
725 return string; in printable8()
731 pANTLR3_STRING string; in printableUTF16() local
742 string = factory->newSize(factory, instr->len *2 + 1); in printableUTF16()
747 scannedText = (pANTLR3_UINT16)(string->chars); in printableUTF16()
778 string->len = outLen; in printableUTF16()
780 return string; in printableUTF16()
800 append8 (pANTLR3_STRING string, const char * newbit) in append8() argument
806 if (string->size < (string->len + len + 1)) in append8()
808 …3_UINT8 newAlloc = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(string->l… in append8()
813 string->chars = newAlloc; in append8()
814 string->size = string->len + len + 1; in append8()
819 ANTLR3_MEMMOVE((void *)(string->chars + string->len), newbit, (ANTLR3_UINT32)(len+1)); in append8()
820 string->len += len; in append8()
822 return string->chars; in append8()
826 appendUTF16_8 (pANTLR3_STRING string, const char * newbit) in appendUTF16_8() argument
834 if (string->size < (string->len + len + 1)) in appendUTF16_8()
836 …lloc = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)((sizeof(ANTLR3_UINT16… in appendUTF16_8()
841 string->chars = newAlloc; in appendUTF16_8()
842 string->size = string->len + len + 1; in appendUTF16_8()
845 apPoint = ((pANTLR3_UINT16)string->chars) + string->len; in appendUTF16_8()
846 string->len += len; in appendUTF16_8()
854 return string->chars; in appendUTF16_8()
858 appendUTF16_UTF16 (pANTLR3_STRING string, const char * newbit) in appendUTF16_UTF16() argument
863 /** First, determine the length of the input string in appendUTF16_UTF16()
873 if (string->size < (string->len + len + 1)) in appendUTF16_UTF16()
875 …loc = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)( sizeof(ANTLR3_UINT16)… in appendUTF16_UTF16()
880 string->chars = newAlloc; in appendUTF16_UTF16()
881 string->size = string->len + len + 1; in appendUTF16_UTF16()
886 …ANTLR3_MEMMOVE((void *)(((pANTLR3_UINT16)string->chars) + string->len), newbit, (ANTLR3_UINT32)(si… in appendUTF16_UTF16()
887 string->len += len; in appendUTF16_UTF16()
889 return string->chars; in appendUTF16_UTF16()
893 set8 (pANTLR3_STRING string, const char * chars) in set8() argument
898 if (string->size < len + 1) in set8()
900 …pANTLR3_UINT8 newAlloc = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(len… in set8()
905 string->chars = newAlloc; in set8()
906 string->size = len + 1; in set8()
911 ANTLR3_MEMMOVE((void *)(string->chars), chars, (ANTLR3_UINT32)(len+1)); in set8()
912 string->len = len; in set8()
914 return string->chars; in set8()
919 setUTF16_8 (pANTLR3_STRING string, const char * chars) in setUTF16_8() argument
926 if (string->size < len + 1) in setUTF16_8()
928 …pANTLR3_UINT8 newAlloc = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(siz… in setUTF16_8()
933 string->chars = newAlloc; in setUTF16_8()
934 string->size = len + 1; in setUTF16_8()
936 apPoint = ((pANTLR3_UINT16)string->chars); in setUTF16_8()
937 string->len = len; in setUTF16_8()
939 for (count = 0; count < string->len; count++) in setUTF16_8()
945 return string->chars; in setUTF16_8()
949 setUTF16_UTF16 (pANTLR3_STRING string, const char * chars) in setUTF16_UTF16() argument
954 /** First, determine the length of the input string in setUTF16_UTF16()
964 if (string->size < len + 1) in setUTF16_UTF16()
966 …pANTLR3_UINT8 newAlloc = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(siz… in setUTF16_UTF16()
971 string->chars = newAlloc; in setUTF16_UTF16()
972 string->size = len + 1; in setUTF16_UTF16()
977 … ANTLR3_MEMMOVE((void *)(string->chars), chars, (ANTLR3_UINT32)((len+1) * sizeof(ANTLR3_UINT16))); in setUTF16_UTF16()
978 string->len = len; in setUTF16_UTF16()
980 return string->chars; in setUTF16_UTF16()
985 addc8 (pANTLR3_STRING string, ANTLR3_UINT32 c) in addc8() argument
987 if (string->size < string->len + 2) in addc8()
989 …3_UINT8 newAlloc = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(string->l… in addc8()
994 string->chars = newAlloc; in addc8()
995 string->size = string->len + 2; in addc8()
997 *(string->chars + string->len) = (ANTLR3_UINT8)c; in addc8()
998 *(string->chars + string->len + 1) = '\0'; in addc8()
999 string->len++; in addc8()
1001 return string->chars; in addc8()
1005 addcUTF16 (pANTLR3_STRING string, ANTLR3_UINT32 c) in addcUTF16() argument
1009 if (string->size < string->len + 2) in addcUTF16()
1011 …loc = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(sizeof(ANTLR3_UINT16) … in addcUTF16()
1016 string->chars = newAlloc; in addcUTF16()
1017 string->size = string->len + 2; in addcUTF16()
1019 ptr = (pANTLR3_UINT16)(string->chars); in addcUTF16()
1021 *(ptr + string->len) = (ANTLR3_UINT16)c; in addcUTF16()
1022 *(ptr + string->len + 1) = '\0'; in addcUTF16()
1023 string->len++; in addcUTF16()
1025 return string->chars; in addcUTF16()
1029 addi8 (pANTLR3_STRING string, ANTLR3_INT32 i) in addi8() argument
1035 return string->append8(string, (const char *)newbit); in addi8()
1038 addiUTF16 (pANTLR3_STRING string, ANTLR3_INT32 i) in addiUTF16() argument
1044 return string->append8(string, (const char *)newbit); in addiUTF16()
1048 inserti8 (pANTLR3_STRING string, ANTLR3_UINT32 point, ANTLR3_INT32 i) in inserti8() argument
1053 return string->insert8(string, point, (const char *)newbit); in inserti8()
1056 insertiUTF16 (pANTLR3_STRING string, ANTLR3_UINT32 point, ANTLR3_INT32 i) in insertiUTF16() argument
1061 return string->insert8(string, point, (const char *)newbit); in insertiUTF16()
1065 insert8 (pANTLR3_STRING string, ANTLR3_UINT32 point, const char * newbit) in insert8() argument
1069 if (point >= string->len) in insert8()
1071 return string->append(string, newbit); in insert8()
1078 return string->chars; in insert8()
1081 if (string->size < (string->len + len + 1)) in insert8()
1083 …3_UINT8 newAlloc = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(string->l… in insert8()
1088 string->chars = newAlloc; in insert8()
1089 string->size = string->len + len + 1; in insert8()
1094 …ANTLR3_MEMMOVE((void *)(string->chars + point + len), (void *)(string->chars + point), (ANTLR3_UIN… in insert8()
1098 ANTLR3_MEMMOVE((void *)(string->chars + point), newbit, (ANTLR3_UINT32)(len)); in insert8()
1100 string->len += len; in insert8()
1102 return string->chars; in insert8()
1106 insertUTF16_8 (pANTLR3_STRING string, ANTLR3_UINT32 point, const char * newbit) in insertUTF16_8() argument
1112 if (point >= string->len) in insertUTF16_8()
1114 return string->append8(string, newbit); in insertUTF16_8()
1121 return string->chars; in insertUTF16_8()
1124 if (string->size < (string->len + len + 1)) in insertUTF16_8()
1126 …lloc = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(sizeof(ANTLR3_UINT16)… in insertUTF16_8()
1131 string->chars = newAlloc; in insertUTF16_8()
1132 string->size = string->len + len + 1; in insertUTF16_8()
1137 …NTLR3_UINT16)string->chars) + point + len), (void *)(((pANTLR3_UINT16)string->chars) + point), (AN… in insertUTF16_8()
1139 string->len += len; in insertUTF16_8()
1141 inPoint = ((pANTLR3_UINT16)(string->chars))+point; in insertUTF16_8()
1147 return string->chars; in insertUTF16_8()
1151 insertUTF16_UTF16 (pANTLR3_STRING string, ANTLR3_UINT32 point, const char * newbit) in insertUTF16_UTF16() argument
1156 if (point >= string->len) in insertUTF16_UTF16()
1158 return string->append(string, newbit); in insertUTF16_UTF16()
1161 /** First, determine the length of the input string in insertUTF16_UTF16()
1173 return string->chars; in insertUTF16_UTF16()
1176 if (string->size < (string->len + len + 1)) in insertUTF16_UTF16()
1178 …lloc = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(sizeof(ANTLR3_UINT16)… in insertUTF16_UTF16()
1183 string->chars = newAlloc; in insertUTF16_UTF16()
1184 string->size = string->len + len + 1; in insertUTF16_UTF16()
1189 …NTLR3_UINT16)string->chars) + point + len), (void *)(((pANTLR3_UINT16)string->chars) + point), (AN… in insertUTF16_UTF16()
1194 …ANTLR3_MEMMOVE((void *)(((pANTLR3_UINT16)string->chars) + point), newbit, (ANTLR3_UINT32)(sizeof(A… in insertUTF16_UTF16()
1196 string->len += len; in insertUTF16_UTF16()
1198 return string->chars; in insertUTF16_UTF16()
1201 static pANTLR3_UINT8 setS (pANTLR3_STRING string, pANTLR3_STRING chars) in setS() argument
1203 return string->set(string, (const char *)(chars->chars)); in setS()
1206 static pANTLR3_UINT8 appendS (pANTLR3_STRING string, pANTLR3_STRING newbit) in appendS() argument
1208 /* We may be passed an empty string, in which case we just return the current pointer in appendS()
1212 return string->chars; in appendS()
1216 return string->append(string, (const char *)(newbit->chars)); in appendS()
1220 static pANTLR3_UINT8 insertS (pANTLR3_STRING string, ANTLR3_UINT32 point, pANTLR3_STRING newb… in insertS() argument
1222 return string->insert(string, point, (const char *)(newbit->chars)); in insertS()
1225 /* Function that compares the text of a string to the supplied
1226 * 8 bit character string and returns a result a la strcmp()
1229 compare8 (pANTLR3_STRING string, const char * compStr) in compare8() argument
1231 return strcmp((const char *)(string->chars), compStr); in compare8()
1234 /* Function that compares the text of a string with the supplied character string
1235 * (which is assumed to be in the same encoding as the string itself) and returns a result
1239 compareUTF16_8 (pANTLR3_STRING string, const char * compStr) in compareUTF16_8() argument
1244 ourString = (pANTLR3_UINT16)(string->chars); in compareUTF16_8()
1263 /* Function that compares the text of a string with the supplied character string
1264 * (which is assumed to be in the same encoding as the string itself) and returns a result
1268 compareUTF16_UTF16 (pANTLR3_STRING string, const char * compStr8) in compareUTF16_UTF16() argument
1274 ourString = (pANTLR3_UINT16)(string->chars); in compareUTF16_UTF16()
1293 /* Function that compares the text of a string with the supplied string
1294 * (which is assumed to be in the same encoding as the string itself) and returns a result
1298 compareS (pANTLR3_STRING string, pANTLR3_STRING compStr) in compareS() argument
1300 return string->compare(string, (const char *)compStr->chars); in compareS()
1308 charAt8 (pANTLR3_STRING string, ANTLR3_UINT32 offset) in charAt8() argument
1310 if (offset > string->len) in charAt8()
1316 return (ANTLR3_UCHAR)(*(string->chars + offset)); in charAt8()
1324 charAtUTF16 (pANTLR3_STRING string, ANTLR3_UINT32 offset) in charAtUTF16() argument
1326 if (offset > string->len) in charAtUTF16()
1332 return (ANTLR3_UCHAR)(*((pANTLR3_UINT16)(string->chars) + offset)); in charAtUTF16()
1336 /* Function that returns a substring of the supplied string a la .subString(s,e)
1340 subString8 (pANTLR3_STRING string, ANTLR3_UINT32 startIndex, ANTLR3_UINT32 endIndex) in subString8() argument
1344 if (endIndex > string->len) in subString8()
1346 endIndex = string->len + 1; in subString8()
1348 …newStr = string->factory->newPtr(string->factory, string->chars + startIndex, endIndex - startInd… in subString8()
1353 /* Returns a substring of the supplied string a la .subString(s,e)
1357 subStringUTF16 (pANTLR3_STRING string, ANTLR3_UINT32 startIndex, ANTLR3_UINT32 endIndex) in subStringUTF16() argument
1361 if (endIndex > string->len) in subStringUTF16()
1363 endIndex = string->len + 1; in subStringUTF16()
1365 …newStr = string->factory->newPtr(string->factory, (pANTLR3_UINT8)((pANTLR3_UINT16)(string->chars)… in subStringUTF16()
1370 /* Function that can convert the characters in the string to an integer
1373 toInt32_8 (struct ANTLR3_STRING_struct * string) in toInt32_8() argument
1375 return atoi((const char *)(string->chars)); in toInt32_8()
1378 /* Function that can convert the characters in the string to an integer
1381 toInt32_UTF16 (struct ANTLR3_STRING_struct * string) in toInt32_UTF16() argument
1388 input = (pANTLR3_UINT16)(string->chars); in toInt32_UTF16()
1411 /* Function that returns a pointer to an 8 bit version of the string,
1412 * which in this case is just the string as this is
1415 static pANTLR3_STRING to8_8 (pANTLR3_STRING string) in to8_8() argument
1417 return string; in to8_8()
1420 /* Function that returns an 8 bit version of the string,
1425 static pANTLR3_STRING to8_UTF16 (pANTLR3_STRING string) in to8_UTF16() argument
1430 /* Create a new 8 bit string in to8_UTF16()
1432 newStr = newRaw8(string->factory); in to8_UTF16()
1441 newStr->chars = (pANTLR3_UINT8) ANTLR3_MALLOC((size_t)(string->len + 1)); in to8_UTF16()
1444 newStr->size = string->len + 1; in to8_UTF16()
1445 newStr->len = string->len; in to8_UTF16()
1450 for (i=0; i<string->len; i++) in to8_UTF16()
1454 c = *(((pANTLR3_UINT16)(string->chars)) + i); in to8_UTF16()