AutoHotkey Community

It is currently May 27th, 2012, 10:50 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: #define
PostPosted: October 10th, 2006, 10:02 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
How difficult is to implement something similar to C #define directive. This would be very useful, with current AHK syntax.

For instance, we can create better DLL wrappers

Code:
#define SelectObject(hDC, hgdiobj)  DllCall("SelectObject", "uint", hDC, "uint", hgdiobj)

   vs

SelectObject( hDC, hgdiobj )
{
   return DllCall("SelectObject", "uint", hDC, "uint", hgdiobj)
}



In this case first code will execute faster. If you are using number of wrappers this is more pronaunced as you are eliminitating one function call for eatch wrapper.

Next is that if you want to use some DLL wrappers from, lets say, dll X, and you created wrappers for all functions in it, you will have to do something like

#include XWrapper.ahk

before using any function.
So if you used 1 function out of 10, all 10 functions will be imported and compiled. If you creater wrapper using define directive, and place it in the same XWrapper file, above include will acctually include and compile only function u used.

I think this is very imprtant because some of us (PhilHo, Holomind, Shimanov, me ...) are creatting wrappers all the time and we will have database of wrapped API functions larger every day. This will provide much better mechanism to do this.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 11th, 2006, 12:49 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Although some kind of preprocessor/macro support is planned, I like the example and reasons you gave. I'll try to raise the priority of this.

Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 18th, 2007, 11:07 am 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
Can we expect this any time soon in v1?

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 27th, 2007, 11:24 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
I don't think so. Version 2 seems like a higher priority. However, the size of the v2 undertaking makes it tempting to continue making incremental improvements to v1. However, I haven't even had time for that lately.


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

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
I vote to move it to v1 (In your Copious Spare Time)

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 28th, 2007, 5:04 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
Nice suggestion :)

Chris wrote:
I don't think so. Version 2 seems like a higher priority. However, the size of the v2 undertaking makes it tempting to continue making incremental improvements to v1. However, I haven't even had time for that lately.
I'd vote for marking the current release as the latest "stable version" then start making incremental improvements to v1 instead with a warning that compatibility might be broken with each new release for a while ;) . Unless you were thinking of writing v2 from scratch :shock: ... or planning on trying to support two different versions of AutoHotkey :shock: ...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 28th, 2007, 1:28 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Yes, it is planned that v2 will be an entirely separate version than v1. There are several reasons; I seem to remember there was a discussion about it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 29th, 2007, 6:01 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
Chris wrote:
Yes, it is planned that v2 will be an entirely separate version than v1. There are several reasons; I seem to remember there was a discussion about it.
I'll see if I can find the topic then... :)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: sks and 3 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