| 2586 | |
| 2587 | |
| 2588 | void String::__boot() |
| 2589 | { |
| 2590 | #ifdef HXCPP_COMBINE_STRINGS |
| 2591 | InitIdent(); |
| 2592 | #endif |
| 2593 | |
| 2594 | sPermanentStringSet = new StringSet(); |
| 2595 | GCAddRoot((hx::Object **)&sPermanentStringSet); |
| 2596 | |
| 2597 | for(int i=0;i<256;i++) |
| 2598 | safeChars[i] = i>32 && i<127; |
| 2599 | unsigned char dodgy[] = { 36, 38, 43, 44, 47, 58, 59, 61, 63, 64, |
| 2600 | 34, 60, 62, 35, 37, 123, 125, 124, 92, 94, 126, 91, 93, 96 }; |
| 2601 | for(int i=0;i<sizeof(dodgy);i++) |
| 2602 | safeChars[ dodgy[i] ] = 0; |
| 2603 | |
| 2604 | for(int c=0;c<256;c++) |
| 2605 | { |
| 2606 | #ifdef HX_SMART_STRINGS |
| 2607 | if (c>127) |
| 2608 | #endif |
| 2609 | { |
| 2610 | char16_t buf[20]; |
| 2611 | buf[0] = c; |
| 2612 | buf[1] = '\0'; |
| 2613 | sConstStrings[c].length = 1; |
| 2614 | char16_t *w = (char16_t *)InternalCreateConstBuffer(buf,2*2,true); |
| 2615 | ((unsigned int *)w)[-1] |= HX_GC_STRING_CHAR16_T; |
| 2616 | sConstStrings[c].__w = w; |
| 2617 | fixHashPerm16(sConstStrings[c]); |
| 2618 | } |
| 2619 | #ifdef HX_SMART_STRINGS |
| 2620 | else |
| 2621 | { |
| 2622 | char buf[20]; |
| 2623 | int utf8Len = UTF8Bytes(c); |
| 2624 | char *p = buf; |
| 2625 | UTF8EncodeAdvance(p,c); |
| 2626 | buf[utf8Len] = '\0'; |
| 2627 | sConstStrings[c].__s = (char *)InternalCreateConstBuffer(buf,utf8Len+1,true); |
| 2628 | sConstStrings[c].length = utf8Len; |
| 2629 | } |
| 2630 | #endif |
| 2631 | } |
| 2632 | |
| 2633 | sConstEmptyString.mPtr = new (hx::NewObjConst)StringData(emptyString); |
| 2634 | |
| 2635 | Static(__StringClass) = hx::_hx_RegisterClass(HX_CSTRING("String"),TCanCast<StringData>,sStringStatics, sStringFields, |
| 2636 | &CreateEmptyString, &CreateString, 0, 0, 0 |
| 2637 | ); |
| 2638 | } |
nothing calls this directly
no test coverage detected