00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _SWORD_BASE_LEXICALFORMATTER_PRIMITIVES_
00020 #define _SWORD_BASE_LEXICALFORMATTER_PRIMITIVES_
00021
00022 #include <limits>
00023
00024 namespace sword {
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170 inline char _getThousandChar()
00171 {
00172 return '_';
00173 }
00174
00175 template<typename INTT> class formatterTraits {};
00176 template<> class formatterTraits<int8> { public: typedef word8 Type; };
00177 template<> class formatterTraits<int16> { public: typedef word16 Type; };
00178 template<> class formatterTraits<int32> { public: typedef word32 Type; };
00179 template<> class formatterTraits<int64> { public: typedef word64 Type; };
00180 template<> class formatterTraits<int> { public: typedef word Type; };
00181
00182
00183
00184 template<typename T>
00185 inline char *_format_U_g_D_L(T value0, word width, word precision, char *buffer, word bufferLen)
00186 {
00187 char *p0 = buffer+bufferLen-width-1;
00188 register char *p = p0 - 1;
00189
00190 const char *letters = "0123456789";
00191 register T value = value0;
00192 word n = 0;
00193 do
00194 {
00195 *p-- = letters[value % 10];
00196 value /= 10;
00197 ++n;
00198 }
00199 while(value);
00200
00201 while(n < precision)
00202 {
00203 *p-- = '0';
00204 ++n;
00205 }
00206 while(p > p0-width-1)
00207 {
00208 *p0++ = ' ';
00209 }
00210 *p0 = '\0';
00211 return p+1;
00212 }
00213
00214 template<typename T>
00215 inline char *_format_U_g_D_C(T value0, word width, word precision, char *buffer, word bufferLen)
00216 {
00217 char *p0 = buffer+bufferLen-width-1;
00218 register char *p = p0 - 1;
00219
00220 const char *letters = "0123456789";
00221 register T value = value0;
00222 word n = 0;
00223 do
00224 {
00225 *p-- = letters[value % 10];
00226 value /= 10;
00227 ++n;
00228 }
00229 while(value);
00230
00231 while(n < precision)
00232 {
00233 *p-- = '0';
00234 ++n;
00235 }
00236 while(p > p0-width-1)
00237 {
00238 *p-- = ' ';
00239 if (p > p0-width-1)
00240 {
00241 *p0++ = ' ';
00242 }
00243 }
00244 *p0 = '\0';
00245 return p+1;
00246 }
00247
00248 template<typename T>
00249 inline char *_format_U_g_D_R(T value0, word width, word precision, char *buffer, word bufferLen)
00250 {
00251 char *p0 = buffer+bufferLen-width-1;
00252 register char *p = p0 - 1;
00253
00254 const char *letters = "0123456789";
00255 register T value = value0;
00256 word n = 0;
00257 do
00258 {
00259 *p-- = letters[value % 10];
00260 value /= 10;
00261 ++n;
00262 }
00263 while(value);
00264
00265 while(n < precision)
00266 {
00267 *p-- = '0';
00268 ++n;
00269 }
00270 while(p > p0-width-1)
00271 {
00272 *p-- = ' ';
00273 }
00274 *p0 = '\0';
00275 return p+1;
00276 }
00277
00278 template<typename T>
00279 inline char *_format_U_G_D_L(T value0, word width, word precision, char *buffer, word bufferLen)
00280 {
00281 char *p0 = buffer+bufferLen-width-1;
00282 register char *p = p0 - 1;
00283
00284 const char *letters = "0123456789";
00285 register T value = value0;
00286 word n = 0;
00287 char thousandChar = _getThousandChar();
00288 word level = 0;
00289 do
00290 {
00291 if (level == 3)
00292 {
00293 *p-- = thousandChar;
00294 level = 1;
00295 }
00296 else
00297 ++level;
00298 *p-- = letters[value % 10];
00299 value /= 10;
00300 ++n;
00301 }
00302 while(value);
00303
00304 while(n < precision)
00305 {
00306 if (level == 3)
00307 {
00308 *p-- = thousandChar;
00309 level = 1;
00310 }
00311 else
00312 ++level;
00313 *p-- = '0';
00314 ++n;
00315 }
00316 while(p > p0-width-1)
00317 {
00318 *p0++ = ' ';
00319 }
00320 *p0 = '\0';
00321 return p+1;
00322 }
00323
00324 template<typename T>
00325 inline char *_format_U_G_D_C(T value0, word width, word precision, char *buffer, word bufferLen)
00326 {
00327 char *p0 = buffer+bufferLen-width-1;
00328 register char *p = p0 - 1;
00329
00330 const char *letters = "0123456789";
00331 register T value = value0;
00332 word n = 0;
00333 char thousandChar = _getThousandChar();
00334 word level = 0;
00335 do
00336 {
00337 if (level == 3)
00338 {
00339 *p-- = thousandChar;
00340 level = 1;
00341 }
00342 else
00343 ++level;
00344 *p-- = letters[value % 10];
00345 value /= 10;
00346 ++n;
00347 }
00348 while(value);
00349
00350 while(n < precision)
00351 {
00352 if (level == 3)
00353 {
00354 *p-- = thousandChar;
00355 level = 1;
00356 }
00357 else
00358 ++level;
00359 *p-- = '0';
00360 ++n;
00361 }
00362 while(p > p0-width-1)
00363 {
00364 *p-- = ' ';
00365 if (p > p0-width-1)
00366 {
00367 *p0++ = ' ';
00368 }
00369 }
00370 *p0 = '\0';
00371 return p+1;
00372 }
00373
00374 template<typename T>
00375 inline char *_format_U_G_D_R(T value0, word width, word precision, char *buffer, word bufferLen)
00376 {
00377 char *p0 = buffer+bufferLen-width-1;
00378 register char *p = p0 - 1;
00379
00380 const char *letters = "0123456789";
00381 register T value = value0;
00382 word n = 0;
00383 char thousandChar = _getThousandChar();
00384 word level = 0;
00385 do
00386 {
00387 if (level == 3)
00388 {
00389 *p-- = thousandChar;
00390 level = 1;
00391 }
00392 else
00393 ++level;
00394 *p-- = letters[value % 10];
00395 value /= 10;
00396 ++n;
00397 }
00398 while(value);
00399
00400 while(n < precision)
00401 {
00402 if (level == 3)
00403 {
00404 *p-- = thousandChar;
00405 level = 1;
00406 }
00407 else
00408 ++level;
00409 *p-- = '0';
00410 ++n;
00411 }
00412 while(p > p0-width-1)
00413 {
00414 *p-- = ' ';
00415 }
00416 *p0 = '\0';
00417 return p+1;
00418 }
00419
00420 template<typename T>
00421 inline char *_format_U_g_O_L_p(T value0, word width, word precision, char *buffer, word bufferLen)
00422 {
00423 char *p0 = buffer+bufferLen-width-1;
00424 register char *p = p0 - 1;
00425
00426 const char *letters = "01234567";
00427 T value = value0;
00428 word n = 0;
00429 do
00430 {
00431 *p-- = letters[value % 8];
00432 value /= 8;
00433 ++n;
00434 }
00435 while(value);
00436
00437 while(n < precision)
00438 {
00439 *p-- = '0';
00440 ++n;
00441 }
00442 while(p > p0-width-1)
00443 {
00444 *p0++ = ' ';
00445 }
00446 *p0 = '\0';
00447 return p+1;
00448 }
00449
00450 template<typename T>
00451 inline char *_format_U_g_O_C_p(T value0, word width, word precision, char *buffer, word bufferLen)
00452 {
00453 char *p0 = buffer+bufferLen-width-1;
00454 register char *p = p0 - 1;
00455
00456 const char *letters = "01234567";
00457 T value = value0;
00458 word n = 0;
00459 do
00460 {
00461 *p-- = letters[value % 8];
00462 value /= 8;
00463 ++n;
00464 }
00465 while(value);
00466
00467 while(n < precision)
00468 {
00469 *p-- = '0';
00470 ++n;
00471 }
00472 while(p > p0-width-1)
00473 {
00474 *p-- = ' ';
00475 if (p > p0-width-1)
00476 {
00477 *p0++ = ' ';
00478 }
00479 }
00480 *p0 = '\0';
00481 return p+1;
00482 }
00483
00484 template<typename T>
00485 inline char *_format_U_g_O_R_p(T value0, word width, word precision, char *buffer, word bufferLen)
00486 {
00487 char *p0 = buffer+bufferLen-width-1;
00488 register char *p = p0 - 1;
00489
00490 const char *letters = "01234567";
00491 T value = value0;
00492 word n = 0;
00493 do
00494 {
00495 *p-- = letters[value % 8];
00496 value /= 8;
00497 ++n;
00498 }
00499 while(value);
00500
00501 while(n < precision)
00502 {
00503 *p-- = '0';
00504 ++n;
00505 }
00506 while(p > p0-width-1)
00507 {
00508 *p-- = ' ';
00509 }
00510 *p0 = '\0';
00511 return p+1;
00512 }
00513
00514 template<typename T>
00515 inline char *_format_U_G_O_L_p(T value0, word width, word precision, char *buffer, word bufferLen)
00516 {
00517 char *p0 = buffer+bufferLen-width-1;
00518 register char *p = p0 - 1;
00519
00520 const char *letters = "01234567";
00521 T value = value0;
00522 word n = 0;
00523 char thousandChar = _getThousandChar();
00524 word level = 0;
00525 do
00526 {
00527 if (level == 4)
00528 {
00529 *p-- = thousandChar;
00530 level = 1;
00531 }
00532 else
00533 ++level;
00534 *p-- = letters[value % 8];
00535 value /= 8;
00536 ++n;
00537 }
00538 while(value);
00539
00540 while(n < precision)
00541 {
00542 if (level == 4)
00543 {
00544 *p-- = thousandChar;
00545 level = 1;
00546 }
00547 else
00548 ++level;
00549 *p-- = '0';
00550 ++n;
00551 }
00552 while(p > p0-width-1)
00553 {
00554 *p0++ = ' ';
00555 }
00556 *p0 = '\0';
00557 return p+1;
00558 }
00559
00560 template<typename T>
00561 inline char *_format_U_G_O_C_p(T value0, word width, word precision, char *buffer, word bufferLen)
00562 {
00563 char *p0 = buffer+bufferLen-width-1;
00564 register char *p = p0 - 1;
00565
00566 const char *letters = "01234567";
00567 T value = value0;
00568 word n = 0;
00569 char thousandChar = _getThousandChar();
00570 word level = 0;
00571 do
00572 {
00573 if (level == 4)
00574 {
00575 *p-- = thousandChar;
00576 level = 1;
00577 }
00578 else
00579 ++level;
00580 *p-- = letters[value % 8];
00581 value /= 8;
00582 ++n;
00583 }
00584 while(value);
00585
00586 while(n < precision)
00587 {
00588 if (level == 4)
00589 {
00590 *p-- = thousandChar;
00591 level = 1;
00592 }
00593 else
00594 ++level;
00595 *p-- = '0';
00596 ++n;
00597 }
00598 while(p > p0-width-1)
00599 {
00600 *p-- = ' ';
00601 if (p > p0-width-1)
00602 {
00603 *p0++ = ' ';
00604 }
00605 }
00606 *p0 = '\0';
00607 return p+1;
00608 }
00609
00610 template<typename T>
00611 inline char *_format_U_G_O_R_p(T value0, word width, word precision, char *buffer, word bufferLen)
00612 {
00613 char *p0 = buffer+bufferLen-width-1;
00614 register char *p = p0 - 1;
00615
00616 const char *letters = "01234567";
00617 T value = value0;
00618 word n = 0;
00619 char thousandChar = _getThousandChar();
00620 word level = 0;
00621 do
00622 {
00623 if (level == 4)
00624 {
00625 *p-- = thousandChar;
00626 level = 1;
00627 }
00628 else
00629 ++level;
00630 *p-- = letters[value % 8];
00631 value /= 8;
00632 ++n;
00633 }
00634 while(value);
00635
00636 while(n < precision)
00637 {
00638 if (level == 4)
00639 {
00640 *p-- = thousandChar;
00641 level = 1;
00642 }
00643 else
00644 ++level;
00645 *p-- = '0';
00646 ++n;
00647 }
00648 while(p > p0-width-1)
00649 {
00650 *p-- = ' ';
00651 }
00652 *p0 = '\0';
00653 return p+1;
00654 }
00655
00656 template<typename T>
00657 inline char *_format_U_g_O_L_P(T value0, word width, word precision, char *buffer, word bufferLen)
00658 {
00659 char *p0 = buffer+bufferLen-width-1;
00660 register char *p = p0 - 1;
00661
00662 const char *letters = "01234567";
00663 T value = value0;
00664 word n = 0;
00665 do
00666 {
00667 *p-- = letters[value % 8];
00668 value /= 8;
00669 ++n;
00670 }
00671 while(value);
00672
00673 while(n < precision)
00674 {
00675 *p-- = '0';
00676 ++n;
00677 }
00678 *p-- = '0';
00679 while(p > p0-width-1)
00680 {
00681 *p0++ = ' ';
00682 }
00683 *p0 = '\0';
00684 return p+1;
00685 }
00686
00687 template<typename T>
00688 inline char *_format_U_g_O_C_P(T value0, word width, word precision, char *buffer, word bufferLen)
00689 {
00690 char *p0 = buffer+bufferLen-width-1;
00691 register char *p = p0 - 1;
00692
00693 const char *letters = "01234567";
00694 T value = value0;
00695 word n = 0;
00696 do
00697 {
00698 *p-- = letters[value % 8];
00699 value /= 8;
00700 ++n;
00701 }
00702 while(value);
00703
00704 while(n < precision)
00705 {
00706 *p-- = '0';
00707 ++n;
00708 }
00709 *p-- = '0';
00710 while(p > p0-width-1)
00711 {
00712 *p-- = ' ';
00713 if (p > p0-width-1)
00714 {
00715 *p0++ = ' ';
00716 }
00717 }
00718 *p0 = '\0';
00719 return p+1;
00720 }
00721
00722 template<typename T>
00723 inline char *_format_U_g_O_R_P(T value0, word width, word precision, char *buffer, word bufferLen)
00724 {
00725 char *p0 = buffer+bufferLen-width-1;
00726 register char *p = p0 - 1;
00727
00728 const char *letters = "01234567";
00729 T value = value0;
00730 word n = 0;
00731 do
00732 {
00733 *p-- = letters[value % 8];
00734 value /= 8;
00735 ++n;
00736 }
00737 while(value);
00738
00739 while(n < precision)
00740 {
00741 *p-- = '0';
00742 ++n;
00743 }
00744 *p-- = '0';
00745 while(p > p0-width-1)
00746 {
00747 *p-- = ' ';
00748 }
00749 *p0 = '\0';
00750 return p+1;
00751 }
00752
00753 template<typename T>
00754 inline char *_format_U_G_O_L_P(T value0, word width, word precision, char *buffer, word bufferLen)
00755 {
00756 char *p0 = buffer+bufferLen-width-1;
00757 register char *p = p0 - 1;
00758
00759 const char *letters = "01234567";
00760 T value = value0;
00761 word n = 0;
00762 char thousandChar = _getThousandChar();
00763 word level = 0;
00764 do
00765 {
00766 if (level == 4)
00767 {
00768 *p-- = thousandChar;
00769 level = 1;
00770 }
00771 else
00772 ++level;
00773 *p-- = letters[value % 8];
00774 value /= 8;
00775 ++n;
00776 }
00777 while(value);
00778
00779 while(n < precision)
00780 {
00781 if (level == 4)
00782 {
00783 *p-- = thousandChar;
00784 level = 1;
00785 }
00786 else
00787 ++level;
00788 *p-- = '0';
00789 ++n;
00790 }
00791 *p-- = '0';
00792 while(p > p0-width-1)
00793 {
00794 *p0++ = ' ';
00795 }
00796 *p0 = '\0';
00797 return p+1;
00798 }
00799
00800 template<typename T>
00801 inline char *_format_U_G_O_C_P(T value0, word width, word precision, char *buffer, word bufferLen)
00802 {
00803 char *p0 = buffer+bufferLen-width-1;
00804 register char *p = p0 - 1;
00805
00806 const char *letters = "01234567";
00807 T value = value0;
00808 word n = 0;
00809 char thousandChar = _getThousandChar();
00810 word level = 0;
00811 do
00812 {
00813 if (level == 4)
00814 {
00815 *p-- = thousandChar;
00816 level = 1;
00817 }
00818 else
00819 ++level;
00820 *p-- = letters[value % 8];
00821 value /= 8;
00822 ++n;
00823 }
00824 while(value);
00825
00826 while(n < precision)
00827 {
00828 if (level == 4)
00829 {
00830 *p-- = thousandChar;
00831 level = 1;
00832 }
00833 else
00834 ++level;
00835 *p-- = '0';
00836 ++n;
00837 }
00838 *p-- = '0';
00839 while(p > p0-width-1)
00840 {
00841 *p-- = ' ';
00842 if (p > p0-width-1)
00843 {
00844 *p0++ = ' ';
00845 }
00846 }
00847 *p0 = '\0';
00848 return p+1;
00849 }
00850
00851 template<typename T>
00852 inline char *_format_U_G_O_R_P(T value0, word width, word precision, char *buffer, word bufferLen)
00853 {
00854 char *p0 = buffer+bufferLen-width-1;
00855 register char *p = p0 - 1;
00856
00857 const char *letters = "01234567";
00858 T value = value0;
00859 word n = 0;
00860 char thousandChar = _getThousandChar();
00861 word level = 0;
00862 do
00863 {
00864 if (level == 4)
00865 {
00866 *p-- = thousandChar;
00867 level = 1;
00868 }
00869 else
00870 ++level;
00871 *p-- = letters[value % 8];
00872 value /= 8;
00873 ++n;
00874 }
00875 while(value);
00876
00877 while(n < precision)
00878 {
00879 if (level == 4)
00880 {
00881 *p-- = thousandChar;
00882 level = 1;
00883 }
00884 else
00885 ++level;
00886 *p-- = '0';
00887 ++n;
00888 }
00889 *p-- = '0';
00890 while(p > p0-width-1)
00891 {
00892 *p-- = ' ';
00893 }
00894 *p0 = '\0';
00895 return p+1;
00896 }
00897
00898 template<typename T>
00899 inline char *_format_U_g_x_L_p(T value0, word width, word precision, char *buffer, word bufferLen)
00900 {
00901 char *p0 = buffer+bufferLen-width-1;
00902 register char *p = p0 - 1;
00903
00904 const char *letters = "0123456789abcdef";
00905 T value = value0;
00906 word n = 0;
00907 do
00908 {
00909 *p-- = letters[value % 16];
00910 value /= 16;
00911 ++n;
00912 }
00913 while(value);
00914
00915 while(n < precision)
00916 {
00917 *p-- = '0';
00918 ++n;
00919 }
00920 while(p > p0-width-1)
00921 {
00922 *p0++ = ' ';
00923 }
00924 *p0 = '\0';
00925 return p+1;
00926 }
00927
00928 template<typename T>
00929 inline char *_format_U_g_x_C_p(T value0, word width, word precision, char *buffer, word bufferLen)
00930 {
00931 char *p0 = buffer+bufferLen-width-1;
00932 register char *p = p0 - 1;
00933
00934 const char *letters = "0123456789abcdef";
00935 T value = value0;
00936 word n = 0;
00937 do
00938 {
00939 *p-- = letters[value % 16];
00940 value /= 16;
00941 ++n;
00942 }
00943 while(value);
00944
00945 while(n < precision)
00946 {
00947 *p-- = '0';
00948 ++n;
00949 }
00950 while(p > p0-width-1)
00951 {
00952 *p-- = ' ';
00953 if (p > p0-width-1)
00954 {
00955 *p0++ = ' ';
00956 }
00957 }
00958 *p0 = '\0';
00959 return p+1;
00960 }
00961
00962 template<typename T>
00963 inline char *_format_U_g_x_R_p(T value0, word width, word precision, char *buffer, word bufferLen)
00964 {
00965 char *p0 = buffer+bufferLen-width-1;
00966 register char *p = p0 - 1;
00967
00968 const char *letters = "0123456789abcdef";
00969 T value = value0;
00970 word n = 0;
00971 do
00972 {
00973 *p-- = letters[value % 16];
00974 value /= 16;
00975 ++n;
00976 }
00977 while(value);
00978
00979 while(n < precision)
00980 {
00981 *p-- = '0';
00982 ++n;
00983 }
00984 while(p > p0-width-1)
00985 {
00986 *p-- = ' ';
00987 }
00988 *p0 = '\0';
00989 return p+1;
00990 }
00991
00992 template<typename T>
00993 inline char *_format_U_G_x_L_p(T value0, word width, word precision, char *buffer, word bufferLen)
00994 {
00995 char *p0 = buffer+bufferLen-width-1;
00996 register char *p = p0 - 1;
00997
00998 const char *letters = "0123456789abcdef";
00999 T value = value0;
01000 word n = 0;
01001 char thousandChar = _getThousandChar();
01002 word level = 0;
01003 do
01004 {
01005 if (level == 4)
01006 {
01007 *p-- = thousandChar;
01008 level = 1;
01009 }
01010 else
01011 ++level;
01012 *p-- = letters[value % 16];
01013 value /= 16;
01014 ++n;
01015 }
01016 while(value);
01017
01018 while(n < precision)
01019 {
01020 if (level == 4)
01021 {
01022 *p-- = thousandChar;
01023 level = 1;
01024 }
01025 else
01026 ++level;
01027 *p-- = '0';
01028 ++n;
01029 }
01030 while(p > p0-width-1)
01031 {
01032 *p0++ = ' ';
01033 }
01034 *p0 = '\0';
01035 return p+1;
01036 }
01037
01038 template<typename T>
01039 inline char *_format_U_G_x_C_p(T value0, word width, word precision, char *buffer, word bufferLen)
01040 {
01041 char *p0 = buffer+bufferLen-width-1;
01042 register char *p = p0 - 1;
01043
01044 const char *letters = "0123456789abcdef";
01045 T value = value0;
01046 word n = 0;
01047 char thousandChar = _getThousandChar();
01048 word level = 0;
01049 do
01050 {
01051 if (level == 4)
01052 {
01053 *p-- = thousandChar;
01054 level = 1;
01055 }
01056 else
01057 ++level;
01058 *p-- = letters[value % 16];
01059 value /= 16;
01060 ++n;
01061 }
01062 while(value);
01063
01064 while(n < precision)
01065 {
01066 if (level == 4)
01067 {
01068 *p-- = thousandChar;
01069 level = 1;
01070 }
01071 else
01072 ++level;
01073 *p-- = '0';
01074 ++n;
01075 }
01076 while(p > p0-width-1)
01077 {
01078 *p-- = ' ';
01079 if (p > p0-width-1)
01080 {
01081 *p0++ = ' ';
01082 }
01083 }
01084 *p0 = '\0';
01085 return p+1;
01086 }
01087
01088 template<typename T>
01089 inline char *_format_U_G_x_R_p(T value0, word width, word precision, char *buffer, word bufferLen)
01090 {
01091 char *p0 = buffer+bufferLen-width-1;
01092 register char *p = p0 - 1;
01093
01094 const char *letters = "0123456789abcdef";
01095 T value = value0;
01096 word n = 0;
01097 char thousandChar = _getThousandChar();
01098 word level = 0;
01099 do
01100 {
01101 if (level == 4)
01102 {
01103 *p-- = thousandChar;
01104 level = 1;
01105 }
01106 else
01107 ++level;
01108 *p-- = letters[value % 16];
01109 value /= 16;
01110 ++n;
01111 }
01112 while(value);
01113
01114 while(n < precision)
01115 {
01116 if (level == 4)
01117 {
01118 *p-- = thousandChar;
01119 level = 1;
01120 }
01121 else
01122 ++level;
01123 *p-- = '0';
01124 ++n;
01125 }
01126 while(p > p0-width-1)
01127 {
01128 *p-- = ' ';
01129 }
01130 *p0 = '\0';
01131 return p+1;
01132 }
01133
01134 template<typename T>
01135 inline char *_format_U_g_x_L_P(T value0, word width, word precision, char *buffer, word bufferLen)
01136 {
01137 char *p0 = buffer+bufferLen-width-1;
01138 register char *p = p0 - 1;
01139
01140 const char *letters = "0123456789abcdef";
01141 T value = value0;
01142 word n = 0;
01143 do
01144 {
01145 *p-- = letters[value % 16];
01146 value /= 16;
01147 ++n;
01148 }
01149 while(value);
01150
01151 while(n < precision)
01152 {
01153 *p-- = '0';
01154 ++n;
01155 }
01156 *p-- = 'x';
01157 *p-- = '0';
01158 while(p > p0-width-1)
01159 {
01160 *p0++ = ' ';
01161 }
01162 *p0 = '\0';
01163 return p+1;
01164 }
01165
01166 template<typename T>
01167 inline char *_format_U_g_x_C_P(T value0, word width, word precision, char *buffer, word bufferLen)
01168 {
01169 char *p0 = buffer+bufferLen-width-1;
01170 register char *p = p0 - 1;
01171
01172 const char *letters = "0123456789abcdef";
01173 T value = value0;
01174 word n = 0;
01175 do
01176 {
01177 *p-- = letters[value % 16];
01178 value /= 16;
01179 ++n;
01180 }
01181 while(value);
01182
01183 while(n < precision)
01184 {
01185 *p-- = '0';
01186 ++n;
01187 }
01188 *p-- = 'x';
01189 *p-- = '0';
01190 while(p > p0-width-1)
01191 {
01192 *p-- = ' ';
01193 if (p > p0-width-1)
01194 {
01195 *p0++ = ' ';
01196 }
01197 }
01198 *p0 = '\0';
01199 return p+1;
01200 }
01201
01202 template<typename T>
01203 inline char *_format_U_g_x_R_P(T value0, word width, word precision, char *buffer, word bufferLen)
01204 {
01205 char *p0 = buffer+bufferLen-width-1;
01206 register char *p = p0 - 1;
01207
01208 const char *letters = "0123456789abcdef";
01209 T value = value0;
01210 word n = 0;
01211 do
01212 {
01213 *p-- = letters[value % 16];
01214 value /= 16;
01215 ++n;
01216 }
01217 while(value);
01218
01219 while(n < precision)
01220 {
01221 *p-- = '0';
01222 ++n;
01223 }
01224 *p-- = 'x';
01225 *p-- = '0';
01226 while(p > p0-width-1)
01227 {
01228 *p-- = ' ';
01229 }
01230 *p0 = '\0';
01231 return p+1;
01232 }
01233
01234 template<typename T>
01235 inline char *_format_U_G_x_L_P(T value0, word width, word precision, char *buffer, word bufferLen)
01236 {
01237 char *p0 = buffer+bufferLen-width-1;
01238 register char *p = p0 - 1;
01239
01240 const char *letters = "0123456789abcdef";
01241 T value = value0;
01242 word n = 0;
01243 char thousandChar = _getThousandChar();
01244 word level = 0;
01245 do
01246 {
01247 if (level == 4)
01248 {
01249 *p-- = thousandChar;
01250 level = 1;
01251 }
01252 else
01253 ++level;
01254 *p-- = letters[value % 16];
01255 value /= 16;
01256 ++n;
01257 }
01258 while(value);
01259
01260 while(n < precision)
01261 {
01262 if (level == 4)
01263 {
01264 *p-- = thousandChar;
01265 level = 1;
01266 }
01267 else
01268 ++level;
01269 *p-- = '0';
01270 ++n;
01271 }
01272 *p-- = 'x';
01273 *p-- = '0';
01274 while(p > p0-width-1)
01275 {
01276 *p0++ = ' ';
01277 }
01278 *p0 = '\0';
01279 return p+1;
01280 }
01281
01282 template<typename T>
01283 inline char *_format_U_G_x_C_P(T value0, word width, word precision, char *buffer, word bufferLen)
01284 {
01285 char *p0 = buffer+bufferLen-width-1;
01286 register char *p = p0 - 1;
01287
01288 const char *letters = "0123456789abcdef";
01289 T value = value0;
01290 word n = 0;
01291 char thousandChar = _getThousandChar();
01292 word level = 0;
01293 do
01294 {
01295 if (level == 4)
01296 {
01297 *p-- = thousandChar;
01298 level = 1;
01299 }
01300 else
01301 ++level;
01302 *p-- = letters[value % 16];
01303 value /= 16;
01304 ++n;
01305 }
01306 while(value);
01307
01308 while(n < precision)
01309 {
01310 if (level == 4)
01311 {
01312 *p-- = thousandChar;
01313 level = 1;
01314 }
01315 else
01316 ++level;
01317 *p-- = '0';
01318 ++n;
01319 }
01320 *p-- = 'x';
01321 *p-- = '0';
01322 while(p > p0-width-1)
01323 {
01324 *p-- = ' ';
01325 if (p > p0-width-1)
01326 {
01327 *p0++ = ' ';
01328 }
01329 }
01330 *p0 = '\0';
01331 return p+1;
01332 }
01333
01334 template<typename T>
01335 inline char *_format_U_G_x_R_P(T value0, word width, word precision, char *buffer, word bufferLen)
01336 {
01337 char *p0 = buffer+bufferLen-width-1;
01338 register char *p = p0 - 1;
01339
01340 const char *letters = "0123456789abcdef";
01341 T value = value0;
01342 word n = 0;
01343 char thousandChar = _getThousandChar();
01344 word level = 0;
01345 do
01346 {
01347 if (level == 4)
01348 {
01349 *p-- = thousandChar;
01350 level = 1;
01351 }
01352 else
01353 ++level;
01354 *p-- = letters[value % 16];
01355 value /= 16;
01356 ++n;
01357 }
01358 while(value);
01359
01360 while(n < precision)
01361 {
01362 if (level == 4)
01363 {
01364 *p-- = thousandChar;
01365 level = 1;
01366 }
01367 else
01368 ++level;
01369 *p-- = '0';
01370 ++n;
01371 }
01372 *p-- = 'x';
01373 *p-- = '0';
01374 while(p > p0-width-1)
01375 {
01376 *p-- = ' ';
01377 }
01378 *p0 = '\0';
01379 return p+1;
01380 }
01381
01382 template<typename T>
01383 inline char *_format_U_g_X_L_p(T value0, word width, word precision, char *buffer, word bufferLen)
01384 {
01385 char *p0 = buffer+bufferLen-width-1;
01386 register char *p = p0 - 1;
01387
01388 const char *letters = "0123456789ABCDEF";
01389 T value = value0;
01390 word n = 0;
01391 do
01392 {
01393 *p-- = letters[value % 16];
01394 value /= 16;
01395 ++n;
01396 }
01397 while(value);
01398
01399 while(n < precision)
01400 {
01401 *p-- = '0';
01402 ++n;
01403 }
01404 while(p > p0-width-1)
01405 {
01406 *p0++ = ' ';
01407 }
01408 *p0 = '\0';
01409 return p+1;
01410 }
01411
01412 template<typename T>
01413 inline char *_format_U_g_X_C_p(T value0, word width, word precision, char *buffer, word bufferLen)
01414 {
01415 char *p0 = buffer+bufferLen-width-1;
01416 register char *p = p0 - 1;
01417
01418 const char *letters = "0123456789ABCDEF";
01419 T value = value0;
01420 word n = 0;
01421 do
01422 {
01423 *p-- = letters[value % 16];
01424 value /= 16;
01425 ++n;
01426 }
01427 while(value);
01428
01429 while(n < precision)
01430 {
01431 *p-- = '0';
01432 ++n;
01433 }
01434 while(p > p0-width-1)
01435 {
01436 *p-- = ' ';
01437 if (p > p0-width-1)
01438 {
01439 *p0++ = ' ';
01440 }
01441 }
01442 *p0 = '\0';
01443 return p+1;
01444 }
01445
01446 template<typename T>
01447 inline char *_format_U_g_X_R_p(T value0, word width, word precision, char *buffer, word bufferLen)
01448 {
01449 char *p0 = buffer+bufferLen-width-1;
01450 register char *p = p0 - 1;
01451
01452 const char *letters = "0123456789ABCDEF";
01453 T value = value0;
01454 word n = 0;
01455 do
01456 {
01457 *p-- = letters[value % 16];
01458 value /= 16;
01459 ++n;
01460 }
01461 while(value);
01462
01463 while(n < precision)
01464 {
01465 *p-- = '0';
01466 ++n;
01467 }
01468 while(p > p0-width-1)
01469 {
01470 *p-- = ' ';
01471 }
01472 *p0 = '\0';
01473 return p+1;
01474 }
01475
01476 template<typename T>
01477 inline char *_format_U_G_X_L_p(T value0, word width, word precision, char *buffer, word bufferLen)
01478 {
01479 char *p0 = buffer+bufferLen-width-1;
01480 register char *p = p0 - 1;
01481
01482 const char *letters = "0123456789ABCDEF";
01483 T value = value0;
01484 word n = 0;
01485 char thousandChar = _getThousandChar();
01486 word level = 0;
01487 do
01488 {
01489 if (level == 4)
01490 {
01491 *p-- = thousandChar;
01492 level = 1;
01493 }
01494 else
01495 ++level;
01496 *p-- = letters[value % 16];
01497 value /= 16;
01498 ++n;
01499 }
01500 while(value);
01501
01502 while(n < precision)
01503 {
01504 if (level == 4)
01505 {
01506 *p-- = thousandChar;
01507 level = 1;
01508 }
01509 else
01510 ++level;
01511 *p-- = '0';
01512 ++n;
01513 }
01514 while(p > p0-width-1)
01515 {
01516 *p0++ = ' ';
01517 }
01518 *p0 = '\0';
01519 return p+1;
01520 }
01521
01522 template<typename T>
01523 inline char *_format_U_G_X_C_p(T value0, word width, word precision, char *buffer, word bufferLen)
01524 {
01525 char *p0 = buffer+bufferLen-width-1;
01526 register char *p = p0 - 1;
01527
01528 const char *letters = "0123456789ABCDEF";
01529 T value = value0;
01530 word n = 0;
01531 char thousandChar = _getThousandChar();
01532 word level = 0;
01533 do
01534 {
01535 if (level == 4)
01536 {
01537 *p-- = thousandChar;
01538 level = 1;
01539 }
01540 else
01541 ++level;
01542 *p-- = letters[value % 16];
01543 value /= 16;
01544 ++n;
01545 }
01546 while(value);
01547
01548 while(n < precision)
01549 {
01550 if (level == 4)
01551 {
01552 *p-- = thousandChar;
01553 level = 1;
01554 }
01555 else
01556 ++level;
01557 *p-- = '0';
01558 ++n;
01559 }
01560 while(p > p0-width-1)
01561 {
01562 *p-- = ' ';
01563 if (p > p0-width-1)
01564 {
01565 *p0++ = ' ';
01566 }
01567 }
01568 *p0 = '\0';
01569 return p+1;
01570 }
01571
01572 template<typename T>
01573 inline char *_format_U_G_X_R_p(T value0, word width, word precision, char *buffer, word bufferLen)
01574 {
01575 char *p0 = buffer+bufferLen-width-1;
01576 register char *p = p0 - 1;
01577
01578 const char *letters = "0123456789ABCDEF";
01579 T value = value0;
01580 word n = 0;
01581 char thousandChar = _getThousandChar();
01582 word level = 0;
01583 do
01584 {
01585 if (level == 4)
01586 {
01587 *p-- = thousandChar;
01588 level = 1;
01589 }
01590 else
01591 ++level;
01592 *p-- = letters[value % 16];
01593 value /= 16;
01594 ++n;
01595 }
01596 while(value);
01597
01598 while(n < precision)
01599 {
01600 if (level == 4)
01601 {
01602 *p-- = thousandChar;
01603 level = 1;
01604 }
01605 else
01606 ++level;
01607 *p-- = '0';
01608 ++n;
01609 }
01610 while(p > p0-width-1)
01611 {
01612 *p-- = ' ';
01613 }
01614 *p0 = '\0';
01615 return p+1;
01616 }
01617
01618 template<typename T>
01619 inline char *_format_U_g_X_L_P(T value0, word width, word precision, char *buffer, word bufferLen)
01620 {
01621 char *p0 = buffer+bufferLen-width-1;
01622 register char *p = p0 - 1;
01623
01624 const char *letters = "0123456789ABCDEF";
01625 T value = value0;
01626 word n = 0;
01627 do
01628 {
01629 *p-- = letters[value % 16];
01630 value /= 16;
01631 ++n;
01632 }
01633 while(value);
01634
01635 while(n < precision)
01636 {
01637 *p-- = '0';
01638 ++n;
01639 }
01640 *p-- = 'X';
01641 *p-- = '0';
01642 while(p > p0-width-1)
01643 {
01644 *p0++ = ' ';
01645 }
01646 *p0 = '\0';
01647 return p+1;
01648 }
01649
01650 template<typename T>
01651 inline char *_format_U_g_X_C_P(T value0, word width, word precision, char *buffer, word bufferLen)
01652 {
01653 char *p0 = buffer+bufferLen-width-1;
01654 register char *p = p0 - 1;
01655
01656 const char *letters = "0123456789ABCDEF";
01657 T value = value0;
01658 word n = 0;
01659 do
01660 {
01661 *p-- = letters[value % 16];
01662 value /= 16;
01663 ++n;
01664 }
01665 while(value);
01666
01667 while(n < precision)
01668 {
01669 *p-- = '0';
01670 ++n;
01671 }
01672 *p-- = 'X';
01673 *p-- = '0';
01674 while(p > p0-width-1)
01675 {
01676 *p-- = ' ';
01677 if (p > p0-width-1)
01678 {
01679 *p0++ = ' ';
01680 }
01681 }
01682 *p0 = '\0';
01683 return p+1;
01684 }
01685
01686 template<typename T>
01687 inline char *_format_U_g_X_R_P(T value0, word width, word precision, char *buffer, word bufferLen)
01688 {
01689 char *p0 = buffer+bufferLen-width-1;
01690 register char *p = p0 - 1;
01691
01692 const char *letters = "0123456789ABCDEF";
01693 T value = value0;
01694 word n = 0;
01695 do
01696 {
01697 *p-- = letters[value % 16];
01698 value /= 16;
01699 ++n;
01700 }
01701 while(value);
01702
01703 while(n < precision)
01704 {
01705 *p-- = '0';
01706 ++n;
01707 }
01708 *p-- = 'X';
01709 *p-- = '0';
01710 while(p > p0-width-1)
01711 {
01712 *p-- = ' ';
01713 }
01714 *p0 = '\0';
01715 return p+1;
01716 }
01717
01718 template<typename T>
01719 inline char *_format_U_G_X_L_P(T value0, word width, word precision, char *buffer, word bufferLen)
01720 {
01721 char *p0 = buffer+bufferLen-width-1;
01722 register char *p = p0 - 1;
01723
01724 const char *letters = "0123456789ABCDEF";
01725 T value = value0;
01726 word n = 0;
01727 char thousandChar = _getThousandChar();
01728 word level = 0;
01729 do
01730 {
01731 if (level == 4)
01732 {
01733 *p-- = thousandChar;
01734 level = 1;
01735 }
01736 else
01737 ++level;
01738 *p-- = letters[value % 16];
01739 value /= 16;
01740 ++n;
01741 }
01742 while(value);
01743
01744 while(n < precision)
01745 {
01746 if (level == 4)
01747 {
01748 *p-- = thousandChar;
01749 level = 1;
01750 }
01751 else
01752 ++level;
01753 *p-- = '0';
01754 ++n;
01755 }
01756 *p-- = 'X';
01757 *p-- = '0';
01758 while(p > p0-width-1)
01759 {
01760 *p0++ = ' ';
01761 }
01762 *p0 = '\0';
01763 return p+1;
01764 }
01765
01766 template<typename T>
01767 inline char *_format_U_G_X_C_P(T value0, word width, word precision, char *buffer, word bufferLen)
01768 {
01769 char *p0 = buffer+bufferLen-width-1;
01770 register char *p = p0 - 1;
01771
01772 const char *letters = "0123456789ABCDEF";
01773 T value = value0;
01774 word n = 0;
01775 char thousandChar = _getThousandChar();
01776 word level = 0;
01777 do
01778 {
01779 if (level == 4)
01780 {
01781 *p-- = thousandChar;
01782 level = 1;
01783 }
01784 else
01785 ++level;
01786 *p-- = letters[value % 16];
01787 value /= 16;
01788 ++n;
01789 }
01790 while(value);
01791
01792 while(n < precision)
01793 {
01794 if (level == 4)
01795 {
01796 *p-- = thousandChar;
01797 level = 1;
01798 }
01799 else
01800 ++level;
01801 *p-- = '0';
01802 ++n;
01803 }
01804 *p-- = 'X';
01805 *p-- = '0';
01806 while(p > p0-width-1)
01807 {
01808 *p-- = ' ';
01809 if (p > p0-width-1)
01810 {
01811 *p0++ = ' ';
01812 }
01813 }
01814 *p0 = '\0';
01815 return p+1;
01816 }
01817
01818 template<typename T>
01819 inline char *_format_U_G_X_R_P(T value0, word width, word precision, char *buffer, word bufferLen)
01820 {
01821 char *p0 = buffer+bufferLen-width-1;
01822 register char *p = p0 - 1;
01823
01824 const char *letters = "0123456789ABCDEF";
01825 T value = value0;
01826 word n = 0;
01827 char thousandChar = _getThousandChar();
01828 word level = 0;
01829 do
01830 {
01831 if (level == 4)
01832 {
01833 *p-- = thousandChar;
01834 level = 1;
01835 }
01836 else
01837 ++level;
01838 *p-- = letters[value % 16];
01839 value /= 16;
01840 ++n;
01841 }
01842 while(value);
01843
01844 while(n < precision)
01845 {
01846 if (level == 4)
01847 {
01848 *p-- = thousandChar;
01849 level = 1;
01850 }
01851 else
01852 ++level;
01853 *p-- = '0';
01854 ++n;
01855 }
01856 *p-- = 'X';
01857 *p-- = '0';
01858 while(p > p0-width-1)
01859 {
01860 *p-- = ' ';
01861 }
01862 *p0 = '\0';
01863 return p+1;
01864 }
01865
01866 template<typename T>
01867 inline char *_format_I_g_D_L_N(T value0, word width, word precision, char *buffer, word bufferLen)
01868 {
01869 char *p0 = buffer+bufferLen-width-1;
01870 register char *p = p0 - 1;
01871
01872 const char *letters = "0123456789";
01873 register T value = value0;
01874 bool negative = value < 0;
01875 if (negative)
01876 {
01877 value = -value;
01878 }
01879 word n = 0;
01880 do
01881 {
01882 *p-- = letters[value % 10];
01883 value /= 10;
01884 ++n;
01885 }
01886 while(value);
01887
01888 while(n < precision)
01889 {
01890 *p-- = '0';
01891 ++n;
01892 }
01893 if (negative)
01894 {
01895 *p-- = '-';
01896 }
01897 while(p > p0-width-1)
01898 {
01899 *p0++ = ' ';
01900 }
01901 *p0 = '\0';
01902 return p+1;
01903 }
01904
01905 template<typename T>
01906 inline char *_format_I_g_D_C_N(T value0, word width, word precision, char *buffer, word bufferLen)
01907 {
01908 char *p0 = buffer+bufferLen-width-1;
01909 register char *p = p0 - 1;
01910
01911 const char *letters = "0123456789";
01912 register T value = value0;
01913 bool negative = value < 0;
01914 if (negative)
01915 {
01916 value = -value;
01917 }
01918 word n = 0;
01919 do
01920 {
01921 *p-- = letters[value % 10];
01922 value /= 10;
01923 ++n;
01924 }
01925 while(value);
01926
01927 while(n < precision)
01928 {
01929 *p-- = '0';
01930 ++n;
01931 }
01932 if (negative)
01933 {
01934 *p-- = '-';
01935 }
01936 while(p > p0-width-1)
01937 {
01938 *p-- = ' ';
01939 if (p > p0-width-1)
01940 {
01941 *p0++ = ' ';
01942 }
01943 }
01944 *p0 = '\0';
01945 return p+1;
01946 }
01947
01948 template<typename T>
01949 inline char *_format_I_g_D_R_N(T value0, word width, word precision, char *buffer, word bufferLen)
01950 {
01951 char *p0 = buffer+bufferLen-width-1;
01952 register char *p = p0 - 1;
01953
01954 const char *letters = "0123456789";
01955 register T value = value0;
01956 bool negative = value < 0;
01957 if (negative)
01958 {
01959 value = -value;
01960 }
01961 word n = 0;
01962 do
01963 {
01964 *p-- = letters[value % 10];
01965 value /= 10;
01966 ++n;
01967 }
01968 while(value);
01969
01970 while(n < precision)
01971 {
01972 *p-- = '0';
01973 ++n;
01974 }
01975 if (negative)
01976 {
01977 *p-- = '-';
01978 }
01979 while(p > p0-width-1)
01980 {
01981 *p-- = ' ';
01982 }
01983 *p0 = '\0';
01984 return p+1;
01985 }
01986
01987 template<typename T>
01988 inline char *_format_I_G_D_L_N(T value0, word width, word precision, char *buffer, word bufferLen)
01989 {
01990 char *p0 = buffer+bufferLen-width-1;
01991 register char *p = p0 - 1;
01992
01993 const char *letters = "0123456789";
01994 register T value = value0;
01995 bool negative = value < 0;
01996 if (negative)
01997 {
01998 value = -value;
01999 }
02000 word n = 0;
02001 char thousandChar = _getThousandChar();
02002 word level = 0;
02003 do
02004 {
02005 if (level == 3)
02006 {
02007 *p-- = thousandChar;
02008 level = 1;
02009 }
02010 else
02011 ++level;
02012 *p-- = letters[value % 10];
02013 value /= 10;
02014 ++n;
02015 }
02016 while(value);
02017
02018 while(n < precision)
02019 {
02020 if (level == 3)
02021 {
02022 *p-- = thousandChar;
02023 level = 1;
02024 }
02025 else
02026 ++level;
02027 *p-- = '0';
02028 ++n;
02029 }
02030 if (negative)
02031 {
02032 *p-- = '-';
02033 }
02034 while(p > p0-width-1)
02035 {
02036 *p0++ = ' ';
02037 }
02038 *p0 = '\0';
02039 return p+1;
02040 }
02041
02042 template<typename T>
02043 inline char *_format_I_G_D_C_N(T value0, word width, word precision, char *buffer, word bufferLen)
02044 {
02045 char *p0 = buffer+bufferLen-width-1;
02046 register char *p = p0 - 1;
02047
02048 const char *letters = "0123456789";
02049 register T value = value0;
02050 bool negative = value < 0;
02051 if (negative)
02052 {
02053 value = -value;
02054 }
02055 word n = 0;
02056 char thousandChar = _getThousandChar();
02057 word level = 0;
02058 do
02059 {
02060 if (level == 3)
02061 {
02062 *p-- = thousandChar;
02063 level = 1;
02064 }
02065 else
02066 ++level;
02067 *p-- = letters[value % 10];
02068 value /= 10;
02069 ++n;
02070 }
02071 while(value);
02072
02073 while(n < precision)
02074 {
02075 if (level == 3)
02076 {
02077 *p-- = thousandChar;
02078 level = 1;
02079 }
02080 else
02081 ++level;
02082 *p-- = '0';
02083 ++n;
02084 }
02085 if (negative)
02086 {
02087 *p-- = '-';
02088 }
02089 while(p > p0-width-1)
02090 {
02091 *p-- = ' ';
02092 if (p > p0-width-1)
02093 {
02094 *p0++ = ' ';
02095 }
02096 }
02097 *p0 = '\0';
02098 return p+1;
02099 }
02100
02101 template<typename T>
02102 inline char *_format_I_G_D_R_N(T value0, word width, word precision, char *buffer, word bufferLen)
02103 {
02104 char *p0 = buffer+bufferLen-width-1;
02105 register char *p = p0 - 1;
02106
02107 const char *letters = "0123456789";
02108 register T value = value0;
02109 bool negative = value < 0;
02110 if (negative)
02111 {
02112 value = -value;
02113 }
02114 word n = 0;
02115 char thousandChar = _getThousandChar();
02116 word level = 0;
02117 do
02118 {
02119 if (level == 3)
02120 {
02121 *p-- = thousandChar;
02122 level = 1;
02123 }
02124 else
02125 ++level;
02126 *p-- = letters[value % 10];
02127 value /= 10;
02128 ++n;
02129 }
02130 while(value);
02131
02132 while(n < precision)
02133 {
02134 if (level == 3)
02135 {
02136 *p-- = thousandChar;
02137 level = 1;
02138 }
02139 else
02140 ++level;
02141 *p-- = '0';
02142 ++n;
02143 }
02144 if (negative)
02145 {
02146 *p-- = '-';
02147 }
02148 while(p > p0-width-1)
02149 {
02150 *p-- = ' ';
02151 }
02152 *p0 = '\0';
02153 return p+1;
02154 }
02155
02156 template<typename T>
02157 inline char *_format_I_g_D_L_F(T value0, word width, word precision, char *buffer, word bufferLen)
02158 {
02159 char *p0 = buffer+bufferLen-width-1;
02160 register char *p = p0 - 1;
02161
02162 const char *letters = "0123456789";
02163 register T value = value0;
02164 bool negative = value < 0;
02165 if (negative)
02166 {
02167 value = -value;
02168 *p-- = ')';
02169 }
02170 word n = 0;
02171 do
02172 {
02173 *p-- = letters[value % 10];
02174 value /= 10;
02175 ++n;
02176 }
02177 while(value);
02178
02179 while(n < precision)
02180 {
02181 *p-- = '0';
02182 ++n;
02183 }
02184 if (negative)
02185 {
02186 *p-- = '(';
02187 }
02188 while(p > p0-width-1)
02189 {
02190 *p0++ = ' ';
02191 }
02192 *p0 = '\0';
02193 return p+1;
02194 }
02195
02196 template<typename T>
02197 inline char *_format_I_g_D_C_F(T value0, word width, word precision, char *buffer, word bufferLen)
02198 {
02199 char *p0 = buffer+bufferLen-width-1;
02200 register char *p = p0 - 1;
02201
02202 const char *letters = "0123456789";
02203 register T value = value0;
02204 bool negative = value < 0;
02205 if (negative)
02206 {
02207 value = -value;
02208 *p-- = ')';
02209 }
02210 word n = 0;
02211 do
02212 {
02213 *p-- = letters[value % 10];
02214 value /= 10;
02215 ++n;
02216 }
02217 while(value);
02218
02219 while(n < precision)
02220 {
02221 *p-- = '0';
02222 ++n;
02223 }
02224 if (negative)
02225 {
02226 *p-- = '(';
02227 }
02228 while(p > p0-width-1)
02229 {
02230 *p-- = ' ';
02231 if (p > p0-width-1)
02232 {
02233 *p0++ = ' ';
02234 }
02235 }
02236 *p0 = '\0';
02237 return p+1;
02238 }
02239
02240 template<typename T>
02241 inline char *_format_I_g_D_R_F(T value0, word width, word precision, char *buffer, word bufferLen)
02242 {
02243 char *p0 = buffer+bufferLen-width-1;
02244 register char *p = p0 - 1;
02245
02246 const char *letters = "0123456789";
02247 register T value = value0;
02248 bool negative = value < 0;
02249 if (negative)
02250 {
02251 value = -value;
02252 *p-- = ')';
02253 }
02254 word n = 0;
02255 do
02256 {
02257 *p-- = letters[value % 10];
02258 value /= 10;
02259 ++n;
02260 }
02261 while(value);
02262
02263 while(n < precision)
02264 {
02265 *p-- = '0';
02266 ++n;
02267 }
02268 if (negative)
02269 {
02270 *p-- = '(';
02271 }
02272 while(p > p0-width-1)
02273 {
02274 *p-- = ' ';
02275 }
02276 *p0 = '\0';
02277 return p+1;
02278 }
02279
02280 template<typename T>
02281 inline char *_format_I_G_D_L_F(T value0, word width, word precision, char *buffer, word bufferLen)
02282 {
02283 char *p0 = buffer+bufferLen-width-1;
02284 register char *p = p0 - 1;
02285
02286 const char *letters = "0123456789";
02287 register T value = value0;
02288 bool negative = value < 0;
02289 if (negative)
02290 {
02291 value = -value;
02292 *p-- = ')';
02293 }
02294 word n = 0;
02295 char thousandChar = _getThousandChar();
02296 word level = 0;
02297 do
02298 {
02299 if (level == 3)
02300 {
02301 *p-- = thousandChar;
02302 level = 1;
02303 }
02304 else
02305 ++level;
02306 *p-- = letters[value % 10];
02307 value /= 10;
02308 ++n;
02309 }
02310 while(value);
02311
02312 while(n < precision)
02313 {
02314 if (level == 3)
02315 {
02316 *p-- = thousandChar;
02317 level = 1;
02318 }
02319 else
02320 ++level;
02321 *p-- = '0';
02322 ++n;
02323 }
02324 if (negative)
02325 {
02326 *p-- = '(';
02327 }
02328 while(p > p0-width-1)
02329 {
02330 *p0++ = ' ';
02331 }
02332 *p0 = '\0';
02333 return p+1;
02334 }
02335
02336 template<typename T>
02337 inline char *_format_I_G_D_C_F(T value0, word width, word precision, char *buffer, word bufferLen)
02338 {
02339 char *p0 = buffer+bufferLen-width-1;
02340 register char *p = p0 - 1;
02341
02342 const char *letters = "0123456789";
02343 register T value = value0;
02344 bool negative = value < 0;
02345 if (negative)
02346 {
02347 value = -value;
02348 *p-- = ')';
02349 }
02350 word n = 0;
02351 char thousandChar = _getThousandChar();
02352 word level = 0;
02353 do
02354 {
02355 if (level == 3)
02356 {
02357 *p-- = thousandChar;
02358 level = 1;
02359 }
02360 else
02361 ++level;
02362 *p-- = letters[value % 10];
02363 value /= 10;
02364 ++n;
02365 }
02366 while(value);
02367
02368 while(n < precision)
02369 {
02370 if (level == 3)
02371 {
02372 *p-- = thousandChar;
02373 level = 1;
02374 }
02375 else
02376 ++level;
02377 *p-- = '0';
02378 ++n;
02379 }
02380 if (negative)
02381 {
02382 *p-- = '(';
02383 }
02384 while(p > p0-width-1)
02385 {
02386 *p-- = ' ';
02387 if (p > p0-width-1)
02388 {
02389 *p0++ = ' ';
02390 }
02391 }
02392 *p0 = '\0';
02393 return p+1;
02394 }
02395
02396 template<typename T>
02397 inline char *_format_I_G_D_R_F(T value0, word width, word precision, char *buffer, word bufferLen)
02398 {
02399 char *p0 = buffer+bufferLen-width-1;
02400 register char *p = p0 - 1;
02401
02402 const char *letters = "0123456789";
02403 register T value = value0;
02404 bool negative = value < 0;
02405 if (negative)
02406 {
02407 value = -value;
02408 *p-- = ')';
02409 }
02410 word n = 0;
02411 char thousandChar = _getThousandChar();
02412 word level = 0;
02413 do
02414 {
02415 if (level == 3)
02416 {
02417 *p-- = thousandChar;
02418 level = 1;
02419 }
02420 else
02421 ++level;
02422 *p-- = letters[value % 10];
02423 value /= 10;
02424 ++n;
02425 }
02426 while(value);
02427
02428 while(n < precision)
02429 {
02430 if (level == 3)
02431 {
02432 *p-- = thousandChar;
02433 level = 1;
02434 }
02435 else
02436 ++level;
02437 *p-- = '0';
02438 ++n;
02439 }
02440 if (negative)
02441 {
02442 *p-- = '(';
02443 }
02444 while(p > p0-width-1)
02445 {
02446 *p-- = ' ';
02447 }
02448 *p0 = '\0';
02449 return p+1;
02450 }
02451
02452 template<typename T>
02453 inline char *_format_I_g_D_L_E(T value0, word width, word precision, char *buffer, word bufferLen)
02454 {
02455 char *p0 = buffer+bufferLen-width-1;
02456 register char *p = p0 - 1;
02457
02458 const char *letters = "0123456789";
02459 register T value = value0;
02460 bool negative = value < 0;
02461 if (negative)
02462 {
02463 value = -value;
02464 }
02465 word n = 0;
02466 do
02467 {
02468 *p-- = letters[value % 10];
02469 value /= 10;
02470 ++n;
02471 }
02472 while(value);
02473
02474 while(n < precision)
02475 {
02476 *p-- = '0';
02477 ++n;
02478 }
02479 if (negative)
02480 {
02481 *p-- = '-';
02482 }
02483 else
02484 {
02485 *p-- = '+';
02486 }
02487 while(p > p0-width-1)
02488 {
02489 *p0++ = ' ';
02490 }
02491 *p0 = '\0';
02492 return p+1;
02493 }
02494
02495 template<typename T>
02496 inline char *_format_I_g_D_C_E(T value0, word width, word precision, char *buffer, word bufferLen)
02497 {
02498 char *p0 = buffer+bufferLen-width-1;
02499 register char *p = p0 - 1;
02500
02501 const char *letters = "0123456789";
02502 register T value = value0;
02503 bool negative = value < 0;
02504 if (negative)
02505 {
02506 value = -value;
02507 }
02508 word n = 0;
02509 do
02510 {
02511 *p-- = letters[value % 10];
02512 value /= 10;
02513 ++n;
02514 }
02515 while(value);
02516
02517 while(n < precision)
02518 {
02519 *p-- = '0';
02520 ++n;
02521 }
02522 if (negative)
02523 {
02524 *p-- = '-';
02525 }
02526 else
02527 {
02528 *p-- = '+';
02529 }
02530 while(p > p0-width-1)
02531 {
02532 *p-- = ' ';
02533 if (p > p0-width-1)
02534 {
02535 *p0++ = ' ';
02536 }
02537 }
02538 *p0 = '\0';
02539 return p+1;
02540 }
02541
02542 template<typename T>
02543 inline char *_format_I_g_D_R_E(T value0, word width, word precision, char *buffer, word bufferLen)
02544 {
02545 char *p0 = buffer+bufferLen-width-1;
02546 register char *p = p0 - 1;
02547
02548 const char *letters = "0123456789";
02549 register T value = value0;
02550 bool negative = value < 0;
02551 if (negative)
02552 {
02553 value = -value;
02554 }
02555 word n = 0;
02556 do
02557 {
02558 *p-- = letters[value % 10];
02559 value /= 10;
02560 ++n;
02561 }
02562 while(value);
02563
02564 while(n < precision)
02565 {
02566 *p-- = '0';
02567 ++n;
02568 }
02569 if (negative)
02570 {
02571 *p-- = '-';
02572 }
02573 else
02574 {
02575 *p-- = '+';
02576 }
02577 while(p > p0-width-1)
02578 {
02579 *p-- = ' ';
02580 }
02581 *p0 = '\0';
02582 return p+1;
02583 }
02584
02585 template<typename T>
02586 inline char *_format_I_G_D_L_E(T value0, word width, word precision, char *buffer, word bufferLen)
02587 {
02588 char *p0 = buffer+bufferLen-width-1;
02589 register char *p = p0 - 1;
02590
02591 const char *letters = "0123456789";
02592 register T value = value0;
02593 bool negative = value < 0;
02594 if (negative)
02595 {
02596 value = -value;
02597 }
02598 word n = 0;
02599 char thousandChar = _getThousandChar();
02600 word level = 0;
02601 do
02602 {
02603 if (level == 3)
02604 {
02605 *p-- = thousandChar;
02606 level = 1;
02607 }
02608 else
02609 ++level;
02610 *p-- = letters[value % 10];
02611 value /= 10;
02612 ++n;
02613 }
02614 while(value);
02615
02616 while(n < precision)
02617 {
02618 if (level == 3)
02619 {
02620 *p-- = thousandChar;
02621 level = 1;
02622 }
02623 else
02624 ++level;
02625 *p-- = '0';
02626 ++n;
02627 }
02628 if (negative)
02629 {
02630 *p-- = '-';
02631 }
02632 else
02633 {
02634 *p-- = '+';
02635 }
02636 while(p > p0-width-1)
02637 {
02638 *p0++ = ' ';
02639 }
02640 *p0 = '\0';
02641 return p+1;
02642 }
02643
02644 template<typename T>
02645 inline char *_format_I_G_D_C_E(T value0, word width, word precision, char *buffer, word bufferLen)
02646 {
02647 char *p0 = buffer+bufferLen-width-1;
02648 register char *p = p0 - 1;
02649
02650 const char *letters = "0123456789";
02651 register T value = value0;
02652 bool negative = value < 0;
02653 if (negative)
02654 {
02655 value = -value;
02656 }
02657 word n = 0;
02658 char thousandChar = _getThousandChar();
02659 word level = 0;
02660 do
02661 {
02662 if (level == 3)
02663 {
02664 *p-- = thousandChar;
02665 level = 1;
02666 }
02667 else
02668 ++level;
02669 *p-- = letters[value % 10];
02670 value /= 10;
02671 ++n;
02672 }
02673 while(value);
02674
02675 while(n < precision)
02676 {
02677 if (level == 3)
02678 {
02679 *p-- = thousandChar;
02680 level = 1;
02681 }
02682 else
02683 ++level;
02684 *p-- = '0';
02685 ++n;
02686 }
02687 if (negative)
02688 {
02689 *p-- = '-';
02690 }
02691 else
02692 {
02693 *p-- = '+';
02694 }
02695 while(p > p0-width-1)
02696 {
02697 *p-- = ' ';
02698 if (p > p0-width-1)
02699 {
02700 *p0++ = ' ';
02701 }
02702 }
02703 *p0 = '\0';
02704 return p+1;
02705 }
02706
02707 template<typename T>
02708 inline char *_format_I_G_D_R_E(T value0, word width, word precision, char *buffer, word bufferLen)
02709 {
02710 char *p0 = buffer+bufferLen-width-1;
02711 register char *p = p0 - 1;
02712
02713 const char *letters = "0123456789";
02714 register T value = value0;
02715 bool negative = value < 0;
02716 if (negative)
02717 {
02718 value = -value;
02719 }
02720 word n = 0;
02721 char thousandChar = _getThousandChar();
02722 word level = 0;
02723 do
02724 {
02725 if (level == 3)
02726 {
02727 *p-- = thousandChar;
02728 level = 1;
02729 }
02730 else
02731 ++level;
02732 *p-- = letters[value % 10];
02733 value /= 10;
02734 ++n;
02735 }
02736 while(value);
02737
02738 while(n < precision)
02739 {
02740 if (level == 3)
02741 {
02742 *p-- = thousandChar;
02743 level = 1;
02744 }
02745 else
02746 ++level;
02747 *p-- = '0';
02748 ++n;
02749 }
02750 if (negative)
02751 {
02752 *p-- = '-';
02753 }
02754 else
02755 {
02756 *p-- = '+';
02757 }
02758 while(p > p0-width-1)
02759 {
02760 *p-- = ' ';
02761 }
02762 *p0 = '\0';
02763 return p+1;
02764 }
02765
02766 template<typename T>
02767 inline char *_format_I_g_O_L_p(T value0, word width, word precision, char *buffer, word bufferLen)
02768 {
02769 char *p0 = buffer+bufferLen-width-1;
02770 register char *p = p0 - 1;
02771
02772 const char *letters = "01234567";
02773 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
02774 word n = 0;
02775 do
02776 {
02777 *p-- = letters[value % 8];
02778 value /= 8;
02779 ++n;
02780 }
02781 while(value);
02782
02783 while(n < precision)
02784 {
02785 *p-- = '0';
02786 ++n;
02787 }
02788 while(p > p0-width-1)
02789 {
02790 *p0++ = ' ';
02791 }
02792 *p0 = '\0';
02793 return p+1;
02794 }
02795
02796 template<typename T>
02797 inline char *_format_I_g_O_C_p(T value0, word width, word precision, char *buffer, word bufferLen)
02798 {
02799 char *p0 = buffer+bufferLen-width-1;
02800 register char *p = p0 - 1;
02801
02802 const char *letters = "01234567";
02803 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
02804 word n = 0;
02805 do
02806 {
02807 *p-- = letters[value % 8];
02808 value /= 8;
02809 ++n;
02810 }
02811 while(value);
02812
02813 while(n < precision)
02814 {
02815 *p-- = '0';
02816 ++n;
02817 }
02818 while(p > p0-width-1)
02819 {
02820 *p-- = ' ';
02821 if (p > p0-width-1)
02822 {
02823 *p0++ = ' ';
02824 }
02825 }
02826 *p0 = '\0';
02827 return p+1;
02828 }
02829
02830 template<typename T>
02831 inline char *_format_I_g_O_R_p(T value0, word width, word precision, char *buffer, word bufferLen)
02832 {
02833 char *p0 = buffer+bufferLen-width-1;
02834 register char *p = p0 - 1;
02835
02836 const char *letters = "01234567";
02837 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
02838 word n = 0;
02839 do
02840 {
02841 *p-- = letters[value % 8];
02842 value /= 8;
02843 ++n;
02844 }
02845 while(value);
02846
02847 while(n < precision)
02848 {
02849 *p-- = '0';
02850 ++n;
02851 }
02852 while(p > p0-width-1)
02853 {
02854 *p-- = ' ';
02855 }
02856 *p0 = '\0';
02857 return p+1;
02858 }
02859
02860 template<typename T>
02861 inline char *_format_I_G_O_L_p(T value0, word width, word precision, char *buffer, word bufferLen)
02862 {
02863 char *p0 = buffer+bufferLen-width-1;
02864 register char *p = p0 - 1;
02865
02866 const char *letters = "01234567";
02867 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
02868 word n = 0;
02869 char thousandChar = _getThousandChar();
02870 word level = 0;
02871 do
02872 {
02873 if (level == 4)
02874 {
02875 *p-- = thousandChar;
02876 level = 1;
02877 }
02878 else
02879 ++level;
02880 *p-- = letters[value % 8];
02881 value /= 8;
02882 ++n;
02883 }
02884 while(value);
02885
02886 while(n < precision)
02887 {
02888 if (level == 4)
02889 {
02890 *p-- = thousandChar;
02891 level = 1;
02892 }
02893 else
02894 ++level;
02895 *p-- = '0';
02896 ++n;
02897 }
02898 while(p > p0-width-1)
02899 {
02900 *p0++ = ' ';
02901 }
02902 *p0 = '\0';
02903 return p+1;
02904 }
02905
02906 template<typename T>
02907 inline char *_format_I_G_O_C_p(T value0, word width, word precision, char *buffer, word bufferLen)
02908 {
02909 char *p0 = buffer+bufferLen-width-1;
02910 register char *p = p0 - 1;
02911
02912 const char *letters = "01234567";
02913 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
02914 word n = 0;
02915 char thousandChar = _getThousandChar();
02916 word level = 0;
02917 do
02918 {
02919 if (level == 4)
02920 {
02921 *p-- = thousandChar;
02922 level = 1;
02923 }
02924 else
02925 ++level;
02926 *p-- = letters[value % 8];
02927 value /= 8;
02928 ++n;
02929 }
02930 while(value);
02931
02932 while(n < precision)
02933 {
02934 if (level == 4)
02935 {
02936 *p-- = thousandChar;
02937 level = 1;
02938 }
02939 else
02940 ++level;
02941 *p-- = '0';
02942 ++n;
02943 }
02944 while(p > p0-width-1)
02945 {
02946 *p-- = ' ';
02947 if (p > p0-width-1)
02948 {
02949 *p0++ = ' ';
02950 }
02951 }
02952 *p0 = '\0';
02953 return p+1;
02954 }
02955
02956 template<typename T>
02957 inline char *_format_I_G_O_R_p(T value0, word width, word precision, char *buffer, word bufferLen)
02958 {
02959 char *p0 = buffer+bufferLen-width-1;
02960 register char *p = p0 - 1;
02961
02962 const char *letters = "01234567";
02963 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
02964 word n = 0;
02965 char thousandChar = _getThousandChar();
02966 word level = 0;
02967 do
02968 {
02969 if (level == 4)
02970 {
02971 *p-- = thousandChar;
02972 level = 1;
02973 }
02974 else
02975 ++level;
02976 *p-- = letters[value % 8];
02977 value /= 8;
02978 ++n;
02979 }
02980 while(value);
02981
02982 while(n < precision)
02983 {
02984 if (level == 4)
02985 {
02986 *p-- = thousandChar;
02987 level = 1;
02988 }
02989 else
02990 ++level;
02991 *p-- = '0';
02992 ++n;
02993 }
02994 while(p > p0-width-1)
02995 {
02996 *p-- = ' ';
02997 }
02998 *p0 = '\0';
02999 return p+1;
03000 }
03001
03002 template<typename T>
03003 inline char *_format_I_g_O_L_P(T value0, word width, word precision, char *buffer, word bufferLen)
03004 {
03005 char *p0 = buffer+bufferLen-width-1;
03006 register char *p = p0 - 1;
03007
03008 const char *letters = "01234567";
03009 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03010 word n = 0;
03011 do
03012 {
03013 *p-- = letters[value % 8];
03014 value /= 8;
03015 ++n;
03016 }
03017 while(value);
03018
03019 while(n < precision)
03020 {
03021 *p-- = '0';
03022 ++n;
03023 }
03024 *p-- = '0';
03025 while(p > p0-width-1)
03026 {
03027 *p0++ = ' ';
03028 }
03029 *p0 = '\0';
03030 return p+1;
03031 }
03032
03033 template<typename T>
03034 inline char *_format_I_g_O_C_P(T value0, word width, word precision, char *buffer, word bufferLen)
03035 {
03036 char *p0 = buffer+bufferLen-width-1;
03037 register char *p = p0 - 1;
03038
03039 const char *letters = "01234567";
03040 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03041 word n = 0;
03042 do
03043 {
03044 *p-- = letters[value % 8];
03045 value /= 8;
03046 ++n;
03047 }
03048 while(value);
03049
03050 while(n < precision)
03051 {
03052 *p-- = '0';
03053 ++n;
03054 }
03055 *p-- = '0';
03056 while(p > p0-width-1)
03057 {
03058 *p-- = ' ';
03059 if (p > p0-width-1)
03060 {
03061 *p0++ = ' ';
03062 }
03063 }
03064 *p0 = '\0';
03065 return p+1;
03066 }
03067
03068 template<typename T>
03069 inline char *_format_I_g_O_R_P(T value0, word width, word precision, char *buffer, word bufferLen)
03070 {
03071 char *p0 = buffer+bufferLen-width-1;
03072 register char *p = p0 - 1;
03073
03074 const char *letters = "01234567";
03075 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03076 word n = 0;
03077 do
03078 {
03079 *p-- = letters[value % 8];
03080 value /= 8;
03081 ++n;
03082 }
03083 while(value);
03084
03085 while(n < precision)
03086 {
03087 *p-- = '0';
03088 ++n;
03089 }
03090 *p-- = '0';
03091 while(p > p0-width-1)
03092 {
03093 *p-- = ' ';
03094 }
03095 *p0 = '\0';
03096 return p+1;
03097 }
03098
03099 template<typename T>
03100 inline char *_format_I_G_O_L_P(T value0, word width, word precision, char *buffer, word bufferLen)
03101 {
03102 char *p0 = buffer+bufferLen-width-1;
03103 register char *p = p0 - 1;
03104
03105 const char *letters = "01234567";
03106 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03107 word n = 0;
03108 char thousandChar = _getThousandChar();
03109 word level = 0;
03110 do
03111 {
03112 if (level == 4)
03113 {
03114 *p-- = thousandChar;
03115 level = 1;
03116 }
03117 else
03118 ++level;
03119 *p-- = letters[value % 8];
03120 value /= 8;
03121 ++n;
03122 }
03123 while(value);
03124
03125 while(n < precision)
03126 {
03127 if (level == 4)
03128 {
03129 *p-- = thousandChar;
03130 level = 1;
03131 }
03132 else
03133 ++level;
03134 *p-- = '0';
03135 ++n;
03136 }
03137 *p-- = '0';
03138 while(p > p0-width-1)
03139 {
03140 *p0++ = ' ';
03141 }
03142 *p0 = '\0';
03143 return p+1;
03144 }
03145
03146 template<typename T>
03147 inline char *_format_I_G_O_C_P(T value0, word width, word precision, char *buffer, word bufferLen)
03148 {
03149 char *p0 = buffer+bufferLen-width-1;
03150 register char *p = p0 - 1;
03151
03152 const char *letters = "01234567";
03153 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03154 word n = 0;
03155 char thousandChar = _getThousandChar();
03156 word level = 0;
03157 do
03158 {
03159 if (level == 4)
03160 {
03161 *p-- = thousandChar;
03162 level = 1;
03163 }
03164 else
03165 ++level;
03166 *p-- = letters[value % 8];
03167 value /= 8;
03168 ++n;
03169 }
03170 while(value);
03171
03172 while(n < precision)
03173 {
03174 if (level == 4)
03175 {
03176 *p-- = thousandChar;
03177 level = 1;
03178 }
03179 else
03180 ++level;
03181 *p-- = '0';
03182 ++n;
03183 }
03184 *p-- = '0';
03185 while(p > p0-width-1)
03186 {
03187 *p-- = ' ';
03188 if (p > p0-width-1)
03189 {
03190 *p0++ = ' ';
03191 }
03192 }
03193 *p0 = '\0';
03194 return p+1;
03195 }
03196
03197 template<typename T>
03198 inline char *_format_I_G_O_R_P(T value0, word width, word precision, char *buffer, word bufferLen)
03199 {
03200 char *p0 = buffer+bufferLen-width-1;
03201 register char *p = p0 - 1;
03202
03203 const char *letters = "01234567";
03204 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03205 word n = 0;
03206 char thousandChar = _getThousandChar();
03207 word level = 0;
03208 do
03209 {
03210 if (level == 4)
03211 {
03212 *p-- = thousandChar;
03213 level = 1;
03214 }
03215 else
03216 ++level;
03217 *p-- = letters[value % 8];
03218 value /= 8;
03219 ++n;
03220 }
03221 while(value);
03222
03223 while(n < precision)
03224 {
03225 if (level == 4)
03226 {
03227 *p-- = thousandChar;
03228 level = 1;
03229 }
03230 else
03231 ++level;
03232 *p-- = '0';
03233 ++n;
03234 }
03235 *p-- = '0';
03236 while(p > p0-width-1)
03237 {
03238 *p-- = ' ';
03239 }
03240 *p0 = '\0';
03241 return p+1;
03242 }
03243
03244 template<typename T>
03245 inline char *_format_I_g_x_L_p(T value0, word width, word precision, char *buffer, word bufferLen)
03246 {
03247 char *p0 = buffer+bufferLen-width-1;
03248 register char *p = p0 - 1;
03249
03250 const char *letters = "0123456789abcdef";
03251 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03252 word n = 0;
03253 do
03254 {
03255 *p-- = letters[value % 16];
03256 value /= 16;
03257 ++n;
03258 }
03259 while(value);
03260
03261 while(n < precision)
03262 {
03263 *p-- = '0';
03264 ++n;
03265 }
03266 while(p > p0-width-1)
03267 {
03268 *p0++ = ' ';
03269 }
03270 *p0 = '\0';
03271 return p+1;
03272 }
03273
03274 template<typename T>
03275 inline char *_format_I_g_x_C_p(T value0, word width, word precision, char *buffer, word bufferLen)
03276 {
03277 char *p0 = buffer+bufferLen-width-1;
03278 register char *p = p0 - 1;
03279
03280 const char *letters = "0123456789abcdef";
03281 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03282 word n = 0;
03283 do
03284 {
03285 *p-- = letters[value % 16];
03286 value /= 16;
03287 ++n;
03288 }
03289 while(value);
03290
03291 while(n < precision)
03292 {
03293 *p-- = '0';
03294 ++n;
03295 }
03296 while(p > p0-width-1)
03297 {
03298 *p-- = ' ';
03299 if (p > p0-width-1)
03300 {
03301 *p0++ = ' ';
03302 }
03303 }
03304 *p0 = '\0';
03305 return p+1;
03306 }
03307
03308 template<typename T>
03309 inline char *_format_I_g_x_R_p(T value0, word width, word precision, char *buffer, word bufferLen)
03310 {
03311 char *p0 = buffer+bufferLen-width-1;
03312 register char *p = p0 - 1;
03313
03314 const char *letters = "0123456789abcdef";
03315 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03316 word n = 0;
03317 do
03318 {
03319 *p-- = letters[value % 16];
03320 value /= 16;
03321 ++n;
03322 }
03323 while(value);
03324
03325 while(n < precision)
03326 {
03327 *p-- = '0';
03328 ++n;
03329 }
03330 while(p > p0-width-1)
03331 {
03332 *p-- = ' ';
03333 }
03334 *p0 = '\0';
03335 return p+1;
03336 }
03337
03338 template<typename T>
03339 inline char *_format_I_G_x_L_p(T value0, word width, word precision, char *buffer, word bufferLen)
03340 {
03341 char *p0 = buffer+bufferLen-width-1;
03342 register char *p = p0 - 1;
03343
03344 const char *letters = "0123456789abcdef";
03345 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03346 word n = 0;
03347 char thousandChar = _getThousandChar();
03348 word level = 0;
03349 do
03350 {
03351 if (level == 4)
03352 {
03353 *p-- = thousandChar;
03354 level = 1;
03355 }
03356 else
03357 ++level;
03358 *p-- = letters[value % 16];
03359 value /= 16;
03360 ++n;
03361 }
03362 while(value);
03363
03364 while(n < precision)
03365 {
03366 if (level == 4)
03367 {
03368 *p-- = thousandChar;
03369 level = 1;
03370 }
03371 else
03372 ++level;
03373 *p-- = '0';
03374 ++n;
03375 }
03376 while(p > p0-width-1)
03377 {
03378 *p0++ = ' ';
03379 }
03380 *p0 = '\0';
03381 return p+1;
03382 }
03383
03384 template<typename T>
03385 inline char *_format_I_G_x_C_p(T value0, word width, word precision, char *buffer, word bufferLen)
03386 {
03387 char *p0 = buffer+bufferLen-width-1;
03388 register char *p = p0 - 1;
03389
03390 const char *letters = "0123456789abcdef";
03391 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03392 word n = 0;
03393 char thousandChar = _getThousandChar();
03394 word level = 0;
03395 do
03396 {
03397 if (level == 4)
03398 {
03399 *p-- = thousandChar;
03400 level = 1;
03401 }
03402 else
03403 ++level;
03404 *p-- = letters[value % 16];
03405 value /= 16;
03406 ++n;
03407 }
03408 while(value);
03409
03410 while(n < precision)
03411 {
03412 if (level == 4)
03413 {
03414 *p-- = thousandChar;
03415 level = 1;
03416 }
03417 else
03418 ++level;
03419 *p-- = '0';
03420 ++n;
03421 }
03422 while(p > p0-width-1)
03423 {
03424 *p-- = ' ';
03425 if (p > p0-width-1)
03426 {
03427 *p0++ = ' ';
03428 }
03429 }
03430 *p0 = '\0';
03431 return p+1;
03432 }
03433
03434 template<typename T>
03435 inline char *_format_I_G_x_R_p(T value0, word width, word precision, char *buffer, word bufferLen)
03436 {
03437 char *p0 = buffer+bufferLen-width-1;
03438 register char *p = p0 - 1;
03439
03440 const char *letters = "0123456789abcdef";
03441 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03442 word n = 0;
03443 char thousandChar = _getThousandChar();
03444 word level = 0;
03445 do
03446 {
03447 if (level == 4)
03448 {
03449 *p-- = thousandChar;
03450 level = 1;
03451 }
03452 else
03453 ++level;
03454 *p-- = letters[value % 16];
03455 value /= 16;
03456 ++n;
03457 }
03458 while(value);
03459
03460 while(n < precision)
03461 {
03462 if (level == 4)
03463 {
03464 *p-- = thousandChar;
03465 level = 1;
03466 }
03467 else
03468 ++level;
03469 *p-- = '0';
03470 ++n;
03471 }
03472 while(p > p0-width-1)
03473 {
03474 *p-- = ' ';
03475 }
03476 *p0 = '\0';
03477 return p+1;
03478 }
03479
03480 template<typename T>
03481 inline char *_format_I_g_x_L_P(T value0, word width, word precision, char *buffer, word bufferLen)
03482 {
03483 char *p0 = buffer+bufferLen-width-1;
03484 register char *p = p0 - 1;
03485
03486 const char *letters = "0123456789abcdef";
03487 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03488 word n = 0;
03489 do
03490 {
03491 *p-- = letters[value % 16];
03492 value /= 16;
03493 ++n;
03494 }
03495 while(value);
03496
03497 while(n < precision)
03498 {
03499 *p-- = '0';
03500 ++n;
03501 }
03502 *p-- = 'x';
03503 *p-- = '0';
03504 while(p > p0-width-1)
03505 {
03506 *p0++ = ' ';
03507 }
03508 *p0 = '\0';
03509 return p+1;
03510 }
03511
03512 template<typename T>
03513 inline char *_format_I_g_x_C_P(T value0, word width, word precision, char *buffer, word bufferLen)
03514 {
03515 char *p0 = buffer+bufferLen-width-1;
03516 register char *p = p0 - 1;
03517
03518 const char *letters = "0123456789abcdef";
03519 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03520 word n = 0;
03521 do
03522 {
03523 *p-- = letters[value % 16];
03524 value /= 16;
03525 ++n;
03526 }
03527 while(value);
03528
03529 while(n < precision)
03530 {
03531 *p-- = '0';
03532 ++n;
03533 }
03534 *p-- = 'x';
03535 *p-- = '0';
03536 while(p > p0-width-1)
03537 {
03538 *p-- = ' ';
03539 if (p > p0-width-1)
03540 {
03541 *p0++ = ' ';
03542 }
03543 }
03544 *p0 = '\0';
03545 return p+1;
03546 }
03547
03548 template<typename T>
03549 inline char *_format_I_g_x_R_P(T value0, word width, word precision, char *buffer, word bufferLen)
03550 {
03551 char *p0 = buffer+bufferLen-width-1;
03552 register char *p = p0 - 1;
03553
03554 const char *letters = "0123456789abcdef";
03555 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03556 word n = 0;
03557 do
03558 {
03559 *p-- = letters[value % 16];
03560 value /= 16;
03561 ++n;
03562 }
03563 while(value);
03564
03565 while(n < precision)
03566 {
03567 *p-- = '0';
03568 ++n;
03569 }
03570 *p-- = 'x';
03571 *p-- = '0';
03572 while(p > p0-width-1)
03573 {
03574 *p-- = ' ';
03575 }
03576 *p0 = '\0';
03577 return p+1;
03578 }
03579
03580 template<typename T>
03581 inline char *_format_I_G_x_L_P(T value0, word width, word precision, char *buffer, word bufferLen)
03582 {
03583 char *p0 = buffer+bufferLen-width-1;
03584 register char *p = p0 - 1;
03585
03586 const char *letters = "0123456789abcdef";
03587 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03588 word n = 0;
03589 char thousandChar = _getThousandChar();
03590 word level = 0;
03591 do
03592 {
03593 if (level == 4)
03594 {
03595 *p-- = thousandChar;
03596 level = 1;
03597 }
03598 else
03599 ++level;
03600 *p-- = letters[value % 16];
03601 value /= 16;
03602 ++n;
03603 }
03604 while(value);
03605
03606 while(n < precision)
03607 {
03608 if (level == 4)
03609 {
03610 *p-- = thousandChar;
03611 level = 1;
03612 }
03613 else
03614 ++level;
03615 *p-- = '0';
03616 ++n;
03617 }
03618 *p-- = 'x';
03619 *p-- = '0';
03620 while(p > p0-width-1)
03621 {
03622 *p0++ = ' ';
03623 }
03624 *p0 = '\0';
03625 return p+1;
03626 }
03627
03628 template<typename T>
03629 inline char *_format_I_G_x_C_P(T value0, word width, word precision, char *buffer, word bufferLen)
03630 {
03631 char *p0 = buffer+bufferLen-width-1;
03632 register char *p = p0 - 1;
03633
03634 const char *letters = "0123456789abcdef";
03635 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03636 word n = 0;
03637 char thousandChar = _getThousandChar();
03638 word level = 0;
03639 do
03640 {
03641 if (level == 4)
03642 {
03643 *p-- = thousandChar;
03644 level = 1;
03645 }
03646 else
03647 ++level;
03648 *p-- = letters[value % 16];
03649 value /= 16;
03650 ++n;
03651 }
03652 while(value);
03653
03654 while(n < precision)
03655 {
03656 if (level == 4)
03657 {
03658 *p-- = thousandChar;
03659 level = 1;
03660 }
03661 else
03662 ++level;
03663 *p-- = '0';
03664 ++n;
03665 }
03666 *p-- = 'x';
03667 *p-- = '0';
03668 while(p > p0-width-1)
03669 {
03670 *p-- = ' ';
03671 if (p > p0-width-1)
03672 {
03673 *p0++ = ' ';
03674 }
03675 }
03676 *p0 = '\0';
03677 return p+1;
03678 }
03679
03680 template<typename T>
03681 inline char *_format_I_G_x_R_P(T value0, word width, word precision, char *buffer, word bufferLen)
03682 {
03683 char *p0 = buffer+bufferLen-width-1;
03684 register char *p = p0 - 1;
03685
03686 const char *letters = "0123456789abcdef";
03687 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03688 word n = 0;
03689 char thousandChar = _getThousandChar();
03690 word level = 0;
03691 do
03692 {
03693 if (level == 4)
03694 {
03695 *p-- = thousandChar;
03696 level = 1;
03697 }
03698 else
03699 ++level;
03700 *p-- = letters[value % 16];
03701 value /= 16;
03702 ++n;
03703 }
03704 while(value);
03705
03706 while(n < precision)
03707 {
03708 if (level == 4)
03709 {
03710 *p-- = thousandChar;
03711 level = 1;
03712 }
03713 else
03714 ++level;
03715 *p-- = '0';
03716 ++n;
03717 }
03718 *p-- = 'x';
03719 *p-- = '0';
03720 while(p > p0-width-1)
03721 {
03722 *p-- = ' ';
03723 }
03724 *p0 = '\0';
03725 return p+1;
03726 }
03727
03728 template<typename T>
03729 inline char *_format_I_g_X_L_p(T value0, word width, word precision, char *buffer, word bufferLen)
03730 {
03731 char *p0 = buffer+bufferLen-width-1;
03732 register char *p = p0 - 1;
03733
03734 const char *letters = "0123456789ABCDEF";
03735 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03736 word n = 0;
03737 do
03738 {
03739 *p-- = letters[value % 16];
03740 value /= 16;
03741 ++n;
03742 }
03743 while(value);
03744
03745 while(n < precision)
03746 {
03747 *p-- = '0';
03748 ++n;
03749 }
03750 while(p > p0-width-1)
03751 {
03752 *p0++ = ' ';
03753 }
03754 *p0 = '\0';
03755 return p+1;
03756 }
03757
03758 template<typename T>
03759 inline char *_format_I_g_X_C_p(T value0, word width, word precision, char *buffer, word bufferLen)
03760 {
03761 char *p0 = buffer+bufferLen-width-1;
03762 register char *p = p0 - 1;
03763
03764 const char *letters = "0123456789ABCDEF";
03765 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03766 word n = 0;
03767 do
03768 {
03769 *p-- = letters[value % 16];
03770 value /= 16;
03771 ++n;
03772 }
03773 while(value);
03774
03775 while(n < precision)
03776 {
03777 *p-- = '0';
03778 ++n;
03779 }
03780 while(p > p0-width-1)
03781 {
03782 *p-- = ' ';
03783 if (p > p0-width-1)
03784 {
03785 *p0++ = ' ';
03786 }
03787 }
03788 *p0 = '\0';
03789 return p+1;
03790 }
03791
03792 template<typename T>
03793 inline char *_format_I_g_X_R_p(T value0, word width, word precision, char *buffer, word bufferLen)
03794 {
03795 char *p0 = buffer+bufferLen-width-1;
03796 register char *p = p0 - 1;
03797
03798 const char *letters = "0123456789ABCDEF";
03799 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03800 word n = 0;
03801 do
03802 {
03803 *p-- = letters[value % 16];
03804 value /= 16;
03805 ++n;
03806 }
03807 while(value);
03808
03809 while(n < precision)
03810 {
03811 *p-- = '0';
03812 ++n;
03813 }
03814 while(p > p0-width-1)
03815 {
03816 *p-- = ' ';
03817 }
03818 *p0 = '\0';
03819 return p+1;
03820 }
03821
03822 template<typename T>
03823 inline char *_format_I_G_X_L_p(T value0, word width, word precision, char *buffer, word bufferLen)
03824 {
03825 char *p0 = buffer+bufferLen-width-1;
03826 register char *p = p0 - 1;
03827
03828 const char *letters = "0123456789ABCDEF";
03829 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03830 word n = 0;
03831 char thousandChar = _getThousandChar();
03832 word level = 0;
03833 do
03834 {
03835 if (level == 4)
03836 {
03837 *p-- = thousandChar;
03838 level = 1;
03839 }
03840 else
03841 ++level;
03842 *p-- = letters[value % 16];
03843 value /= 16;
03844 ++n;
03845 }
03846 while(value);
03847
03848 while(n < precision)
03849 {
03850 if (level == 4)
03851 {
03852 *p-- = thousandChar;
03853 level = 1;
03854 }
03855 else
03856 ++level;
03857 *p-- = '0';
03858 ++n;
03859 }
03860 while(p > p0-width-1)
03861 {
03862 *p0++ = ' ';
03863 }
03864 *p0 = '\0';
03865 return p+1;
03866 }
03867
03868 template<typename T>
03869 inline char *_format_I_G_X_C_p(T value0, word width, word precision, char *buffer, word bufferLen)
03870 {
03871 char *p0 = buffer+bufferLen-width-1;
03872 register char *p = p0 - 1;
03873
03874 const char *letters = "0123456789ABCDEF";
03875 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03876 word n = 0;
03877 char thousandChar = _getThousandChar();
03878 word level = 0;
03879 do
03880 {
03881 if (level == 4)
03882 {
03883 *p-- = thousandChar;
03884 level = 1;
03885 }
03886 else
03887 ++level;
03888 *p-- = letters[value % 16];
03889 value /= 16;
03890 ++n;
03891 }
03892 while(value);
03893
03894 while(n < precision)
03895 {
03896 if (level == 4)
03897 {
03898 *p-- = thousandChar;
03899 level = 1;
03900 }
03901 else
03902 ++level;
03903 *p-- = '0';
03904 ++n;
03905 }
03906 while(p > p0-width-1)
03907 {
03908 *p-- = ' ';
03909 if (p > p0-width-1)
03910 {
03911 *p0++ = ' ';
03912 }
03913 }
03914 *p0 = '\0';
03915 return p+1;
03916 }
03917
03918 template<typename T>
03919 inline char *_format_I_G_X_R_p(T value0, word width, word precision, char *buffer, word bufferLen)
03920 {
03921 char *p0 = buffer+bufferLen-width-1;
03922 register char *p = p0 - 1;
03923
03924 const char *letters = "0123456789ABCDEF";
03925 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03926 word n = 0;
03927 char thousandChar = _getThousandChar();
03928 word level = 0;
03929 do
03930 {
03931 if (level == 4)
03932 {
03933 *p-- = thousandChar;
03934 level = 1;
03935 }
03936 else
03937 ++level;
03938 *p-- = letters[value % 16];
03939 value /= 16;
03940 ++n;
03941 }
03942 while(value);
03943
03944 while(n < precision)
03945 {
03946 if (level == 4)
03947 {
03948 *p-- = thousandChar;
03949 level = 1;
03950 }
03951 else
03952 ++level;
03953 *p-- = '0';
03954 ++n;
03955 }
03956 while(p > p0-width-1)
03957 {
03958 *p-- = ' ';
03959 }
03960 *p0 = '\0';
03961 return p+1;
03962 }
03963
03964 template<typename T>
03965 inline char *_format_I_g_X_L_P(T value0, word width, word precision, char *buffer, word bufferLen)
03966 {
03967 char *p0 = buffer+bufferLen-width-1;
03968 register char *p = p0 - 1;
03969
03970 const char *letters = "0123456789ABCDEF";
03971 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
03972 word n = 0;
03973 do
03974 {
03975 *p-- = letters[value % 16];
03976 value /= 16;
03977 ++n;
03978 }
03979 while(value);
03980
03981 while(n < precision)
03982 {
03983 *p-- = '0';
03984 ++n;
03985 }
03986 *p-- = 'X';
03987 *p-- = '0';
03988 while(p > p0-width-1)
03989 {
03990 *p0++ = ' ';
03991 }
03992 *p0 = '\0';
03993 return p+1;
03994 }
03995
03996 template<typename T>
03997 inline char *_format_I_g_X_C_P(T value0, word width, word precision, char *buffer, word bufferLen)
03998 {
03999 char *p0 = buffer+bufferLen-width-1;
04000 register char *p = p0 - 1;
04001
04002 const char *letters = "0123456789ABCDEF";
04003 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
04004 word n = 0;
04005 do
04006 {
04007 *p-- = letters[value % 16];
04008 value /= 16;
04009 ++n;
04010 }
04011 while(value);
04012
04013 while(n < precision)
04014 {
04015 *p-- = '0';
04016 ++n;
04017 }
04018 *p-- = 'X';
04019 *p-- = '0';
04020 while(p > p0-width-1)
04021 {
04022 *p-- = ' ';
04023 if (p > p0-width-1)
04024 {
04025 *p0++ = ' ';
04026 }
04027 }
04028 *p0 = '\0';
04029 return p+1;
04030 }
04031
04032 template<typename T>
04033 inline char *_format_I_g_X_R_P(T value0, word width, word precision, char *buffer, word bufferLen)
04034 {
04035 char *p0 = buffer+bufferLen-width-1;
04036 register char *p = p0 - 1;
04037
04038 const char *letters = "0123456789ABCDEF";
04039 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
04040 word n = 0;
04041 do
04042 {
04043 *p-- = letters[value % 16];
04044 value /= 16;
04045 ++n;
04046 }
04047 while(value);
04048
04049 while(n < precision)
04050 {
04051 *p-- = '0';
04052 ++n;
04053 }
04054 *p-- = 'X';
04055 *p-- = '0';
04056 while(p > p0-width-1)
04057 {
04058 *p-- = ' ';
04059 }
04060 *p0 = '\0';
04061 return p+1;
04062 }
04063
04064 template<typename T>
04065 inline char *_format_I_G_X_L_P(T value0, word width, word precision, char *buffer, word bufferLen)
04066 {
04067 char *p0 = buffer+bufferLen-width-1;
04068 register char *p = p0 - 1;
04069
04070 const char *letters = "0123456789ABCDEF";
04071 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
04072 word n = 0;
04073 char thousandChar = _getThousandChar();
04074 word level = 0;
04075 do
04076 {
04077 if (level == 4)
04078 {
04079 *p-- = thousandChar;
04080 level = 1;
04081 }
04082 else
04083 ++level;
04084 *p-- = letters[value % 16];
04085 value /= 16;
04086 ++n;
04087 }
04088 while(value);
04089
04090 while(n < precision)
04091 {
04092 if (level == 4)
04093 {
04094 *p-- = thousandChar;
04095 level = 1;
04096 }
04097 else
04098 ++level;
04099 *p-- = '0';
04100 ++n;
04101 }
04102 *p-- = 'X';
04103 *p-- = '0';
04104 while(p > p0-width-1)
04105 {
04106 *p0++ = ' ';
04107 }
04108 *p0 = '\0';
04109 return p+1;
04110 }
04111
04112 template<typename T>
04113 inline char *_format_I_G_X_C_P(T value0, word width, word precision, char *buffer, word bufferLen)
04114 {
04115 char *p0 = buffer+bufferLen-width-1;
04116 register char *p = p0 - 1;
04117
04118 const char *letters = "0123456789ABCDEF";
04119 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
04120 word n = 0;
04121 char thousandChar = _getThousandChar();
04122 word level = 0;
04123 do
04124 {
04125 if (level == 4)
04126 {
04127 *p-- = thousandChar;
04128 level = 1;
04129 }
04130 else
04131 ++level;
04132 *p-- = letters[value % 16];
04133 value /= 16;
04134 ++n;
04135 }
04136 while(value);
04137
04138 while(n < precision)
04139 {
04140 if (level == 4)
04141 {
04142 *p-- = thousandChar;
04143 level = 1;
04144 }
04145 else
04146 ++level;
04147 *p-- = '0';
04148 ++n;
04149 }
04150 *p-- = 'X';
04151 *p-- = '0';
04152 while(p > p0-width-1)
04153 {
04154 *p-- = ' ';
04155 if (p > p0-width-1)
04156 {
04157 *p0++ = ' ';
04158 }
04159 }
04160 *p0 = '\0';
04161 return p+1;
04162 }
04163
04164 template<typename T>
04165 inline char *_format_I_G_X_R_P(T value0, word width, word precision, char *buffer, word bufferLen)
04166 {
04167 char *p0 = buffer+bufferLen-width-1;
04168 register char *p = p0 - 1;
04169
04170 const char *letters = "0123456789ABCDEF";
04171 typename formatterTraits<T>::Type value = static_cast<typename formatterTraits<T>::Type>(value0);
04172 word n = 0;
04173 char thousandChar = _getThousandChar();
04174 word level = 0;
04175 do
04176 {
04177 if (level == 4)
04178 {
04179 *p-- = thousandChar;
04180 level = 1;
04181 }
04182 else
04183 ++level;
04184 *p-- = letters[value % 16];
04185 value /= 16;
04186 ++n;
04187 }
04188 while(value);
04189
04190 while(n < precision)
04191 {
04192 if (level == 4)
04193 {
04194 *p-- = thousandChar;
04195 level = 1;
04196 }
04197 else
04198 ++level;
04199 *p-- = '0';
04200 ++n;
04201 }
04202 *p-- = 'X';
04203 *p-- = '0';
04204 while(p > p0-width-1)
04205 {
04206 *p-- = ' ';
04207 }
04208 *p0 = '\0';
04209 return p+1;
04210 }
04211
04212 }
04213
04214 #endif // _SWORD_BASE_LEXICALFORMATTER_PRIMITIVES_