AutoHotkey Community

It is currently May 27th, 2012, 12:53 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: August 10th, 2011, 11:18 am 
Anonymous wrote:
You'll understand if you have a file downloaded a thousand times a day and get complained by the hosting company to upgrade the plan which charges extra fees.
Care to share which program it is? I'd like to try it myself.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 10th, 2011, 7:30 pm 
Offline
User avatar

Joined: November 2nd, 2008, 4:23 pm
Posts: 2906
Location: 127.0.0.1
HotKeyIt, I've thought about rewriting all AutoHotkey functions in C#. There would then be a converter that translates the AutoHotkey code into .NET compatible code and includes any functions needed by the script. All the variables could be stored in a global associative array and each function with its own scope can have its own set of variables.

I realize that IronAHK is/was being worked on but an interpreter sounds much more difficult to implement than a converter.

I think this is very practical because all someone would need to do is convert a command or function to its C# equivalent. Anyone with more C# knowledge could work on the converter/parser separately from the functions. So if someone has 30 minutes every week to spend on it, that can actually be a big help.

For example, SubStr()
Code:
public static string SubStr(string _String, string _StartingPos)
{
    int StartingPos = 0;
    Int32.TryParse(_StartingPos, out StartingPos);
    return _String.Substring(StartingPos);
}

public static string SubStr(string _String, string _StartingPos, string _Length)
{
    int StartingPos = 0, Length = 0;
    Int32.TryParse(_StartingPos, out StartingPos);
    Int32.TryParse(_Length, out Length);
    return _String.Substring(StartingPos, Length);
}
It took like 5 minutes to write that in VS and it's good enough quality for a project like this. Like I said, the converter has the hardest job and even that isn't that bad. If you look at the above functions, about half the lines above just convert strings to integers.

The limitations of something like this would be that it has to be compiled using a C# compiler and that I don't see dynamic functions being possible (exception: class members).

Advantages would be speed, exe size and (possibly) cross-platform.

_________________
aboutscriptappsscripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 10th, 2011, 11:52 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Frankie wrote:
I realize that IronAHK is/was being worked on but an interpreter sounds much more difficult to implement than a converter.
I believe IronAHK is/contains a compiler, not an interpreter. Also,
polyethene wrote:
Tobias has been working on another important module - the smart compiler. Currently IronAHK compiles scripts with dynamic links to IronAHK.Rusty.dll (command library) and IronAHK.Scripting.dll (script host). [...] The smart compiler extracts only the bare minimum from the DLLs and rewrites the opcodes of the compiled script to embed them directly. The benefit is a completely standalone executable that is the smallest size possible.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 11th, 2011, 12:57 am 
Offline
User avatar

Joined: November 2nd, 2008, 4:23 pm
Posts: 2906
Location: 127.0.0.1
Ahh. Thanks for the info.

_________________
aboutscriptappsscripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 11th, 2011, 4:30 pm 
Offline
User avatar

Joined: May 10th, 2007, 10:54 am
Posts: 649
Location: .switzerland
@Frankie & Lexikos
Quote:
I think this is very practical because all someone would need to do is convert a command or function to its C# equivalent.

This is exactly what IA does.
An Lexxer/Parser is needed in any case.

Part of IA is the Rusty.dll. This dll is a collection of C# Functions Equivalent to the AHK Build-in Functions. There are some missing Features, but for Windows most Commands/Functions work as expected.

Now, to create C# which calls the approperiate AHK Build-in Commands, you need a full blown compiler.
IA parses the Skriptcode, and creates an CodeDOM representation - (This is an AST with full type info)

I'm currently working on a new Version of the Parser --> AST/CodeDOM Generator to avoid using a Dictionary like it is done in AHK/IA.
Instead, I try to create real Fields/Variables like it would be done if you write c# code ad-hoc.
This is possible because I use a Master Class, where as Globals are Master-Class Fields. User Defined Classes are nested in the Master Class, so Access to Methods/Globals defined in the Masterclass works.
All Build-In Functions/Properties are added as Members to this Master Class too.

No need for a Dictionary.

Quote:
The limitations of something like this would be that it has to be compiled using a C# compiler and that I don't see dynamic functions being possible (exception: class members).

Dynamic functions aren't a problem (delegates) - I think I can support anonymous Methods / Lambdas either.

The most problematic part are dynamic Variables. They will get a very limited support. It's possible to use Reflection to get most Variables, but not all of them; eg: A local Variable in a Method will loose it's identifier info after compilation.

so long

BTW:
To stay on Topic: IA has a Compiler (smart compiler) which just adds those Methods from Rusty to the compiled assembly which are referenced.
This is IMHO not that important for .NET Assemblies as they are very thiny (but require the fat .NET Framework installed)

_________________
http://securityvision.ch
AHK 2D GAME ENGINE


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 1st, 2012, 7:31 pm 
Offline

Joined: January 28th, 2006, 1:23 am
Posts: 89
Location: Germany
We don't need #exclude. We need the compiler to find out itself which libraries are needed. Also we need the compiler to figure out which functions/variables that you created in the script are not being used and (ask if) remove them if not. I included a lot of functions in my script to only use one or two.


Last edited by CircuitryMaker on January 2nd, 2012, 11:52 pm, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 1st, 2012, 7:50 pm 
Offline
User avatar

Joined: February 28th, 2011, 7:28 pm
Posts: 625
Location: Germany
The problem with that might be the dynamic functionalities AHK has: we don't have Eval(), but you can dynamically call functions (even built-in), use dynamic variables etc.

_________________
RECOMMENDED: AutoHotkey_L
Image
github - ImportTypeLib
Win7 HP SP1 32bit | AHK_L U 32bit


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2012, 11:52 pm 
Offline

Joined: January 28th, 2006, 1:23 am
Posts: 89
Location: Germany
Addition to my previous post: This happens a lot when you include a script, most functions go unused.

Quote:
but you can dynamically call functions (even built-in), use dynamic variables etc.
Das könnte man deaktivieren.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group