Page 1 of 4
Xbase++ forum
Posted: Wed Mar 27, 2019 1:32 pm
by Anonymous
Xbase++ support is in development by the X# Team. If you have a strong interest in joining the early development stage,
please join the FOX program to gain access to the Private discussion forum.
Some questions about migrating from Xbase++
Posted: Fri Jun 30, 2023 1:07 pm
by DenGhostYY
Hello. Please answer my questions.[*]
[*]What function do you plan to implement? What Xbase++ documentation do you rely on? We need to know about this in order to migrate from Xbase++ to X#.
[*]Why did you deprecate functions
Error(),
Inkey()? What functions then to use instead of them?
[*]There is function Int() in Xbase++. I found a X# function Integer(), read the tip, however questions remain. What happens if the number is greater than the short?
What is the best way to get around this error?
It seems to me that just entering such the UDC is wrong.
Code: Select all
#xtranslate int(<x>) => integer(<x>)
X# Compiler version 2.16.0.5 (public)
-dialect:xBase++ -xpp1 -lb -memvar -vo1 -vo3 -vo5 -vo10 -vo15 -vo16
Code: Select all
procedure Main()
? int(12.4) // error XS0103: The name 'int' does not exist in the current context
return
Some questions about migrating from Xbase++
Posted: Sun Jul 02, 2023 4:14 pm
by wriedmann
Hello,
PMFJI, but even if I'm not from the development team: you are waiting for an answer. A part from the fact that is weekend now: I can give you some sort of answer I could immagine one of the team members could give.
First the easy one: Inkey() and the other functions make only sense in a character mode application, and X# does not supports them. If you are using things like Inkey() in a console/command line application: the .NET Framework offers a System.Console class with static methods like ReadLine() and ReadKey():
https://learn.microsoft.com/en-us/dotne ... le.readkey
https://learn.microsoft.com/en-us/dotne ... e.readline
You can build your own function library to implement that function. The same could be made for the Int() function. And you are asking what is occurring when a value is too large for a function? Try it out, IMHO that is the most simple and fast thing (at least I would do that).
Regarding the functions to implement: the X# project is request driven. If you need a function that is not in the library, request it, or better, show code to implement it.
In your situation, if you have a large Xbase++ application to migrate, contact Robert and hire him for a day or more to look at your code, and then he can help you.
Or you can even pay him and his team for creating what you need. After all, it is an open source project and the development team needs to eat and to pay their bills.
Currently the projects has some larger sponsors and many small ones (the FoX members, including myself).
Wolfgang
Xbase++ forum
Posted: Sun Jul 02, 2023 4:16 pm
by robert
Hi,
1) So far we have implemented the functions that our customers needed and asked for. If you are missing functions, please let us know. We will try to implement them then. Of course, you can also implement missing functions yourself and share them with us.
2) The Error() function in Xbase++ is the class function of the Error class. In .Net there normally is no "Class Function". This is something from Xbase++ (and Classs(y) in Clipper). The Inkey() function is used in Terminal based applications. X# is normally used to write either console apps, or Windows apps. In these contexts, Inkey() does not make sense. We do not plan to support writing terminal applications. The only exception is the ? (Qout) and ?? (QQout) that write to the console. SET CONSOLE and SET ALTERNATE are supported for this.
3) The function Int() was dropped in Visual Objects, because there is also a type with the name Int() and the expression Int(<something>) meant either cast a value to Int or dereference a pointer to an integer.
We an add that function in the Xbase++ runtime library if you depend on it.
Integer() should return the same results.
I am not sure why you are referring to Short in your question. If the value you send in to the function is between Int32.MinValue and Int32.MaxValue then the function returns an Int32 value. Otherwise it returns a float without fraction. That is why the return type of Integer() is not Int32 (or Int64) but USUAL.
Robert
Re: Xbase++ forum
Posted: Tue Dec 19, 2023 9:08 am
by DenGhostYY
Hello. Please tell me how to write a library of functions compatible with X# in C# using dependencies XSharp.RT and XSharp.XPP (dialect XBase++)
I tried to write
XbTools.cs
Code: Select all
using XSharp.RT;
using XSharp.XPP;
namespace XbTools
{
public static class XbTools
{
public static XSharp.__Usual CharRem(XSharp.__Usual cDeleteChars, XSharp.__Usual cString)
{
return new XSharp.__Usual("result");
}
}
}
Program.prg
Doesn't compile without the XbTools.XbTools
Code: Select all
procedure Main()
local s := XbTools.XbTools.CharRem("", "")
? s
wait
return
Re: Xbase++ forum
Posted: Tue Dec 19, 2023 9:25 am
by DenGhostYY
What language is better to write such functions in terms of performance?
Re: Xbase++ forum
Posted: Tue Dec 19, 2023 9:26 am
by wriedmann
Hello,
C# does not knows anything about the xBase types.
You have to use only base .NET types, no usuals, arrays, dates or similar things.
And to use your class without a namespace you can simply add a
using XbTools;
in your .cs file.
Mixing C# and X# definitively works, I have done that several times. The only thing you have to be aware is that C# does not knows the special xBase datatypes.
Wolfgang
Re: Xbase++ forum
Posted: Tue Dec 19, 2023 9:27 am
by wriedmann
Hello,
if you can use X# Core dialect, it should behave like C#.
Or you can also use the X# runtime, strong typing all variables.
Wolfgang
Re: Xbase++ forum
Posted: Tue Dec 19, 2023 10:09 am
by robert
Den,
DenGhostYY wrote: ↑Tue Dec 19, 2023 9:08 am
Hello. Please tell me how to write a library of functions compatible with X# in C# using dependencies XSharp.RT and XSharp.XPP (dialect XBase++)
I tried to write
XbTools.cs
Code: Select all
using XSharp.RT;
using XSharp.XPP;
namespace XbTools
{
public static class XbTools
{
public static XSharp.__Usual CharRem(XSharp.__Usual cDeleteChars, XSharp.__Usual cString)
{
return new XSharp.__Usual("result");
}
}
}
Program.prg
Doesn't compile without the XbTools.XbTools
Code: Select all
procedure Main()
local s := XbTools.XbTools.CharRem("", "")
? s
wait
return
Our compiler adds a special attribute to assemblies that indicates which class contains static methods that should be treated as functions.
You can find the attribute here:
https://www.xsharp.eu/runtimehelp/html/ ... ribute.htm
You can also add a namespace with this attribute that should be automatically added as "using" at the start of your app.
If you write the code as a function in X# then this is done automatically by the compiler.
Robert
Re: Xbase++ forum
Posted: Tue Dec 19, 2023 10:10 am
by robert
DenGhostYY wrote: ↑Tue Dec 19, 2023 9:25 am
What language is better to write such functions in terms of performance?
There should be no difference in runtime performance when written in C# or X#. The performance is not determined by the compiler but by the algoritm used.
Robert