graphic points

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, LCMark

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: graphic points

Post by mwieder » Mon Jun 10, 2013 9:19 pm

OK - there are (at least) two issues here:

1. Fixing parsepoint and parsepoints to return truncated integer values. This is easy.
2. Changing MCU_strtol to return the true value rather than a truncated integer.

Without #2, parsepoint and parsepoints can only work with truncated values, not rounded values. That was my first attempt, and it works as designed. No other side-effects into other functions. Rounding rather than truncating can't happen without changing MCU_strtol or without changing parsepoint and parsepoints to use a different function that allows for the parsing of non-integer numbers.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: graphic points

Post by mwieder » Tue Jun 11, 2013 6:37 pm

Looked at the code again last night, made a couple of changes, and pushed to github. Looks like I need to integrate the docs changes before I'm ready to issue a pull request, but

The change to MCU_strtol rounds up or down if a non-integer value is entered, and does this properly for both positive and negative values.
This change is *necessary* to keep the parser from stopping on encountering a decimal point. Otherwise "42.43,44.45" becomes

42
43,44
45

which completely screws up setting the points of a graphic.
After that, parsepoint and parsepoints just allow real numbers and cast the result from an int4 to an int2.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: graphic points

Post by mwieder » Wed Jun 12, 2013 9:31 pm

Pull request submitted ("fix-integer-points").

Locked

Return to “Engine Contributors”