twitchyliquid64 Posted May 6, 2011 Share Posted May 6, 2011 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 More sharing options...
jvanegmond Posted May 6, 2011 Share Posted May 6, 2011 (edited) Try the file thats cryptically called variable_table.cpp. The parser is a left-to-right parser which implements shunting yard, among other things. Edited May 6, 2011 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
Valik Posted May 6, 2011 Share Posted May 6, 2011 Magic. Link to comment Share on other sites More sharing options...
twitchyliquid64 Posted May 6, 2011 Author Share Posted May 6, 2011 (edited) 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 May 6, 2011 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 More sharing options...
twitchyliquid64 Posted May 6, 2011 Author Share Posted May 6, 2011 (edited) 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 May 6, 2011 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 More sharing options...
Administrators Jon Posted May 6, 2011 Administrators Share Posted May 6, 2011 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. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
twitchyliquid64 Posted May 7, 2011 Author Share Posted May 7, 2011 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 More sharing options...
Administrators Jon Posted May 7, 2011 Administrators Share Posted May 7, 2011 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. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Mat Posted May 8, 2011 Share Posted May 8, 2011 Since someone has been asking already, I have one question that I've been trying to get from the source code: How do you handle variant casting? I've posted a question on stackoverflow (here) to try and see what systems other people recommend. AutoIt Project Listing Link to comment Share on other sites More sharing options...
Richard Robertson Posted May 8, 2011 Share Posted May 8, 2011 You have to store some indicator of what you are holding. If it matches the destination type, you're done. If it can be converted (based on rules you define), convert it. If it can't, error out. That's how any cast works. Link to comment Share on other sites More sharing options...
Mat Posted May 8, 2011 Share Posted May 8, 2011 Yes, but how would you define the rules? That's the bit I'm interested in. AutoIt Project Listing Link to comment Share on other sites More sharing options...
ProgAndy Posted May 8, 2011 Share Posted May 8, 2011 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 More sharing options...
Mat Posted May 8, 2011 Share Posted May 8, 2011 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. AutoIt Project Listing Link to comment Share on other sites More sharing options...
Richard Robertson Posted May 8, 2011 Share Posted May 8, 2011 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 More sharing options...
Administrators Jon Posted May 8, 2011 Administrators Share Posted May 8, 2011 We made it up as we went along. It still comes back to haunt us. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
James Posted May 8, 2011 Share Posted May 8, 2011 We made it up as we went along. It still comes back to haunt us.Always a good time to renovate. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
twitchyliquid64 Posted May 9, 2011 Author Share Posted May 9, 2011 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 More sharing options...
Richard Robertson Posted May 9, 2011 Share Posted May 9, 2011 (edited) People have been talking about v4 since v3 came out. Edited May 9, 2011 by Richard Robertson Link to comment Share on other sites More sharing options...
trancexx Posted May 9, 2011 Share Posted May 9, 2011 (edited) People have been talking about v4 since v3 came out.I'm curious. Whose suggestion was to edit the post? Manadar's? Edited May 9, 2011 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted May 9, 2011 Share Posted May 9, 2011 I'm curious. Whose suggestion was to edit the post? Manadar's?What did it say earlier? (I forgot) .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now