AutoHotkey Community

It is currently May 26th, 2012, 11:02 pm

All times are UTC [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 237 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 16  Next
Author Message
 Post subject:
PostPosted: November 2nd, 2009, 3:20 am 
Offline

Joined: November 30th, 2008, 1:51 pm
Posts: 73
Sean wrote:
I'm feeling rather unfortunate to have to test separately two new big features, Object and Unicode. Anyway, may I ask why you chose the function name StringGet, instead of e.g., StrGet etc? StringGet appears to me rather out of tune with current naming scheme of AHK, either NumGet/NumPut or InStr/SubStr. I'm just becoming concerned/curious about the opinions of Chris and/or Lexikos and/or other developers, under the assumption that someday these big features are incorporated into the official build.

And, personally, I hope characters like ? [ ] disabled in variable names as in AutoHotkey_L.

You are right, I'll change it to StrGet(). In fact, I named it as DerefString() initially, the later I changed it to StringGet(). But StrGet() sounds better.

Is it means in AutoHotkey_L "? [ ]" can not be used in variable names and they have other special meanings? I'm sorry I haven't played with _L so it is unfamiliar for me.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 4:30 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
jackieku wrote:
Is it means in AutoHotkey_L "? [ ]" can not be used in variable names and they have other special meanings?
Right, AutoHotkey_L now supports Object/Array and naturally [] are reserved as the delimiters as in x[y]:=z. And ? was disallowed to remove the conflict with the ternary operator as in x?y:z.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 4:49 am 
Offline

Joined: November 30th, 2008, 1:51 pm
Posts: 73
Sean wrote:
Right, AutoHotkey_L now supports Object/Array and naturally [] are reserved as the delimiters as in x[y]:=z. And ? was disallowed to remove the conflict with the ternary operator as in x?y:z.

I love objects, too. I think I should merge that feature from _L when we found most bugs in Unicode version are fixed. :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 8:09 am 
great! great! keep up the good work!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 1:23 pm 
Offline

Joined: November 30th, 2008, 1:51 pm
Posts: 73
fincs wrote:
Yesterday I ended up forking your version :P

I'm currently trying to get RegExes working with non-ASCII characters.
Currently this is what I have:
  • Fixed IniWrite, it wasn't outputting Unicode files.
  • Asc(), Chr() and Windows 7 fixes (although you fixed them in the latest release).
  • Added A_IsUnicode which returns 1 if the script is running under AutoHotkeyU.
  • UTF-8 was enabled in PCRE although it still doesn't work right.
  • get_compiled_pcre() now uses native Unicode strings and converts to UTF-8 when calling PCRE.
  • Disabled function_order_for_linker_optimization.txt because it was issuing warnings.
  • Added a ReleaseANSI target in the project files although the ANSI versions fails at startup.
PD: I have VC++ 2008 Express.

Hi,

I forgot we always convert the strings from UTF-16 to UTF-8 to use PCRE, so I didn't add PCRE_UTF8 flag because its has some side effects when I write the codes in Perl. (PCRE is Perl Compat... IIRC). However, in our situation it should be used since the AHK scripts are in UTF-16 view.

But what is get_compiled_pcre()? Is it the same purpose with get_compiled_regex()? Why you think you need it to take UTF-16 string as parameter?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 2:01 pm 
Offline
User avatar

Joined: May 5th, 2007, 7:24 pm
Posts: 1240
Location: Seville, Spain
Hi.
The get_compiled_pcre() thingy is a typo, it should be get_compiled_regex().

I made it accept TCHAR strings because of a performance thing: the RegEx string is now only converted to UTF-8 when compiling (*cough* caching).

Anyway, I'm fixing most of the UTF-8 string position <-> TCHAR string position problems and basic RegExMatch() features are working :D.

_________________
fincs
Highly recommended: AutoHotkey_L (see why) (all my code snippets require it)
Formal request to polyethene - I support the unity of the AutoHotkey community
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 2:40 pm 
Offline

Joined: November 30th, 2008, 1:51 pm
Posts: 73
fincs wrote:
Hi.
The get_compiled_pcre() thingy is a typo, it should be get_compiled_regex().

I made it accept TCHAR strings because of a performance thing: the RegEx string is now only converted to UTF-8 when compiling (*cough* caching).

Anyway, I'm fixing most of the UTF-8 string position <-> TCHAR string position problems and basic RegExMatch() features are working :D.

About the performance, it only converts the strings to UTF-8 when compiles the pattern and call pcre_exec(), isn't it? So I have no idea why there are performance gains?

RegExMatch() in the script was not working since I believed it calls RegExMatch function (the same name in the C++ source codes), but it doesn't. :(


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 4:02 pm 
Offline
User avatar

Joined: May 5th, 2007, 7:24 pm
Posts: 1240
Location: Seville, Spain
Your version converts to UTF-8 even when the RegEx is cached.
The caching was also changed to hold native TCHAR strings.

This is how the RegEx stuff works:
  • The RegExMatch() and RegExReplace() script functions make AutoHotkey call the BIF_RegEx() AHK source code function.
  • BIF_RegEx() compiles the RegEx and redirects to the RegExReplace() AHK source function if the user intended to call the RegExReplace() script function, otherwise the matching is done in BIF_RegEx().
  • The RegExMatch() AHK source code function is used for RegEx window title matching apparently.

_________________
fincs
Highly recommended: AutoHotkey_L (see why) (all my code snippets require it)
Formal request to polyethene - I support the unity of the AutoHotkey community
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 4:33 pm 
Offline

Joined: November 30th, 2008, 1:51 pm
Posts: 73
@fincs
I examine the codes, then I found you are right. :) May I wait for your fixes?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 4:53 pm 
Offline
User avatar

