• 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 *(string->chars) = '\0'; in newSize8()
436 string->size = size + 1; in newSize8()
439 return string; in newSize8()
442 * Creates a new string with enough capacity for size UTF16 characters plus a terminator.
444 * \param[in] factory - Pointer to the string factory that owns strings
446 * \return pointer to the new string.
451 pANTLR3_STRING string; in newSizeUTF16() local
453 string = factory->newRaw(factory); in newSizeUTF16()
455 if (string == NULL) in newSizeUTF16()
457 return string; in newSizeUTF16()
462 string->chars = (pANTLR3_UINT8) ANTLR3_MALLOC((size_t)(sizeof(ANTLR3_UINT16) * (size+1))); in newSizeUTF16()
463 *(string->chars) = '\0'; in newSizeUTF16()
464 string->size = size+1; /* Size is always in characters, as is len */ in newSizeUTF16()
466 return string; in newSizeUTF16()
469 /** Creates a new 8 bit string initialized with the 8 bit characters at the
471 * \param[in] factory - Pointer to the string factory that owns the strings
473 * \return pointer to the new string
478 pANTLR3_STRING string; in newPtr8() local
480 string = factory->newSize(factory, size); in newPtr8()
482 if (string == NULL) in newPtr8()
489 return string; in newPtr8()
494 ANTLR3_MEMMOVE(string->chars, (const void *)ptr, size); in newPtr8()
495 …*(string->chars + size) = '\0'; /* Terminate, these strings are usually used for Token streams… in newPtr8()
496 string->len = size; in newPtr8()
499 return string; in newPtr8()
502 /** Creates a new UTF16 string initialized with the 8 bit characters at the
504 * \param[in] factory - Pointer to the string factory that owns the strings
506 * \return pointer to the new string
511 pANTLR3_STRING string; in newPtrUTF16_8() local
515 string = factory->newSize(factory, size); in newPtrUTF16_8()
517 if (string == NULL) in newPtrUTF16_8()
524 return string; in newPtrUTF16_8()
532 out = (pANTLR3_UINT16)(string->chars); in newPtrUTF16_8()
542 *(((pANTLR3_UINT16)(string->chars)) + size) = '\0'; in newPtrUTF16_8()
544 string->len = size; in newPtrUTF16_8()
547 return string; in newPtrUTF16_8()
550 /** Creates a new UTF16 string initialized with the UTF16 characters at the
552 * \param[in] factory - Pointer to the string factory that owns the strings
554 * \return pointer to the new string
559 pANTLR3_STRING string; in newPtrUTF16_UTF16() local
561 string = factory->newSize(factory, size); in newPtrUTF16_UTF16()
563 if (string == NULL) in newPtrUTF16_UTF16()
570 return string; in newPtrUTF16_UTF16()
575 ANTLR3_MEMMOVE(string->chars, (const void *)ptr, (size * sizeof(ANTLR3_UINT16))); in newPtrUTF16_UTF16()
579 *(((pANTLR3_UINT16)(string->chars)) + size) = '\0'; in newPtrUTF16_UTF16()
580 string->len = size; in newPtrUTF16_UTF16()
583 return string; in newPtrUTF16_UTF16()
586 /** Create a new 8 bit string from the supplied, null terminated, 8 bit string pointer.
587 * \param[in] factory - Pointer to the string factory that owns strings.
588 * \param[in] ptr - Pointer to the 8 bit encoded string
589 * \return Pointer to the newly initialized string
597 /** Create a new UTF16 string from the supplied, null terminated, 8 bit string pointer.
598 * \param[in] factory - Pointer to the string factory that owns strings.
599 * \param[in] ptr - Pointer to the 8 bit encoded string
600 * \return POinter to the newly initialized string
608 /** Create a new UTF16 string from the supplied, null terminated, UTF16 string pointer.
609 * \param[in] factory - Pointer to the string factory that owns strings.
610 * \param[in] ptr - Pointer to the UTF16 encoded string
611 * \return Pointer to the newly initialized string
619 /** First, determine the length of the input string in newStrUTF16_UTF16()
632 destroy (pANTLR3_STRING_FACTORY factory, pANTLR3_STRING string) in destroy() argument
634 // Record which string we are deleting in destroy()
636 ANTLR3_UINT32 strIndex = string->index; in destroy()
638 // Ensure that the string was not factory made, or we would try in destroy()
641 // Remove the specific indexed string from the vector in destroy()
645 // One less string in the vector, so decrement the factory index in destroy()
646 // so that the next string allocated is indexed correctly with in destroy()
671 // The string has been destroyed and the elements of the factory are reindexed. in destroy()
679 pANTLR3_STRING string; in printable8() local
688 string = factory->newSize(factory, instr->len *2 + 1); in printable8()
693 scannedText = string->chars; in printable8()
718 string->len = (ANTLR3_UINT32)(scannedText - string->chars); in printable8()
720 return string; in printable8()
726 pANTLR3_STRING string; in printableUTF16() local
737 string = factory->newSize(factory, instr->len *2 + 1); in printableUTF16()
742 scannedText = (pANTLR3_UINT16)(string->chars); in printableUTF16()
773 string->len = outLen; in printableUTF16()
775 return string; in printableUTF16()
795 append8 (pANTLR3_STRING string, const char * newbit) in append8() argument
801 if (string->size < (string->len + len + 1)) in append8()
803string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(string->len … in append8()
804 string->size = string->len + len + 1; in append8()
809 ANTLR3_MEMMOVE((void *)(string->chars + string->len), newbit, (ANTLR3_UINT32)(len+1)); in append8()
810 string->len += len; in append8()
812 return string->chars; in append8()
816 appendUTF16_8 (pANTLR3_STRING string, const char * newbit) in appendUTF16_8() argument
824 if (string->size < (string->len + len + 1)) in appendUTF16_8()
826string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)((sizeof(ANTL… in appendUTF16_8()
827 string->size = string->len + len + 1; in appendUTF16_8()
830 apPoint = ((pANTLR3_UINT16)string->chars) + string->len; in appendUTF16_8()
831 string->len += len; in appendUTF16_8()
839 return string->chars; in appendUTF16_8()
843 appendUTF16_UTF16 (pANTLR3_STRING string, const char * newbit) in appendUTF16_UTF16() argument
848 /** First, determine the length of the input string in appendUTF16_UTF16()
858 if (string->size < (string->len + len + 1)) in appendUTF16_UTF16()
860string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)( sizeof(ANTL… in appendUTF16_UTF16()
861 string->size = string->len + len + 1; in appendUTF16_UTF16()
866 …ANTLR3_MEMMOVE((void *)(((pANTLR3_UINT16)string->chars) + string->len), newbit, (ANTLR3_UINT32)(si… in appendUTF16_UTF16()
867 string->len += len; in appendUTF16_UTF16()
869 return string->chars; in appendUTF16_UTF16()
873 set8 (pANTLR3_STRING string, const char * chars) in set8() argument
878 if (string->size < len + 1) in set8()
880 string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(len + 1)); in set8()
881 string->size = len + 1; in set8()
886 ANTLR3_MEMMOVE((void *)(string->chars), chars, (ANTLR3_UINT32)(len+1)); in set8()
887 string->len = len; in set8()
889 return string->chars; in set8()
894 setUTF16_8 (pANTLR3_STRING string, const char * chars) in setUTF16_8() argument
901 if (string->size < len + 1) in setUTF16_8()
903string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(sizeof(ANTLR… in setUTF16_8()
904 string->size = len + 1; in setUTF16_8()
906 apPoint = ((pANTLR3_UINT16)string->chars); in setUTF16_8()
907 string->len = len; in setUTF16_8()
909 for (count = 0; count < string->len; count++) in setUTF16_8()
915 return string->chars; in setUTF16_8()
919 setUTF16_UTF16 (pANTLR3_STRING string, const char * chars) in setUTF16_UTF16() argument
924 /** First, determine the length of the input string in setUTF16_UTF16()
934 if (string->size < len + 1) in setUTF16_UTF16()
936string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(sizeof(ANTLR… in setUTF16_UTF16()
937 string->size = len + 1; in setUTF16_UTF16()
942 … ANTLR3_MEMMOVE((void *)(string->chars), chars, (ANTLR3_UINT32)((len+1) * sizeof(ANTLR3_UINT16))); in setUTF16_UTF16()
943 string->len = len; in setUTF16_UTF16()
945 return string->chars; in setUTF16_UTF16()
950 addc8 (pANTLR3_STRING string, ANTLR3_UINT32 c) in addc8() argument
952 if (string->size < string->len + 2) in addc8()
954string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(string->len … in addc8()
955 string->size = string->len + 2; in addc8()
957 *(string->chars + string->len) = (ANTLR3_UINT8)c; in addc8()
958 *(string->chars + string->len + 1) = '\0'; in addc8()
959 string->len++; in addc8()
961 return string->chars; in addc8()
965 addcUTF16 (pANTLR3_STRING string, ANTLR3_UINT32 c) in addcUTF16() argument
969 if (string->size < string->len + 2) in addcUTF16()
971string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(sizeof(ANTLR… in addcUTF16()
972 string->size = string->len + 2; in addcUTF16()
974 ptr = (pANTLR3_UINT16)(string->chars); in addcUTF16()
976 *(ptr + string->len) = (ANTLR3_UINT16)c; in addcUTF16()
977 *(ptr + string->len + 1) = '\0'; in addcUTF16()
978 string->len++; in addcUTF16()
980 return string->chars; in addcUTF16()
984 addi8 (pANTLR3_STRING string, ANTLR3_INT32 i) in addi8() argument
990 return string->append8(string, (const char *)newbit); in addi8()
993 addiUTF16 (pANTLR3_STRING string, ANTLR3_INT32 i) in addiUTF16() argument
999 return string->append8(string, (const char *)newbit); in addiUTF16()
1003 inserti8 (pANTLR3_STRING string, ANTLR3_UINT32 point, ANTLR3_INT32 i) in inserti8() argument
1008 return string->insert8(string, point, (const char *)newbit); in inserti8()
1011 insertiUTF16 (pANTLR3_STRING string, ANTLR3_UINT32 point, ANTLR3_INT32 i) in insertiUTF16() argument
1016 return string->insert8(string, point, (const char *)newbit); in insertiUTF16()
1020 insert8 (pANTLR3_STRING string, ANTLR3_UINT32 point, const char * newbit) in insert8() argument
1024 if (point >= string->len) in insert8()
1026 return string->append(string, newbit); in insert8()
1033 return string->chars; in insert8()
1036 if (string->size < (string->len + len + 1)) in insert8()
1038string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(string->len … in insert8()
1039 string->size = string->len + len + 1; in insert8()
1044 …ANTLR3_MEMMOVE((void *)(string->chars + point + len), (void *)(string->chars + point), (ANTLR3_UIN… in insert8()
1048 ANTLR3_MEMMOVE((void *)(string->chars + point), newbit, (ANTLR3_UINT32)(len)); in insert8()
1050 string->len += len; in insert8()
1052 return string->chars; in insert8()
1056 insertUTF16_8 (pANTLR3_STRING string, ANTLR3_UINT32 point, const char * newbit) in insertUTF16_8() argument
1062 if (point >= string->len) in insertUTF16_8()
1064 return string->append8(string, newbit); in insertUTF16_8()
1071 return string->chars; in insertUTF16_8()
1074 if (string->size < (string->len + len + 1)) in insertUTF16_8()
1076string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(sizeof(ANTLR… in insertUTF16_8()
1077 string->size = string->len + len + 1; in insertUTF16_8()
1082 …NTLR3_UINT16)string->chars) + point + len), (void *)(((pANTLR3_UINT16)string->chars) + point), (AN… in insertUTF16_8()
1084 string->len += len; in insertUTF16_8()
1086 inPoint = ((pANTLR3_UINT16)(string->chars))+point; in insertUTF16_8()
1092 return string->chars; in insertUTF16_8()
1096 insertUTF16_UTF16 (pANTLR3_STRING string, ANTLR3_UINT32 point, const char * newbit) in insertUTF16_UTF16() argument
1101 if (point >= string->len) in insertUTF16_UTF16()
1103 return string->append(string, newbit); in insertUTF16_UTF16()
1106 /** First, determine the length of the input string in insertUTF16_UTF16()
1118 return string->chars; in insertUTF16_UTF16()
1121 if (string->size < (string->len + len + 1)) in insertUTF16_UTF16()
1123string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(sizeof(ANTLR… in insertUTF16_UTF16()
1124 string->size = string->len + len + 1; in insertUTF16_UTF16()
1129 …NTLR3_UINT16)string->chars) + point + len), (void *)(((pANTLR3_UINT16)string->chars) + point), (AN… in insertUTF16_UTF16()
1134 …ANTLR3_MEMMOVE((void *)(((pANTLR3_UINT16)string->chars) + point), newbit, (ANTLR3_UINT32)(sizeof(A… in insertUTF16_UTF16()
1136 string->len += len; in insertUTF16_UTF16()
1138 return string->chars; in insertUTF16_UTF16()
1141 static pANTLR3_UINT8 setS (pANTLR3_STRING string, pANTLR3_STRING chars) in setS() argument
1143 return string->set(string, (const char *)(chars->chars)); in setS()
1146 static pANTLR3_UINT8 appendS (pANTLR3_STRING string, pANTLR3_STRING newbit) in appendS() argument
1148 /* We may be passed an empty string, in which case we just return the current pointer in appendS()
1152 return string->chars; in appendS()
1156 return string->append(string, (const char *)(newbit->chars)); in appendS()
1160 static pANTLR3_UINT8 insertS (pANTLR3_STRING string, ANTLR3_UINT32 point, pANTLR3_STRING newb… in insertS() argument
1162 return string->insert(string, point, (const char *)(newbit->chars)); in insertS()
1165 /* Function that compares the text of a string to the supplied
1166 * 8 bit character string and returns a result a la strcmp()
1169 compare8 (pANTLR3_STRING string, const char * compStr) in compare8() argument
1171 return strcmp((const char *)(string->chars), compStr); in compare8()
1174 /* Function that compares the text of a string with the supplied character string
1175 * (which is assumed to be in the same encoding as the string itself) and returns a result
1179 compareUTF16_8 (pANTLR3_STRING string, const char * compStr) in compareUTF16_8() argument
1184 ourString = (pANTLR3_UINT16)(string->chars); in compareUTF16_8()
1203 /* Function that compares the text of a string with the supplied character string
1204 * (which is assumed to be in the same encoding as the string itself) and returns a result
1208 compareUTF16_UTF16 (pANTLR3_STRING string, const char * compStr8) in compareUTF16_UTF16() argument
1214 ourString = (pANTLR3_UINT16)(string->chars); in compareUTF16_UTF16()
1233 /* Function that compares the text of a string with the supplied string
1234 * (which is assumed to be in the same encoding as the string itself) and returns a result
1238 compareS (pANTLR3_STRING string, pANTLR3_STRING compStr) in compareS() argument
1240 return string->compare(string, (const char *)compStr->chars); in compareS()
1248 charAt8 (pANTLR3_STRING string, ANTLR3_UINT32 offset) in charAt8() argument
1250 if (offset > string->len) in charAt8()
1256 return (ANTLR3_UCHAR)(*(string->chars + offset)); in charAt8()
1264 charAtUTF16 (pANTLR3_STRING string, ANTLR3_UINT32 offset) in charAtUTF16() argument
1266 if (offset > string->len) in charAtUTF16()
1272 return (ANTLR3_UCHAR)(*((pANTLR3_UINT16)(string->chars) + offset)); in charAtUTF16()
1276 /* Function that returns a substring of the supplied string a la .subString(s,e)
1280 subString8 (pANTLR3_STRING string, ANTLR3_UINT32 startIndex, ANTLR3_UINT32 endIndex) in subString8() argument
1284 if (endIndex > string->len) in subString8()
1286 endIndex = string->len + 1; in subString8()
1288 …newStr = string->factory->newPtr(string->factory, string->chars + startIndex, endIndex - startInd… in subString8()
1293 /* Returns a substring of the supplied string a la .subString(s,e)
1297 subStringUTF16 (pANTLR3_STRING string, ANTLR3_UINT32 startIndex, ANTLR3_UINT32 endIndex) in subStringUTF16() argument
1301 if (endIndex > string->len) in subStringUTF16()
1303 endIndex = string->len + 1; in subStringUTF16()
1305 …newStr = string->factory->newPtr(string->factory, (pANTLR3_UINT8)((pANTLR3_UINT16)(string->chars)… in subStringUTF16()
1310 /* Function that can convert the characters in the string to an integer
1313 toInt32_8 (struct ANTLR3_STRING_struct * string) in toInt32_8() argument
1315 return atoi((const char *)(string->chars)); in toInt32_8()
1318 /* Function that can convert the characters in the string to an integer
1321 toInt32_UTF16 (struct ANTLR3_STRING_struct * string) in toInt32_UTF16() argument
1328 input = (pANTLR3_UINT16)(string->chars); in toInt32_UTF16()
1351 /* Function that returns a pointer to an 8 bit version of the string,
1352 * which in this case is just the string as this is
1355 static pANTLR3_STRING to8_8 (pANTLR3_STRING string) in to8_8() argument
1357 return string; in to8_8()
1360 /* Function that returns an 8 bit version of the string,
1365 static pANTLR3_STRING to8_UTF16 (pANTLR3_STRING string) in to8_UTF16() argument
1370 /* Create a new 8 bit string in to8_UTF16()
1372 newStr = newRaw8(string->factory); in to8_UTF16()
1381 newStr->chars = (pANTLR3_UINT8) ANTLR3_MALLOC((size_t)(string->len + 1)); in to8_UTF16()
1382 newStr->size = string->len + 1; in to8_UTF16()
1383 newStr->len = string->len; in to8_UTF16()
1388 for (i=0; i<string->len; i++) in to8_UTF16()
1392 c = *(((pANTLR3_UINT16)(string->chars)) + i); in to8_UTF16()