On Thu, Nov 10, 2016 at 7:49 AM, Carsten Haitzler <ras...@rasterman.com> wrote: > On Wed, 9 Nov 2016 12:14:36 -0200 Gustavo Sverzut Barbieri > <barbi...@gmail.com> > said: > >> Hi all, >> >> I'm using Eo extensively and its Eolian works well, great work. >> >> But one thing that I struggle in my examples is to translate >> enumerations to string and back. I have to repeat that similar code in >> my examples and I wonder if Eolian should generate them for me... I >> guess so, what's your take on that? >> >> Also, please add another marker for "enum" that informs it's a >> bitwise, we just document that, but would be nice to have a formal way >> to inform. Maybe also something in the pass/return of values, to >> specify if it takes a single or multiple. Like this: >> >> enum @bitwise Mode { >> read, [[ being bitwise, no values means (1 << 0)]] >> write, [[ 1<<1 is automatic]] >> } >> >> generates: >> const char *mode_str_to(enum Mode); // for single entry >> enum Mode mode_str_from(const char *Mode); // for single entry >> >> const char *mode_bitmask_str_to(unsigned Mode); // for many entry > > this one above is going to suck for bitwise. you'd have to generate a biffer - > you couldn't sanely generate "all combinations" and compile theme except for > very trivial examples. then the q is - what buffer is this? a single one isnt > very usable. :(
I know, as I wrote later down. Ideally return const is more helpful, but it must be able to deliver more than one entry, like this: printf("%s x %s\n", bitmask_to_str(before), bitmask_to_str(after)); if we do an internal static char and print over it many times, they will look the same in the printf. Then I was thinking about either be simple and return non-const, requires an intermediate variable and free, or use some freeq() like system that will postpone to next mainloop iteration free. > jpeg brought this up today. he might expand on this. :) willing to read... HOWEVER, implementation details aside, generating and having such information would be good. In Python, for example, you could do a simple number-to-object map and create an instance with proper __str__/__repr__ methods so they print well and the language takes care of ref/unref. -- Gustavo Sverzut Barbieri -------------------------------------- Mobile: +55 (16) 99354-9890 ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel