AutoHotkey Community

It is currently May 27th, 2012, 12:21 am

All times are UTC [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1036 posts ]  Go to page Previous  1 ... 17, 18, 19, 20, 21, 22, 23 ... 70  Next
Author Message
 Post subject:
PostPosted: December 3rd, 2009, 9:40 am 
Offline

Joined: December 17th, 2007, 6:39 pm
Posts: 235
Location: Galati, Romania
AHKU = AHK + AHK_L additions + AHK_U additions

In order to make one single version, they need to talk to Chris first.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 14th, 2009, 11:05 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
Quote:
Revision 40 - December 13, 2009
  • Changed meta-functions and multi-param behaviour to improve flexibility. Meta-functions are now invoked *before* searching for an appropriate field in each base object; however, values in x.base will override meta-functions defined in x.base.base. Chaining meta-functions (inheritence) is now possible by avoiding "Return" - See Objects - Extensibility.
  • Improved Default Base functionality to be more consistent with real objects.
  • Changed (Debugger): While stepping through code, skip all braces except those which end a function.
  • Changed (Debugger): When stepping onto the hidden "Exit" at end of the script, consider it to be *below* the last physical line to avoid confusion.
Source: AutoHotkey_L

(It's been up for a while, but I forgot to post.)

Also, github/Lexikos/AutoHotkey_L.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 4:22 pm 
Offline

Joined: November 30th, 2008, 1:51 pm
Posts: 73
Lexikos wrote:

Hi,

I have some troubles with your repository when I want to merge your branch into AutoHotkeyU. Could you apply core.autocrlf = true on it?
It's very hard to keep the EOL usage of the files in a project consistent without this setting. Sometimes the things went even worse: a file contains both LF and CRLF for some reasons.


Last edited by jackieku on December 22nd, 2009, 4:07 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 11:10 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
I avoided it because when I began importing each revision, it would tell me every line of every file had changed. My understanding was that it is supposed to keep CRLF in the working copy and LF in the repository. Most of the files I was copying in should've been identical to the working copy.

I tried enabling autocrlf just now (in my local repository only); strangely, from the latest commit it "replaces" only script_object.cpp.
Code:
1 files changed, 980 insertions(+), 1006 deletions(-)
(I'd also moved a couple lines and deleted some commented code.)

If I checkout an arbitrary commit (like L10 or L40), it immediately shows every line of every file has changed. If I then try to checkout some other commit, it complains that I've made changes to the working copy. :?

Any suggestions?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2009, 2:51 am 
Offline

Joined: November 30th, 2008, 1:51 pm
Posts: 73
@Lexikos
If you want to modify the history commits, you could use git-filter-branch. Thanks for the repository was just created, it could be considered safe to do (or other developers can't push/pull the repository after you modify the commits).

Here is how I done it (in the bash shell).

Convert the files by dos2unix utility.
Code:
N=$'\n' \
git filter-branch --tag-name-filter cat --tree-filter '
(
    IFS="$N"
    git ls-files | while read f ; do
        case "$f" in
            *.ico|*.exe|*.lib) : it is not a text file ;;
            *) dos2unix "$f" ;;
        esac
    done
    true
)
' -- --all


Now you could check the correctness of the result. If everything looks fine, just drop the backups.
Code:
git for-each-ref --format='%(refname)' refs/original | \
while read ref ; do
    git update-ref -d "$ref"
done


(Optional) cleanups
Code:
git reflog expire --expire=0 --all
git repack -ad
git prune


I recommend you clone the repository first, and then doing the above steps in the newly created repository. Finally, use "git push -f --all ; git push -f --tags" to push the changes back.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2009, 9:09 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
jackieku wrote:
Convert the files by dos2unix utility.
I'm not sure I accept this as a "solution." I will think more about it. I'm familiar with filter-branch, having used it repeatedly while importing my archives into git; but thanks for the git scripts.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 19th, 2009, 6:49 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
Thanks jackieku, the scripts were very helpful. Although I didn't like the idea of git messing with the files, it seemed a necessarily evil once I realised autocrlf is enabled by default in new repositories. Anyway, my github repository has been updated with (autocrlf-friendly) `n-only files. I also took the opportunity to remove Test.ahk and rename AutoHotkey_L.sln/vcproj back to AutoHotkey.sln/vcproj in the applicable commits.

Quote:
Revision 41 - December 20, 2009
  • Fixed: Floating-point numbers were equivalent to an empty string when used as keys in objects. They are now converted to numeric strings in the current float format, as originally intended.
  • Developers only: see commit c7260a6 for additional changes.
Source: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
PostPosted: December 22nd, 2009, 6:51 pm 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
Lexikos wrote:

For any interested developers:

I've been migrating my source code archives to github, minus a couple lost revisions. I'm not sure whether I'll merely use it as a mirror of sorts; offer incremental updates between "L" revisions; or abandon numbered revisions entirely (instead updating as each change is made). So far it's mostly been to learn git.

Given the recent development on AutoHotkeyU, I'm not sure the .L suffix on A_AhkVersion is appropriate anymore. I would appreciate any ideas related to identifying a particular build (by script and/or without running it). My ideas so far are: A_AhkBuild (e.g. a git commit id), A_AhkBuildTime, A_AhkBranch... I suppose that they would only be useful if given meaningful values in AutoHotkey_L, AutoHotkeyU, AutoHotkey.dll, etc. (If you think these would or wouldn't be useful or worth implementing, I'd like to hear.)

Lexikos, welcome to git :)
My vote is to keep the numbering. I use a number followed by a descriptor in my tags. This is the shell script i use:
Code:
$ cat /l/naveen/bin/localbin/tag
echo naveens tag script: commits, tags, push changes and master
if [ $# -ne 2 ]; then
     echo 1>&2 Usage: $0 tag_number-descriptor commit_message
     exit 127
fi

git add . ; git commit -a -m $2
git tag $1
git push origin $1
git push origin master

I like the idea of having a A_AhkBuild (e.g. a git commit id). This could also be used as a security feature to make sure the autohotkey executable that is being used is authentic.

As far as checking for ahkl, ahku, ahkn/dll, or a specific combination there of, it may be better for the users to check for specific features instead of version numbers... test for existence of some builtin function, builtin variable, etc...

I was just starting to use objects, ran into an issue derefrencing object members in continuation sections.
the following:
Code:
dcm.sfile =
(
("%dcm.file%")
)
fails on two levels:
1. can't assign to objects using "=", and continuation sections can't be assigned with a ":="...
2. how do you deref a object.member in a continuation section ?

For now, I guess I will use temporary variables...


Report this post
Top
 Profile  
Reply with quote  
PostPosted: December 22nd, 2009, 11:19 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
tinku99 wrote:
I like the idea of having a A_AhkBuild (e.g. a git commit id). This could also be used as a security feature to make sure the autohotkey executable that is being used is authentic.
How so? A_AhkBuild could contain anything, and the real source code could easily differ from the commit it identifies. While it probably couldn't be done at run-time, using a commit ID would allow the user to determine exactly what features it has, who authored it, etc.
Quote:
As far as checking for ahkl, ahku, ahkn/dll, or a specific combination there of, it may be better for the users to check for specific features instead of version numbers...
That isn't always feasible. For instance, I've used L<num> from A_AhkVersion in LowLevel to determine if a compatible version is in use; i.e. the linked list of functions is available. There is no other way in this case.
Quote:
test for existence of some builtin function, builtin variable, etc...
What about differences in behaviour of functionality existing in multiple branches?
Quote:
I was just starting to use objects, ran into an issue derefrencing object members in continuation sections.
That syntax is valid only in expressions. That is not an expression. Contiuation sections have nothing to do with it, as they're merely a way of merging source lines at load-time.
Code:
dcm.sfile = "%dcm.file%" ; same thing.

Quote:
and continuation sections can't be assigned with a ":="...
They certainly can.
Quote:
2. how do you deref a object.member in a continuation section ?
Use an expression.
Code:
x := Object("y", "one")
y :=
( Join`s
"'"
x.y
"'"
)
MsgBox % y
I've thought about supporting objects (and perhaps arbitrary expressions) between percent signs in "traditional" syntax, but I think it would require fairly extensive changes.
Quote:
I use a number followed by a descriptor in my tags.
Part of my concern was about whether to include numbering in the executable itself, as currently I have to (rather, my script has to) modify the source to update the revision number. OTOH, if it was based on a resource or the version info contained within the executable, it might be better as no source code changes would be required. (Only the compiled binary would be modified.)

Additionally, with the "proliferation" of custom builds, version numbers for individual builds become less meaningful.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: December 27th, 2009, 6:25 am 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
One of the nice things objects makes possible is the ability pass around binary values through expressions. Unfortunately the & operator, and numput, numget don't work with object.member . Lexikos, do you plan on adding support for these?
Also, do you plan on adding support for deep copying objects?

arbitrary expessions between %% signs would be interesting, essentially enabling lisp like macros.
Could it be implemented by just expanding it internally to two lines as follows:
Code:
%expression%(expession)
would become:
Code:
uniquetemp := expression
%uniquetemp%(expression)


Report this post
Top
 Profile  
Reply with quote  
PostPosted: December 27th, 2009, 11:57 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
tinku99 wrote:
Unfortunately the & operator, and numput, numget don't work with object.member .
Address-of does not work as it is not a variable. NumGet and NumPut work just fine if object.member returns an address, which is the most logical way to use it.
Quote:
Also, do you plan on adding support for deep copying objects?
Not specifically. I plan to add functions for enumerating the keys/values contained within an object. This would allow a copy routine to be written in script, and many other things.
Quote:
Could it be implemented by just expanding it internally to two lines ...
I had decided not to implement it in expressions as there are too many ways it could be implemented. I specifically mentioned traditional syntax in my previous post. This would be simple by comparison; the text outside the percent signs would be translated to literal strings/concatenations and the sub-expressions would be used as-is.

According to your example, the expression between percent signs would be used to calculate the variable or function name. For instance, calling a function explicitly by name stored in an object:
Code:
t:=a[b], %t%()  ; current
%a[b]%()        ; proposed
This could be implemented by a bit of clever pre-processing - all expressions are currently pre-processed into postfix form at load-time. a[b] would remain part of the overall expression, but its result would be used to determine which function to call. Above, the postfix form of the first line could be expressed as follows:
Code:
t a b ObjGet(¿,¿) := %t% ¿() ,
  • Push t (onto the stack).
    Stack: t
  • Push a.
    Stack: t, a
  • Push b.
    Stack: t, a, b
  • Call ObjGet with two parameters.
    (Parameters are popped off the stack and the return value is pushed onto the stack.)
    Stack: t, (result of ObjGet)
  • Assign.
    (Both operands - the destination var and value to assign - are popped off the stack, and the destination var is pushed back onto the stack.)
    Stack: t
  • Resolve func named %t% and replace ¿ below with a func reference.
    (This uses the same "operator" as a dynamic variable reference, but updates the associated function-call "operator" rather than finding and pushing a variable onto the stack. A reference to variable t is stored statically in the expression by load-time pre-processing.)
    Stack: t
  • Call ¿ with no parameters.
    Stack: t, (result of ¿)
  • Pop the return value off the stack and discard it. This is the only run-time effect of the comma operator. Although var x is still on the stack (as the result of the assignment), since this is a standalone expression it is discarded once expression evaluation finishes.
This approach was easy to implement and is fairly efficient, but isn't suited for arbitrary sub-expressions. Introducing a separate "operator" for dynamic function calls would allow function names to be calculated with arbitrary sub-expressions. For instance, the postfix form of the second line above could be expressed as follows:
Code:
a b ObjGet(¿,¿) Call(¿)
  • Push a.
    Stack: a
  • Push b.
    Stack: a, b
  • Call ObjGet with two parameters.
    Stack: (result of ObjGet)
  • Pop into ¿, find function named by ¿ and call it.
    Stack: (result of ¿)
It is simple in principle, but this only covers vaguely how it would work at run-time. Making the necessary changes to load-time pre-processing would probably be more difficult (but not necessarily more difficult than splitting the expression into two lines).


However, what I had in mind was something significantly more powerful and complicated: allow text substitution within the expression itself. For instance, where x evaluates to "a,b,c", the following would pass variables a, b and c as parameters to function F:
Code:
F(%x%)
After thinking of various ways it could be done, I decided that it would be best to not support this syntax, but something more conventional instead: Eval().
Code:
Eval("F(" . x . ")")
Eval(a[b] . "()")
Code like this has been written in the past, using the now-defunct __expr from LowLevel.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 27th, 2009, 1:33 pm 
Offline
User avatar

Joined: May 5th, 2007, 7:24 pm
Posts: 1240
Location: Seville, Spain
I vote for Eval().

_________________
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  
PostPosted: December 27th, 2009, 5:45 pm 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
Lexikos wrote:
Address-of does not work as it is not a variable.
How are we supposed to ever work with binary values? What if you use binary fileread into object.member, how do we access the value. Object.member walks and quacks like a variable everywhere else, unless it is explicitly initialized as an object separately. Please reconsider supporting binary values in object.members atleast to the same extent as official ahk.
Lexikos wrote:
I decided that it would be best to not support this syntax, but something more conventional instead: Eval().
Code:
Eval("F(" . x . ")")
Eval(a[b] . "()")
Eval() would be fantastic!


Report this post
Top
 Profile  
Reply with quote  
PostPosted: December 28th, 2009, 3:26 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
tinku99 wrote:
What if you use binary fileread into object.member,
Go ahead and try.
Quote:
Object.member walks and quacks like a variable everywhere else,
Except for OutputVars, ByRef parameters, traditional assignment operator, condensed assignment operators (+= .= etc.), (lack of) naming restrictions, use in %traditional% or double%deref% syntax ... Did I leave anything out? x.y and x.y:=z are only syntax sugar for internal functions ObjGet() and ObjSet().
Quote:
unless it is explicitly initialized as an object separately.
I'm not sure what you mean. Storing an object in an object.member is hardly different from storing an object in a variable.
Quote:
Please reconsider supporting binary values in object.members atleast to the same extent as official ahk.
I originally supported _GetAddress and _Get/SetCapacity on "string" fields of objects, but removed them to simplify as they offered very little over storing a pointer in the field. In hindsight, I suppose there are some advantages:
  • Allocating memory is more concise and less prone to error.
    Code:
    obj._SetCapacity("data", 1024)
    ;vs
    obj.ptr := DllCall("GlobalAlloc", "uint", 0, "uint", 1024)
  • No need to define a __Delete handler for each object type (unless the binary data contains pointers to other "unmanaged" binary data) as fields are already freed on release of the object.
  • Also no need to specify each field that needs to be cleaned up, which makes it more maintainable.
  • Data size is easier to get:
    Code:
    size := obj._GetCapacity("data")
    ;vs
    size := DllCall("GlobalSize", "uint", obj.ptr)
...and disadvantages:
  • Retrieving the pointer is less concise. (I suppose this adds up if the pointer is retrieved more often than assigned/allocated/resized.)
    Code:
    ptr := obj._GetAddress("data")
    ;vs
    ptr := obj.ptr
  • obj.data won't return anything useful (unless the binary data has an initial string component).
However, this could all be implemented generically in script (for reuse by other scripts), including letting obj.data return the pointer via __Get. This script implementation could have additional functionality, which would perhaps be too rarely used to build in.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: object.member functions
PostPosted: December 28th, 2009, 5:31 am 
Offline

Joined: August 3rd, 2007, 8:01 am
Posts: 555
Location: Houston, TX
Lexikos wrote:
...and disadvantages:
[list][*]Retrieving the pointer is less concise. (I suppose this adds up if the pointer is retrieved more often than assigned/allocated/resized.)
Code:
ptr := obj._GetAddress("data")
;vs
ptr := obj.ptr
Why wouldn't you just use ptr, instead of retrieving it with _GetAddress over and over again? or you could just do this once:
Code:
object.dataPointer := obj._GetAddresss("data")

I request you bring back the 3 functions.
Thanks.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1036 posts ]  Go to page Previous  1 ... 17, 18, 19, 20, 21, 22, 23 ... 70  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Maestr0, Scratch and 1 guest


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