xsharp.eu • Xbase++ forum - Page 3
Page 3 of 4

Re: Xbase++ forum

Posted: Fri Apr 26, 2024 9:24 am
by DenGhostYY
As far as I know, strings in Xbase++ do not have a special setting that is responsible for the case sensitivity of strings when comparing. You can select a collation table for characters using SET COLLATION. However, in Alaska there is no corresponding #define for the Russian language, so we use LocaleConfigure to recreate the Russian character table in 866 encoding.

The X# documentation for the SetCollation says that if the #Clipper mode is set, then the comparison of Latin characters is carried out in this order: A < B < C < ... < Z < a < b < c < ... < z

So after seeing this function in the documentation, I decided that the string comparison problem could be solved in a simpler way. Can I rely on these functions?
Chris wrote: Fri Apr 26, 2024 7:25 am Den,

Is Alaska always ignoring the case when doing string comparisons, or is this behavior based on a setting?

Re: Xbase++ forum

Posted: Fri Apr 26, 2024 9:30 am
by DenGhostYY
Doesn't the Russian clipper/vo collation table correspond to the code page 866?
In X# the function Asc() returns the correct result for Latin 'b', 'C'. Imho, this means something is wrong with the comparison settings.
robert wrote: Fri Apr 26, 2024 7:48 am Den,
The sort order is controlled by the russian collation. I would have to check what the contents of that collation is.
We extracted that sort order from the clipper / vo collation table

Robert

Re: Xbase++ forum

Posted: Fri Apr 26, 2024 10:33 am
by robert
Guys,
The problem is different from what you would expect:
there is a SetCollation() function in both XSharp.Core and XSharp.XPP
I am not sure why we did this, but SetCollation() inside XSharp.XPP expects a numeric parameter from Collat.ch
This activates one of the Xbase++ collation tables.

In this case, you would need to call the function inside XSharp.Core like this:

Code: Select all

XSharp.Core.Functions.SetCollation("CLIPPER")
This would also have worked

SetCollation(COLLAT_AMERICAN)


I will change the version inside XPP to forward string (and symbol) parameters to the function inside XSharp.Core

Robert

Re: Xbase++ forum

Posted: Fri Apr 26, 2024 11:31 am
by DenGhostYY
Yes, clarifying the namespace helped. I decided to try with Cyrillic characters, but for some reason the function Asc() returns codes based on code page 1251, although the source was in 866 encoding and there was a compilation flag -codepage:866

Code: Select all

procedure Main()
#ifdef __XSHARP__
    SetInternational(#CLIPPER)
    XSharp.Core.Functions.SetCollation("CLIPPER")
    SetNatDll("RUSSIAN.DLL")
#endif
    ? asc("Г"), asc("б"), "Г" < "б"
    wait
    return
Alaska outputs:
67 98 Y
131 161 Y

X# outputs:
67 98 .T.
195 225 .T.

Re: Xbase++ forum

Posted: Fri Apr 26, 2024 2:05 pm
by robert
Den,
The Asc() function translates the characters from unicode to ansi at runtime.
What is the value of
RuntimeState.DosCodePage
RuntimeState.WinCodePage

Robert

Re: Xbase++ forum

Posted: Fri May 31, 2024 11:58 am
by DenGhostYY
866, 1251

Re: Xbase++ forum

Posted: Wed Jun 19, 2024 5:07 am
by DenGhostYY
Hello. Is there an analogue of the function SymbolInfo in XSharp?

Re: Xbase++ forum

Posted: Wed Jun 19, 2024 6:42 am
by robert
The function SymbolInfo() does not exist yet.
But we could create / emulate it.
However, the result may be a HUGE array, depending on the information requested.
Especially when asking for SYMBOL_BUILTIN_CLASSFUNC
Should that include the classes in the X# runtime or also all the classes inside the .Net runtime?
And should SYMBOL_BUILTIN_FUNCTION only return functions declared in the X# runtime or also static methods in the .Net runtime?
In other words:
what exactly are you looking for?

Robert

Re: Xbase++ forum

Posted: Wed Jun 19, 2024 7:31 am
by DenGhostYY
SYMBOL_FUNCTION

Re: Xbase++ forum

Posted: Wed Jun 19, 2024 7:32 am
by DenGhostYY
SYMBOL_FUNCTION

The return value is a one-dimensional array holding the symbolic names of FUNCTIONs and PROCEDUREs as character strings.