Re: [E-devel] [PATH] eet fixed / variable arrays support

2007-03-09 Thread Jorge Luis Zapata Muga
On 3/8/07, Nathan Ingersoll [EMAIL PROTECTED] wrote:
 On 3/8/07, Jorge Luis Zapata Muga [EMAIL PROTECTED] wrote:
 
  basically it was on the eet TODO, both group types were already
  defined but weren't implemented. I was looking for any of them for a
  project i'm coding on parallel. If your question is why are both
  EET_G_ARRAY and EET_G_VAR_ARRAY defined on eet, i guess it will handle
  more data types from the client side. (of course i'm avoiding the
  benefits of a variable length array from a programmer point of view).

 I guess I should have been more clear on my question. What I meant is
 why are two different types necessary? When encoded in the eet, how is
 there any difference between a variable array and a static array?

True. When encoded there's no difference between them, the chunks
looks the same.

 Can't the number of elements be calculated in the size of the encoded
 region if you know the size of the individual elements?

That's also true. Just note that a different semantics has to be done,
in case of a variable array the allocated size has to be done apart
from the data descriptor, but for a fixed array that space is already
allocated. That's mainly the only difference, besides how to count
elements (with a counter offset or using the sizeof).


  Note that if you want to encode a variable number of elements of an
  array (without the EET_G_VAR_ARRAY) you must say how many to the api
  before encoding, using variable arrays the encoding handle's it by
  itself (of course you will need the counter offset to know how many
  elements are in there). With this you can define the descriptor at the
  beginning and don't care about the length or when to encode.

 Is this so that you can do a sizeof(my_array) on a fixed size array
 rather than passing the number of elements or is the counter offset
 defining an offset within a struct that points to a counter for the
 number of elements in the array?

Both, the first applies to the fixed array, the second to the variable array.


 Thanks for clarifying.
 Nathan


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


[E-devel] [PATH] eet fixed / variable arrays support

2007-03-08 Thread Jorge Luis Zapata Muga

hi all, the following patch makes eet support for fixed arrays and
variable arrays:
int array[100]; // fixed
int varray*; // variable
int varray_count;

if you prefer i can commit directly but i prefer if someone can take a
look on it :)
note that this makes an API break on the function
eet_data_descriptor_element_add as we need another parameter the
count_offset to store/get the number of elements when
decoding/encoding a variable array.

i have also changed the way _decode and _encode function is
implemented, instead of open branches for different types of
group_types it now uses a table, there's still a problem with hashes
and arrays because both aren't accumulative (like a list with
list_add, etc) but iterative, they need the current chunk *and* the
following chunks to decode correctly, so there's still work to do to
clean it up.

ps: i did the diff with cvs diff -u hope it is ok =)


eet_array.patch
Description: Binary data
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] [PATH] eet fixed / variable arrays support

2007-03-08 Thread Jorge Luis Zapata Muga
On 3/8/07, Nathan Ingersoll [EMAIL PROTECTED] wrote:
 Hi Jorge,

Hi Nathan,


 On 3/8/07, Jorge Luis Zapata Muga [EMAIL PROTECTED] wrote:
 
  if you prefer i can commit directly but i prefer if someone can take a
  look on it :)
  note that this makes an API break on the function
  eet_data_descriptor_element_add as we need another parameter the
  count_offset to store/get the number of elements when
  decoding/encoding a variable array.

 Could you explain the reasoning for implementing the two different array 
 types?

basically it was on the eet TODO, both group types were already
defined but weren't implemented. I was looking for any of them for a
project i'm coding on parallel. If your question is why are both
EET_G_ARRAY and EET_G_VAR_ARRAY defined on eet, i guess it will handle
more data types from the client side. (of course i'm avoiding the
benefits of a variable length array from a programmer point of view).

Note that if you want to encode a variable number of elements of an
array (without the EET_G_VAR_ARRAY) you must say how many to the api
before encoding, using variable arrays the encoding handle's it by
itself (of course you will need the counter offset to know how many
elements are in there). With this you can define the descriptor at the
beginning and don't care about the length or when to encode.


  ps: i did the diff with cvs diff -u hope it is ok =)

 That's the preferred format.

 Thanks,
 Nathan


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] [PATH] eet fixed / variable arrays support

2007-03-08 Thread Jorge Luis Zapata Muga
On 3/8/07, Jorge Luis Zapata Muga [EMAIL PROTECTED] wrote:
 hi all, the following patch makes eet support for fixed arrays and
 variable arrays:
 int array[100]; // fixed
 int varray*; // variable
 int varray_count;

 if you prefer i can commit directly but i prefer if someone can take a
 look on it :)
 note that this makes an API break on the function
 eet_data_descriptor_element_add as we need another parameter the
 count_offset to store/get the number of elements when
 decoding/encoding a variable array.

 i have also changed the way _decode and _encode function is
 implemented, instead of open branches for different types of
 group_types it now uses a table, there's still a problem with hashes
 and arrays because both aren't accumulative (like a list with
 list_add, etc) but iterative, they need the current chunk *and* the
 following chunks to decode correctly, so there's still work to do to
 clean it up.

 ps: i did the diff with cvs diff -u hope it is ok =)



Another issue i found with eet is that none of the macros to add a
group of elements (EET_DATA_DESCRIPTOR_ADD_LIST, _HASH, _ARRAY,
_VAR_ARRAY) has a parameter to set the type, the EET_T_UNKNOWN is hard
coded, so with those we can't set up a list of ints or an array of
chars, etc. its quite easy to add those, if you agree i can add them
too =)

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] [PATH] eet fixed / variable arrays support

2007-03-08 Thread Nathan Ingersoll
On 3/8/07, Jorge Luis Zapata Muga [EMAIL PROTECTED] wrote:

 basically it was on the eet TODO, both group types were already
 defined but weren't implemented. I was looking for any of them for a
 project i'm coding on parallel. If your question is why are both
 EET_G_ARRAY and EET_G_VAR_ARRAY defined on eet, i guess it will handle
 more data types from the client side. (of course i'm avoiding the
 benefits of a variable length array from a programmer point of view).

I guess I should have been more clear on my question. What I meant is
why are two different types necessary? When encoded in the eet, how is
there any difference between a variable array and a static array?
Can't the number of elements be calculated in the size of the encoded
region if you know the size of the individual elements?

 Note that if you want to encode a variable number of elements of an
 array (without the EET_G_VAR_ARRAY) you must say how many to the api
 before encoding, using variable arrays the encoding handle's it by
 itself (of course you will need the counter offset to know how many
 elements are in there). With this you can define the descriptor at the
 beginning and don't care about the length or when to encode.

Is this so that you can do a sizeof(my_array) on a fixed size array
rather than passing the number of elements or is the counter offset
defining an offset within a struct that points to a counter for the
number of elements in the array?

Thanks for clarifying.
Nathan

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel