LonkeroAdministrator
(KiX Master Guru)
2012-11-26 02:29 AM
KiXnet first public release

I got bored at some day last winter and decided to write a "sister" interpreter for kixtart. then got busy with other stuff and finally found the time to finish off the few last unwritten functions. so...

it's called KiXnet

it's supposed to be able to use .net natively, (kinda like powershell), right inside the script, without external help. supposed to have 32bit and 64bit executables and target wide range of .net versions.
KiXnet is also supposed to have ability to compile scripts.

for now, 1.0 is only planned to provide full kixtart language support and compatibility with kixtart 4.6x branch

0.9 version tells that it's not officially in beta state yet.
this version was build targeting .net 2.0

what ya guys think?
rude? blasphemous? cool?

Thanks to Shane Ptomey for coding the macro's
and my wife Sara Nieminen for patiently giving me time to work on my obsession.

KiXnet and test scripts are attached.


Arend_
(MM club member)
2012-11-26 09:49 AM
Re: KiXnet first public release

Very cool, something I've been waiting for Ruud to do for years now.
One question though, does it remain "normal" kix functionality when there are no .Net libraries installed on the client systems?


AllenAdministrator
(KiX Supporter)
2012-11-26 10:17 AM
Re: KiXnet first public release

Awesome work Lonk. My deepest apologies for not helping. My intentions were good, but so was business. Unfortunately that didn't leave much time for anything else. I'm looking forward to trying this out. \:\)

AllenAdministrator
(KiX Supporter)
2012-11-26 10:46 AM
Re: KiXnet first public release

What is the minimum requirements to run this? .net ver ##?

LonkeroAdministrator
(KiX Master Guru)
2012-11-26 03:28 PM
Re: KiXnet first public release

.net 2.0 was the chosen target. with 4.0 would have been way easier task but that would have just been pretty much unusable, imo.

Arend, the code won't run on system without .net, sorry.


ShaneEP
(MM club member)
2012-11-26 04:10 PM
Re: KiXnet first public release

Awesome! Sorry I didn't have time to help more once school started back.

LonkeroAdministrator
(KiX Master Guru)
2012-11-26 04:53 PM
Re: KiXnet first public release

you did plenty. and as it's out there now, you get to do more ;\)

ShaneEP
(MM club member)
2012-11-26 05:29 PM
Re: KiXnet first public release

The included test.kix file seems to bomb out at the following section....I thought maybe because the C:\users folder didnt exist, but changed it to c:\windows and still nothing.

 Code:
"kixtart has dir. kixnet also has getfiles:"
for each $file in getfiles("c:\windows",0) ; non-recursive option
 ? $file
next

This is on a Windows XP SP3 machine. It has up to .Net 4.0 installed.


LonkeroAdministrator
(KiX Master Guru)
2012-11-26 05:38 PM
Re: KiXnet first public release

uhm. yea, forgot about that. I need to recode around well known "MS bug"

shall be making a new build after hours today.


ShaneEP
(MM club member)
2012-11-26 05:48 PM
Re: KiXnet first public release

I think there may be a array handling problem somewhere that it causing it to crash on all the For Each loops. It seems to not be the call of the function that is killing it, but rather the attempted enumeration of the results.

If I run this code...It shows just 1234, and not the zero.

 Code:
$testarr = "0","1","2","3","4"
for each $num in $testarr
  ? $num
next

CORRECTION: It's not seeing the list as an array. It's just assigning the first value "0" to $testarray, and then displaying the rest to the console. The For Each just bombs without displaying anything.


LonkeroAdministrator
(KiX Master Guru)
2012-11-26 06:22 PM
Re: KiXnet first public release

dang dang. that don't make no sense.
have to do some debug on it.


LonkeroAdministrator
(KiX Master Guru)
2012-11-27 04:08 AM
Re: KiXnet first public release

after some hours debugging, the for each seems to be working correctly.
my head is spinning trying to debug my debug output :P

the workaround for the getfiles is posted everywhere, like: http://www.codeproject.com/Articles/38258/How-to-Get-a-List-of-Files-and-Folders-Without-Dir

funny thing is, microsoft doesn't still see the issue here and all coders end up using all sort of workarounds to fix the software giants shortcomings.

anyhow, there is an issue with array declaration handling as you noted. I will try to get this sorted out as it should be a rather simple thing to fix.


LonkeroAdministrator
(KiX Master Guru)
2012-11-28 03:39 AM
Re: KiXnet first public release

did the array thing. took a while longer than thought.
I have come to hate c# even more with all this "Object of type 'System.Object[]' cannot be converted to type 'System.Int32[]'." crap \:\(

but, if this means kixtart as a language lives on, I will keep on fighting the crap :P


ShaneEP
(MM club member)
2012-11-28 04:23 AM
Re: KiXnet first public release

.ToInt32() ;\)

AllenAdministrator
(KiX Supporter)
2012-11-28 04:50 AM
Re: KiXnet first public release

I ran into that with something I was messing with too.. How did you fix it?

LonkeroAdministrator
(KiX Master Guru)
2012-11-28 05:29 AM
Re: KiXnet first public release

testing what the value actually is and casting to it.
more troublesome is "system.int[]" can not be converted to system.object[]"


LonkeroAdministrator
(KiX Master Guru)
2012-11-29 12:54 AM
Re: KiXnet first public release, second build

ok, inline array declaration fixed and foreach fixed.
lots of buggies seem to still exist, like vartypename() seems to eagerly return object \:\(



It_took_my_meds
(Hey THIS is FUN)
2012-11-29 02:35 AM
Re: KiXnet first public release, second build

This is fantastic and exciting Lonk! I would like to give feedback on inconsistencies between KiXtart and KiX.Net. Is there currently a method debugging scripts with KiX.Net? Are you planning to open source the code once it is finished?

LonkeroAdministrator
(KiX Master Guru)
2012-11-29 03:02 AM
Re: KiXnet first public release, second build

there is a debugger but for now it is geared towards handling debugging internals for my sake.
not sure if kixnet will ever get kix like debugger which always struck me as useless.


It_took_my_meds
(Hey THIS is FUN)
2012-11-29 04:16 AM
Re: KiXnet first public release, second build

Thanks. For what it is worth, I really do think there is a need for a debugger of some sort and I certainly use the current debugging functionality quite a bit. I have some very large scripts (one of which is 16,000+ lines) and beyond a certain size, print statements become impractical.

Anyway, I know you've put a whole lot of effort into this and I only want to encourage you further. It would be good to know the syntax for accessing the .Net framework if you have implemented it.


LonkeroAdministrator
(KiX Master Guru)
2012-11-29 02:19 PM
Re: KiXnet first public release, second build

in output .net replaces $ with consolekeyinfo?

open() crashes instead of erroring, will fix today

will look into getfiles() as it also affects dir()
btw, getfiles works fine if you run it as administrator...


LonkeroAdministrator
(KiX Master Guru)
2012-11-30 12:31 AM
Re: KiXnet first public release, 3rd build

fixed erroring for open()

LonkeroAdministrator
(KiX Master Guru)
2012-11-30 01:40 AM
Re: KiXnet first public release, 3rd build

can someone try some kixforms script on it?
.net is broken on my laptop, so can't really debug my com-handling at all :P


It_took_my_meds
(Hey THIS is FUN)
2012-11-30 02:06 AM
Re: KiXnet first public release, 3rd build

Sorry it doesn't work for me.

 Code:
? "createobject kixforms: "
$kixforms = CreateObject("Kixtart.Form")
? "show form:"
$kixforms.visible = 1
@error " " @result " " @serror ?

gives

 Code:
createobject kixforms:
show form:Object of type 'System.String' cannot be converted to type 'System.Object[]'.
unrecoverable internal error occured while Executing the script.
Object reference not set to an instance of an object.


 Code:
? "createobject kixforms: "
$kixforms = CreateObject("Kixtart.Form")
? "show form:"
$kixforms.show()
@error " " @result " " @serror ?

gives

 Code:
createobject kixforms:
show form:unrecoverable internal error occured while Executing the script.
Unable to cast object of type 'System.Object[]' to type 'System.Int32[]'.


 Code:
? "createobject kixforms: "
$kixforms = CreateObject("Kixtart.System")
@error " " @result " " @serror ?
? "create form:"
$form = $kixforms.Form
@error " " @result " " @serror ?
? "show form:"
$forms.show()
@error " " @result " " @serror ?

gives

 Code:
createobject kixforms: 0  The operation completed successfully

create form:unrecoverable internal error occured while Executing the script.
Exception has been thrown by the target of an invocation.


LonkeroAdministrator
(KiX Master Guru)
2012-11-30 02:34 AM
Re: KiXnet first public release, 3rd build

k, thank you sir.

LonkeroAdministrator
(KiX Master Guru)
2012-11-30 03:57 AM
Re: KiXnet first public release, 3rd build

btw, do you have both kixforms classic and the .net versions installed?
I only have classic and that is what is causing me pain. .net doesn't like to create com objects that are not manifests, as in, it seems to HATE real com.


It_took_my_meds
(Hey THIS is FUN)
2012-11-30 04:08 AM
Re: KiXnet first public release, 3rd build

I just rebuilt my computer and only have classic installed at the moment, although I can install kixforms.net if you like. I haven't instantiated a COM object in .NET for a long time but I don't recall having issues with it when I did. I was however using VB.Net which has a CreateObject function.

LonkeroAdministrator
(KiX Master Guru)
2012-11-30 04:24 AM
Re: KiXnet first public release, 3rd build

yea, in vb it is different.
object someobjectHandle = Activator.CreateInstance(objType);

is what is supposed to work in c#, and like with you, you get object created fine.

you could try:
 Code:
? "createobject kixforms: "
$kixforms = CreateObject("Kixtart.System")
@error " " @result " " @serror ?
"create form:"
$form = $kixforms.Form()
@error " " @result " " @serror ?
"show form:"
$form.show()
@error " " @result " " @serror ?


made form creation a method call and fixed your typo with the form(s)

why that causes accessviolation exception on my system I have no idea and again, the only way to fix a corrupted .net in win7 is a reinstall.


It_took_my_meds
(Hey THIS is FUN)
2012-11-30 04:31 AM
Re: KiXnet first public release, 3rd build

Unfortunately, I still get the same error with the code you suggested.

A translation engine gave me this as the equivalent of CreateObject in C#
 Code:
object adoConn = Interaction.CreateObject("ADODB.Connection")


LonkeroAdministrator
(KiX Master Guru)
2012-11-30 05:09 AM
Re: KiXnet first public release, 3rd build

interaction? in what namespace that would be?

I was checking my old code and I even tried with winapi calls and I end up with error 87 or accessviolation. and the only library that keeps failing on me was kixforms by my notes \:\)


