On 3 March 2016 at 20:33, Tom Hacohen <t...@osg.samsung.com> wrote: > On 03/03/16 10:58, Tom Hacohen wrote: > > On 03/03/16 10:22, Tom Hacohen wrote: > >> On 01/03/16 09:05, Tom Hacohen wrote: > >>> Hey, > >>> > >>> The Eo syntax is going to be changing once more, and this time, I > really > >>> think/hope it'll be the last time. We plan on stabilizing Eo and all of > >>> the functions on top of it in the next few months, so that doesn't > leave > >>> us much more time to change it again. :) > >>> > >>> These changes will remove the need for the eo_do family of functions. > >>> Functions will now look like normal C functions (which they are). There > >>> are many benefits to that, and we have many cool new ideas. > >>> > >>> For more info: https://phab.enlightenment.org/w/eo/ > >>> > >>> I'm sending this email as an head's up, as I'll be starting to work on > >>> migrating to the new Eo syntax (and implementing it) today. Felipe and > I > >>> have actually already started (needed to for the PoC), but I plan on > >>> pushing my changes to master soon. > >>> > >>> If you have any issues/suggestions/comments with the proposal, please > >>> let me know, either in pm, irc or just here. > >>> > >> > >> Changes are in! I still haven't migrated eo_add to the new syntax (it > >> uses a non portable gcc extension in the meanwhile), but otherwise > >> everything is in. Took me *much* less time than I thought it would, so > >> yay. :P > >> > >> I decided to push it now instead of letting it rest in my branch for a > >> while because literally every hour that passed introduced more merge > >> conflicts for me, so the benefits from stabilising it more in my branch > >> were diminished by the new conflicts and issues that could arise. > >> > >> If you have an application that uses the Eo api, you can use my script > >> https://devs.enlightenment.org/~tasn/migrate_eo.py to migrate your > code. > >> When using the script you should keep two things in mind: > >> 1. You are only allowed to run it *once* per source code, because the > >> changes to eo_add() would otherwise accumulate and your code will be > >> wrong. If you need to correct something you've done wrong, reset the > >> code to the previous state and run the script again on the original > code. > >> 2. The migration script is not perfect. In particular it can't deal with > >> some corner cases like: > >> eo_do(obj, a_set(1), > >> /* b_set(2), > >> g_set(4), */ > >> c_set(2)); > >> Or abominations like: > >> eo_do(obj, if (a_get()) > >> do_something()); > >> > >> So please be aware of that and *manually* review your changes after the > >> script has run. > >> > >> If your code does have these cases, I recommend you either get rid of > >> them, or manually migrate that code before running the script (remove > >> the relevant eo_do). > > > > Oh, one more thing about the script! There is another very important > > "gotcha" you should be aware of. > > > > If you had if/for/while/whatever statements without {} (you really > > shouldn't have those, is it's your fault to begin with), those can fail > > in some cases (a la the infamous "goto fail") because for example: > > if (bla) > > eo_do(obj, a_set(1), b_set(2)); > > > > will be changed by the script to: > > if (bla) > > a_set(obj, 1); > > b_set(obj, 2); > > > > which is obviously absolutely wrong, so please be aware of those, and > > maybe run gcc 6 with the misleading indentation warning on. :) > > One more comment, if you wanna migrate an already migrated file and > don't want it to break on eo_add, you can just edit this line in the > script: > eo_do = > > re.compile(r'^(.*)\b(eo_add|eo_add_ref|eo_do|eo_do_ret|eo_do_super|eo_do_super_ret)\s*\(', > re.MULTILINE) > > Remove eo_add and eo_add_ref like this: > eo_do = > re.compile(r'^(.*)\b(eo_do|eo_do_ret|eo_do_super|eo_do_super_ret)\s*\(', > re.MULTILINE) > > And you should be good to go, it'll just fix whatever remaining eo_do > you may have. > > Enjoy. > > Thanks a lot for all this, Tom.
If like me you had a work branch with tons of changes with eo_do, here's what I did to get back on track: 1. git rebase -i master This will conflict all the time... now run: 2. git mergetool (i used meld) 3. save merged file 4. run migrate_eo.py on all C files 5. git add those C files 6. git rebase --continue Repeat 2-6 until your last patch. Don't try to hack patch files from git format-patch, I wasted my time doing it... :) -- Jean-Philippe André ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel