• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/iserver/libantlr3c-3.2/src/

Lines Matching refs:string

2  * Implementation of the ANTLR3 string and string factory classes
42 static pANTLR3_STRING newPtr8 (pANTLR3_STRING_FACTORY factory, pANTLR3_UINT8 string, ANTLR3_UINT32 size);
43 static pANTLR3_STRING newPtr16_8 (pANTLR3_STRING_FACTORY factory, pANTLR3_UINT8 string, ANTLR3_UINT32 size);
44 static pANTLR3_STRING newPtr16_16 (pANTLR3_STRING_FACTORY factory, pANTLR3_UINT8 string, ANTLR3_UINT32 size);
45 static pANTLR3_STRING newStr8 (pANTLR3_STRING_FACTORY factory, pANTLR3_UINT8 string);
46 static pANTLR3_STRING newStr16_8 (pANTLR3_STRING_FACTORY factory, pANTLR3_UINT8 string);
47 static pANTLR3_STRING newStr16_16 (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 printable16 (pANTLR3_STRING_FACTORY factory, pANTLR3_STRING string);
55 static pANTLR3_UINT8 set8 (pANTLR3_STRING string, const char * chars);
56 static pANTLR3_UINT8 set16_8 (pANTLR3_STRING string, const char * chars);
57 static pANTLR3_UINT8 set16_16 (pANTLR3_STRING string, const char * chars);
58 static pANTLR3_UINT8 append8 (pANTLR3_STRING string, const char * newbit);
59 static pANTLR3_UINT8 append16_8 (pANTLR3_STRING string, const char * newbit);
60 static pANTLR3_UINT8 append16_16 (pANTLR3_STRING string, const char * newbit);
61 static pANTLR3_UINT8 insert8 (pANTLR3_STRING string, ANTLR3_UINT32 point, const char * newbit);
62 static pANTLR3_UINT8 insert16_8 (pANTLR3_STRING string, ANTLR3_UINT32 point, const char * newbit);
63 static pANTLR3_UINT8 insert16_16 (pANTLR3_STRING string, ANTLR3_UINT32 point, const char * newbit);
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 newbit);
69 static pANTLR3_UINT8 addc8 (pANTLR3_STRING string, ANTLR3_UINT32 c);
70 static pANTLR3_UINT8 addc16 (pANTLR3_STRING string, ANTLR3_UINT32 c);
71 static pANTLR3_UINT8 addi8 (pANTLR3_STRING string, ANTLR3_INT32 i);
72 static pANTLR3_UINT8 addi16 (pANTLR3_STRING string, ANTLR3_INT32 i);
73 static pANTLR3_UINT8 inserti8 (pANTLR3_STRING string, ANTLR3_UINT32 point, ANTLR3_INT32 i);
74 static pANTLR3_UINT8 inserti16 (pANTLR3_STRING string, ANTLR3_UINT32 point, ANTLR3_INT32 i);
76 static ANTLR3_UINT32 compare8 (pANTLR3_STRING string, const char * compStr);
77 static ANTLR3_UINT32 compare16_8 (pANTLR3_STRING string, const char * compStr);
78 static ANTLR3_UINT32 compare16_16(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 charAt16 (pANTLR3_STRING string, ANTLR3_UINT32 offset);
82 static pANTLR3_STRING subString8 (pANTLR3_STRING string, ANTLR3_UINT32 startIndex, ANTLR3_UINT32 endIndex);
83 static pANTLR3_STRING subString16 (pANTLR3_STRING string, ANTLR3_UINT32 startIndex, ANTLR3_UINT32 endIndex);
84 static ANTLR3_INT32 toInt32_8 (pANTLR3_STRING string);
85 static ANTLR3_INT32 toInt32_16 (pANTLR3_STRING string);
86 static pANTLR3_STRING to8_8 (pANTLR3_STRING string);
87 static pANTLR3_STRING to8_16 (pANTLR3_STRING string);
88 static pANTLR3_STRING toUTF8_8 (pANTLR3_STRING string);
89 static pANTLR3_STRING toUTF8_16 (pANTLR3_STRING string);
93 static void stringInit8 (pANTLR3_STRING string);
94 static void stringInit16 (pANTLR3_STRING string);
95 static void ANTLR3_CDECL stringFree (pANTLR3_STRING string);
139 /** Create a string factory that is UCS2 (16 bit) encoding based
182 pANTLR3_STRING string;
184 string = (pANTLR3_STRING) ANTLR3_MALLOC(sizeof(ANTLR3_STRING));
186 if (string == NULL)
193 stringInit8(string);
194 string->factory = factory;
196 /* Add the string into the allocated list
198 factory->strings->set(factory->strings, factory->index, (void *) string, (void (ANTLR3_CDECL *)(void *))(stringFree), ANTLR3_TRUE);
199 string->index = factory->index++;
201 return string;
211 pANTLR3_STRING string;
213 string = (pANTLR3_STRING) ANTLR3_MALLOC(sizeof(ANTLR3_STRING));
215 if (string == NULL)
222 stringInit16(string);
223 string->factory = factory;
225 /* Add the string into the allocated list
227 factory->strings->set(factory->strings, factory->index, (void *) string, (void (ANTLR3_CDECL *)(void *))(stringFree), ANTLR3_TRUE);
228 string->index = factory->index++;
230 return string;
233 void ANTLR3_CDECL stringFree (pANTLR3_STRING string)
235 /* First free the string itself if there was anything in it
237 if (string->chars)
239 ANTLR3_FREE(string->chars);
242 /* Now free the space for this string
244 ANTLR3_FREE(string);
250 * \param string
254 stringInit8 (pANTLR3_STRING string)
256 string->len = 0;
257 string->size = 0;
258 string->chars = NULL;
259 string->encoding = ANTLR3_ENCODING_LATIN1;
263 string->set = set8;
264 string->set8 = set8;
265 string->append = append8;
266 string->append8 = append8;
267 string->insert = insert8;
268 string->insert8 = insert8;
269 string->addi = addi8;
270 string->inserti = inserti8;
271 string->addc = addc8;
272 string->charAt = charAt8;
273 string->compare = compare8;
274 string->compare8 = compare8;
275 string->subString = subString8;
276 string->toInt32 = toInt32_8;
277 string->to8 = to8_8;
278 string->toUTF8 = toUTF8_8;
279 string->compareS = compareS;
280 string->setS = setS;
281 string->appendS = appendS;
282 string->insertS = insertS;
287 * \param string
291 stringInit16 (pANTLR3_STRING string)
293 string->len = 0;
294 string->size = 0;
295 string->chars = NULL;
296 string->encoding = ANTLR3_ENCODING_UCS2;
300 string->set = set16_16;
301 string->set8 = set16_8;
302 string->append = append16_16;
303 string->append8 = append16_8;
304 string->insert = insert16_16;
305 string->insert8 = insert16_8;
306 string->addi = addi16;
307 string->inserti = inserti16;
308 string->addc = addc16;
309 string->charAt = charAt16;
310 string->compare = compare16_16;
311 string->compare8 = compare16_8;
312 string->subString = subString16;
313 string->toInt32 = toInt32_16;
314 string->to8 = to8_16;
315 string->toUTF8 = toUTF8_16;
317 string->compareS = compareS;
318 string->setS = setS;
319 string->appendS = appendS;
320 string->insertS = insertS;
324 * \param string
329 stringInitUTF8 (pANTLR3_STRING string)
331 string->len = 0;
332 string->size = 0;
333 string->chars = NULL;
339 // Convert an 8 bit string into a UTF8 representation, which is in fact just the string itself
343 toUTF8_8 (pANTLR3_STRING string)
345 return string->factory->newPtr(string->factory, (pANTLR3_UINT8)(string->chars), string->len);
348 // Convert a 16 bit (UCS2) string into a UTF8 representation using the Unicode.org
354 toUTF8_16 (pANTLR3_STRING string)
366 utf8String = string->factory->newStr8(string->factory, (pANTLR3_UINT8)"");
376 utf8String->size = string->len *3;
381 inputEnd = (UTF16 *) (string->chars);
389 ((const UTF16 *)(string->chars)) + string->len,
408 * Creates a new string with enough capacity for size 8 bit characters plus a terminator.
410 * \param[in] factory - Pointer to the string factory that owns strings
412 * \return pointer to the new string.
417 pANTLR3_STRING string;
419 string = factory->newRaw(factory);
421 if (string == NULL)
423 return string;
428 string->chars = (pANTLR3_UINT8) ANTLR3_MALLOC((size_t)(sizeof(ANTLR3_UINT8) * (size+1)));
429 *(string->chars) = '\0';
430 string->size = size + 1;
433 return string;
436 * Creates a new string with enough capacity for size 16 bit characters plus a terminator.
438 * \param[in] factory - POitner to the string factory that owns strings
440 * \return pointer to the new string.
445 pANTLR3_STRING string;
447 string = factory->newRaw(factory);
449 if (string == NULL)
451 return string;
456 string->chars = (pANTLR3_UINT8) ANTLR3_MALLOC((size_t)(sizeof(ANTLR3_UINT16) * (size+1)));
457 *(string->chars) = '\0';
458 string->size = size+1; /* Size is always in characters, as is len */
460 return string;
463 /** Creates a new 8 bit string initialized with the 8 bit characters at the
465 * \param[in] factory - Pointer to the string factory that owns the strings
467 * \return pointer to the new string
472 pANTLR3_STRING string;
474 string = factory->newSize(factory, size);
476 if (string == NULL)
483 return string;
488 ANTLR3_MEMMOVE(string->chars, (const void *)ptr, size);
489 *(string->chars + size) = '\0'; /* Terminate, these strings are usually used for Token streams and printing etc. */
490 string->len = size;
493 return string;
496 /** Creates a new 16 bit string initialized with the 8 bit characters at the
498 * \param[in] factory - Pointer to the string factory that owns the strings
500 * \return pointer to the new string
505 pANTLR3_STRING string;
509 string = factory->newSize(factory, size);
511 if (string == NULL)
518 return string;
526 out = (pANTLR3_UINT16)(string->chars);
536 *(((pANTLR3_UINT16)(string->chars)) + size) = '\0';
538 string->len = size;
541 return string;
544 /** Creates a new 16 bit string initialized with the 16 bit characters at the
546 * \param[in] factory - Pointer to the string factory that owns the strings
548 * \return pointer to the new string
553 pANTLR3_STRING string;
555 string = factory->newSize(factory, size);
557 if (string == NULL)
564 return string;
569 ANTLR3_MEMMOVE(string->chars, (const void *)ptr, (size * sizeof(ANTLR3_UINT16)));
573 *(((pANTLR3_UINT16)(string->chars)) + size) = '\0';
574 string->len = size;
577 return string;
580 /** Create a new 8 bit string from the supplied, null terminated, 8 bit string pointer.
581 * \param[in] factory - Pointer to the string factory that owns strings.
582 * \param[in] ptr - Pointer to the 8 bit encoded string
583 * \return Pointer to the newly initialized string
591 /** Create a new 16 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 16 bit string from the supplied, null terminated, 16 bit string pointer.
603 * \param[in] factory - Pointer to the string factory that owns strings.
604 * \param[in] ptr - Pointer to the 16 bit encoded string
605 * \return Pointer to the newly initialized string
613 /** First, determine the length of the input string
626 destroy (pANTLR3_STRING_FACTORY factory, pANTLR3_STRING string)
628 // Record which string we are deleting
630 ANTLR3_UINT32 strIndex = string->index;
632 // Ensure that the string was not factory made, or we would try
635 // Remove the specific indexed string from the vector
639 // One less string in the vector, so decrement the factory index
640 // so that the next string allocated is indexed correctly with
665 // The string has been destroyed and the elements of the factory are reindexed.
673 pANTLR3_STRING string;
682 string = factory->newSize(factory, instr->len *2 + 1);
687 scannedText = string->chars;
712 string->len = (ANTLR3_UINT32)(scannedText - string->chars);
714 return string;
720 pANTLR3_STRING string;
731 string = factory->newSize(factory, instr->len *2 + 1);
736 scannedText = (pANTLR3_UINT16)(string->chars);
767 string->len = outLen;
769 return string;
789 append8 (pANTLR3_STRING string, const char * newbit)
795 if (string->size < (string->len + len + 1))
797 string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(string->len + len + 1));
798 string->size = string->len + len + 1;
803 ANTLR3_MEMMOVE((void *)(string->chars + string->len), newbit, (ANTLR3_UINT32)(len+1));
804 string->len += len;
806 return string->chars;
810 append16_8 (pANTLR3_STRING string, const char * newbit)
818 if (string->size < (string->len + len + 1))
820 string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)((sizeof(ANTLR3_UINT16)*(string->len + len + 1))));
821 string->size = string->len + len + 1;
824 apPoint = ((pANTLR3_UINT16)string->chars) + string->len;
825 string->len += len;
833 return string->chars;
837 append16_16 (pANTLR3_STRING string, const char * newbit)
842 /** First, determine the length of the input string
852 if (string->size < (string->len + len + 1))
854 string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)( sizeof(ANTLR3_UINT16) *(string->len + len + 1) ));
855 string->size = string->len + len + 1;
860 ANTLR3_MEMMOVE((void *)(((pANTLR3_UINT16)string->chars) + string->len), newbit, (ANTLR3_UINT32)(sizeof(ANTLR3_UINT16)*(len+1)));
861 string->len += len;
863 return string->chars;
867 set8 (pANTLR3_STRING string, const char * chars)
872 if (string->size < len + 1)
874 string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(len + 1));
875 string->size = len + 1;
880 ANTLR3_MEMMOVE((void *)(string->chars), chars, (ANTLR3_UINT32)(len+1));
881 string->len = len;
883 return string->chars;
888 set16_8 (pANTLR3_STRING string, const char * chars)
895 if (string->size < len + 1)
897 string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(sizeof(ANTLR3_UINT16)*(len + 1)));
898 string->size = len + 1;
900 apPoint = ((pANTLR3_UINT16)string->chars);
901 string->len = len;
903 for (count = 0; count < string->len; count++)
909 return string->chars;
913 set16_16 (pANTLR3_STRING string, const char * chars)
918 /** First, determine the length of the input string
928 if (string->size < len + 1)
930 string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(sizeof(ANTLR3_UINT16)*(len + 1)));
931 string->size = len + 1;
936 ANTLR3_MEMMOVE((void *)(string->chars), chars, (ANTLR3_UINT32)((len+1) * sizeof(ANTLR3_UINT16)));
937 string->len = len;
939 return string->chars;
944 addc8 (pANTLR3_STRING string, ANTLR3_UINT32 c)
946 if (string->size < string->len + 2)
948 string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(string->len + 2));
949 string->size = string->len + 2;
951 *(string->chars + string->len) = (ANTLR3_UINT8)c;
952 *(string->chars + string->len + 1) = '\0';
953 string->len++;
955 return string->chars;
959 addc16 (pANTLR3_STRING string, ANTLR3_UINT32 c)
963 if (string->size < string->len + 2)
965 string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(sizeof(ANTLR3_UINT16) * (string->len + 2)));
966 string->size = string->len + 2;
968 ptr = (pANTLR3_UINT16)(string->chars);
970 *(ptr + string->len) = (ANTLR3_UINT16)c;
971 *(ptr + string->len + 1) = '\0';
972 string->len++;
974 return string->chars;
978 addi8 (pANTLR3_STRING string, ANTLR3_INT32 i)
984 return string->append8(string, (const char *)newbit);
987 addi16 (pANTLR3_STRING string, ANTLR3_INT32 i)
993 return string->append8(string, (const char *)newbit);
997 inserti8 (pANTLR3_STRING string, ANTLR3_UINT32 point, ANTLR3_INT32 i)
1002 return string->insert8(string, point, (const char *)newbit);
1005 inserti16 (pANTLR3_STRING string, ANTLR3_UINT32 point, ANTLR3_INT32 i)
1010 return string->insert8(string, point, (const char *)newbit);
1014 insert8 (pANTLR3_STRING string, ANTLR3_UINT32 point, const char * newbit)
1018 if (point >= string->len)
1020 return string->append(string, newbit);
1027 return string->chars;
1030 if (string->size < (string->len + len + 1))
1032 string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(string->len + len + 1));
1033 string->size = string->len + len + 1;
1038 ANTLR3_MEMMOVE((void *)(string->chars + point + len), (void *)(string->chars + point), (ANTLR3_UINT32)(string->len - point + 1));
1042 ANTLR3_MEMMOVE((void *)(string->chars + point), newbit, (ANTLR3_UINT32)(len));
1044 string->len += len;
1046 return string->chars;
1050 insert16_8 (pANTLR3_STRING string, ANTLR3_UINT32 point, const char * newbit)
1056 if (point >= string->len)
1058 return string->append8(string, newbit);
1065 return string->chars;
1068 if (string->size < (string->len + len + 1))
1070 string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(sizeof(ANTLR3_UINT16)*(string->len + len + 1)));
1071 string->size = string->len + len + 1;
1076 ANTLR3_MEMMOVE((void *)(((pANTLR3_UINT16)string->chars) + point + len), (void *)(((pANTLR3_UINT16)string->chars) + point), (ANTLR3_UINT32)(sizeof(ANTLR3_UINT16)*(string->len - point + 1)));
1078 string->len += len;
1080 inPoint = ((pANTLR3_UINT16)(string->chars))+point;
1086 return string->chars;
1090 insert16_16 (pANTLR3_STRING string, ANTLR3_UINT32 point, const char * newbit)
1095 if (point >= string->len)
1097 return string->append(string, newbit);
1100 /** First, determine the length of the input string
1112 return string->chars;
1115 if (string->size < (string->len + len + 1))
1117 string->chars = (pANTLR3_UINT8) ANTLR3_REALLOC((void *)string->chars, (ANTLR3_UINT32)(sizeof(ANTLR3_UINT16)*(string->len + len + 1)));
1118 string->size = string->len + len + 1;
1123 ANTLR3_MEMMOVE((void *)(((pANTLR3_UINT16)string->chars) + point + len), (void *)(((pANTLR3_UINT16)string->chars) + point), (ANTLR3_UINT32)(sizeof(ANTLR3_UINT16)*(string->len - point + 1)));
1128 ANTLR3_MEMMOVE((void *)(((pANTLR3_UINT16)string->chars) + point), newbit, (ANTLR3_UINT32)(sizeof(ANTLR3_UINT16)*(len)));
1130 string->len += len;
1132 return string->chars;
1135 static pANTLR3_UINT8 setS (pANTLR3_STRING string, pANTLR3_STRING chars)
1137 return string->set(string, (const char *)(chars->chars));
1140 static pANTLR3_UINT8 appendS (pANTLR3_STRING string, pANTLR3_STRING newbit)
1142 /* We may be passed an empty string, in which case we just return the current pointer
1146 return string->chars;
1150 return string->append(string, (const char *)(newbit->chars));
1154 static pANTLR3_UINT8 insertS (pANTLR3_STRING string, ANTLR3_UINT32 point, pANTLR3_STRING newbit)
1156 return string->insert(string, point, (const char *)(newbit->chars));
1159 /* Function that compares the text of a string to the supplied
1160 * 8 bit character string and returns a result a la strcmp()
1163 compare8 (pANTLR3_STRING string, const char * compStr)
1165 return strcmp((const char *)(string->chars), compStr);
1168 /* Function that compares the text of a string with the supplied character string
1169 * (which is assumed to be in the same encoding as the string itself) and returns a result
1173 compare16_8 (pANTLR3_STRING string, const char * compStr)
1178 ourString = (pANTLR3_UINT16)(string->chars);
1197 /* Function that compares the text of a string with the supplied character string
1198 * (which is assumed to be in the same encoding as the string itself) and returns a result
1202 compare16_16 (pANTLR3_STRING string, const char * compStr8)
1208 ourString = (pANTLR3_UINT16)(string->chars);
1227 /* Function that compares the text of a string with the supplied string
1228 * (which is assumed to be in the same encoding as the string itself) and returns a result
1232 compareS (pANTLR3_STRING string, pANTLR3_STRING compStr)
1234 return string->compare(string, (const char *)compStr->chars);
1242 charAt8 (pANTLR3_STRING string, ANTLR3_UINT32 offset)
1244 if (offset > string->len)
1250 return (ANTLR3_UCHAR)(*(string->chars + offset));
1258 charAt16 (pANTLR3_STRING string, ANTLR3_UINT32 offset)
1260 if (offset > string->len)
1266 return (ANTLR3_UCHAR)(*((pANTLR3_UINT16)(string->chars) + offset));
1270 /* Function that returns a substring of the supplied string a la .subString(s,e)
1274 subString8 (pANTLR3_STRING string, ANTLR3_UINT32 startIndex, ANTLR3_UINT32 endIndex)
1278 if (endIndex > string->len)
1280 endIndex = string->len + 1;
1282 newStr = string->factory->newPtr(string->factory, string->chars + startIndex, endIndex - startIndex);
1287 /* Returns a substring of the supplied string a la .subString(s,e)
1291 subString16 (pANTLR3_STRING string, ANTLR3_UINT32 startIndex, ANTLR3_UINT32 endIndex)
1295 if (endIndex > string->len)
1297 endIndex = string->len + 1;
1299 newStr = string->factory->newPtr(string->factory, (pANTLR3_UINT8)((pANTLR3_UINT16)(string->chars) + startIndex), endIndex - startIndex);
1304 /* Function that can convert the characters in the string to an integer
1307 toInt32_8 (struct ANTLR3_STRING_struct * string)
1309 return atoi((const char *)(string->chars));
1312 /* Function that can convert the characters in the string to an integer
1315 toInt32_16 (struct ANTLR3_STRING_struct * string)
1322 input = (pANTLR3_UINT16)(string->chars);
1345 /* Function that returns a pointer to an 8 bit version of the string,
1346 * which in this case is just the string as this is
1349 static pANTLR3_STRING to8_8 (pANTLR3_STRING string)
1351 return string;
1354 /* Function that returns an 8 bit version of the string,
1359 static pANTLR3_STRING to8_16 (pANTLR3_STRING string)
1364 /* Create a new 8 bit string
1366 newStr = newRaw8(string->factory);
1375 newStr->chars = (pANTLR3_UINT8) ANTLR3_MALLOC((size_t)(string->len + 1));
1376 newStr->size = string->len + 1;
1377 newStr->len = string->len;
1382 for (i=0; i<string->len; i++)
1386 c = *(((pANTLR3_UINT16)(string->chars)) + i);