It_took_my_meds
(Hey THIS is FUN)
2012-11-30 05:14 AM
Re: KiXnet first public release, 3rd build

Some Google-fu came back with Microsoft.VisualBasic.Interaction. I figure you could use that from C# if you reference the Microsoft.VisualBasic assembly?

LonkeroAdministrator
(KiX Master Guru)
2012-11-30 01:52 PM
Re: KiXnet first public release, 3rd build

reading this stuff, remembered that kixnet is multithreaded.
so that is something for the coming releases.
starting and controlling your own threads.


It_took_my_meds
(Hey THIS is FUN)
2012-12-01 05:52 AM
Re: KiXnet first public release, 3rd build

Sounds great!

ShaneEP
(MM club member)
2012-12-01 08:46 PM
Re: KiXnet first public release, 3rd build

Ran thru the test.kix script again. Most works now. There are still some bugs though.

The line...
 Code:
call @ScriptDir+"\test_call.kix"
Produces message "Exception has been thrown by the target of an invocation.
call to unexisting script file
on script line:1 char position:1
Hit Enter to quit"
even thought the @scriptdir is populating correctly, and the test_call.kix file exists.

These lines...
 Code:
$files = getfiles("c:\windows",0)
? "ubound: "+ubound($files)
Produces message "Exception has been thrown by the target of an invocation.
Array does not have that many dimensions.
on script line:2 char position:27
Hit Enter to quit"

