On Tue, 6 Jul 2010 18:01:12 -0300 Bruno Dilly <[email protected]> said:

> On Wed, Jun 30, 2010 at 5:07 PM, Gustavo Sverzut Barbieri
> <[email protected]> wrote:
> > On Wed, Jun 30, 2010 at 4:05 PM, Leandro Pereira <[email protected]>
> > wrote:
> >> Hi.
> >>
> >> While working with eet, I thought that writing all the boilerplate
> >> code was was boring enough, that I've written a Python script that
> >> generates C code from a simple structure definition. The source code
> >> is available here[1], and a (incomplete) documentation is written
> >> here[2]. I'm still new to EFL, so I'm asking for comments, esp.
> >> regarding the output of the script.
> >>
> >> BTW, this is my first post on this list. I'm working at ProFUSION on
> >> EWebKit, and some of you might know me from IRC, where I use the
> >> "acidx" nickname.
> >>
> >> [1] git://git.profusion.mobi/users/leandro/geneet.git
> >> [2] http://git.profusion.mobi/~leandro/geneet.html
> >
> > This is a great tool that we could integrate into eet's source as
> > utilities, similar to what I added in edje (inscake2edc).
> 
> Today I've tested geneet and it made my life easier. =)
> I have reported some small issues to Leandro, this tool is really cool.
> 
> I agree with Barbieri, Leandro let's move it to e repo.

i agree. though my take on it is that i'd prefer it to be done as part of the c
 src like this:

typedef struct my_struct My_Struct;
typedef struct my_list   My_List;

struct my_struct               /* eet: extern My_Struct edd_name */
{
  int        val;              /* eet: int val */
  double     fval;             /* eet: double fval */
  Eina_List *list;             /* eet: list edd_list */
  char      *strval;           /* eet: str strval */
  int        not_encoded;
  void      *not_encoded_data;
};

struct my_list                 /* eet: extern My_List edd_list */
{
  char *name;                  /* eet: str name */
};


if i run:
  geneet -data *.c *.h > edd0.c
  geneet -code *.c *.h > edd1.c
  geneet -head *.c *.h > edd.h
i get (dependency ordered too so since my_strict depends on the edd of my_list):

edd0.c:
Eet_Data_Descriptor *edd_list = NULL;
Eet_Data_Descriptor *edd_name = NULL;

edd1.c:
Eet_Data_Descriptor_Class eddc;

EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, My_List);
edd_list = eet_data_descriptor_file_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_BASIC (edd_list, My_Struct, "name", name,
EET_T_STRING);

EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, My_Struct);
edd_name = eet_data_descriptor_file_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_name, My_Struct, "val", val, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_name, My_Struct, "fval", fval, EET_T_DOUBLE);
EET_DATA_DESCRIPTOR_ADD_LIST (edd_name, My_Struct, "list", list, edd_list);
EET_DATA_DESCRIPTOR_ADD_BASIC (edd_name, My_Struct, "strval", strval,
EET_T_STRING);

edd.h:
extern Eet_Data_Descriptor *edd_list;
extern Eet_Data_Descriptor *edd_name;

of course extern in the eet: comment means create extern (not static) edd's -
replace with static instead of extern and it'd gen static Eet_Data_Descriptor
etc. and header would be empty. what it's missing is generation the
shutdown/free code so maybe a -clean option to generate cleanup code (simply
delete every edd in reverse dependency order - maintain dependency tree when
parsing). also being aple to ptovide how to init the eddc (class). this just
uses eina standard stuff. being able to add things like -nodirect to add after
the class init:

   eddc.func.str_direct_alloc = NULL;
   eddc.func.str_direct_free = NULL;

or a custom eddc etc. would be needed etc. but you get the idea. the reason i
suggest the above is:

1. it becomes minimal to no maintenance while writing the c code. the c code
simply tags thigns that should be eet codecable in comments. generating of
these snippiets of c code can be automated in the makefiles and build system.
you just #include the appropriate output files in your main source and
instantly get the "right code" to do the job for you.

2. it has the same functionality as geneet does, but more production-ready.

-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    [email protected]


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to