AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

v1.0.47 released: Stdlib, RegisterCallback, NumGet/Put
Goto page Previous  1, 2, 3, 4  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Announcements
View previous topic :: View next topic  
Author Message
Thalon



Joined: 12 Jul 2005
Posts: 633

PostPosted: Thu Nov 22, 2007 3:45 pm    Post subject: Reply with quote

So.. I hope the next release will take some time.
I had some work to merge the changed parts into the existing german translation Laughing

Just joking.
Thanks for this new version!

Thalon
_________________
AHK-Icon-Changer
AHK-IRC
deutsches Forum
Back to top
View user's profile Send private message
ryebread



Joined: 11 Dec 2006
Posts: 4

PostPosted: Sun Dec 23, 2007 12:39 am    Post subject: Reply with quote

big release Chris, congratulations!
thx Very Happy
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Sun Mar 09, 2008 3:19 pm    Post subject: Reply with quote

Here are the changes for v1.0.47.06:

Fixed crash when a function was called concurrently with an optional ByRef parameter omitted by one thread but not omitted by the other. [thanks DeathByNukes]

Fixed "Menu, Tray, MainWindow" to enable the menu items in the main window's View menu. [thanks lexiKos]

Added dynamic function calling. [developed by lexiKos]
Description: A function (even a built-in function) may be called dynamically via percent signs. For example, %Var%(x, "fox") would call the function whose name is contained in Var. Similarly, Func%A_Index%() would call Func1() or Func2(), etc., depending on the current value of A_Index. The called function's definition must exist explicitly in the script, either via #Include or a non-dynamic call to a library containing the function. If the function does not exist -- or if the wrong number or type of parameters is passed to it -- the expression containing the call produces an empty string.


Last edited by Chris on Mon Mar 10, 2008 12:22 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Sun Mar 09, 2008 3:23 pm    Post subject: Reply with quote

Thanks for the update.. and nice to see you back in action Mr.Chris
Dynamic function Calling! Ooh.. Thanks lexiKos Very Happy
Back to top
View user's profile Send private message Send e-mail
daonlyfreez



Joined: 16 Mar 2005
Posts: 949
Location: Berlin

PostPosted: Sun Mar 09, 2008 5:04 pm    Post subject: Reply with quote

Excellent! Especially the dynamic function calling Cool

And, also from me: good to see you are still around, Chris. I hope you can keep up the good work somehow. Smile
_________________
mirror 1mirror 2mirror 3ahk4.me • PM or
Back to top
View user's profile Send private message
Tuncay



Joined: 07 Nov 2006
Posts: 1886
Location: Germany

PostPosted: Sun Mar 09, 2008 6:06 pm    Post subject: Reply with quote

Oh great thx, long waited internal support of dynamic function call. Go(o)d to see you back, Chris.

lexikos, your`re great!!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Mon Mar 10, 2008 6:19 am    Post subject: Reply with quote

Quote:
lexikos, your`re great!!
...but not infallible. Wink Expect a bug-fix release some time in the future. I've "submitted" the fix already, but until AutoHotkey is updated, avoid doing things like this:
Code:
f = ; empty...
%f%() ; crashes.
VarSetCapacity(f, 255, Asc("f")) ; too long...
%f%() ; crashes.

Chris wrote:
Similarly, Func%A_Index%() would call the function whose name is stored in the specified array element.
I think this is misleading: "Func" actually forms part of the name. Func%A_Index%() calls Func1(), Func2(), etc. and does not touch the variables (array elements) named Func1, Func2, FuncN...

I'm not sure it is worth mentioning in the help file, but failure can be detected by taking advantage of the difference between standalone assignment and multi-statement expressions:
Code:
f = InvalidFunc

; Standalone assignment: if the dynamic call fails,
;   the expression results in a blank value, which is assigned.
result := "FAIL" ; This is overwritten.
result := %f%()

MsgBox %result%

; Multi-statement expression: if the dynamic call fails,
;   the second assignment never even occurs.
result := "FAIL", result := %f%()

MsgBox %result%
Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Mon Mar 10, 2008 12:21 pm    Post subject: Reply with quote

lexiKos wrote:
Chris wrote:
Similarly, Func%A_Index%() would call the function whose name is stored in the specified array element.
I think this is misleading: "Func" actually forms part of the name. Func%A_Index%() calls Func1(), Func2(), etc. and does not touch the variables (array elements) named Func1, Func2, FuncN...
Thanks. I've fixed the documentation.
Back to top
View user's profile Send private message Send e-mail
Rajat as guest
Guest





PostPosted: Mon Mar 10, 2008 2:43 pm    Post subject: Reply with quote

Thanks for the update Chris and lexiKos!
and Chris, we all missed you.
I'm glad to see you back.
Back to top
Zoulou
Guest





PostPosted: Tue Mar 11, 2008 5:13 pm    Post subject: Reply with quote

Exactly the same as Rajat.
Just a little noob question : please Chris, do you continue to work on V2 of AHK, and, if it is the case, do you think that we will see it in few/a lot of months ?
Thanks again Very Happy Very Happy Very Happy
Back to top
toralf not loged in
Guest





PostPosted: Wed Mar 12, 2008 7:49 am    Post subject: Reply with quote

Hi,
And thanks a lot for the dynamic function calls. Even that I stoped coding, I still have an eye on AHK.
Greetings.
Back to top
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Thu Mar 13, 2008 1:25 pm    Post subject: Reply with quote

Thanks lexikos. Finaly offical recognition for your valuable work.
_________________
Back to top
View user's profile Send private message
williamsharkey



Joined: 06 Oct 2007
Posts: 49
Location: Philadelphia

PostPosted: Thu Mar 13, 2008 2:20 pm    Post subject: Reply with quote

With dynamic function calling, the possibilities are mind boggling. Shocked Shocked Shocked
Back to top
View user's profile Send private message Visit poster's website
TL



Joined: 01 Nov 2006
Posts: 20

PostPosted: Thu Mar 13, 2008 4:20 pm    Post subject: Validating function's name without invoking it? Reply with quote

I'm evaluating whether to switch to the new dynamic function method on my existing project. Some questions:

If I want to validate that a string contains a valid function name without executing the function at that time (for example, a function is registered in some way at program startup), is it best to still use the RegisterCallback function to see if an error occurs or is there a way that is quicker or doesn't depend on the number or type of parameters?

Also, if I use the Register Callback to validate the function's name should I then just use the old style DllCall method to invoke the function or is there an performance gain by using the new dynamic function method?

TL
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Thu Mar 13, 2008 11:48 pm    Post subject: Reply with quote

You could use RegisterCallback to validate the function, then free the callback and use dynamic function calls. RegisterCallback fails for built-in functions or user-defined functions with ByRef parameters, while dynamic function calls support both.

Dynamic function calls require the function to be looked up every call. AutoHotkey searches the function list sequentially, so speed may vary depending on the order of functions: Explicitly included user-defined functions are first, followed by library and built-in functions (depending roughly on the order such functions are referenced in script.)

My benchmarks show dynamic function calls are roughly five times faster than DllCall when used with the first function in the script. I recommend benchmarking some scenarios typical to your script before deciding.

If your script would benefit from being able to pass strings to the callback rather than numbers or return values ByRef, dynamic function calls are the way to go.
Quote:
or is there a way that is quicker or doesn't depend on the number or type of parameters?
I am nearly finished a function library for facilitating run-time code generation. It would typically be slower to generate the code to call a function, but once generated it would perform the same as a regular function call. LowLevel could potentially be used to validate the number and type of parameters.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Announcements All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
Jump to:  
You cannot post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group