And of course the kixforms section fails. It gets past the createobject line, but bombs out on the .Show() line.


ShaneEP
(MM club member)
2012-12-01 08:50 PM
Re: KiXnet first public release, 3rd build

Also, are the SetOption properties supposed to work?

 Code:
SetOption("WrapAtEOL","On")
Produces "Exception has been thrown by the target of an invocation.
Index and length must refer to a location within the string.
Parameter name: length
on script line:3 char position:1
Hit Enter to quit"

And the @ScriptDir might have a problem after all. It is cutting off after about half the path.


LonkeroAdministrator
(KiX Master Guru)
2012-12-02 12:16 AM
Re: KiXnet first public release, 3rd build

so, @scriptdir, ubound() and setoption()?

was implementing the .net part... I guess I could put that on hold before I get these fixed ;\)


[edit1]
scriptdir seems to be returning exe dir for me.

[edit2]
yea, as I didn't check the macro-code, scriptdir is indeed faulted...


LonkeroAdministrator
(KiX Master Guru)
2012-12-02 12:53 AM
Re: KiXnet first public release, 4th build

scriptdir fixed in this build.

ShaneEP
(MM club member)
2012-12-02 01:08 AM
Re: KiXnet first public release, 4th build

Who wrote those macros anyways...

LonkeroAdministrator
(KiX Master Guru)
2012-12-02 01:14 AM
Re: KiXnet first public release, 4th build

some community college dude? ;\)

LonkeroAdministrator
(KiX Master Guru)
2012-12-02 01:19 AM
Re: KiXnet first public release, 4th build

the setoption can't be the cause of your error.
what was your next line?


ShaneEP
(MM club member)
2012-12-02 01:21 AM
Re: KiXnet first public release, 4th build

This is the entire script...
 Code:
setoption("wrapateol","on")

get $
And it says this...
"Exception has been thrown by the target of an invocation.
Index and length must refer to a location within the string.
Parameter name: length
on script line:1 char position:27
Hit Enter to quit'


ShaneEP
(MM club member)
2012-12-02 01:25 AM
Re: KiXnet first public release, 4th build

The call using the scriptdir now works. The "use list" command in the test_call.kix file is bombing however.

LonkeroAdministrator
(KiX Master Guru)
2012-12-02 01:44 AM
Re: KiXnet public alpha release, 5th build

figured out the cause for the setoption error, this build will not do that no more.
but, it seems to wrap all the time \:\(

and might have found another bug while fixing this one \:\)
and looking at your post, you have come to be victim of that bug too...


It_took_my_meds
(Hey THIS is FUN)
2012-12-02 12:25 PM
Re: KiXnet public alpha release, 5th build

I hope I'm not jumping the gun on this (because KiXnet isn't even in beta yet) but my mind has been pondering the consequences of what your aiming for - an interpreter that completely supports the current KiXtart syntax but can be expanded in ways that many of us have long hoped for.

I have a bit of a wish list that I've been contemplating... However to keep it just to my my main two wishes (apart from the already included .NET support), here they are.

Firstly, I would love it if you could hook up scripts to receive events. I'm not entirely sure how you would would choose to implement it, but I figure you could mark functions to handle events in a similar syntax to VB.NET. I figure you could also possibly put in something like a "Wait" command that would put the script into a mode to wait for events instead of finishing.

The second wish would be passing by reference - possibly by adding a ByRef marker in function parameters. In each case it would be possible to support current KiXtart syntax but expand it for the new functionality.

Sorry if you consider these suggestions too premature, I know there is much work still to be done, however I'm sincerely hoping this thing takes off and I have high hopes!


LonkeroAdministrator
(KiX Master Guru)
2012-12-02 03:47 PM
Re: KiXnet public alpha release, 5th build

yes, on my list too.
I'm not sure about the byref. internally everything is supposed to byref already. so reference handles would be handles to reference handles doable, but not sure I see the point anymore ;\)

eventhandlers and multithreading have been high on my list for years.
as well as handling binary data and files.

as Ruud is still supporting current kix fixing and implementing now and then, my aim is to let him have control of kixtart. and as long as it is plausible, kixnet would be fully compatible with kixtart.