Joined: May 5th, 2007, 7:24 pm
Posts: 1240
Location: Seville, Spain
RegExReplace() is the only function remaining.
EDIT: Done :D

Link to my forked version (precompiled .exe included):
http://www.autohotkey.net/~fincs/AutoHotkeyU.zip

EDIT2: And yes, I'm using the latest commit :)

_________________
fincs
Highly recommended: AutoHotkey_L (see why) (all my code snippets require it)
Formal request to polyethene - I support the unity of the AutoHotkey community
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 3rd, 2009, 1:11 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
jackieku wrote:
I love objects, too. I think I should merge that feature from _L when we found most bugs in Unicode version are fixed. :)
That would be great. Currently I can't carry out comprehensive tests with AutoHotkeyU since I changed, how to say, my custom libraries at the lowest level taking advantage of the automatic release feature (__Delete) of Object.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 4th, 2009, 5:32 am 
Offline

Joined: April 25th, 2007, 10:13 pm
Posts: 29
Super excited about this unicode version.

I'm testing the Unicode versions by either fincs or original one from the first post on Garry's youtube mp4 download script. (http://www.autohotkey.com/forum/topic34932.html)

on some Chinese songs (with Chinese titles), I was hoping the unicode version would automatically save the Chinese titles. But every time, both versions are crashing.

The youtube Chinese song link: http://www.youtube.com/watch?v=BbCBPfaeg-Y


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 4th, 2009, 9:50 am 
Offline

Joined: November 30th, 2008, 1:51 pm
Posts: 73
@mosaic
Something should be noted. The scripts were written for ANSI version may not work in Unicode version of AutoHotkey without changes. Since we now store the characters in UTF-16, which is the native format in current Windows systems, a character consumes (at least) two bytes in this format. So if a script calls some APIs by DllCall() that take some strings as its parameters, it should call the Unicode version of such API instead.

For example,
Code:
filename := "C:\file.txt"

; Can not work on Unicode version
DllCall("kernel32\DeleteFileA", "UInt", &filename)
DllCall("kernel32\DeleteFileA", "str", filename)

; Can not work on ANSI version
DllCall("kernel32\DeleteFileW", "UInt", &filename)
DllCall("kernel32\DeleteFileW", "str", filename)
DllCall("kernel32\DeleteFileA", "astr", filename)

; This should work on both
DllCall("DeleteFile", "UInt", &filename)
DllCall("DeleteFile", "str", filename)


Some API may take more complex parameters (e.g. structures), that should be checked, too. (make sure you allocate enough bytes by VarSetCapacity or whatever)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 4th, 2009, 10:20 am 
Offline
User avatar

Joined: April 4th, 2009, 8:19 pm
Posts: 1143
Location: Croatia
I currently can't help by testing AutoHotkeyU, but at least I can support this project by kind words, so;

Fantastic! Keep up the great work!

This should really be Sticky topic.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 4th, 2009, 1:11 pm 
Learning one wrote:
I currently can't help by testing AutoHotkeyU, but at least I can support this project by kind words, so;

Fantastic! Keep up the great work!

This should really be Sticky topic.


yes, agree! :D


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 237 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 16  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot], Stigg, Yahoo [Bot] and 11 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