From 20248b5300d4af06f63b60029f5e8e2784b7e4c9 Mon Sep 17 00:00:00 2001 From: cxl Date: Wed, 5 Nov 2008 21:36:41 +0000 Subject: [PATCH] A++: fixed problems with typecast operator, navigator scope double-click goes to the first item git-svn-id: svn://ultimatepp.org/upp/trunk@609 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/Format.cpp | 8 +- uppsrc/Core/Format.h | 1 - uppsrc/Core/src.tpp/Format$en-us.tpp | 276 ++---------------------- uppsrc/Core/src.tpp/Format$en-us.tppi | 19 ++ uppsrc/Core/src.tpp/FormatFn$en-us.tpp | 195 +++++++++++++++++ uppsrc/Core/src.tpp/FormatFn$en-us.tppi | 13 ++ uppsrc/Core/src.tpp/String1$en-us.tppi | 4 + uppsrc/Core/src.tpp/all.i | 12 ++ uppsrc/CppBase/CppBase.h | 7 +- uppsrc/CppBase/Parser.cpp | 44 ++-- uppsrc/CppBase/Qualify.cpp | 10 +- uppsrc/CtrlCore/Win32Clip.cpp | 2 + uppsrc/ide/Annotations.cpp | 11 +- uppsrc/ide/Assist.cpp | 1 + uppsrc/ide/Browser/Base.cpp | 2 +- uppsrc/ide/Browser/CodeBrowser.cpp | 2 + uppsrc/ide/Browser/CodeRef.cpp | 2 +- uppsrc/ide/Browser/Topic.cpp | 1 + uppsrc/ide/Browser/TopicBase.cpp | 2 +- uppsrc/ide/Browser/Util.cpp | 2 +- uppsrc/ide/Navigator.cpp | 8 +- uppsrc/ide/ide.h | 1 + 22 files changed, 333 insertions(+), 290 deletions(-) create mode 100644 uppsrc/Core/src.tpp/Format$en-us.tppi create mode 100644 uppsrc/Core/src.tpp/FormatFn$en-us.tpp create mode 100644 uppsrc/Core/src.tpp/FormatFn$en-us.tppi create mode 100644 uppsrc/Core/src.tpp/String1$en-us.tppi create mode 100644 uppsrc/Core/src.tpp/all.i diff --git a/uppsrc/Core/Format.cpp b/uppsrc/Core/Format.cpp index c7cbd675d..fdf17988c 100644 --- a/uppsrc/Core/Format.cpp +++ b/uppsrc/Core/Format.cpp @@ -897,7 +897,6 @@ String NFormat0(int language, const char *s, const Value **v, int count) } f.format.Clear(); f.id.Clear(); - f.maxn = 0; b = s; int pad = -1; int padn; @@ -970,11 +969,8 @@ String NFormat0(int language, const char *s, const Value **v, int count) ASSERT(*s); if(IsDigit(*s)) n = 10 * n + *s - '0'; - else { - if(n > f.maxn) - f.maxn = n; + else n = 0; - } s++; } } @@ -993,8 +989,6 @@ String NFormat0(int language, const char *s, const Value **v, int count) } #endif f.arg = *v[pos++]; - if(n > f.maxn) - f.maxn = n; String r; if(!nvl_value.IsVoid() && IsNull(f.arg)) r = nvl_value; diff --git a/uppsrc/Core/Format.h b/uppsrc/Core/Format.h index e574e59a4..581af444a 100644 --- a/uppsrc/Core/Format.h +++ b/uppsrc/Core/Format.h @@ -64,7 +64,6 @@ Time ScanTime(const char *text, const char **endptr, const char *format, struct Formatting { int language; - int maxn; Value arg; String format; String id; diff --git a/uppsrc/Core/src.tpp/Format$en-us.tpp b/uppsrc/Core/src.tpp/Format$en-us.tpp index 1285357d5..a47d7bfe2 100644 --- a/uppsrc/Core/src.tpp/Format$en-us.tpp +++ b/uppsrc/Core/src.tpp/Format$en-us.tpp @@ -10,7 +10,7 @@ topic "Text formatting"; [i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam] [b42;2 $$9,9#13035079074754324216151401829390:normal] [{_}%EN-US -[s0; [*+117 Format `- text formatting]&] +[s0; [*4 Format `- text formatting]&] [s0;*+117 &] [s5;:`:`:Format`(const char`*`,const`:`:Vector`<`:`:Value`>`&`):%- [^`:`:String^ String ]_[* Format][@(64) (][@(0.0.255) const][@(64) _][@(0.0.255) char][@(64) _`*][*@3 format][@(64) , @@ -345,247 +345,12 @@ width&] ][^Formatting^@(64) Formatting][@(64) `&_fmt)]&] [s2; Formatter has to have form of function with single [^Formatting^ Formatting] argument.&] -[s0; &] +[s3; &] [ {{10000F(128)G(128)@1 [s0; [* Formatting]]}}&] -[s0;%- &] +[s4;%- &] [s1;:Formatting`:`:struct:%- [@(0.0.255) struct]_[* Formatting]&] [s2; This structure passes all informations to format Value argument to the formatter.&] -[s3;%- &] -[s4;%- &] -[s5;:FormatInt`(int`):%- [_^String^ String]_[* FormatInt]([@(0.0.255) int]_[*@3 i])&] -[s2; Outputs decimally formatted signed integer without `+ or any -paddings. Supposed to be quite fast. Equivalent to FormatIntBase(i, -10).&] -[s2; &] -[s0;l288;O9;~~~.640; [* i]-|the number to format.&] -[s3; [* v]&] -[s4;%- &] -[s5;:FormatIntDec`(int`,int`,char`,bool`):%- [_^String^ String]_[* FormatIntDec]([@(0.0.255) i -nt]_[*@3 i], [@(0.0.255) int]_[*@3 width], [@(0.0.255) char]_[*@3 lpad]_`=_`'_`', -[@(0.0.255) bool]_[*@3 always`_sign]_`=_[@(0.0.255) false])&] -[s0;l288; Formats a signed decimal integer (i) with left padding -up to given (width) characters with a given (lpad) character.&] -[s0;l288; &] -[s0;l288;O9;~~~.1152; [* i]-|the number to format.&] -[s0;l288;O9;~~~.1152; [* width]-|left padding width (output longer than -this is not padded)&] -[s0;l288;O9;~~~.1152; [* lpad]-|character to left pad output with&] -[s2;~~~.1152; [* always`_sign]-|true `= start positive numbers with -`[`+`], false `= just negative with `[`-`]&] -[s3; &] -[s4;%- &] -[s5;:FormatIntHex`(int`,int`,char`):%- [_^String^ String]_[* FormatIntHex]([@(0.0.255) int]_ -[*@3 i], [@(0.0.255) int]_[*@3 width]_`=_[@3 8], [@(0.0.255) char]_[*@3 lpad]_`=_`'[@3 0]`')&] -[s0;l288; Formats an unsigned hexadecimal (radix 16) integer (i) -with left padding up to given (width) characters with a given -(lpad) character.&] -[s0;l288; &] -[s0;l288;O9;~~~.1152; [* i]-|the number to format.&] -[s0;l288;O9;~~~.1152; [* width]-|left padding width (output longer than -this is not padded)&] -[s2;~~~.1152; [* lpad]-|character to left pad output with&] -[s4;%- &] -[s5;:FormatIntOct`(int`,int`,char`):%- [_^String^ String]_[* FormatIntOct]([@(0.0.255) int]_ -[*@3 i], [@(0.0.255) int]_[*@3 width]_`=_[@3 12], [@(0.0.255) char]_[*@3 lpad]_`=_`'[@3 0]`')&] -[s0;l288; Formats an unsigned octal (radix 8) integer (i) with left -padding up to given (width) characters with a given (lpad) character -(usually a space or 0).&] -[s0;l288; &] -[s0;l288;O9;~~~.1152; [* i]-|the number to format.&] -[s0;l288;O9;~~~.1152; [* width]-|left padding width (output longer than -this is not padded)&] -[s0;l288;O9;~~~.1152; [* lpad]-|character to left pad output with&] -[s3; &] -[s4;%- &] -[s5;:FormatIntRoman`(int`,bool`):%- [_^String^ String]_[* FormatIntRoman]([@(0.0.255) int]_ -[*@3 i], [@(0.0.255) bool]_[*@3 upper]_`=_[@(0.0.255) false])&] -[s0;l288; Formats a signed integer in Roman numerals. The biggest -`"implemented`" numeral is M (1000), so expect quite a long return -string when formatting a billion. Negative numbers are prepended -with `[`-`], 0 or Null is output as a Null String.&] -[s0;l288; &] -[s0;l288;O9;~~~.1152; [* i]-|the number to format.&] -[s0;l288;O9;~~~.1152; [* upper]-|use uppercase `[true`] or lowercase -`[false`] letters&] -[s0;l288;O9;~~~.1152;* &] -[s3; &] -[s4;%- &] -[s5;:FormatIntAlpha`(int`,bool`):%- [_^String^ String]_[* FormatIntAlpha]([@(0.0.255) int]_ -[*@3 i], [@(0.0.255) bool]_[*@3 upper]_`=_[@(0.0.255) true])&] -[s0;l288; Formats a signed integer in length`-first lexicographic -index, i.e. excel column numbering (1 `= A,2 `= B.. 26 `= Z, -27 `= AA, 28 `= AB .. 52 `= AZ, 53 `= BA ... 78 `= BZ etc). 0 -or Null is output as a Null String. Only negative numbers are -prepended with a `[`-`].&] -[s0;l288; &] -[s0;l288;O9;~~~.1152; [* i]-|the number to format.&] -[s0;l288;O9;~~~.1152; [* upper]-|use uppercase `[true`] or lowercase -`[false`] letters&] -[s0;l288;O9;~~~.1152;* &] -[s3; &] -[s4;%- &] -[s5;:Format64`(uint64`):%- [_^String^ String]_[* Format64]([_^uint64^ uint64]_[*@3 a])&] -[s2; Formats an unsigned decimal 64`-bit integer. Supposed to be -quite fast.&] -[s2; &] -[s0;l288;O9;~~~.1152; [* a]-|the number to format.&] -[s3; &] -[s4;%- &] -[s5;:Format64Hex`(uint64`):%- [_^String^ String]_[* Format64Hex]([_^uint64^ uint64]_[*@3 a])&] -[s2; Formats an unsigned hexadecimal (radix 16) 64`-bit integer. -Supposed to be quite fast. Lowecase letters a`-f are used for -digits `[10`] through `[15`].&] -[s2; &] -[s0;l288;O9;~~~.1152; [* a]-|the number to format.&] -[s3; &] -[s4;%- &] -[s5;:FormatIntHex`(const void`*`):%- [_^String^ String]_[* FormatIntHex]([@(0.0.255) const]_ -[@(0.0.255) void]_`*[*@3 ptr])&] -[s2; Formats the pointer address as a hexadecimal (base 16) number -zero`-padded to the number of digits appropriate for the memory -model (8 digits in 32`-bit systems, 16 digits in 64`-bit systems). -Useful for logging and debugging purposes. Equivalent to FormatHex, -god knows why there are two of them.&] -[s2; &] -[s0;l288;O9;~~~.1152; [* ptr]-|the number to format.&] -[s3; &] -[s4;%- &] -[s5;:FormatHex`(const void`*`):%- [_^String^ String]_[* FormatHex]([@(0.0.255) const]_[@(0.0.255) v -oid]_`*[*@3 ptr])&] -[s2; Formats the pointer address as a hexadecimal (base 16) number -zero`-padded to the number of digits appropriate for the memory -model (8 digits in 32`-bit systems, 16 digits in 64`-bit systems). -Useful for logging and debugging purposes. Equivalent to FormatIntHex.&] -[s2; &] -[s0;l288;O9;~~~.1152; [* ptr]-|the number to format.&] -[s3; &] -[s4;%- &] -[s5;:FormatInteger`(int`):%- [_^String^ String]_[* FormatInteger]([@(0.0.255) int]_[*@3 a])&] -[s2; Formats a signed decimal integer without padding. In comparison -to FormatInt it returns String(Null) when given int(Null) whereas -FormatInt returns a plain empty string, hah.&] -[s2; &] -[s0;l288;O9;~~~.1152; [* ptr]-|the number to format.&] -[s3; &] -[s4;%- &] -[s5;:FormatUnsigned`(unsigned long`):%- [_^String^ String]_[* FormatUnsigned]([@(0.0.255) u -nsigned]_[@(0.0.255) long]_[*@3 a])&] -[s2; A very old freak, implemented through Sprintf(`"%u`", a). Definitely -deprecated, I hope.&] -[s2; &] -[s0;l288;O9;~~~.1152; [* a]-|the number to format.&] -[s3; &] -[s4;%- &] -[s5;:FormatDouble`(double`):%- [_^String^ String]_[* FormatDouble]([@(0.0.255) double]_[*@3 a -])&] -[s2; Formats a floating point in decimal notation automatically selecting -ordinary or scientific (exponential) notation according to the -absolute value of a. In ordinary notation, the number is formatted -to 10 significant digits; in exponential notation, the mantissa -is formatted to 10 decimal digits.&] -[s2; &] -[s0;l288;O9;~~~.1152; [* a]-|the number to format.&] -[s3; &] -[s4;%- &] -[s5;:FormatBool`(bool`):%- [_^String^ String]_[* FormatBool]([@(0.0.255) bool]_[*@3 a])&] -[s2; Formats a boolean as one of the fixed words `"true`" or `"false`" -(regardless of language settings).&] -[s0; &] -[s0;l288;O9;~~~.1152; [* a]-|the logical value to format.&] -[s3; &] -[s4;%- &] -[s5;:FormatInt64`(int64`):%- [_^String^ String]_[* FormatInt64]([_^int64^ int64]_[*@3 a])&] -[s2; Formats a signed decimal 64`-bit integer without any padding. -Only negative numbers are prepended with a `[`-`].&] -[s0; &] -[s0;l288;O9;~~~.1152; [* a]-|the number to format&] -[s3; &] -[s4;%- &] -[s5;:FormatDouble`(double`,int`,int`,int`):%- [_^String^ String]_[* FormatDouble]([@(0.0.255) d -ouble]_[*@3 d], [@(0.0.255) int]_[*@3 digits], [@(0.0.255) int]_[*@3 flags]_`=_[@3 0], -[@(0.0.255) int]_[*@3 fill`_exp]_`=_[@3 0])&] -[s2; Formats a floating point in decimal notation automatically selecting -ordinary or scientific (exponential) notation according to the -absolute value of a and the given number of digits. In the (default) -absolute decimal mode, a number is formatted in exponential notation -whenever its absolute value exceeds the interval `[1e`-15, 1e`+15`]; -in relative (significant) decimal mode (FD`_REL), a number is -formatted in exponential notation whenever its absolute value -exceeds the interval `[10`^`-<2 `* digits>, 10`^`+<2 `* digits>`].&] -[s2; &] -[s0;l288;O9;~~~.1152; [* d]-|the number to format&] -[s0;l288;O9;~~~.1152; [* digits]-|number of digits&] -[s0;l288;O9;~~~.1152; [* flags]-|formatting flags, can be or`-ed (`|) -together:&] -[s0;l704;O9;~~~.1472; [/@(90) FD`_SIGN-|always prepend sign (`+10)]&] -[s0;l704;O9;~~~.1472; [/@(90) FD`_REL-|relative decimal places (valid -digits)]&] -[s0;l704;O9;~~~.1472; [/@(90) FD`_SIGN`_EXP-|always prepend sign to -exponent (1e`+2)]&] -[s0;l704;O9;~~~.1472; [/@(90) FD`_CAP`_E-|capital E for exponent (1E10)]&] -[s0;l704;O9;~~~.1472; [/@(90) FD`_ZERO-|keep trailing zeros (1.25000)]&] -[s0;l704;O9;~~~.1472; [/@(90) FD`_FIX-|always use fixed notation (FormatDouble -only)]&] -[s0;l704;O9;~~~.1472; [/@(90) FD`_EXP-|always use exponential notation -(FormatDouble only)]&] -[s0;l288;O9;~~~.1152; [* fill`_exp]-|left zero`-padding of exponent -in exponential notation&] -[s3; &] -[s4;%- &] -[s5;:FormatDoubleFix`(double`,int`,int`):%- [_^String^ String]_[* FormatDoubleFix]([@(0.0.255) d -ouble]_[*@3 d], [@(0.0.255) int]_[*@3 digits], [@(0.0.255) int]_[*@3 flags]_`=_[@3 0])&] -[s2; Formats a floating point in ordinary decimal notation (whole -part, comma, decimal part). Then number of digits (digits) can -be interpreted either as the absolute number of decimal digits -(the default mode) or the relative number of significant digits -excluding leading zeros. Decimal point is always output as a -period independent on language settings.&] -[s0; &] -[s0;l288;O9;~~~.1152; [* d]-|the number to format&] -[s0;l288;O9;~~~.1152; [* digits]-|number of digits&] -[s0;l288;O9;~~~.1152; [* flags]-|formatting flags, can be or`-ed (`|) -together:&] -[s0;l704;O9;~~~.1472; [/@(90) FD`_SIGN-|always prepend sign (`+10)]&] -[s0;l704;O9;~~~.1472; [/@(90) FD`_REL-|relative decimal places (valid -digits)]&] -[s0;l704;O9;~~~.1472; [/@(90) FD`_ZERO-|keep trailing zeros (1.25000)]&] -[s3; &] -[s4;%- &] -[s5;:FormatDoubleExp`(double`,int`,int`,int`):%- [_^String^ String]_[* FormatDoubleExp]([@(0.0.255) d -ouble]_[*@3 d], [@(0.0.255) int]_[*@3 digits], [@(0.0.255) int]_[*@3 flags]_`=_[@3 0], -[@(0.0.255) int]_[*@3 fill`_exp]_`=_[@3 0])&] -[s2; Formats a floating point in scientific / exponential notation -(sign, single digit, period, decimal part, `"e`" decimal exponent).&] -[s2; &] -[s0;l288;O9;~~~.1152; [* d]-|the number to format&] -[s0;l288;O9;~~~.1152; [* digits]-|number of digits&] -[s0;l288;O9;~~~.1152; [* flags]-|formatting flags, can be or`-ed (`|) -together:&] -[s0;l704;O9;~~~.1472; [/@(90) FD`_SIGN-|always prepend sign (`+10)]&] -[s0;l704;O9;~~~.1472; [/@(90) FD`_SIGN`_EXP-|always prepend sign to -exponent (1e`+2)]&] -[s0;l704;O9;~~~.1472; [/@(90) FD`_CAP`_E-|capital E for exponent (1E10)]&] -[s0;l704;O9;~~~.1472; [/@(90) FD`_ZERO-|keep trailing zeros (1.25000)]&] -[s0;l288;O9;~~~.1152; [* fill`_exp]-|left zero`-padding of exponent&] -[s2; &] -[s3; &] -[s4;%- &] -[s5;:FormatIntBase`(int`,int`,int`,char`,int`):%- [_^String^ String]_[* FormatIntBase]([@(0.0.255) i -nt]_[*@3 i], [@(0.0.255) int]_[*@3 base], [@(0.0.255) int]_[*@3 width]_`=_[@3 0], -[@(0.0.255) char]_[*@3 lpad]_`=_`'_`', [@(0.0.255) int]_[*@3 sign]_`=_[@3 0])&] -[s0;l288; Formats a signed or unsigned integer (i) in a given radix -(base) with left padding to given (width) with a given (lpad) -character. &] -[s0;l288; &] -[s0;l288;O9;~~~.1152; [* i]-|the number to format.&] -[s0;l288;O9;~~~.1152; [* base]-|radix to format i in, 2 to 36 (0..9a..z)&] -[s0;l288;O9;~~~.1152; [* width]-|left padding width (output longer than -this is not padded)&] -[s0;l288;O9;~~~.1152; [* lpad]-|character to left pad output with&] -[s0;l288;O9;~~~.1152; [* sign]-|`+1 `= always prepend `+/`-; 0 `= auto -(`- only); `-1 `= unsigned formatting&] -[s0;~~~.1152;%- -|&] [s4;%- &] [s5;:Formatting`:`:language:%- [@(0.0.255) int]_[* language]&] [s2; Language of resulting text.&] @@ -601,42 +366,45 @@ this is not padded)&] [s4;%- &] [s5;:Formatting`:`:id:%- String_[* id]&] [s2; Formatter`-id.&] -[s0; &] +[s3; &] [ {{10000F(128)G(128)@1 [s0; [* Format registration functions]]}}&] [s3;%- &] -[s5;:RegisterFormatter`(int`,const char`*`,Formatter`):%- [@(0.0.255) void]_[* RegisterFo -rmatter]([@(0.0.255) int]_[*@3 type], [@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id], -Formatter_[*@3 f])&] +[s5;:RegisterFormatter`(int`,const char`*`,Formatter`)init`_:%- [@(0.0.255) void]_[* Regi +sterFormatter]([@(0.0.255) int]_[*@3 type], [@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id], + Formatter_[*@3 f])&] [s2; Registers formatter for specific Value [%-*@3 type]. If [%-*@3 type] is VALUE`_V, formatter is applied to all Value types if no formatter for specific type is specified.&] [s3;%- &] [s4;%- &] -[s5;:RegisterNumberFormatter`(const char`*`,Formatter`):%- [@(0.0.255) void]_[* RegisterN -umberFormatter]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id], Formatter_[*@3 f])&] +[s5;:RegisterNumberFormatter`(const char`*`,Formatter`)init`_:%- [@(0.0.255) void]_[* Reg +isterNumberFormatter]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id], +Formatter_[*@3 f])&] [s2; Registers formatter for bool, int, double and int64 types.&] [s3;%- &] [s4;%- &] -[s5;:RegisterStringFormatter`(const char`*`,Formatter`):%- [@(0.0.255) void]_[* RegisterS -tringFormatter]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id], Formatter_[*@3 f])&] +[s5;:RegisterStringFormatter`(const char`*`,Formatter`)init`_:%- [@(0.0.255) void]_[* Reg +isterStringFormatter]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id], +Formatter_[*@3 f])&] [s2; Registers formatter for String and WString types.&] [s3;%- &] [s4;%- &] -[s5;:RegisterDateTimeFormatter`(const char`*`,Formatter`):%- [@(0.0.255) void]_[* Registe -rDateTimeFormatter]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id], +[s5;:RegisterDateTimeFormatter`(const char`*`,Formatter`)init`_:%- [@(0.0.255) void]_[* R +egisterDateTimeFormatter]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id], Formatter_[*@3 f])&] [s2; Registers formatter for Date and Time types.&] [s3;%- &] [s4;%- &] -[s5;:RegisterValueFormatter`(const char`*`,Formatter`):%- [@(0.0.255) void]_[* RegisterVa -lueFormatter]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id], Formatter_[*@3 f])&] +[s5;:RegisterValueFormatter`(const char`*`,Formatter`)init`_:%- [@(0.0.255) void]_[* Regi +sterValueFormatter]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id], +Formatter_[*@3 f])&] [s2; Registers formatter to be applied when no formatter for specific type is specified.&] -[s0; &] +[s3; &] [s4;%- &] -[s5;:RegisterNullFormatter`(const char`*`,Formatter`):%- [@(0.0.255) void]_[* RegisterNul -lFormatter]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id], Formatter_[*@3 f])&] +[s5;:RegisterNullFormatter`(const char`*`,Formatter`)init`_:%- [@(0.0.255) void]_[* Regis +terNullFormatter]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id], +Formatter_[*@3 f])&] [s2; Registers formatter [%-*@3 id] to be applied when the Value argument is Void (Value()) or ErrorValue.&] -[s3; &] [s0; ] \ No newline at end of file diff --git a/uppsrc/Core/src.tpp/Format$en-us.tppi b/uppsrc/Core/src.tpp/Format$en-us.tppi new file mode 100644 index 000000000..5fe7e164c --- /dev/null +++ b/uppsrc/Core/src.tpp/Format$en-us.tppi @@ -0,0 +1,19 @@ +TITLE("Text formatting") +COMPRESSED +120,156,213,91,11,119,211,70,22,254,43,83,104,90,59,216,70,79,63,129,67,22,82,218,221,2,61,16,90,122,124,148,72,177,198,182,22,89,114,37,57,33,109,202,111,223,123,103,70,111,141,156,4,216,61,219,114,98,103,102,190,59,247,61,119,30,153,107,228,219,111,149,158,114,95,217,243,223,244,57,93,58,59,63,177,230,158,97,140,103,142,102,206,62,252,235,245,100,134,120,21,240,250,72,213,199,166,174,26,218,16,126,168,186,170,153,154,110,168,99,109,98,140,117,125,172,76,23,190,19,199,214,220,215,198,99,6,210,0,164,141,76,77,29,25,99,99,172,234,163,177,6,88,77,81,52,101,164,153,170,161,143,53,115,234,210,120,97,205,21,24,174,195,240,201,80,159,40,170,162,140,84,85,209,181,145,162,155,134,170,234,26,144,208,70,154,170,152,83,26,184,214,252,199,225,12,1,6,10,101,14,129,245,33,80,51,12,5,168,35,204,208,85,93,209,116,83,157,152,195,233,57,93,121,65,147,72,230,94,145,70,202,212,75,232,70,72,228,24,179,195,167,230,76,5,232, +176,55,188,63,130,105,13,19,38,155,160,68,58,192,52,109,104,78,84,211,0,150,12,69,155,70,244,143,157,23,209,13,13,18,65,193,83,85,77,157,157,171,163,25,176,240,233,211,167,129,106,40,92,83,35,224,69,85,128,111,77,133,54,144,99,164,154,19,101,98,142,213,177,162,143,12,205,28,129,232,91,39,114,54,66,146,115,67,155,9,57,198,189,241,253,161,58,4,141,42,99,224,223,156,0,1,5,132,128,79,80,164,9,255,244,241,52,17,96,196,33,104,210,155,220,7,37,233,166,50,154,40,35,99,100,26,32,137,166,14,85,80,164,130,242,131,25,166,65,24,109,28,223,154,255,117,246,247,193,241,171,254,187,183,100,30,43,51,50,63,52,200,15,216,149,16,187,79,18,250,49,33,75,246,107,226,5,43,235,59,11,7,29,62,80,213,17,193,239,230,108,106,195,255,28,96,119,22,97,16,39,100,177,118,34,251,208,238,177,223,176,251,87,186,72,194,200,126,196,190,59,254,142,218,79,236,239,236,238,244,160,79,230,167,216,248,54,137,128,250,41,225,159,214,217,252, +80,240,96,205,159,118,134,70,151,116,240,139,50,80,6,160,130,46,97,132,211,174,179,114,23,204,157,245,216,135,214,252,240,169,46,4,72,155,123,164,149,216,105,206,241,41,111,228,191,164,67,30,165,67,80,144,116,4,126,79,7,128,108,103,124,94,39,90,197,105,107,215,226,250,250,223,201,220,206,117,206,50,124,233,193,55,149,55,160,178,12,98,207,173,30,185,45,133,128,67,173,193,96,96,145,138,26,50,151,241,130,68,120,74,217,111,72,234,52,53,135,145,43,174,83,212,10,16,198,62,224,195,119,130,213,206,89,81,20,161,166,209,179,154,38,65,133,12,22,55,143,231,124,21,59,30,89,140,199,98,19,176,43,38,191,176,186,159,103,120,148,163,172,225,76,158,155,57,244,255,181,167,104,51,194,115,78,154,148,144,219,152,132,187,100,187,75,120,122,58,119,98,234,146,48,32,69,105,122,160,183,152,70,152,180,136,179,72,118,142,143,211,237,48,95,199,36,9,201,214,119,22,116,29,250,46,141,226,1,57,18,93,228,2,217,140,97,40,69,53,94,0,1,32,13,195, +217,68,187,24,169,137,108,200,112,239,236,7,246,3,18,111,233,194,91,122,128,139,105,66,194,37,137,19,39,112,157,200,45,140,157,17,103,187,245,189,133,147,120,192,233,194,9,200,50,162,212,191,34,17,172,96,49,140,32,201,154,122,17,9,47,131,2,10,191,166,228,23,92,135,36,185,218,82,20,33,28,8,197,136,143,87,97,2,157,107,80,17,80,2,65,34,207,57,247,41,9,118,155,115,160,14,92,113,120,174,5,15,254,109,182,62,91,195,64,202,243,43,18,130,192,126,232,184,40,38,18,17,42,223,109,81,5,154,66,216,50,67,153,232,229,185,127,41,104,19,165,143,18,114,233,37,107,176,8,57,176,8,40,131,172,157,11,42,4,155,150,177,108,12,152,142,185,14,124,22,29,121,179,1,108,44,122,173,106,127,184,69,101,74,187,51,53,218,125,207,149,13,178,237,180,199,170,178,213,196,9,243,12,136,72,26,109,35,42,180,38,180,20,129,79,122,1,37,157,32,76,114,155,101,76,116,7,228,216,89,172,83,82,224,42,127,236,104,176,160,4,106,158,152,107,11, +163,19,124,149,166,38,191,74,237,240,193,3,0,88,80,96,123,208,8,198,115,169,239,109,60,52,36,68,69,20,110,82,125,160,190,31,130,223,100,83,87,140,117,116,225,120,62,243,141,84,172,130,69,200,95,127,169,163,177,57,29,107,170,121,154,86,4,15,11,170,216,134,177,135,211,128,218,200,212,178,166,211,199,124,212,91,74,63,176,200,2,215,78,125,140,128,90,36,104,136,57,223,15,47,25,194,190,23,209,48,90,57,129,247,39,181,239,145,48,2,55,66,209,65,226,204,91,123,16,125,116,185,243,185,166,146,200,9,98,159,197,82,60,0,30,26,57,189,244,220,100,141,108,62,42,176,201,60,53,206,117,3,241,23,67,85,140,54,13,9,196,176,239,166,158,91,39,149,27,8,216,113,124,111,5,186,246,233,50,217,207,193,147,175,200,65,228,173,214,55,96,193,126,252,21,121,0,212,2,179,72,84,226,131,7,116,145,2,166,81,198,140,101,127,42,176,243,83,110,104,204,74,48,224,213,206,247,45,102,243,152,52,144,192,228,158,80,135,5,69,85,136,129,245,247,223, +45,161,92,205,10,176,108,109,118,88,124,128,43,65,34,102,78,231,111,215,78,65,76,88,91,252,43,96,38,240,189,15,148,60,35,158,11,140,98,194,71,13,184,222,10,99,16,226,205,254,222,62,179,191,103,25,2,83,128,131,254,77,93,8,123,200,170,87,16,177,224,209,231,52,185,164,52,144,38,23,8,243,22,102,81,55,140,77,136,15,190,44,157,83,210,152,17,25,165,45,236,215,248,176,60,19,20,86,137,61,19,229,139,77,158,204,112,67,0,233,40,134,69,128,4,248,3,215,49,145,171,64,17,203,37,240,21,36,5,139,184,116,11,233,141,197,114,80,160,56,216,43,37,44,233,118,63,166,1,102,139,11,90,73,96,207,178,60,137,174,116,136,222,32,81,67,12,181,26,174,183,64,50,162,108,201,103,25,59,115,182,124,141,231,107,251,81,204,139,178,202,132,224,159,18,53,131,173,209,247,195,32,113,128,137,170,227,96,162,166,87,36,160,153,181,96,59,236,108,179,233,88,136,224,210,131,189,46,120,31,52,238,188,120,157,101,114,150,214,75,234,145,47,188,204,24, +160,109,66,33,114,225,87,144,51,8,3,187,95,97,10,61,21,186,112,106,168,183,202,196,25,9,224,18,147,26,161,155,109,114,53,67,221,50,119,65,147,100,5,1,134,101,170,43,161,0,212,99,106,98,81,47,117,92,186,132,21,209,69,26,111,188,197,154,247,178,213,115,9,108,119,83,127,218,132,16,119,64,235,194,131,42,173,80,152,161,217,80,20,10,76,82,86,39,32,203,101,5,252,182,246,252,140,175,172,156,137,49,250,216,138,137,135,22,224,185,91,224,52,41,228,138,30,204,67,81,34,136,84,15,22,225,228,50,4,198,32,18,183,176,168,156,123,62,184,29,141,203,133,138,167,154,202,236,53,174,159,126,177,150,132,73,196,236,44,141,156,103,133,163,135,43,108,7,3,177,84,77,118,81,61,76,19,3,242,58,96,242,243,69,17,234,35,140,236,158,80,226,22,148,196,74,221,192,73,118,17,40,134,83,136,153,95,176,68,228,134,59,156,194,238,63,65,157,246,72,28,98,37,0,58,3,122,49,155,29,102,162,131,213,0,237,69,14,88,53,154,130,88,157,59,104, +150,175,236,18,246,61,234,36,49,44,203,168,209,170,131,15,200,9,86,34,240,207,1,21,135,64,121,67,46,215,144,224,152,231,21,77,89,245,66,47,230,137,9,147,100,209,230,61,206,241,129,187,229,231,15,72,126,237,196,34,124,46,35,15,24,131,64,139,97,132,109,195,152,142,109,231,133,16,42,179,196,125,183,226,45,217,130,240,16,118,95,181,26,189,86,1,2,101,118,102,150,143,177,106,137,161,172,45,224,150,197,77,106,69,158,177,27,115,12,233,20,171,111,73,136,200,248,175,57,116,149,249,151,24,83,181,65,204,21,227,221,118,27,34,67,245,66,124,65,128,19,18,146,143,228,61,129,26,192,247,136,31,18,255,35,241,223,19,74,142,201,146,172,200,11,82,157,234,23,30,73,16,166,184,139,9,211,89,221,112,193,66,132,239,120,208,247,208,60,120,32,24,121,44,189,73,101,139,161,246,128,74,89,166,244,212,229,216,194,3,129,33,118,56,249,170,211,73,247,84,180,232,243,184,35,76,216,194,8,159,67,67,108,245,186,3,73,106,199,109,92,133,143,60,207,131, +102,120,169,144,238,23,129,42,84,31,91,92,110,32,142,49,251,197,232,190,78,118,128,86,221,132,178,56,69,69,97,133,176,103,53,68,149,84,243,222,73,230,234,5,78,155,37,241,226,90,57,84,223,107,109,66,119,231,135,86,97,51,86,219,42,225,10,192,171,254,82,51,43,200,102,2,3,27,248,42,204,77,207,157,107,219,44,220,107,232,19,216,107,12,21,51,173,25,235,44,65,153,152,85,137,44,29,112,193,112,169,192,125,38,211,35,133,82,1,50,32,71,20,247,13,216,189,139,133,31,8,45,161,28,108,215,208,48,39,147,49,235,122,5,52,34,88,61,176,85,2,96,210,103,93,39,169,181,87,224,6,1,122,230,62,124,170,157,172,87,28,211,115,199,17,185,148,47,190,32,10,152,123,177,6,143,169,149,184,121,89,135,185,146,31,86,128,187,249,87,169,207,226,78,37,225,53,201,37,100,90,154,42,35,173,52,10,149,146,227,179,5,217,241,47,157,171,184,169,98,177,216,135,85,117,201,66,0,179,204,198,210,216,170,24,153,213,204,1,78,28,211,106,122,186,69, +240,14,202,190,100,104,195,233,216,28,25,107,117,246,180,163,41,70,183,65,223,229,232,42,104,61,75,75,208,246,84,99,173,120,98,119,8,78,21,192,174,39,183,222,51,242,51,212,245,128,103,70,97,189,172,24,30,100,99,56,238,101,13,247,50,27,203,119,87,75,47,2,61,115,187,16,72,202,41,209,30,230,18,232,200,167,169,209,126,253,234,228,199,18,237,119,57,188,133,39,232,41,161,142,206,207,35,10,101,23,174,64,254,77,165,146,82,200,81,189,207,147,77,58,195,238,70,82,186,206,149,212,94,208,215,136,121,94,193,60,23,227,62,215,82,207,143,126,151,218,73,198,139,123,117,35,35,73,69,145,195,83,200,231,216,231,249,239,55,50,143,140,187,228,178,4,87,53,187,191,14,119,81,154,187,121,124,86,65,78,217,158,156,107,62,180,71,212,41,113,122,68,155,146,243,30,129,245,135,64,22,32,127,66,195,8,218,29,214,84,161,118,244,69,169,69,82,95,131,205,155,19,136,242,36,174,194,222,72,221,162,10,171,230,250,60,207,58,62,112,14,251,3,76,154,13, +133,80,37,221,138,107,73,221,212,24,56,176,250,215,75,239,35,122,5,212,81,27,199,143,27,135,93,192,48,200,182,222,158,97,1,187,93,129,225,20,201,134,17,30,108,126,220,134,1,158,148,32,107,33,175,3,155,177,75,129,93,102,88,206,88,59,202,23,40,31,80,233,149,136,221,231,183,1,249,149,101,91,217,116,219,122,137,216,15,242,226,72,180,244,179,194,166,188,174,179,99,161,82,41,69,190,41,255,106,159,90,141,164,203,132,64,139,64,171,249,144,90,104,196,28,13,103,128,239,95,139,37,27,234,33,60,118,129,101,120,21,212,7,22,231,220,195,124,161,169,127,109,229,55,9,169,39,100,213,62,233,4,116,229,176,218,215,126,204,143,15,242,97,176,31,101,251,211,116,51,5,35,134,221,38,190,64,65,253,235,15,148,110,241,120,15,120,199,51,39,7,136,255,73,163,48,110,4,128,10,251,215,169,159,165,22,20,219,26,95,29,102,227,135,134,56,144,124,96,53,106,137,237,148,5,25,41,186,193,40,101,5,101,140,108,29,151,29,122,177,3,211,198,224,229,31, +44,19,60,36,199,31,29,172,151,98,201,213,81,185,98,54,117,85,157,26,195,241,36,205,37,252,244,161,99,223,195,218,221,229,49,113,16,91,246,61,200,101,154,222,131,13,252,201,241,251,19,251,94,183,152,127,158,241,62,236,41,230,165,18,45,109,26,11,106,234,212,221,75,15,27,217,8,41,61,69,85,50,50,21,176,120,163,210,138,182,15,5,90,109,161,32,37,97,95,51,145,148,71,64,228,186,153,9,251,26,218,72,245,63,251,186,149,222,147,54,122,53,98,48,104,15,61,251,241,77,8,22,25,149,16,100,222,96,219,214,54,105,38,6,45,219,68,138,180,231,236,24,3,207,233,83,151,42,53,101,222,128,7,245,77,158,197,198,202,201,219,18,71,104,243,128,5,195,12,205,10,228,72,46,254,29,38,241,238,128,9,101,152,145,28,243,81,130,25,157,75,33,239,101,144,127,72,33,148,67,6,117,214,160,9,195,133,218,15,224,167,20,127,188,15,127,220,142,95,238,195,75,145,171,54,164,20,245,226,78,168,224,78,40,181,13,70,172,249,67,210,129,5,193,247,22, +94,66,234,75,103,87,74,87,255,166,149,31,133,147,230,101,82,195,58,41,39,28,180,122,3,149,219,66,179,79,237,7,122,43,156,251,81,38,53,95,6,243,34,172,133,169,220,69,168,174,212,131,174,237,73,163,156,168,47,101,181,215,98,209,139,59,249,129,214,6,227,26,209,136,168,160,89,93,37,87,70,74,170,33,251,40,183,163,116,113,87,91,95,124,13,123,92,220,205,30,246,92,157,130,39,205,180,105,114,25,206,244,105,178,142,40,157,57,176,43,88,195,102,201,226,53,142,86,161,8,67,63,147,96,85,106,209,223,66,85,63,184,11,221,54,78,249,161,19,91,239,42,168,127,239,2,42,133,189,148,194,254,217,10,99,199,73,141,176,119,175,142,219,152,148,177,216,198,161,140,191,54,246,100,204,201,215,126,231,170,17,19,227,109,90,241,128,168,10,124,46,1,190,221,11,60,250,189,25,120,116,242,238,77,241,24,168,198,170,140,83,249,84,50,22,229,8,25,111,82,68,114,201,16,245,20,176,15,81,173,207,204,125,0,181,138,104,217,4,200,32,138,28,227,112,68, +53,168,247,141,175,165,42,26,75,33,71,141,83,200,117,123,36,153,226,248,173,20,18,49,200,184,2,184,240,60,79,10,121,147,206,82,101,236,229,179,103,239,223,191,255,105,95,117,254,130,38,111,175,226,231,78,66,59,221,170,186,199,15,53,243,161,166,40,195,155,17,57,241,54,109,68,32,55,78,245,209,84,153,236,163,102,223,195,187,141,218,222,179,116,9,115,123,105,52,115,160,140,7,92,26,201,97,91,97,191,206,222,190,191,17,151,20,184,203,95,236,226,164,248,76,163,116,236,150,189,116,198,43,135,169,61,197,231,47,46,93,226,75,102,241,245,172,254,162,185,99,31,102,160,110,167,237,109,239,233,15,89,141,37,30,218,230,13,233,48,251,187,179,229,38,201,158,211,102,148,211,123,245,236,105,38,123,77,181,11,248,69,16,59,247,198,59,31,159,146,210,52,197,25,178,123,54,118,19,163,103,55,49,88,13,252,208,81,181,113,247,5,251,249,84,21,39,157,135,69,180,80,182,129,122,197,47,106,166,43,232,69,101,197,73,180,91,36,236,213,119,65,7,188,181,240, +110,58,251,203,4,77,92,14,243,17,187,136,242,55,80,252,53,136,23,112,11,177,235,174,236,81,84,229,85,44,123,187,82,124,69,48,40,113,104,86,57,76,207,29,171,60,138,199,231,249,83,109,193,222,207,226,119,84,53,127,174,198,94,208,128,255,10,13,138,137,228,51,2,167,56,25,99,27,103,192,71,212,130,248,81,249,138,249,166,20,185,172,72,148,251,31,82,229,109,21,151,225,23,128,13,71,166,55,157,201,115,203,179,120,110,205,41,179,55,78,183,112,38,113,101,24,137,151,6,194,131,227,212,191,244,2,63,105,220,230,243,53,253,1,66,222,219,245,2,47,177,207,170,230,189,8,129,117,148,160,70,79,246,55,8,24,236,183,252,251,3,15,79,94,50,194,156,204,146,255,53,1,104,44,157,185,248,138,115,89,127,45,62,63,232,103,211,15,216,67,182,66,3,123,231,119,244,243,187,99,251,236,215,94,129,14,94,2,227,107,117,254,108,13,131,167,248,244,220,91,226,149,180,100,86,246,96,48,125,156,177,4,10,114,223,72,37,120,197,54,199,5,139,124,174,49, +42,4,173,134,12,250,165,181,126,30,134,126,143,63,195,18,47,172,242,187,106,166,181,253,106,224,97,241,5,213,80,33,248,223,80,131,120,217,132,178,255,150,190,14,188,153,244,184,48,99,149,240,5,229,175,145,252,111,104,0,39,101,242,227,204,55,21,158,69,215,23,148,188,76,239,107,139,205,159,230,165,9,35,125,178,114,203,252,208,146,29,124,255,139,230,134,2,185,175,173,25,145,107,241,25,87,131,146,176,206,168,84,31,152,143,129,99,210,97,237,80,168,226,107,221,227,40,10,185,73,211,247,46,214,127,0,84,107,50,83, + diff --git a/uppsrc/Core/src.tpp/FormatFn$en-us.tpp b/uppsrc/Core/src.tpp/FormatFn$en-us.tpp new file mode 100644 index 000000000..77684a0b4 --- /dev/null +++ b/uppsrc/Core/src.tpp/FormatFn$en-us.tpp @@ -0,0 +1,195 @@ +topic "Formatting functions"; +[ $$0,0#00000000000000000000000000000000:Default] +[l288;2 $$1,0#27521748481378242620020725143825:desc] +[H6;0 $$2,0#05600065144404261032431302351956:begin] +[i448;a25;kKO9;2 $$3,0#37138531426314131252341829483370:item] +[0 $$4,0#96390100711032703541132217272105:end] +[{_}%EN-US +[s0; [*4 Formatting functions]&] +[s0; &] +[ {{10000F(128)G(128)@1 [s0; [* Global functions]]}}&] +[s2;H0;%- &] +[s3;:FormatInt`(int`):%- [_^String^ String]_[* FormatInt]([@(0.0.255) int]_[*@3 i])&] +[s1; Outputs decimally formatted signed integer [%-*@3 i] without `+ +or any paddings. Supposed to be quite fast. Equivalent to FormatIntBase(i, +10).&] +[s4;* &] +[s2;%- &] +[s3;:FormatIntDec`(int`,int`,char`,bool`):%- [_^String^ String]_[* FormatIntDec]([@(0.0.255) i +nt]_[*@3 i], [@(0.0.255) int]_[*@3 width], [@(0.0.255) char]_[*@3 lpad]_`=_`'_`', +[@(0.0.255) bool]_[*@3 always`_sign]_`=_[@(0.0.255) false])&] +[s1; Formats a signed decimal integer [%-*@3 i] with left padding up +to given [%-*@3 width] characters (output longer than this is not +padded) with a given [%-*@3 lpad] character. If [%-*@3 always`_sign +]is true, start positive numbers with `'`+`' (negative numbers +always start with `'`-`').&] +[s4; &] +[s2;%- &] +[s3;:FormatIntHex`(int`,int`,char`):%- [_^String^ String]_[* FormatIntHex]([@(0.0.255) int]_ +[*@3 i], [@(0.0.255) int]_[*@3 width]_`=_[@3 8], [@(0.0.255) char]_[*@3 lpad]_`=_`'[@3 0]`')&] +[s1;~~~.1152; Formats an unsigned hexadecimal (radix 16) integer +[%-*@3 i] with left padding up to given [%-*@3 width] characters +(output longer than this is not padded) with a given [%-*@3 lpad] +character.&] +[s4; &] +[s2;%- &] +[s3;:FormatIntOct`(int`,int`,char`):%- [_^String^ String]_[* FormatIntOct]([@(0.0.255) int]_ +[*@3 i], [@(0.0.255) int]_[*@3 width]_`=_[@3 12], [@(0.0.255) char]_[*@3 lpad]_`=_`'[@3 0]`')&] +[s1; Formats an unsigned octal (radix 8) integer [%-*@3 i] with left +padding up to given [%-*@3 width] characters (output longer than +this is not padded) with a given [%-*@3 lpad] character.&] +[s4; &] +[s2;%- &] +[s3;:FormatIntRoman`(int`,bool`):%- [_^String^ String]_[* FormatIntRoman]([@(0.0.255) int]_ +[*@3 i], [@(0.0.255) bool]_[*@3 upper]_`=_[@(0.0.255) false])&] +[s1; Formats a signed integer [%-*@3 i] in Roman numerals. The biggest +`"implemented`" numeral is M (1000), so expect quite a long return +string when formatting a billion. Negative numbers are prepended +with `[`-`], 0 or Null is output as a Null String. If [%-*@3 upper] +is true, use uppercase `[true`] or lowercase `[false`] letters&] +[s4; &] +[s2;%- &] +[s3;:FormatIntAlpha`(int`,bool`):%- [_^String^ String]_[* FormatIntAlpha]([@(0.0.255) int]_ +[*@3 i], [@(0.0.255) bool]_[*@3 upper]_`=_[@(0.0.255) true])&] +[s1; Formats a signed integer [%-*@3 i] in length`-first lexicographic +index, i.e. excel column numbering (1 `= A,2 `= B.. 26 `= Z, +27 `= AA, 28 `= AB .. 52 `= AZ, 53 `= BA ... 78 `= BZ etc). 0 +or Null is output as a Null String. Only negative numbers are +prepended with a `[`-`]. If [%-*@3 upper] is true, use uppercase +letter.&] +[s4; &] +[s2;%- &] +[s3;:Format64`(uint64`):%- [_^String^ String]_[* Format64]([_^uint64^ uint64]_[*@3 a])&] +[s1; Formats an unsigned decimal 64`-bit integer [%-*@3 a]. Supposed +to be quite fast.&] +[s4; &] +[s2;%- &] +[s3;:Format64Hex`(uint64`):%- [_^String^ String]_[* Format64Hex]([_^uint64^ uint64]_[*@3 a])&] +[s1; Formats an unsigned hexadecimal [%-*@3 a] (radix 16) 64`-bit integer. +Supposed to be quite fast. Lowecase letters a`-f are used for +digits `[10`] through `[15`].&] +[s4; &] +[s2;%- &] +[s3;:FormatIntHex`(const void`*`):%- [_^String^ String]_[* FormatIntHex]([@(0.0.255) const]_ +[@(0.0.255) void]_`*[*@3 ptr])&] +[s1; Formats the pointer address [%-*@3 ptr] as a hexadecimal (base +16) number zero`-padded to the number of digits appropriate for +the memory model (8 digits in 32`-bit systems, 16 digits in 64`-bit +systems). Useful for logging and debugging purposes. Equivalent +to FormatHex, god knows why there are two of them.&] +[s4; &] +[s2;%- &] +[s3;:FormatHex`(const void`*`):%- [_^String^ String]_[* FormatHex]([@(0.0.255) const]_[@(0.0.255) v +oid]_`*[*@3 ptr])&] +[s1; Same as FormatIntHex.&] +[s4; &] +[s2;%- &] +[s3;:FormatInteger`(int`):%- [_^String^ String]_[* FormatInteger]([@(0.0.255) int]_[*@3 a])&] +[s1; Formats a signed decimal integer without padding. In comparison +to FormatInt it returns String(Null) when given int(Null) whereas +FormatInt returns a plain empty string.&] +[s4; &] +[s2;%- &] +[s3;:FormatUnsigned`(unsigned long`):%- [_^String^ String]_[* FormatUnsigned]([@(0.0.255) u +nsigned]_[@(0.0.255) long]_[*@3 a])&] +[s1; A very old freak, implemented through Sprintf(`"%u`", a). Deprecated.&] +[s4; &] +[s2;%- &] +[s3;:FormatDouble`(double`):%- [_^String^ String]_[* FormatDouble]([@(0.0.255) double]_[*@3 a +])&] +[s1; Formats a floating point [%-*@3 a] in decimal notation automatically +selecting ordinary or scientific (exponential) notation according +to the absolute value of a. In ordinary notation, the number +is formatted to 10 significant digits; in exponential notation, +the mantissa is formatted to 10 decimal digits.&] +[s4; &] +[s2;%- &] +[s3;:FormatBool`(bool`):%- [_^String^ String]_[* FormatBool]([@(0.0.255) bool]_[*@3 a])&] +[s1; Formats a boolean [%-*@3 a] as one of the fixed words `"true`" +or `"false`" (regardless of language settings).&] +[s4; &] +[s2;%- &] +[s3;:FormatInt64`(int64`):%- [_^String^ String]_[* FormatInt64]([_^int64^ int64]_[*@3 a])&] +[s1; Formats a signed decimal 64`-bit integer [%-*@3 a] without any +padding. Only negative numbers are prepended with a `[`-`].&] +[s4; &] +[s2;%- &] +[s3;:FormatDouble`(double`,int`,int`,int`):%- [_^String^ String]_[* FormatDouble]([@(0.0.255) d +ouble]_[*@3 d], [@(0.0.255) int]_[*@3 digits], [@(0.0.255) int]_[*@3 flags]_`=_[@3 0], +[@(0.0.255) int]_[*@3 fill`_exp]_`=_[@3 0])&] +[s1; Formats a floating point number [%-*@3 d] in decimal notation +automatically selecting ordinary or scientific (exponential) +notation according to the absolute value of a and the given number +of [%-*@3 digits]. In the (default) absolute decimal mode, a number +is formatted in exponential notation whenever its absolute value +exceeds the interval `[1e`-15, 1e`+15`]; in relative (significant) +decimal mode (FD`_REL), a number is formatted in exponential +notation whenever its absolute value exceeds the interval `[10`^`-<2 +`* digits>, 10`^`+<2 `* digits>`]. [%-*@3 flags] can be a binary +combination ([@(0.0.255) `|]) of&] +[s0; &] +[ {{2098:7902<288;h1; [s0; [2 FD`_SIGN]] +:: [s0; [/2 always prepend sign (`+10)]] +:: [s0; [2 FD`_REL]] +:: [s0; [/2 relative decimal places (valid digits)]] +:: [s0; [2 FD`_SIGN`_EXP]] +:: [s0; [/2 always prepend sign to exponent (1e`+2)]] +:: [s0; [2 FD`_CAP`_E]] +:: [s0; [/2 capital E for exponent (1E10)]] +:: [s0; [2 FD`_ZERO]] +:: [s0; [/2 keep trailing zeros (1.25000)]] +:: [s0; [2 FD`_FIX]] +:: [s0; [/2 always use fixed notation (FormatDouble only)]] +:: [s0; [2 FD`_EXP]] +:: [s0; [/2 always use exponential notation (FormatDouble only)]]}}&] +[s1; &] +[s1; [*@3 fill`_exp ]is left zero`-padding of exponent in exponential +notation&] +[s4; &] +[s2;%- &] +[s3;:FormatDoubleFix`(double`,int`,int`):%- [_^String^ String]_[* FormatDoubleFix]([@(0.0.255) d +ouble]_[*@3 d], [@(0.0.255) int]_[*@3 digits], [@(0.0.255) int]_[*@3 flags]_`=_[@3 0])&] +[s1; Formats a floating point number [%-*@3 d] in ordinary decimal +notation (whole part, comma, decimal part). Then number of [%-*@3 digits] +can be interpreted either as the absolute number of decimal digits +(the default mode) or the relative number of significant digits +excluding leading zeros. Decimal point is always output as a +period independent on language settings. [%-*@3 flags] can be a +binary combination ([@(0.0.255) `|]) of&] +[ {{2098:7902<288;h1; [s0; [2 FD`_SIGN]] +:: [s0; [/2 always prepend sign (`+10)]] +:: [s0; [2 FD`_REL]] +:: [s0; [/2 relative decimal places (valid digits)]] +:: [s0; [2 FD`_ZERO]] +:: [s0; [/2 keep trailing zeros (1.25000)]]}}&] +[s4; &] +[s2;%- &] +[s3;:FormatDoubleExp`(double`,int`,int`,int`):%- [_^String^ String]_[* FormatDoubleExp]([@(0.0.255) d +ouble]_[*@3 d], [@(0.0.255) int]_[*@3 digits], [@(0.0.255) int]_[*@3 flags]_`=_[@3 0], +[@(0.0.255) int]_[*@3 fill`_exp]_`=_[@3 0])&] +[s1; Formats a floating point number [%-*@3 d] in scientific / exponential +notation (sign, single digit, period, decimal part, `"e`" decimal +exponent) with given number of [%-*@3 digits]. [%-*@3 flags] can +be a binary combination ([@(0.0.255) `|]) of&] +[s1; &] +[ {{2098:7902<288;h1; [s0; [2 FD`_SIGN]] +:: [s0; [/2 always prepend sign (`+10)]] +:: [s0; [2 FD`_SIGN`_EXP]] +:: [s0; [/2 always prepend sign to exponent (1e`+2)]] +:: [s0; [2 FD`_CAP`_E]] +:: [s0; [/2 capital E for exponent (1E10)]] +:: [s0; [2 FD`_ZERO]] +:: [s0; [/2 keep trailing zeros (1.25000)]]}}&] +[s1; &] +[s1; [*@3 fill`_exp ]is left zero`-padding of exponent in exponential +notation&] +[s4; &] +[s2;%- &] +[s3;:FormatIntBase`(int`,int`,int`,char`,int`):%- [_^String^ String]_[* FormatIntBase]([@(0.0.255) i +nt]_[*@3 i], [@(0.0.255) int]_[*@3 base], [@(0.0.255) int]_[*@3 width]_`=_[@3 0], +[@(0.0.255) char]_[*@3 lpad]_`=_`'_`', [@(0.0.255) int]_[*@3 sign]_`=_[@3 0])&] +[s1; Formats a signed or unsigned integer [%-*@3 i] in a given radix +[%-*@3 base] with left padding to given [%-*@3 width] with a given +[%-*@3 lpad] character. If [*@3 sign ]is `+1 `= always prepend `'`+`'/`-, +if 0 `= auto (`'`-`' only), if `-1, format as unsigned.&] +[s0; ] \ No newline at end of file diff --git a/uppsrc/Core/src.tpp/FormatFn$en-us.tppi b/uppsrc/Core/src.tpp/FormatFn$en-us.tppi new file mode 100644 index 000000000..6d540278c --- /dev/null +++ b/uppsrc/Core/src.tpp/FormatFn$en-us.tppi @@ -0,0 +1,13 @@ +TITLE("Formatting functions") +COMPRESSED +120,156,221,89,11,111,219,56,18,254,43,131,220,246,42,167,142,171,135,95,177,119,15,77,54,73,91,236,94,179,104,174,192,162,134,26,209,18,109,19,149,37,157,68,229,113,221,246,183,223,12,41,217,82,108,199,78,186,232,94,175,40,108,71,228,140,56,175,111,62,146,35,248,225,7,179,105,254,205,220,242,111,112,194,39,44,15,165,59,10,237,126,127,104,163,152,133,98,118,175,99,91,189,118,191,221,183,156,94,223,110,219,93,219,52,109,179,103,119,172,182,211,183,59,131,128,103,190,59,122,213,29,154,40,97,211,139,58,93,84,215,197,241,118,219,196,249,150,233,216,109,199,114,76,219,233,88,135,157,238,96,204,167,34,114,71,162,221,238,15,153,221,25,126,252,229,252,80,189,207,65,105,167,103,57,253,142,99,161,32,126,88,142,101,119,108,167,109,245,237,195,118,223,113,122,230,64,72,62,119,71,244,178,54,78,63,236,58,135,166,101,154,61,139,94,211,51,157,78,219,178,28,27,151,108,247,108,203,236,12,120,20,184,163,79,151,159,159,156,190,57,120,119,1,163,204, +28,194,104,191,13,103,113,58,103,82,138,104,10,147,60,242,165,136,163,204,253,187,171,198,241,11,62,125,178,200,43,103,134,101,247,27,47,213,231,11,171,20,135,151,97,60,102,97,69,210,253,252,153,132,237,225,43,115,248,228,128,52,100,206,112,160,95,242,58,146,158,33,240,163,49,192,161,209,229,135,11,153,226,123,63,128,254,118,47,81,225,98,166,107,140,94,24,102,203,108,217,157,78,3,80,138,134,95,56,32,220,6,41,181,134,112,158,203,36,151,25,4,220,23,115,22,134,183,48,209,182,240,0,50,49,141,240,11,197,248,148,167,48,122,114,160,101,225,90,200,89,156,75,240,158,65,156,2,139,110,33,97,65,128,111,207,90,112,145,39,73,156,161,152,140,97,204,225,223,57,186,24,38,44,147,45,56,197,63,174,88,200,35,73,131,139,69,30,179,140,27,162,9,150,217,104,209,170,218,195,125,208,230,175,177,253,132,251,218,252,166,250,240,103,44,245,154,227,56,14,119,242,7,74,111,118,73,19,214,143,92,139,64,206,238,140,210,123,139,225,16,109,119,47,189,159, +46,189,167,248,191,62,141,22,86,76,99,225,53,187,205,188,75,114,170,154,94,157,55,97,97,198,23,49,209,203,205,128,149,17,40,130,179,33,18,16,242,137,44,35,0,121,66,206,157,138,43,30,149,243,180,1,106,205,204,151,60,205,192,136,85,216,33,140,35,210,39,103,44,194,15,145,1,254,143,98,173,140,7,13,173,158,213,181,41,123,151,202,90,240,122,82,14,85,109,4,23,117,201,52,231,77,200,36,75,81,103,156,9,137,138,32,202,231,99,90,132,82,238,61,245,158,121,79,193,136,248,148,213,70,181,174,66,182,156,122,224,61,45,115,100,115,138,188,226,55,43,41,178,75,114,160,220,99,147,67,199,211,129,254,78,105,66,51,77,23,77,209,241,254,242,229,75,203,178,58,118,37,240,17,228,81,17,251,25,191,97,101,252,141,148,5,226,6,172,110,227,127,51,21,182,69,230,220,151,143,138,12,202,125,109,100,44,251,49,161,89,27,145,216,151,203,88,244,191,211,80,188,141,231,44,42,130,177,51,124,42,161,93,35,81,193,62,108,9,60,125,40,232,173,186,85, +68,160,86,64,24,193,83,148,110,193,191,102,28,198,98,58,229,25,118,163,61,49,79,66,62,199,254,194,3,111,175,156,69,222,251,39,24,212,128,27,136,69,49,240,155,132,251,178,232,76,76,121,27,82,46,243,52,66,180,33,163,225,122,134,142,157,44,123,58,195,119,132,33,182,230,22,188,89,193,169,148,67,146,242,4,169,1,46,90,3,213,8,129,10,189,97,82,119,124,147,135,106,9,69,108,25,89,168,158,105,7,87,225,83,187,9,22,184,153,103,92,63,243,177,67,162,86,122,234,185,164,52,140,175,23,79,149,27,241,113,200,37,101,209,182,192,31,133,201,140,61,52,240,74,232,79,11,60,217,241,192,184,35,105,152,202,153,119,48,17,41,70,58,228,55,194,143,167,41,75,102,194,199,225,128,223,52,65,180,120,11,99,235,243,16,252,56,204,231,81,17,34,10,160,97,129,247,19,28,53,109,250,58,110,181,0,236,46,253,124,223,4,187,167,134,142,240,87,95,253,58,6,28,239,168,153,71,56,222,113,148,204,17,62,109,65,79,77,57,126,15,92,250,141,214,142, +1,62,143,144,85,173,246,183,213,188,97,69,230,236,158,19,58,230,247,23,123,183,237,25,57,58,21,191,183,134,186,219,198,32,95,126,208,211,63,128,254,46,9,204,106,200,42,160,88,182,40,124,203,193,88,200,187,81,100,238,125,204,112,203,250,85,67,223,221,4,221,199,31,101,69,181,217,46,86,94,109,187,119,204,187,151,238,254,138,69,90,137,18,190,9,243,87,197,61,39,1,196,23,8,196,84,224,18,188,145,101,98,5,203,89,26,231,83,194,15,171,131,89,176,19,207,241,113,191,32,225,42,22,129,183,255,56,150,163,52,184,181,2,37,117,88,181,251,202,99,137,76,87,124,38,17,118,147,152,156,128,244,63,8,82,158,101,165,191,104,186,46,130,26,115,25,147,35,200,131,58,255,225,63,60,141,189,3,221,209,200,119,164,177,24,138,39,165,95,88,146,164,113,146,10,70,62,141,83,53,105,206,231,113,122,11,243,56,192,66,55,250,229,84,196,8,199,214,177,201,110,51,220,213,101,184,161,232,86,70,203,200,21,163,88,189,239,50,62,201,67,165,56,140,167,83, +5,244,17,101,242,56,215,127,37,121,74,177,205,214,239,92,94,17,232,76,227,0,62,70,241,53,178,217,217,45,173,15,163,75,17,150,215,49,217,129,15,230,247,199,241,17,65,252,170,8,94,176,57,167,240,84,243,97,107,166,81,170,239,190,233,164,217,155,122,197,154,242,219,180,201,41,55,153,5,133,66,80,140,208,210,121,194,82,145,197,81,109,7,9,24,87,221,193,179,98,69,6,33,112,67,55,114,205,147,80,237,242,97,202,171,46,88,200,50,72,66,134,185,194,231,137,188,45,200,192,253,206,121,87,32,7,226,83,137,33,196,39,182,251,169,20,172,59,170,84,82,15,38,105,92,241,223,17,92,113,172,131,56,68,36,65,115,62,98,3,92,178,159,5,148,92,96,245,68,114,98,120,123,79,114,111,175,9,12,243,254,132,99,223,241,177,166,130,251,109,59,137,243,113,200,61,35,208,223,91,77,210,243,235,6,105,217,123,130,63,9,99,166,56,150,130,147,10,232,98,24,202,140,64,238,203,232,96,4,88,46,145,255,73,225,171,131,138,140,135,200,227,72,54,78,49, +67,24,121,35,133,204,23,232,2,49,65,98,96,32,211,139,35,250,139,97,216,151,90,124,95,9,76,75,220,97,227,12,9,3,98,12,150,120,206,169,110,153,202,182,133,218,82,180,89,133,41,108,201,203,163,18,212,100,153,42,147,233,205,12,45,209,200,51,36,59,42,203,184,163,10,201,172,20,89,198,214,41,43,173,215,138,238,15,213,49,17,57,99,55,58,71,115,235,65,170,158,82,172,9,17,13,115,22,85,98,131,197,131,6,21,0,7,19,113,67,12,6,189,133,157,108,79,145,212,61,138,132,183,167,169,233,30,54,80,100,63,105,16,82,155,64,161,144,69,211,156,77,57,70,80,241,235,108,251,158,158,72,204,142,4,64,205,86,4,160,232,255,91,218,255,93,252,217,200,96,22,136,84,57,240,122,12,187,123,72,209,53,151,187,229,157,224,119,107,13,6,27,247,203,58,207,54,14,79,66,54,205,22,219,105,115,243,60,220,41,121,151,152,242,149,185,91,203,190,40,169,194,213,193,95,93,253,138,7,208,152,110,29,75,94,82,46,80,187,74,129,4,77,51,2,125, +218,221,88,42,43,87,79,60,5,97,119,45,104,108,128,6,213,181,248,21,205,38,95,213,151,71,27,28,30,104,6,166,248,23,62,38,194,200,189,3,171,131,148,135,123,207,136,60,42,220,73,121,168,179,210,168,0,83,163,182,52,48,206,78,188,203,183,167,191,54,190,197,34,77,239,131,119,240,35,110,173,246,11,23,254,131,78,125,241,225,179,218,67,218,1,21,158,214,89,7,184,112,98,215,180,15,87,145,70,30,64,191,212,66,106,185,238,253,225,54,48,80,181,163,119,219,60,236,15,122,135,166,253,35,93,69,204,48,15,245,193,187,13,100,251,197,235,151,111,92,119,48,40,30,62,183,203,147,199,162,124,21,60,128,129,110,53,27,149,121,90,24,29,87,151,93,184,188,116,50,18,10,159,103,96,160,7,68,80,24,184,170,135,22,225,93,158,254,254,219,246,149,200,120,17,15,220,214,98,184,237,85,117,63,31,253,134,218,234,186,124,150,8,58,183,58,85,132,183,162,226,116,157,97,239,79,223,158,215,229,63,114,158,224,30,148,137,144,106,135,232,59,90,101,161,215, +233,92,101,69,254,236,245,239,107,77,161,237,171,238,23,139,68,50,170,200,133,125,37,188,93,85,183,201,51,164,110,109,118,174,85,170,111,85,44,13,189,148,6,53,188,82,7,214,234,208,110,185,55,81,240,50,89,122,107,67,49,236,128,232,103,226,102,13,168,239,136,231,40,252,45,32,253,81,48,189,64,223,21,188,54,174,103,72,28,176,83,166,178,73,21,59,103,205,101,89,224,195,134,58,190,219,12,175,101,213,43,4,193,26,32,52,226,130,246,88,68,64,106,208,93,217,57,214,88,19,24,52,173,64,103,5,120,13,40,246,145,139,74,93,202,174,210,55,66,178,48,87,105,128,20,40,88,100,62,145,232,194,16,229,24,177,184,175,168,158,2,37,60,21,113,160,206,167,20,17,192,137,232,150,21,246,243,39,128,221,247,129,114,15,6,21,93,176,91,42,235,244,38,249,74,186,132,26,254,47,24,83,133,252,60,223,0,139,20,230,38,6,59,154,98,101,170,245,55,139,52,173,215,102,19,217,59,49,247,242,89,169,173,184,124,216,198,139,190,190,123,91,223,160,123,127, +255,93,247,175,233,104,197,157,125,245,42,175,114,25,191,235,49,17,169,120,248,173,30,157,35,238,120,229,119,183,226,118,188,179,95,170,171,92,213,175,175,201,242,66,48,93,158,32,175,189,189,40,239,234,244,57,114,49,164,44,89,115,85,184,225,158,112,231,171,248,114,229,42,250,152,248,116,99,113,39,165,245,165,251,115,239,160,9,98,2,166,154,129,155,43,172,19,117,197,174,249,146,26,195,93,69,179,216,12,80,79,43,205,108,21,4,219,253,47,109,155,160,149, + diff --git a/uppsrc/Core/src.tpp/String1$en-us.tppi b/uppsrc/Core/src.tpp/String1$en-us.tppi new file mode 100644 index 000000000..4e7a3cee1 --- /dev/null +++ b/uppsrc/Core/src.tpp/String1$en-us.tppi @@ -0,0 +1,4 @@ +TITLE("") +COMPRESSED +120,156,133,206,189,74,68,65,12,5,224,87,185,224,218,41,36,39,201,252,182,10,130,160,133,88,13,131,172,123,103,229,226,186,22,187,86,226,187,155,235,11,152,34,77,206,23,78,155,54,27,186,162,11,250,103,202,205,216,111,191,14,231,222,238,66,37,71,188,34,11,126,10,198,170,74,138,192,36,80,97,33,136,113,182,80,94,199,219,114,236,109,81,77,117,11,171,239,247,143,185,194,53,92,75,100,73,38,236,208,23,11,195,32,202,9,89,147,72,164,178,251,156,199,114,30,31,189,29,144,210,159,19,119,136,6,142,154,52,177,196,4,231,32,2,69,120,15,73,176,50,143,211,174,183,181,164,122,60,7,201,196,68,145,215,122,145,196,148,89,224,47,16,193,100,101,28,231,222,190,95,126,46,111,31,174,159,159,166,118,162,58,245,95,90,209,64,106, + diff --git a/uppsrc/Core/src.tpp/all.i b/uppsrc/Core/src.tpp/all.i new file mode 100644 index 000000000..beb6410a1 --- /dev/null +++ b/uppsrc/Core/src.tpp/all.i @@ -0,0 +1,12 @@ +TOPIC("Format$en-us") +#include "Format$en-us.tppi" +END_TOPIC + +TOPIC("FormatFn$en-us") +#include "FormatFn$en-us.tppi" +END_TOPIC + +TOPIC("String1$en-us") +#include "String1$en-us.tppi" +END_TOPIC + diff --git a/uppsrc/CppBase/CppBase.h b/uppsrc/CppBase/CppBase.h index e9a211721..fdfd0f35c 100644 --- a/uppsrc/CppBase/CppBase.h +++ b/uppsrc/CppBase/CppBase.h @@ -300,6 +300,7 @@ class Parser { bool isdestructor; bool isptr; bool nofn; + bool castoper; String tnames; String type; @@ -361,10 +362,10 @@ class Parser { String TemplateParams(String& pnames); String TemplateParams(); String TemplatePnames(); - String Name(String& h); - String Name(); + String Name(String& h, bool& castoper); + String Name(bool& castoper); String Constant(); - String ReadOper(); + String ReadOper(bool& castoper); int GetLine(const char *pos); void Line(); diff --git a/uppsrc/CppBase/Parser.cpp b/uppsrc/CppBase/Parser.cpp index 1024b5ed5..4f8d9d08b 100644 --- a/uppsrc/CppBase/Parser.cpp +++ b/uppsrc/CppBase/Parser.cpp @@ -209,6 +209,7 @@ Parser::Decla::Decla() function = type_def = false; s_static = s_auto = s_register = s_extern = s_mutable = s_explicit = s_virtual = false; isfriend = istemplate = istructor = isptr = nofn = false; + castoper = false; } @@ -320,7 +321,7 @@ String Parser::TemplatePnames() return pnames; } -String Parser::ReadOper() { +String Parser::ReadOper(bool& castoper) { const char *p = lex.Pos(); Key(tk_operator); int level = 0; @@ -335,19 +336,28 @@ String Parser::ReadOper() { ++lex; } StringBuffer r; + bool spc = false; while(p < lex.Pos()) { - if((byte)*p > ' ') + if((byte)*p > ' ') { + if(spc && iscid(*p)) { + castoper = true; + r.Cat(' '); + } r.Cat(*p); + spc = false; + } + else + spc = true; p++; } return r; } -String Parser::Name(String& name) +String Parser::Name(String& name, bool& castoper) { String s; if(Key(t_dblcolon)) { - s << "::"; + s = "::"; name = s; } Check(lex.IsId() || lex == tk_operator, "Name expected"); @@ -357,7 +367,7 @@ String Parser::Name(String& name) s << lex.GetId(); } else { - String h = ReadOper(); + String h = ReadOper(castoper); name << h; s << h; break; @@ -378,10 +388,10 @@ String Parser::Name(String& name) return s; } -String Parser::Name() +String Parser::Name(bool& castoper) { String h; - return Name(h); + return Name(h, castoper); } String Parser::Constant() @@ -548,10 +558,11 @@ void Parser::Declarator(Decl& d, const char *p) // d.name = ReadOper(); // else if(lex.IsId() || lex == t_dblcolon || lex == tk_operator) { - d.name = Name(); + d.name = Name(d.castoper); + bool dummy; if(Key(':')) if(!Key(t_integer)) - Name(); + Name(dummy); } if(Key('(')) { if(inbody || (lex < 256 || lex == tk_true || lex == tk_false) @@ -674,7 +685,7 @@ Array Parser::Declaration0(bool l0, bool more) if(lex == tk_operator) { Decl& a = r.Add(); (Decla&)a = d; - a.name = ReadOper(); + a.name = ReadOper(a.castoper); Key('('); ParamList(a); Qualifier(); @@ -702,6 +713,8 @@ Array Parser::Declaration0(bool l0, bool more) Decl& a = r.Add(); (Decla&)a = d; Declarator(a, p); + if(a.castoper) + a.name = Filter(natural1, CharFilterNotWhitespace) + a.name; a.natural = natural1 + String(p1, lex.Pos()); p = lex.Pos(); } @@ -1134,7 +1147,8 @@ bool Parser::Scope(const String& tp, const String& tn) { if(Key(tk_private)) access = "private"; if(Key(tk_virtual)) access << " virtual"; String h; - String n = Name(h); + bool dummy; + String n = Name(h, dummy); ScAdd(im.pname, h); if(c) im.ptype << ';'; @@ -1190,7 +1204,13 @@ CppItem& Parser::Fn(const Decl& d, const String& templ, bool body, } String nn0; String nm = d.name; - int q = d.name.ReverseFind(':'); + int q; + if(d.castoper) { + q = d.name.ReverseFind(' '); + q = q > 0 ? d.name.ReverseFind(':', q) : q = d.name.ReverseFind(':'); + } + else + q = d.name.ReverseFind(':'); if(q >= 0) { nm = d.name.Mid(q + 1); if(q > 0) diff --git a/uppsrc/CppBase/Qualify.cpp b/uppsrc/CppBase/Qualify.cpp index f740df844..9e202d96d 100644 --- a/uppsrc/CppBase/Qualify.cpp +++ b/uppsrc/CppBase/Qualify.cpp @@ -216,10 +216,10 @@ void QualifyPass1(CppBase& base) } m.qitem = m.item; } - LLOG(base.GetKey(ni) << "." << m.item << " " << GetCppFile(m.file) << '(' << m.line << ") " - << AsCString(m.natural) - << " impl:" << m.impl << " kind:" << (int)m.kind << " IsType:" << m.IsType() - << " type: " << m.type << " qtype:" << m.qtype << " tparam:" << m.tparam); + //LLOG(base.GetKey(ni) << "." << m.item << " " << GetCppFile(m.file) << '(' << m.line << ") " + // << AsCString(m.natural) + // << " impl:" << m.impl << " kind:" << (int)m.kind << " IsType:" << m.IsType() + // << " type: " << m.type << " qtype:" << m.qtype << " tparam:" << m.tparam); } } } @@ -265,7 +265,7 @@ void QualifyPass2(CppBase& base) : m.item; } } - LLOG(base.GetKey(ni) << "." << m.item << " " << GetCppFile(m.file) << '(' << m.line << ") " + LLOG(base.GetKey(ni) << "." << m.item << " -> " << m.qitem << "\n " << GetCppFile(m.file) << '(' << m.line << ") " << AsCString(m.natural) << " impl:" << m.impl << " kind:" << (int)m.kind << " IsType:" << m.IsType() << " qtype:" << m.qtype << " tparam:" << m.tparam); diff --git a/uppsrc/CtrlCore/Win32Clip.cpp b/uppsrc/CtrlCore/Win32Clip.cpp index 0454f38e0..9723cd21c 100644 --- a/uppsrc/CtrlCore/Win32Clip.cpp +++ b/uppsrc/CtrlCore/Win32Clip.cpp @@ -30,6 +30,8 @@ int GetClipboardFormatCode(const char *format_id) return CF_DIB; if(fmt == "files") return CF_HDROP; + static StaticMutex m; + Mutex::Lock __(m); static VectorMap format_map; int f = format_map.Find(format_id); if(f < 0) { diff --git a/uppsrc/ide/Annotations.cpp b/uppsrc/ide/Annotations.cpp index 7816a1e8b..632cffb3e 100644 --- a/uppsrc/ide/Annotations.cpp +++ b/uppsrc/ide/Annotations.cpp @@ -22,7 +22,7 @@ void AssistEditor::Annotate(const String& filename) bool IsCodeItem(RichText& txt, int i) { static Uuid codeitem = CodeItemUuid(); - static Uuid stritem = StructItemUuid();; + static Uuid stritem = StructItemUuid(); if(i < txt.GetPartCount() && txt.IsPara(i)) { Uuid style = txt.GetParaStyle(i); return style == codeitem || style == stritem; @@ -105,9 +105,14 @@ void AssistEditor::SyncAnnotationPopup() if(!IsCodeItem(topic_text, i)) i++; while(IsCodeItem(topic_text, i)) result.Cat(topic_text.Get(i++)); - while(i < topic_text.GetPartCount() && topic_text.IsPara(i) && !IsCodeItem(topic_text, i) + while(i < topic_text.GetPartCount() && !IsCodeItem(topic_text, i) && !IsBeginEnd(topic_text, i)) - result.Cat(topic_text.Get(i++)); + if(topic_text.IsPara(i)) + result.Cat(topic_text.Get(i++)); + else { + RichTable table(topic_text.GetTable(i++), 1); + result.CatPick(table); + } break; } annotation_popup.Pick(result, GetRichTextStdScreenZoom()); diff --git a/uppsrc/ide/Assist.cpp b/uppsrc/ide/Assist.cpp index 2f8421db2..e3e4e6d51 100644 --- a/uppsrc/ide/Assist.cpp +++ b/uppsrc/ide/Assist.cpp @@ -59,6 +59,7 @@ AssistEditor::AssistEditor() scope_item.SetPos(3000); navigatorpane.Add(scope_item); browser.scope.NoWantFocus(); + browser.scope.WhenLeftDouble = THISBACK(GotoBrowserScope); browser.item.NoWantFocus(); browser.item.WhenLeftClick = browser.item.WhenLeftDouble = THISBACK(BrowserGoto); browser.WhenKeyItem = THISBACK(BrowserGotoNF); diff --git a/uppsrc/ide/Browser/Base.cpp b/uppsrc/ide/Browser/Base.cpp index 9e5dadc1a..d9421ce06 100644 --- a/uppsrc/ide/Browser/Base.cpp +++ b/uppsrc/ide/Browser/Base.cpp @@ -3,7 +3,7 @@ #define LTIMING(x) // RTIMING(x) #define LLOG(x) -static const char s_dbver[] = "CPP-BASE 2.35"; +static const char s_dbver[] = "CPP-BASE 2.36"; void GC_Cache() { diff --git a/uppsrc/ide/Browser/CodeBrowser.cpp b/uppsrc/ide/Browser/CodeBrowser.cpp index eb1669d6f..221c37300 100644 --- a/uppsrc/ide/Browser/CodeBrowser.cpp +++ b/uppsrc/ide/Browser/CodeBrowser.cpp @@ -84,6 +84,7 @@ void CodeBrowser::Load() scope.Add(IsString(ndx[i]) ? ndx[i] : Null, txt[i], ndx[i]); if(scope.FindSetCursor(key)) scope.ScCursor(sc); + clear.Enable(IsSearch()); } int ItemCompare(const Value& v1, const Value& v2) @@ -219,6 +220,7 @@ void CodeBrowser::Search() bool CodeBrowser::Key(dword key, int count) { + clear.Enable(IsSearch()); if(key == K_UP || key == K_DOWN) { if(search.HasFocus() || search_item.HasFocus()) { EditString& es = search.HasFocus() ? search : search_item; diff --git a/uppsrc/ide/Browser/CodeRef.cpp b/uppsrc/ide/Browser/CodeRef.cpp index 7194531c5..8963ec1c7 100644 --- a/uppsrc/ide/Browser/CodeRef.cpp +++ b/uppsrc/ide/Browser/CodeRef.cpp @@ -99,7 +99,7 @@ void TopicEditor::Tools(Bar& bar) String l = editor.GetFormatInfo().label; bool b = l.GetCount() > 2 && l != "noref"; bar.Add(b, "See referenced code", IdeCommonImg::Source(), THISBACK(JumpToDefinition)) - .Key(K_ALT_J); + .Key(K_ALT_J).Key(K_ALT_I); bar.Add("Find broken references..", IdeCommonImg::FindBrokenRef(), THISBACK(FindBrokenRef)) .Key(K_CTRL_F3); #ifdef REPAIR diff --git a/uppsrc/ide/Browser/Topic.cpp b/uppsrc/ide/Browser/Topic.cpp index 1e2e36383..ebf11d210 100644 --- a/uppsrc/ide/Browser/Topic.cpp +++ b/uppsrc/ide/Browser/Topic.cpp @@ -21,6 +21,7 @@ void LoadTopics(FileList& topic, const String& grouppath) while(ff) { if(ff.IsFile() && GetFileExt(ff.GetName()) == ".tpp") topic.Add(GetFileTitle(ff.GetName()), TopicImg::Topic()); + ff.Next(); } topic.Sort(ListOrder()); topic.Enable(); diff --git a/uppsrc/ide/Browser/TopicBase.cpp b/uppsrc/ide/Browser/TopicBase.cpp index e7970ed20..c4f7581f3 100644 --- a/uppsrc/ide/Browser/TopicBase.cpp +++ b/uppsrc/ide/Browser/TopicBase.cpp @@ -167,7 +167,7 @@ void InvalidateTopicInfoPath(const String& path) { VectorMap& t = topic_info(); for(int i = 0; i < t.GetCount(); i++) - if(t[i].path == path) + if(!t.IsUnlinked(i) && t[i].path == path) t.Unlink(i); } diff --git a/uppsrc/ide/Browser/Util.cpp b/uppsrc/ide/Browser/Util.cpp index c6ee8071e..6fd00dd94 100644 --- a/uppsrc/ide/Browser/Util.cpp +++ b/uppsrc/ide/Browser/Util.cpp @@ -2,7 +2,7 @@ void SplitCodeRef(const String& s, String& scope, String& item) { - int q = s.Find('('); + int q = s.FindFirstOf("( "); q = q >= 0 ? s.ReverseFind(':', q) : s.ReverseFind(':'); if(q < 0) { scope.Clear(); diff --git a/uppsrc/ide/Navigator.cpp b/uppsrc/ide/Navigator.cpp index 978b2c3c1..077f1a1d3 100644 --- a/uppsrc/ide/Navigator.cpp +++ b/uppsrc/ide/Navigator.cpp @@ -219,7 +219,7 @@ void AssistEditor::BrowserGotoNF() int itemsc = browser.item.GetScroll(); String cref = browser.GetCodeRef(); - if(assist_active && !(theide && theide->SwapSIf(cref))) + if(assist_active && !(theide && theide->SwapSIf(cref))) IdeGotoCodeRef(cref); if(scope == browser.scope.GetKey()) { @@ -238,6 +238,12 @@ void AssistEditor::BrowserGoto() SetFocus(); } +void AssistEditor::GotoBrowserScope() +{ + browser.item.GoBegin(); + BrowserGoto(); +} + bool AssistEditor::NavigatorKey(dword key) { if(navigator == NAV_INDEX) diff --git a/uppsrc/ide/ide.h b/uppsrc/ide/ide.h index dc269c7ba..0ae1e26ef 100644 --- a/uppsrc/ide/ide.h +++ b/uppsrc/ide/ide.h @@ -449,6 +449,7 @@ struct AssistEditor : CodeEditor { bool NavigatorKey(dword key); void SyncNavigator(); + void GotoBrowserScope(); void BrowserGoto(); void BrowserGotoNF();