Command Window or Immediate Window in XIDE or Visual Studio???

This forum is meant for questions and discussions about the X# language and tools
Anonymous

Command Window or Immediate Window in XIDE or Visual Studio???

Post by Anonymous »

Is there an Command Window or "immediate" window in XIDE or Visual Studio where we can run single commands? In the VFP IDE we have a Command Window where we can directly enter commands and so forth like "USE Blah.dbf" and it will open the table into a local cursor, then we can enter the BROWSE command and it will open the cursor and we can scroll up and down, and even change fields (yes, in live data edit mode). We can even define variables that stay in scope, and then make function calls that reference the vars. It can write to the IDE screen space with the "?" command, etc.

Does X# have such a thing in XIDE or Visual Studio??

Screenshot of VFP IDE and using the Command Window:
2019-04-22 10_27_17-Labor Mgmt Ver 16.0.png
2019-04-22 10_27_17-Labor Mgmt Ver 16.0.png (81.34 KiB) Viewed 693 times
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Command Window or Immediate Window in XIDE or Visual Studio???

Post by robert »

Matt,
We don't have that inside VS yet. The best we have at this moment inside VS is the C# immediate window but you have to use the C# syntax to evaluate expressions in this window.
What we DO have is xsi.exe, our xs script interpreter. This (by default) runs in x# core mode and allows you to enter and compile code without having to create assemblies. A bit like the command window, except that the input and output are in the same window.
This xsi however does not support the preprocessor (afaik, but I would have to check to be sure). To support USE commands and BROWSE we need to add support for:
- UDCs to convert the USE command to a function call in the runtime
- A runtime that keeps track of open workareas (which is not loaded by default in xsi)
- A runtime that supports a BROWSE like window on the current workarea.
This is one of the things on my todo list, just like a window in the debugger that lets you see which workareas (and SQL cursors) are open and which allows you to browse (and edit ?) the open workarea. I would also like to add a window where you can inspect the settings like SET EXACT, SET DELETED etc. Something like what the DISPLAY STATUS command does in VFP.
This is not all very complicated, but is just extra work that needs to be done.

Of course we need to determine what will happen if you type:
cFirstName := "Robert"
will cFirstName be a local variable or a private variable (I think VFP creates a private, is that correct ?)

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Jamal
Posts: 315
Joined: Mon Jul 03, 2017 7:02 pm

Command Window or Immediate Window in XIDE or Visual Studio???

Post by Jamal »

Robert,

In VFP undeclared variables have a "Private" scope.
Source: https://www.alvechurchdata.co.uk/fox101var.htm (first paragraph)

Jamal

FWIW, I found the following link about the VFP Language Reference (it was a hard find):
https://docs.microsoft.com/en-us/previo ... 3dvs.71%29
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

Command Window or Immediate Window in XIDE or Visual Studio???

Post by Karl-Heinz »

robert wrote:Matt,
Of course we need to determine what will happen if you type:
cFirstName := "Robert"
will cFirstName be a local variable or a private variable (I think VFP creates a private, is that correct ?)
Hi Robert,

vars created in the command window are public.

regards
Karl-Heinz
Attachments
FPMemory.png
FPMemory.png (10.51 KiB) Viewed 693 times
FoxProMatt

Command Window or Immediate Window in XIDE or Visual Studio???

Post by FoxProMatt »

Robert - I launched xsi.exe, but I could get it to accept my assigning of a variable of Date type.

I also found that it does not recognize basic Functions like Upper() and Alltrim().

So, what do I need to enter to get the missing assemblies loaded into scope so XSI.exe could process these data types and functions?
2019-04-23 14_30_39-H__Work_Repos_XSharp.VFP_Samples_VCX Classlib Sample_TempOutput.png
2019-04-23 14_30_39-H__Work_Repos_XSharp.VFP_Samples_VCX Classlib Sample_TempOutput.png (22.26 KiB) Viewed 693 times
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Command Window or Immediate Window in XIDE or Visual Studio???

Post by robert »

Matt,
Look at this doc. Translate CSI to XSI and use the X# syntax:
https://msdn.microsoft.com/en-us/magazine/mt614271.aspx

XSI.EXE starts in Core mode, so do not load any runtime assmblies. To allow Upper() and AllTrim() to work you need to load XSharp.Core.DLL and XSharp.RT.DLL with the #r command or by specifying the /r: commandline option when starting xsi.
If we use this for a command window we will automatically load these assemblies.
For the date literals we would have to run XSI in a dialect other then Core. I am not sure if the /dialect commandline option works correctly with xsi.exe. I have never tested that.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
FoxProMatt

Command Window or Immediate Window in XIDE or Visual Studio???

Post by FoxProMatt »

Robert - I loaded the assemblies as you said, but still get errors using Alltrim() and Upper(). See screenshot:

What am I missing?
2019-04-23 20_30_09-Reply_ - XSharp Forums - XSharp.png
2019-04-23 20_30_09-Reply_ - XSharp Forums - XSharp.png (10.58 KiB) Viewed 693 times
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Command Window or Immediate Window in XIDE or Visual Studio???

Post by robert »

Matt,
It looks like you're not missing anything. I checked and the XSI.exe runs in 'core' dialect mode. We'll have to add an option to switch the dialect. And because it is in 'Core' dialect mode it does not automatically include the necessary 'using static' statements based on the namespaces in the 2 assemblies.
I'll discuss this with Nikos and will see how to solve this.
If you enter the following 2 commands it should work:
using static XSharp.Core.Functions
using static XSharp.Rt.Functions

I agree that this is not ideal, but remember we did not market this as the Command window replacement (yet).
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

Command Window or Immediate Window in XIDE or Visual Studio???

Post by Karl-Heinz »

Hi Robert and Matt

It seems that this is currently the only chance to get something running. Either run the code as a script, or enter the code line by line in the xsie console.

test.prgx

Code: Select all

#R "XSharp.Core"
#R "XSharp.RT"
#R "XSharp.VO"

using aa := xsharp.Core.Functions
using bb := xsharp.RT.Functions
using cc := xsharp.VO.Functions

var c := "abcdefg"

? aa.Upper (c )
? xsharp.core.functions.Upper ( c)

// (1,1): error XS0103: The name 'Upper' does not exist in the current context
// ? Upper(c) 

? aa.Left ( c, 3 )
? bb.Substr ( c , 3  , 3 )
? cc.GetAppLocaleID()
?
?

Console.WriteLine ("press any key" ) 
Console.Read()  

regards
Karl-Heinz
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Command Window or Immediate Window in XIDE or Visual Studio???

Post by robert »

Karl Heinz,
You can omit the aa := and replace that with STATIC
Then you don't need to prefix the function names

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply