patchGnash - The GNU Flash player - Patches: patch #6081, Finish implemention of array.sort...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #6081: Finish implemention of array.sort using AS comparison function

Submitter:  None
Submitted:  Sat 07 Jul 2007 09:40:51 PM UTC
   
 
Category:  ActionScript Priority:  3 - Low
Status:  Done Privacy:  Public
Assigned to:  strk Originator Email:  -email is unavailable-
Open/Closed:  Closed

Wed 18 Jul 2007 11:22:00 AM UTC, comment #3: 

I postponed working on 'this' as it takes much more thinking.
For now, your patch is in. Thanks.
See task  #7093 for the 'this' thing.

Sandro Santilli <strk>
Group Member
Fri 13 Jul 2007 01:15:03 AM UTC, comment #2: 

Committed, adding a test about 'this', which is failing in Gnash.
Will track the 'this' issue next.

Yes, calling the function directly should be fine.

Sandro Santilli <strk>
Group Member
Fri 13 Jul 2007 01:09:11 AM UTC, comment #1: 

No, there's no way to avoid it currently. We always need a 'this' pointer when we call a function. Try tracing 'this' from within the comparator function to see what it should be pointing at.

Also, what's your name and email-address for the ChangeLog ?

Sandro Santilli <strk>
Group Member
Sat 07 Jul 2007 09:40:51 PM UTC, original submission:  

I had a quick go at finishing the array.sort(compareFunction) implementation since most of the work had already been done. I also added a test for it in the array.as (see attached patch).

The patch is a little more complex than I would have liked because I found that I had to pass in an as_object* "fn.this_ptr" to the call_method when invoking the compareFunction (passing in NULL resulted in assert failures). I suspect there might be a way to avoid this.

Also I'm not sure if call_method should be used in preference to the original idea of directly invoking the function on a fn_call object (either works, I leaned toward the call_method approach since it is already used in the code-base for a similar task [see timers.cpp]). If the fn_call approach is used, the stack_offset (last argument) should be set to 1 not 0 (and obviously the as_object* first argument changed from NULL).

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #13267:  array_cmp_sort.patch added by None (4KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by strk (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-07-18 strk StatusIn Progress Done
        Open/ClosedOpen Closed
    2007-07-13 strk StatusNone In Progress
        Assigned toNone strk
    2007-07-07 None Attached File- Added array_cmp_sort.patch, #13267

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code