Xbase++ forum

This forum is meant for questions about the XBase++ Language support in X#.

User avatar
DenGhostYY
Posts: 15
Joined: Fri Sep 16, 2022 8:23 am

Re: Xbase++ forum

Post 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?
User avatar
DenGhostYY
Posts: 15
Joined: Fri Sep 16, 2022 8:23 am

Re: Xbase++ forum

Post 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
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: Xbase++ forum

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
DenGhostYY
Posts: 15
Joined: Fri Sep 16, 2022 8:23 am

Re: Xbase++ forum

Post 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.
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: Xbase++ forum

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
DenGhostYY
Posts: 15
Joined: Fri Sep 16, 2022 8:23 am

Re: Xbase++ forum

Post by DenGhostYY »

866, 1251
User avatar
DenGhostYY
Posts: 15
Joined: Fri Sep 16, 2022 8:23 am

Re: Xbase++ forum

Post by DenGhostYY »

Hello. Is there an analogue of the function SymbolInfo in XSharp?
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: Xbase++ forum

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
DenGhostYY
Posts: 15
Joined: Fri Sep 16, 2022 8:23 am

Re: Xbase++ forum

Post by DenGhostYY »

SYMBOL_FUNCTION
User avatar
DenGhostYY
Posts: 15
Joined: Fri Sep 16, 2022 8:23 am

Re: Xbase++ forum

Post by DenGhostYY »

SYMBOL_FUNCTION

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