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 

UNICODE version of AutoHotkey
Goto page Previous  1, 2, 3, 4, 5 ... 14, 15, 16  Next
 
This topic is locked: you cannot edit posts or make replies.    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
jackieku



Joined: 30 Nov 2008
Posts: 73

PostPosted: Mon Nov 02, 2009 2:20 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Mon Nov 02, 2009 3:30 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
jackieku



Joined: 30 Nov 2008
Posts: 73

PostPosted: Mon Nov 02, 2009 3:49 am    Post subject: Reply with quote

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. Smile
Back to top
View user's profile Send private message
neh neh pork
Guest





PostPosted: Mon Nov 02, 2009 7:09 am    Post subject: Reply with quote

great! great! keep up the good work!
Back to top
jackieku



Joined: 30 Nov 2008
Posts: 73

PostPosted: Mon Nov 02, 2009 12:23 pm    Post subject: Reply with quote

fincs wrote:
Yesterday I ended up forking your version Razz

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?
Back to top
View user's profile Send private message
fincs



Joined: 05 May 2007
Posts: 1163
Location: Seville, Spain

PostPosted: Mon Nov 02, 2009 1:01 pm    Post subject: Reply with quote

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 Very Happy.
_________________
fincs
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]
Back to top
View user's profile Send private message
jackieku



Joined: 30 Nov 2008
Posts: 73

PostPosted: Mon Nov 02, 2009 1:40 pm    Post subject: Reply with quote

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 Very Happy.

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. Sad
Back to top
View user's profile Send private message
fincs



Joined: 05 May 2007
Posts: 1163
Location: Seville, Spain

PostPosted: Mon Nov 02, 2009 3:02 pm    Post subject: Reply with quote

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
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]
Back to top
View user's profile Send private message
jackieku



Joined: 30 Nov 2008
Posts: 73

PostPosted: Mon Nov 02, 2009 3:33 pm    Post subject: Reply with quote

@fincs
I examine the codes, then I found you are right. Smile May I wait for your fixes?
Back to top
View user's profile Send private message
fincs



Joined: 05 May 2007
Posts: 1163
Location: Seville, Spain

PostPosted: Mon Nov 02, 2009 3:53 pm    Post subject: Reply with quote

RegExReplace() is the only function remaining.
EDIT: Done Very Happy

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

EDIT2: And yes, I'm using the latest commit Smile
_________________
fincs
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Tue Nov 03, 2009 12:11 am    Post subject: Reply with quote

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. Smile
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.
Back to top
View user's profile Send private message
mosaic



Joined: 25 Apr 2007
Posts: 29

PostPosted: Wed Nov 04, 2009 4:32 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
jackieku



Joined: 30 Nov 2008
Posts: 73

PostPosted: Wed Nov 04, 2009 8:50 am    Post subject: Reply with quote

@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)
Back to top
View user's profile Send private message
Learning one



Joined: 04 Apr 2009
Posts: 1001
Location: Croatia

PostPosted: Wed Nov 04, 2009 9:20 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
neh neh pork
Guest





PostPosted: Wed Nov 04, 2009 12:11 pm    Post subject: Reply with quote

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! Very Happy
Back to top
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies.    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5 ... 14, 15, 16  Next
Page 4 of 16

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


Powered by phpBB © 2001, 2005 phpBB Group