Pages: « 1 2
  Print  
Author Topic: Who fixed arrays?  (Read 11395 times)
Offline (Unknown gender) sorlok_reaves
Reply #15 Posted on: October 26, 2014, 08:30:33 pm
Contributor
Joined: Dec 2013
Posts: 260

View Profile
Ok, my array branch is stable; should fix about 30% of the problems with arrays (the rest are far more fundamental and will require a separate fix).

Please test!

https://github.com/sorlok/enigma-dev/tree/array_fix
Logged
Offline (Male) Goombert
Reply #16 Posted on: October 27, 2014, 09:20:55 am

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
Sorlok you're amazing!!!  (Y)

Josh wanted to pull it right away but I want to pull and test it first, I am extremely swamped atm but I will make the time to test this and get it merged as soon as I can.

Edit:
I have reviewed the pull request and everything is great except warnings in the console.
https://github.com/enigma-dev/enigma-dev/pull/856

I took the liberty of documenting the new functions for everyone.
http://enigma-dev.org/docs/Wiki/Data_Structure_Functions
« Last Edit: October 27, 2014, 04:27:18 pm by Robert B Colton » Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) sorlok_reaves
Reply #17 Posted on: October 30, 2014, 04:58:47 pm
Contributor
Joined: Dec 2013
Posts: 260

View Profile
Thanks for testing this! I've updated the pull request with the fixes you requested.
Logged
Offline (Male) Goombert
Reply #18 Posted on: October 30, 2014, 05:38:29 pm

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
As of the following pull request we now have working array length functionality that has been tested and confirmed to work mostly as we expect with the exception of is_array() which is not yet ECMA compliant.
https://github.com/enigma-dev/enigma-dev/pull/856

Everyone give sorlok a round of applause! Yay sorlok!  (Y)



You can get these changes by using git-bash to pull from master. I will updating the Portable ZIP in a few days.
« Last Edit: October 30, 2014, 05:41:29 pm by Robert B Colton » Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Male) Goombert
Reply #19 Posted on: December 27, 2014, 05:11:30 pm

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
I'd like to add to this post that I've recently sent a patch for some additional array fixes, specifically those which use primitives like int[] or double[]
https://github.com/enigma-dev/enigma-dev/pull/905

I believe Harri was complaining about these bugs, it was broken by fundies just before the new JDI was merged back in 2012. The code for coercing the type was destroyed however because secondary parse is supposed to use an AST, but I temporarily hacked around that using a map. I would appreciate if the pull request could be regression tested by everyone to ensure I haven't broken anything else in the process.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) TheExDeus
Reply #20 Posted on: December 27, 2014, 05:32:39 pm

Developer
Joined: Apr 2008
Posts: 1860

View Profile
Thank you! This is so awesome! Does it also work with 2d arrays? This bug is the reason why I have often used ds_ instead of arrays, because often regular arrays were parsed wrong as well. Like when used in scripts.
Also, do these arrays (together with EDL arrays) extend to more than 2 dimensions? I actually don't like that GM limitation of only having 2 dimensions. EDL arrays will probably be stuck there, but if the parser bugs are fixed and these are used as regular C++ arrays, then at least they should allow n-dimensions.
I will test all of this later. Thank you!
Logged
Offline (Male) Goombert
Reply #21 Posted on: December 27, 2014, 05:43:06 pm

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
You are welcome Harri, and it looks like that is the next thing to fix while I am in here.

Code: (EDL) [Select]
int d[5][5];
d[5][5] = 3;
show_message(string(d[5][5]));

Gives me...
Code: [Select]
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:54:17: error: expression cannot be used as a function
     d[int(5)] (5)= 3;
                 ^
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:55:39: error: expression cannot be used as a function
     show_message(toString(d[int(5)] (5) ));
                                       ^

So I still have some work to do, I'll try and see if I can get it fixed.

Edit: I fixed the multi-dimensional arrays as well in the following commit.
https://github.com/enigma-dev/enigma-dev/pull/908

Code: (EDL) [Select]
int d[5][5][5];
d[5][5][5] = 4;
show_message(string(d[5][5][5]));

Will now properly parse into the following.
Code: (CPP) [Select]
int d[5] [5] [5];
d[int(5)] [int(5)] [int(5)]= 4;
show_message(toString(d[int(5)] [int(5)] [int(5)] ));

Edit: Fixes tested and merged.
https://github.com/enigma-dev/enigma-dev/pull/908
« Last Edit: December 27, 2014, 11:13:10 pm by Robert B Colton » Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Pages: « 1 2
  Print