Jump to content

How does the autoit interpreter do...


Recommended Posts

Hi all,

Been looking through the public bits of the autoit source code, and there are a couple of things I dont understand (probably deriving from my lack of experience with c++)

I was wondering how Autoit Implements...

VARIABLE Lookup and storage:

My guesses is that variables are organised into some sort of ordered linked list, Which is used for lookup. Is this correct?? If not, how is it implemented??

Interrupts:

Functions like HotKeySet can interrupt the execution of the script, calling another function instead. How does autoit do this??

Parser:

Whats the name of the algorithm implemented? Is it the Shift/Reduce Thingy???

Thanks heaps in advance,

-Hyperzap.

@Manadar: I am still studying as well!

ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Link to comment
Share on other sites

Try the file thats cryptically called variable_table.cpp. The parser is a left-to-right parser which implements shunting yard, among other things.

Yes - I have seen variable_table.cpp, what I mean is that I dont understand it, I can see It implements some kind of data structure with pointers to other data structures, which suggests to me that it is a linked list, but then there is more to the story -as some kind of greater than/less than comparision is used (I think), which suggests to me that there is an ordering and lookup system. How this is implemented, what is used as the basis for ordering, what the memory representation actually looks like, is yet to be discovered (assuming of course, that I am right).

Shunting Yard? Really? Its a very LONG implementation. It thought it was an LALR Shift/Reduce Algorithm. Hmmmm.

Any Idea how execution is interrupted? (eg: HotKeySet)??????

Thx.

Edited by hyperzap

ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Link to comment
Share on other sites

Magic.

Indeed. But the human body is magic and medical science has allowed us to take the interesting bits out of it as well.

Edited by hyperzap

ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Link to comment
Share on other sites

  • Administrators

It's shift/reduce. The public source code is almost unrecognizable to what it is like now however. The variable look up table IIRC was a linked list but may be a binary tree now for more speed. But at the most basic level, yeah a linked list.

Link to comment
Share on other sites

It's shift/reduce. The public source code is almost unrecognizable to what it is like now however. The variable look up table IIRC was a linked list but may be a binary tree now for more speed. But at the most basic level, yeah a linked list.

thankyou.

also, how are you doing interrupts? (like when hotkeyset interrupts code execution to run its corresponding function.)???

ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Link to comment
Share on other sites

  • Administrators

They are not really interrupts they are more like "doing something else rather than running a line of script". Before a line of code is run we check if there are any windows messages that need processing - hotkeys appear as one of these messages. So then we just save the state of the script and then recursively execute the hotkey function.

Link to comment
Share on other sites

Yes, but how would you define the rules? That's the bit I'm interested in.

Create a variant-class which will be used to store variables. Implement the operators including automatic conversion. If you don't want to do it from scratch, use COM-Varaints as a basis.

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Create a variant-class which will be used to store variables. Implement the operators including automatic conversion. If you don't want to do it from scratch, use COM-Varaints as a basis.

I've already done that. I have a variant class that overloads the operators and the only thing I need to do is the conversion/casting itself. Of the conversion and casting I have a header defining the type, which is extended by the variant class to include the data.

All I am interested in is the specific process of casting data D from type F to type T, knowing that such a cast is possible, and F != T.

Link to comment
Share on other sites

The rules are what you feel like. This is a pretty common variant rule set.

Can convert to string if it's a string, number, or boolean.

Can convert to a number if it's a number. Can parse string for number if you choose. Can optionally convert booleans to 0s and 1s.

Can convert to a boolean using rules like 0/"" = false, everything else = true.

Arrays can't be converted to anything else except maybe strings if they are character arrays.

Link to comment
Share on other sites

Always a good time to renovate.

It has been a while since a new version of autoit has been released. Autoit v4 has been forshadowed for some time. Is there going to be another version?? if yes what will be included??? how can we contribute??? when will it be released???

If the answer is yes, Im pretty sure there is an army of people who are willing to help out in any way.

ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...