honestly speaking, I would have not even started this adventure if there would have been a way to co-develop kixtart itself, but as I didn't get a chance, here we are. and that's the main reason for this project. to take kixtart language to par with current needs.


LonkeroAdministrator
(KiX Master Guru)
2012-12-02 03:57 PM
Re: KiXnet public alpha release, 5th build

and on the alpha stage... I coded 99% of the code in the spring and finished it just week ago. this is also when I also broke some functionality and this is why we are in public alpha instead of beta.

once I fix all the commands that worked and no longer do, we shall have a beta release.
not sure how should I handle the debug stuff as console debugging the way kixtart does it was never helpful to me. on the other hand writing a gui debugger would kick the release date back for at least a week (as in work hours)


LonkeroAdministrator
(KiX Master Guru)
2012-12-02 04:37 PM
Re: KiXnet public alpha release, 5th build

Shane, I can't get the use list to misbehave...

you have mapped drives?
what's the error/exception you get?


ShaneEP
(MM club member)
2012-12-02 08:11 PM
Re: KiXnet public alpha release, 5th build

Perhaps it's more of a problem with the '?'.

This code simply pops open a console, and then closes...never displays anything
 Code:
? use list
get $

This code opens a console and displays the drives (in a different format than kix however) and then waits for a key to be hit as expected.
 Code:
use list ?

get $


It_took_my_meds
(Hey THIS is FUN)
2012-12-02 11:18 PM
Re: KiXnet public alpha release, 5th build

A GUI debugger would be a dream come true! I'm surprised you think it would take a week, I would have thought it would be much more difficult and longer task.

LonkeroAdministrator
(KiX Master Guru)
2012-12-03 02:34 AM
Re: KiXnet public alpha release, 5th build

Shane, that's good info. I think I know what's going on in there. most likely use causes the next token to be skipped. in this case either the linefeed or get.
now if I had a working machine to fix it...
will need to start rebuilding one of my vista laptops as this one is totally unworkable in the devel now.

kinda wish the devel server would be usable :p



LonkeroAdministrator
(KiX Master Guru)
2012-12-03 02:36 AM
Re: KiXnet public alpha release, 5th build

gui debugger taking a week. yea. it isn't all that hard. most of the time is about UI.
now, I will not have that week this year so debugger functionality might be a matter of later releases.


LonkeroAdministrator
(KiX Master Guru)
2012-12-03 03:05 AM
Re: KiXnet public alpha release, 6th build

found a way to open the project on another machine.
still can't run to test.

try this one, the use list thing should be fixed.


LonkeroAdministrator
(KiX Master Guru)
2012-12-03 05:48 PM
Re: KiXnet public alpha release, 6th build

found a computer to test on:
a) the use list works as I wrote it. but the list is incomplete. doesn't list non-drive mappings.
b) the com-object part... now I was able to see what actually errors. there is object array and int array mismatch thingie going on, as well as something more profound and am afraid that kixforms, even though it says threadinmode both, it actually only supports STA applications.

I will remove that kixforms stuff from the test.kix for now.


ShaneEP
(MM club member)
2012-12-03 05:49 PM
Re: KiXnet public alpha release, 6th build

Here a couple more bugs for you.

Trying to display a variable outside of where it was declared causes the following error.

Also...the CD command cuts off half the current dir much like the @ScriptDir did before you fixed it.
 Code:
cd "c:\nonexistingdir"

if 1<>2
 dim $b
 $b = 3
 ? "b: "+$b
endif

? "b: "+$b

get $

"CURRENT DIR:C:\Documents and Settings\Shane

b: 3
Exception has been thrown by the target of an invocation.
Object reference not set to an instance of an object.
on script line:9 char position:8
Hit Enter to quit"

The wrapateol seems to be working. However it is adding 2 line feeds as shown below.

"rather long text output coming your way just to see that the text wrapping works

as expected or what not if that was the case of it."

The GoSub is also failing. It simply displays the sub name to the console and continues on without actuall running the sub-routine.
 Code:
gosub "testsub"
? "after sub"

get $

:testsub
? "in sub"
return
Produces this on the console...
"testsub
after sub"


LonkeroAdministrator
(KiX Master Guru)
2012-12-03 05:53 PM
Re: KiXnet public alpha release, 6th build

cool, thanks for these. I have some work to do still ;\)

Glenn BarnasAdministrator
(KiX Supporter)
2012-12-04 09:11 PM
Re: KiXnet public alpha release, 5th build

Why is the test server not usable? You both have logons, VS2010 is loaded, and you have the NDR docs there from all of us..

I can't create Win-8 VMs (yet) until the VSphere 5.1 upgrade is complete, but I have a Win-8 physical box, a couple of Win-7 VMs, and can spin up Server 2K8 systems for you as well. Next month, I could even provide a virtual VM 5.1 environment..

Glenn


LonkeroAdministrator
(KiX Master Guru)
2012-12-05 02:43 AM
Re: KiXnet public alpha release, 5th build

you busy?

LonkeroAdministrator
(KiX Master Guru)
2012-12-06 03:38 AM
Re: KiXnet public alpha release, 5th build

cool, now we are talking.

LonkeroAdministrator
(KiX Master Guru)
2012-12-07 05:04 AM
Re: KiXnet public alpha release, 5th build

ok, I don't know why... can't seem to find anything with google, but writing to console is autowrapped.
and I can't turn that off!!!

anyways, fixing the gosub showed me that return didn't work right.
now need to figure that one out \:\)


LonkeroAdministrator
(KiX Master Guru)
2012-12-07 01:57 PM
Re: KiXnet public alpha release, 5th build

Don't have time to fix them this morning but both exit and return logics are bit faulty...
maybe during lunch break...


It_took_my_meds
(Hey THIS is FUN)
2012-12-07 02:14 PM
Re: KiXnet public alpha release, 5th build

Out of curiosity, is KiXnet done in a similar way to SteelKix or are they radically different approaches? Also, am I right in understanding that all KiXtart functions and macros have been ported to KiXnet, but that currently a number of them aren't working correctly?

Anyway, keep up the fantastic work Lonk. I got excited when I saw that you were doing this as not only are you the most active KiXtart.org member; your many entries and wins at KiXgolf competitions have always impressed me; not only with your intimate knowledge of the obscurities of KiXtart code, but also with your persistence in coming up with something highly succinct and capable. If anyone can fully implement current KiXtart code behaviour and then take it further, it is you!

p.s I would love a chance to read the code at some point. I also please ask at this stage that you opensource it. However if you are not up for that while you're developing it, then at least opensource it when/if you desire you longer want to work on it. I'm feeling rather bitten by my large time investments in KiXforms scripts only to have the creator leave us with no possible way to expand it or fix problems with it... I hoping down the line that I may be able to eventually replace KiXforms with native .NET forms in KiXnet!


LonkeroAdministrator
(KiX Master Guru)
2012-12-07 03:19 PM
Re: KiXnet public alpha release, 5th build

yea, kixforms requiring .net 1.1 to run has been a bitter part lately.
having done some development on kf.net myself, I would love the chance to retarger it for something newer and maybe even improve it.

I am not totally sure but think steelkix was build around a language framework where you give rules how things should behave and the interpreter does the heavy lifting.
I was planning in the beginning of doing that too, but because of the free nature of kixtart language, I ended up going other way. Even though I took out one layer of code processing in the earlier builds, I still think kixnet is more complex than kixtart itself. And thus I don't believe steelkix and kixnet having really anything in common.

and yes, I wrote all of it. might be something that isn't working right (as proven) as when I wrote it, I went through all of it in couple months with little sleep or social interaction. and I am ready grateful that Shane helped me with the macro's, even though they are not the hardest part, saved my fingers a lot \:\)

and like said before, debug isn't there. that was a choice in the beginning to save some time and make a compatible engine asap. I have debugging code but I wipe it out when I publish the build because it doesn't work the same as normal user would expect ;\)
another not working bit is sendmessage() as that is not supported by OS since XP sp2 (iirc). so I didn't enable it.

Open sourcing is definitely a choice. just need to, when I have time, go and compare different licensing options there are.