14 # define EAPI __declspec(dllexport)
17 # endif /* ! DLL_EXPORT */
19 # define EAPI __declspec(dllimport)
20 # endif /* ! EFL_EET_BUILD */
24 # define EAPI __attribute__ ((visibility("default")))
39 * @brief The file that provides the eet functions.
41 * This header provides the Eet management functions.
45 /***************************************************************************/
47 #define EET_T_UNKNOW 0 /**< Unknown data encoding type */
48 #define EET_T_CHAR 1 /**< Data type: char */
49 #define EET_T_SHORT 2 /**< Data type: short */
50 #define EET_T_INT 3 /**< Data type: int */
51 #define EET_T_LONG_LONG 4 /**< Data type: long long */
52 #define EET_T_FLOAT 5 /**< Data type: float */
53 #define EET_T_DOUBLE 6 /**< Data type: double */
54 #define EET_T_UCHAR 7 /**< Data type: unsigned char */
55 #define EET_T_USHORT 8 /**< Data type: unsigned short */
56 #define EET_T_UINT 9 /**< Data type: unsigned int */
57 #define EET_T_ULONG_LONG 10 /**< Data type: unsigned long long */
58 #define EET_T_STRING 11 /**< Data type: char * */
59 #define EET_T_INLINED_STRING 12 /**< Data type: char * (but compressed inside the resulting eet) */
60 #define EET_T_NULL 13 /**< Data type: (void *) (only use it if you know why) */
61 #define EET_T_LAST 14 /**< Last data type */
63 #define EET_G_UNKNOWN 100 /**< Unknown group data encoding type */
64 #define EET_G_ARRAY 101 /**< Fixed size array group type */
65 #define EET_G_VAR_ARRAY 102 /**< Variable size array group type */
66 #define EET_G_LIST 103 /**< Linked list group type */
67 #define EET_G_HASH 104 /**< Hash table group type */
68 #define EET_G_LAST 105 /**< Last group type */
70 /***************************************************************************/
72 typedef enum _Eet_File_Mode
74 EET_FILE_MODE_INVALID = -1,
77 EET_FILE_MODE_READ_WRITE
80 typedef enum _Eet_Error
85 EET_ERROR_NOT_WRITABLE,
86 EET_ERROR_OUT_OF_MEMORY,
87 EET_ERROR_WRITE_ERROR,
88 EET_ERROR_WRITE_ERROR_FILE_TOO_BIG,
89 EET_ERROR_WRITE_ERROR_IO_ERROR,
90 EET_ERROR_WRITE_ERROR_OUT_OF_SPACE,
91 EET_ERROR_WRITE_ERROR_FILE_CLOSED,
92 EET_ERROR_MMAP_FAILED,
93 EET_ERROR_X509_ENCODING_FAILED,
94 EET_ERROR_SIGNATURE_FAILED,
95 EET_ERROR_INVALID_SIGNATURE,
97 EET_ERROR_NOT_IMPLEMENTED,
98 EET_ERROR_PRNG_NOT_SEEDED,
99 EET_ERROR_ENCRYPT_FAILED,
100 EET_ERROR_DECRYPT_FAILED
103 typedef struct _Eet_File Eet_File;
104 typedef struct _Eet_Dictionary Eet_Dictionary;
105 typedef struct _Eet_Data_Descriptor Eet_Data_Descriptor;
106 typedef struct _Eet_Key Eet_Key;
108 typedef struct _Eet_Data_Descriptor_Class Eet_Data_Descriptor_Class;
110 #define EET_DATA_DESCRIPTOR_CLASS_VERSION 2
111 struct _Eet_Data_Descriptor_Class
117 void *(*mem_alloc) (size_t size);
118 void (*mem_free) (void *mem);
119 char *(*str_alloc) (const char *str);
120 void (*str_free) (const char *str);
121 void *(*list_next) (void *l);
122 void *(*list_append) (void *l, void *d);
123 void *(*list_data) (void *l);
124 void *(*list_free) (void *l);
125 void (*hash_foreach) (void *h, int (*func) (void *h, const char *k, void *dt, void *fdt), void *fdt);
126 void *(*hash_add) (void *h, const char *k, void *d);
127 void (*hash_free) (void *h);
128 char *(*str_direct_alloc) (const char *str);
129 void (*str_direct_free) (const char *str);
133 /***************************************************************************/
136 * Initialize the EET library.
138 * @return The new init count.
142 EAPI int eet_init(void);
145 * Shut down the EET library.
147 * @return The new init count.
151 EAPI int eet_shutdown(void);
156 * Eet didn't free items by default. If you are under memory presure, just
157 * call this function to recall all memory that are not yet referenced anymore.
158 * The cache take care of modification on disk.
162 EAPI void eet_clearcache(void);
165 * Open an eet file on disk, and returns a handle to it.
166 * @param file The file path to the eet file. eg: "/tmp/file.eet".
167 * @param mode The mode for opening. Either EET_FILE_MODE_READ, EET_FILE_MODE_WRITE or EET_FILE_MODE_READ_WRITE.
168 * @return An opened eet file handle.
170 * This function will open an exiting eet file for reading, and build
171 * the directory table in memory and return a handle to the file, if it
172 * exists and can be read, and no memory errors occur on the way, otherwise
173 * NULL will be returned.
175 * It will also open an eet file for writing. This will, if successful,
176 * delete the original file and replace it with a new empty file, till
177 * the eet file handle is closed or flushed. If it cannot be opened for
178 * writing or a memory error occurs, NULL is returned.
180 * You can also open the file for read/write. If you then write a key that
181 * does not exist it will be created, if the key exists it will be replaced
190 * main(int argc, char **argv)
193 * char buf[1024], *ret, **list;
196 * strcpy(buf, "Here is a string of data to save!");
198 * ef = eet_open("/tmp/my_file.eet", EET_FILE_MODE_WRITE);
199 * if (!ef) return -1;
200 * if (!eet_write(ef, "/key/to_store/at", buf, 1024, 1))
201 * fprintf(stderr, "Error writing data!\n");
204 * ef = eet_open("/tmp/my_file.eet", EET_FILE_MODE_READ);
205 * if (!ef) return -1;
206 * list = eet_list(ef, "*", &num);
209 * for (i = 0; i < num; i++)
210 * printf("Key stored: %s\n", list[i]);
213 * ret = eet_read(ef, "/key/to_store/at", &size);
216 * printf("Data read (%i bytes):\n%s\n", size, ret);
227 EAPI Eet_File *eet_open(const char *file, Eet_File_Mode mode);
230 * Open an eet file directly from a memory location. The data are not copied,
231 * so you must keep them around as long as the eet file is open. Their is
232 * currently no cache for this kind of Eet_File, so it's reopen every time
233 * you do use eet_memopen_read.
237 EAPI Eet_File *eet_memopen_read(const void *data, size_t size);
240 * Get the mode an Eet_File was opened with.
241 * @param ef A valid eet file handle.
242 * @return The mode ef was opened with.
246 EAPI Eet_File_Mode eet_mode_get(Eet_File *ef);
249 * Close an eet file handle and flush and writes pending.
250 * @param ef A valid eet file handle.
252 * This function will flush any pending writes to disk if the eet file
253 * was opened for write, and free all data associated with the file handle
254 * and file, and close the file.
256 * If the eet file handle is not valid nothing will be done.
260 EAPI Eet_Error eet_close(Eet_File *ef);
263 * Callback used to request if needed the password of a private key.
267 typedef int (*Eet_Key_Password_Callback)(char *buffer, int size, int rwflag, void *data);
270 * Create an Eet_Key needed for signing an eet file.
272 * The certificate should provide the public that match the private key.
273 * No verification is done to ensure that.
277 EAPI Eet_Key* eet_identity_open(const char *certificate_file, const char *private_key_file, Eet_Key_Password_Callback cb);
280 * Close and release all ressource used by an Eet_Key.
281 * An reference counter prevent it from being freed until all file using it are
286 EAPI void eet_identity_close(Eet_Key *key);
289 * Set a key to sign a file
293 EAPI Eet_Error eet_identity_set(Eet_File *ef, Eet_Key *key);
296 * Display both private and public key of an Eet_Key.
300 EAPI void eet_identity_print(Eet_Key *key, FILE *out);
303 * Get the x509 der certificate associated with an Eet_File. Will return NULL
304 * if the file is not signed.
308 EAPI const void *eet_identity_x509(Eet_File *ef, int *der_length);
311 * Get the raw signature associated with an Eet_File. Will return NULL
312 * if the file is not signed.
314 EAPI const void *eet_identity_signature(Eet_File *ef, int *signature_length);
317 * Display the x509 der certificate to out.
321 EAPI void eet_identity_certificate_print(const unsigned char *certificate, int der_length, FILE *out);
324 * Return a handle to the shared string dictionary of the Eet file
325 * @param ef A valid eet file handle.
326 * @return A handle to the dictionary of the file
328 * This function returns a handle to the dictionary of an Eet file whose
329 * handle is @p ef, if a dictionary exists. NULL is returned otherwise or
330 * if the file handle is known to be invalid.
334 EAPI Eet_Dictionary *eet_dictionary_get(Eet_File *ef);
337 * Check if a given string comes from a given dictionary
338 * @param ed A valid dictionary handle
339 * @param string A valid 0 byte terminated C string
340 * @return 1 if it is in the dictionary, 0 otherwise
342 * This checks the given dictionary to see if the given string is actually
343 * inside that dictionary (i.e. comes from it) and returns 1 if it does.
344 * If the dictionary handle is invlide, the string is NULL or the string is
345 * not in the dictionary, 0 is returned.
349 EAPI int eet_dictionary_string_check(Eet_Dictionary *ed, const char *string);
352 * Read a specified entry from an eet file and return data
353 * @param ef A valid eet file handle opened for reading.
354 * @param name Name of the entry. eg: "/base/file_i_want".
355 * @param size_ret Number of bytes read from entry and returned.
356 * @return The data stored in that entry in the eet file.
358 * This function finds an entry in the eet file that is stored under the
359 * name specified, and returns that data, decompressed, if successful.
360 * NULL is returned if the lookup fails or if memory errors are
361 * encountered. It is the job of the calling program to call free() on
362 * the returned data. The number of bytes in the returned data chunk are
363 * placed in size_ret.
365 * If the eet file handle is not valid NULL is returned and size_ret is
370 EAPI void *eet_read_cipher(Eet_File *ef, const char *name, int *size_ret, const char *cipher_key);
371 EAPI void *eet_read(Eet_File *ef, const char *name, int *size_ret);
374 * Read a specified entry from an eet file and return data
375 * @param ef A valid eet file handle opened for reading.
376 * @param name Name of the entry. eg: "/base/file_i_want".
377 * @param size_ret Number of bytes read from entry and returned.
378 * @return The data stored in that entry in the eet file.
380 * This function finds an entry in the eet file that is stored under the
381 * name specified, and returns that data if not compressed and successful.
382 * NULL is returned if the lookup fails or if memory errors are
383 * encountered or if the data is comrpessed. The calling program must never
384 * call free() on the returned data. The number of bytes in the returned
385 * data chunk are placed in size_ret.
387 * If the eet file handle is not valid NULL is returned and size_ret is
392 EAPI const void *eet_read_direct(Eet_File *ef, const char *name, int *size_ret);
395 * Write a specified entry to an eet file handle
396 * @param ef A valid eet file handle opened for writing.
397 * @param name Name of the entry. eg: "/base/file_i_want".
398 * @param data Pointer to the data to be stored.
399 * @param size Length in bytes in the data to be stored.
400 * @param compress Compression flags (1 == compress, 0 = don't compress).
401 * @return Success or failure of the write.
403 * This function will write the specified chunk of data to the eet file
404 * and return greater than 0 on success. 0 will be returned on failure.
406 * The eet file handle must be a valid file handle for an eet file opened
407 * for writing. If it is not, 0 will be returned and no action will be
410 * Name, and data must not be NULL, and size must be > 0. If these
411 * conditions are not met, 0 will be returned.
413 * The data will be copied (and optionally compressed) in ram, pending
414 * a flush to disk (it will stay in ram till the eet file handle is
419 EAPI int eet_write_cipher(Eet_File *ef, const char *name, const void *data, int size, int compress, const char *cipher_key);
420 EAPI int eet_write(Eet_File *ef, const char *name, const void *data, int size, int compress);
423 * Delete a specified entry from an Eet file being written or re-written
424 * @param ef A valid eet file handle opened for writing.
425 * @param name Name of the entry. eg: "/base/file_i_want".
426 * @return Success or failure of the delete.
428 * This function will delete the specified chunk of data from the eet file
429 * and return greater than 0 on success. 0 will be returned on failure.
431 * The eet file handle must be a valid file handle for an eet file opened
432 * for writing. If it is not, 0 will be returned and no action will be
435 * Name, must not be NULL, otherwise 0 will be returned.
439 EAPI int eet_delete(Eet_File *ef, const char *name);
442 * List all entries in eet file matching shell glob.
443 * @param ef A valid eet file handle.
444 * @param glob A shell glob to match against.
445 * @param count_ret Number of entries found to match.
446 * @return Pointer to an array of strings.
448 * This function will list all entries in the eet file matching the
449 * supplied shell glob and return an allocated list of their names, if
450 * there are any, and if no memory errors occur.
452 * The eet file handle must be valid and glob must not be NULL, or NULL
453 * will be returned and count_ret will be filled with 0.
455 * The calling program must call free() on the array returned, but NOT
456 * on the string pointers in the array. They are taken as read-only
457 * internals from the eet file handle. They are only valid as long as
458 * the file handle is not closed. When it is closed those pointers in the
459 * array are now not valid and should not be used.
461 * On success the array returned will have a list of string pointers
462 * that are the names of the entries that matched, and count_ret will have
463 * the number of entries in this array placed in it.
465 * Hint: an easy way to list all entries in an eet file is to use a glob
470 EAPI char **eet_list(Eet_File *ef, const char *glob, int *count_ret);
473 * Return the number of entries in the specified eet file.
474 * @param ef A valid eet file handle.
475 * @return Number of entries in ef or -1 if the number of entries
476 * cannot be read due to open mode restrictions.
480 EAPI int eet_num_entries(Eet_File *ef);
482 /***************************************************************************/
485 * Read just the header data for an image and dont decode the pixels.
486 * @param ef A valid eet file handle opened for reading.
487 * @param name Name of the entry. eg: "/base/file_i_want".
488 * @param w A pointer to the unsigned int to hold the width in pixels.
489 * @param h A pointer to the unsigned int to hold the height in pixels.
490 * @param alpha A pointer to the int to hold the alpha flag.
491 * @param compress A pointer to the int to hold the compression amount.
492 * @param quality A pointer to the int to hold the quality amount.
493 * @param lossy A pointer to the int to hold the lossiness flag.
494 * @return 1 on successfull decode, 0 otherwise
496 * This function reads an image from an eet file stored under the named
497 * key in the eet file and return a pointer to the decompressed pixel data.
499 * The other parameters of the image (width, height etc.) are placed into
500 * the values pointed to (they must be supplied). The pixel data is a linear
501 * array of pixels starting from the top-left of the image scanning row by
502 * row from left to right. Each pile is a 32bit value, with the high byte
503 * being the alpha channel, the next being red, then green, and the low byte
504 * being blue. The width and height are measured in pixels and will be
505 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
506 * that the alpha channel is not used. 1 denotes that it is significant.
507 * Compress is filled with the compression value/amount the image was
508 * stored with. The quality value is filled with the quality encoding of
509 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
510 * the image was encoded lossily or not.
512 * On success the function returns 1 indicating the header was read and
513 * decoded properly, or 0 on failure.
517 EAPI int eet_data_image_header_read_cipher(Eet_File *ef, const char *name, const char *key, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
518 EAPI int eet_data_image_header_read(Eet_File *ef, const char *name, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
521 * Read image data from the named key in the eet file.
522 * @param ef A valid eet file handle opened for reading.
523 * @param name Name of the entry. eg: "/base/file_i_want".
524 * @param w A pointer to the unsigned int to hold the width in pixels.
525 * @param h A pointer to the unsigned int to hold the height in pixels.
526 * @param alpha A pointer to the int to hold the alpha flag.
527 * @param compress A pointer to the int to hold the compression amount.
528 * @param quality A pointer to the int to hold the quality amount.
529 * @param lossy A pointer to the int to hold the lossiness flag.
530 * @return The image pixel data decoded
532 * This function reads an image from an eet file stored under the named
533 * key in the eet file and return a pointer to the decompressed pixel data.
535 * The other parameters of the image (width, height etc.) are placed into
536 * the values pointed to (they must be supplied). The pixel data is a linear
537 * array of pixels starting from the top-left of the image scanning row by
538 * row from left to right. Each pile is a 32bit value, with the high byte
539 * being the alpha channel, the next being red, then green, and the low byte
540 * being blue. The width and height are measured in pixels and will be
541 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
542 * that the alpha channel is not used. 1 denotes that it is significant.
543 * Compress is filled with the compression value/amount the image was
544 * stored with. The quality value is filled with the quality encoding of
545 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
546 * the image was encoded lossily or not.
548 * On success the function returns a pointer to the image data decoded. The
549 * calling application is responsible for calling free() on the image data
550 * when it is done with it. On failure NULL is returned and the parameter
551 * values may not contain any sensible data.
555 EAPI void *eet_data_image_read_cipher(Eet_File *ef, const char *name, const char *key, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
556 EAPI void *eet_data_image_read(Eet_File *ef, const char *name, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
559 * Read image data from the named key in the eet file.
560 * @param ef A valid eet file handle opened for reading.
561 * @param name Name of the entry. eg: "/base/file_i_want".
562 * @param src_x The starting x coordinate from where to dump the stream.
563 * @param src_y The starting y coordinate from where to dump the stream.
564 * @param d A pointer to the pixel surface.
565 * @param w The expected width in pixels of the pixel surface to decode.
566 * @param h The expected height in pixels of the pixel surface to decode.
567 * @param row_stride The length of a pixels line in the destination surface.
568 * @param alpha A pointer to the int to hold the alpha flag.
569 * @param compress A pointer to the int to hold the compression amount.
570 * @param quality A pointer to the int to hold the quality amount.
571 * @param lossy A pointer to the int to hold the lossiness flag.
572 * @return 1 on success, 0 otherwise.
574 * This function reads an image from an eet file stored under the named
575 * key in the eet file and return a pointer to the decompressed pixel data.
577 * The other parameters of the image (width, height etc.) are placed into
578 * the values pointed to (they must be supplied). The pixel data is a linear
579 * array of pixels starting from the top-left of the image scanning row by
580 * row from left to right. Each pile is a 32bit value, with the high byte
581 * being the alpha channel, the next being red, then green, and the low byte
582 * being blue. The width and height are measured in pixels and will be
583 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
584 * that the alpha channel is not used. 1 denotes that it is significant.
585 * Compress is filled with the compression value/amount the image was
586 * stored with. The quality value is filled with the quality encoding of
587 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
588 * the image was encoded lossily or not.
590 * On success the function returns 1, and 0 on failure. On failure the
591 * parameter values may not contain any sensible data.
595 EAPI int eet_data_image_read_to_surface_cipher(Eet_File *ef, const char *name, const char *key, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, int *lossy);
596 EAPI int eet_data_image_read_to_surface(Eet_File *ef, const char *name, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, int *lossy);
599 * Write image data to the named key in an eet file.
600 * @param ef A valid eet file handle opened for writing.
601 * @param name Name of the entry. eg: "/base/file_i_want".
602 * @param data A pointer to the image pixel data.
603 * @param w The width of the image in pixels.
604 * @param h The height of the image in pixels.
605 * @param alpha The alpha channel flag.
606 * @param compress The compression amount.
607 * @param quality The quality encoding amount.
608 * @param lossy The lossiness flag.
609 * @return Success if the data was encoded and written or not.
611 * This function takes image pixel data and encodes it in an eet file
612 * stored under the supplied name key, and returns how many bytes were
613 * actually written to encode the image data.
615 * The data expected is the same format as returned by eet_data_image_read.
616 * If this is not the case weird things may happen. Width and height must
617 * be between 1 and 8000 pixels. The alpha flags can be 0 or 1 (0 meaning
618 * the alpha values are not useful and 1 meaning they are). Compress can
619 * be from 0 to 9 (0 meaning no compression, 9 meaning full compression).
620 * This is only used if the image is not lossily encoded. Quality is used on
621 * lossy compression and should be a value from 0 to 100. The lossy flag
622 * can be 0 or 1. 0 means encode losslessly and 1 means to encode with
623 * image quality loss (but then have a much smaller encoding).
625 * On success this function returns the number of bytes that were required
626 * to encode the image data, or on failure it returns 0.
630 EAPI int eet_data_image_write_cipher(Eet_File *ef, const char *name, const char *key, const void *data, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy);
631 EAPI int eet_data_image_write(Eet_File *ef, const char *name, const void *data, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy);
634 * Decode Image data header only to get information.
635 * @param data The encoded pixel data.
636 * @param size The size, in bytes, of the encoded pixel data.
637 * @param w A pointer to the unsigned int to hold the width in pixels.
638 * @param h A pointer to the unsigned int to hold the height in pixels.
639 * @param alpha A pointer to the int to hold the alpha flag.
640 * @param compress A pointer to the int to hold the compression amount.
641 * @param quality A pointer to the int to hold the quality amount.
642 * @param lossy A pointer to the int to hold the lossiness flag.
643 * @return 1 on success, 0 on failure.
645 * This function takes encoded pixel data and decodes it into raw RGBA
648 * The other parameters of the image (width, height etc.) are placed into
649 * the values pointed to (they must be supplied). The pixel data is a linear
650 * array of pixels starting from the top-left of the image scanning row by
651 * row from left to right. Each pixel is a 32bit value, with the high byte
652 * being the alpha channel, the next being red, then green, and the low byte
653 * being blue. The width and height are measured in pixels and will be
654 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
655 * that the alpha channel is not used. 1 denotes that it is significant.
656 * Compress is filled with the compression value/amount the image was
657 * stored with. The quality value is filled with the quality encoding of
658 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
659 * the image was encoded lossily or not.
661 * On success the function returns 1 indicating the header was read and
662 * decoded properly, or 0 on failure.
666 EAPI int eet_data_image_header_decode_cipher(const void *data, const char *key, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
667 EAPI int eet_data_image_header_decode(const void *data, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
670 * Decode Image data into pixel data.
671 * @param data The encoded pixel data.
672 * @param size The size, in bytes, of the encoded pixel data.
673 * @param w A pointer to the unsigned int to hold the width in pixels.
674 * @param h A pointer to the unsigned int to hold the height in pixels.
675 * @param alpha A pointer to the int to hold the alpha flag.
676 * @param compress A pointer to the int to hold the compression amount.
677 * @param quality A pointer to the int to hold the quality amount.
678 * @param lossy A pointer to the int to hold the lossiness flag.
679 * @return The image pixel data decoded
681 * This function takes encoded pixel data and decodes it into raw RGBA
684 * The other parameters of the image (width, height etc.) are placed into
685 * the values pointed to (they must be supplied). The pixel data is a linear
686 * array of pixels starting from the top-left of the image scanning row by
687 * row from left to right. Each pixel is a 32bit value, with the high byte
688 * being the alpha channel, the next being red, then green, and the low byte
689 * being blue. The width and height are measured in pixels and will be
690 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
691 * that the alpha channel is not used. 1 denotes that it is significant.
692 * Compress is filled with the compression value/amount the image was
693 * stored with. The quality value is filled with the quality encoding of
694 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
695 * the image was encoded lossily or not.
697 * On success the function returns a pointer to the image data decoded. The
698 * calling application is responsible for calling free() on the image data
699 * when it is done with it. On failure NULL is returned and the parameter
700 * values may not contain any sensible data.
704 EAPI void *eet_data_image_decode_cipher(const void *data, const char *key, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
705 EAPI void *eet_data_image_decode(const void *data, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
708 * Decode Image data into pixel data.
709 * @param data The encoded pixel data.
710 * @param size The size, in bytes, of the encoded pixel data.
711 * @param src_x The starting x coordinate from where to dump the stream.
712 * @param src_y The starting y coordinate from where to dump the stream.
713 * @param d A pointer to the pixel surface.
714 * @param w The expected width in pixels of the pixel surface to decode.
715 * @param h The expected height in pixels of the pixel surface to decode.
716 * @param row_stride The length of a pixels line in the destination surface.
717 * @param alpha A pointer to the int to hold the alpha flag.
718 * @param compress A pointer to the int to hold the compression amount.
719 * @param quality A pointer to the int to hold the quality amount.
720 * @param lossy A pointer to the int to hold the lossiness flag.
721 * @return 1 on success, 0 otherwise.
723 * This function takes encoded pixel data and decodes it into raw RGBA
726 * The other parameters of the image (alpha, compress etc.) are placed into
727 * the values pointed to (they must be supplied). The pixel data is a linear
728 * array of pixels starting from the top-left of the image scanning row by
729 * row from left to right. Each pixel is a 32bit value, with the high byte
730 * being the alpha channel, the next being red, then green, and the low byte
731 * being blue. The width and height are measured in pixels and will be
732 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
733 * that the alpha channel is not used. 1 denotes that it is significant.
734 * Compress is filled with the compression value/amount the image was
735 * stored with. The quality value is filled with the quality encoding of
736 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
737 * the image was encoded lossily or not.
739 * On success the function returns 1, and 0 on failure. On failure the
740 * parameter values may not contain any sensible data.
744 EAPI int eet_data_image_decode_to_surface_cipher(const void *data, const char *key, int size, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, int *lossy);
745 EAPI int eet_data_image_decode_to_surface(const void *data, int size, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, int *lossy);
748 * Encode image data for storage or transmission.
749 * @param data A pointer to the image pixel data.
750 * @param size_ret A pointer to an int to hold the size of the returned data.
751 * @param w The width of the image in pixels.
752 * @param h The height of the image in pixels.
753 * @param alpha The alpha channel flag.
754 * @param compress The compression amount.
755 * @param quality The quality encoding amount.
756 * @param lossy The lossiness flag.
757 * @return The encoded image data.
759 * This function stakes image pixel data and encodes it with compression and
760 * possible loss of quality (as a trade off for size) for storage or
761 * transmission to another system.
763 * The data expected is the same format as returned by eet_data_image_read.
764 * If this is not the case weird things may happen. Width and height must
765 * be between 1 and 8000 pixels. The alpha flags can be 0 or 1 (0 meaning
766 * the alpha values are not useful and 1 meaning they are). Compress can
767 * be from 0 to 9 (0 meaning no compression, 9 meaning full compression).
768 * This is only used if the image is not lossily encoded. Quality is used on
769 * lossy compression and should be a value from 0 to 100. The lossy flag
770 * can be 0 or 1. 0 means encode losslessly and 1 means to encode with
771 * image quality loss (but then have a much smaller encoding).
773 * On success this function returns a pointer to the encoded data that you
774 * can free with free() when no longer needed.
778 EAPI void *eet_data_image_encode_cipher(const void *data, const char *key, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy, int *size_ret);
779 EAPI void *eet_data_image_encode(const void *data, int *size_ret, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy);
781 /***************************************************************************/
784 * Create a new empty data structure descriptor.
785 * @param name The string name of this data structure (most be a global constant and never change).
786 * @param size The size of the struct (in bytes).
787 * @param func_list_next The function to get the next list node.
788 * @param func_list_append The function to append a member to a list.
789 * @param func_list_data The function to get the data from a list node.
790 * @param func_list_free The function to free an entire linked list.
791 * @param func_hash_foreach The function to iterate through all hash table entries.
792 * @param func_hash_add The function to add a member to a hash table.
793 * @param func_hash_free The function to free an entire hash table.
794 * @return A new empty data descriptor.
796 * This function creates a new data descriptore and returns a handle to the
797 * new data descriptor. On creation it will be empty, containing no contents
798 * describing anything other than the shell of the data structure.
800 * You add structure members to the data descriptor using the macros
801 * EET_DATA_DESCRIPTOR_ADD_BASIC(), EET_DATA_DESCRIPTOR_ADD_SUB() and
802 * EET_DATA_DESCRIPTOR_ADD_LIST(), depending on what type of member you are
803 * adding to the description.
805 * Once you have described all the members of a struct you want loaded, or
806 * saved eet can load and save those members for you, encode them into
807 * endian-independant serialised data chunks for transmission across a
810 * The function pointers to the list and hash table functions are only
811 * needed if you use those data types, else you can pass NULL instead.
819 * typedef struct _blah2
825 * typedef struct _blah3
831 * typedef struct _blah
838 * double floating_lots;
846 * eet_eina_hash_add(Eina_Hash *hash, const char *key, const void *data)
848 * if (!hash) hash = eina_hash_string_superfast_new(NULL);
849 * if (!hash) return NULL;
851 * eina_hash_add(hash, key, data);
856 * main(int argc, char **argv)
861 * Eet_Data_Descriptor *edd, *edd2, *edd3;
867 * edd3 = eet_data_descriptor_new("blah3", sizeof(Blah3),
870 * eina_list_data_get,
875 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd3, Blah3, "string3", string, EET_T_STRING);
877 * edd2 = eet_data_descriptor_new("blah2", sizeof(Blah2),
880 * eina_list_data_get,
885 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd2, Blah2, "string2", string, EET_T_STRING);
887 * edd = eet_data_descriptor_new("blah", sizeof(Blah),
890 * eina_list_data_get,
895 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "character", character, EET_T_CHAR);
896 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "sixteen", sixteen, EET_T_SHORT);
897 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "integer", integer, EET_T_INT);
898 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "lots", lots, EET_T_LONG_LONG);
899 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "floating", floating, EET_T_FLOAT);
900 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "floating_lots", floating_lots, EET_T_DOUBLE);
901 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "string", string, EET_T_STRING);
902 * EET_DATA_DESCRIPTOR_ADD_SUB(edd, Blah, "blah2", blah2, edd2);
903 * EET_DATA_DESCRIPTOR_ADD_LIST(edd, Blah, "blah3", blah3, edd3);
905 * blah3.string="PANTS";
907 * blah2.string="subtype string here!";
909 * blah.character='7';
910 * blah.sixteen=0x7777;
911 * blah.integer=0xc0def00d;
912 * blah.lots=0xdeadbeef31337777;
913 * blah.floating=3.141592654;
914 * blah.floating_lots=0.777777777777777;
915 * blah.string="bite me like a turnip";
916 * blah.blah2 = &blah2;
917 * blah.blah3 = eina_list_append(NULL, &blah3);
918 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
919 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
920 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
921 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
922 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
923 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
925 * data = eet_data_descriptor_encode(edd, &blah, &size);
926 * printf("-----DECODING\n");
927 * blah_in = eet_data_descriptor_decode(edd, data, size);
929 * printf("-----DECODED!\n");
930 * printf("%c\n", blah_in->character);
931 * printf("%x\n", (int)blah_in->sixteen);
932 * printf("%x\n", blah_in->integer);
933 * printf("%lx\n", blah_in->lots);
934 * printf("%f\n", (double)blah_in->floating);
935 * printf("%f\n", (double)blah_in->floating_lots);
936 * printf("%s\n", blah_in->string);
937 * printf("%p\n", blah_in->blah2);
938 * printf(" %s\n", blah_in->blah2->string);
943 * EINA_LIST_FOREACH(blah_in->blah3, l, blah3_in)
945 * printf("%p\n", blah3_in);
946 * printf(" %s\n", blah3_in->string);
949 * eet_data_descriptor_free(edd);
950 * eet_data_descriptor_free(edd2);
951 * eet_data_descriptor_free(edd3);
960 EAPI Eet_Data_Descriptor *eet_data_descriptor_new(const char *name, int size, void *(*func_list_next) (void *l), void *(*func_list_append) (void *l, void *d), void *(*func_list_data) (void *l), void *(*func_list_free) (void *l), void (*func_hash_foreach) (void *h, int (*func) (void *h, const char *k, void *dt, void *fdt), void *fdt), void *(*func_hash_add) (void *h, const char *k, void *d), void (*func_hash_free) (void *h));
964 * moving to this api from the old above. this will break things when the
965 * move happens - but be warned
967 EAPI Eet_Data_Descriptor *eet_data_descriptor2_new(Eet_Data_Descriptor_Class *eddc);
968 EAPI Eet_Data_Descriptor *eet_data_descriptor3_new(Eet_Data_Descriptor_Class *eddc);
971 * This function frees a data descriptor when it is not needed anymore.
972 * @param edd The data descriptor to free.
974 * This function takes a data descriptor handle as a parameter and frees all
975 * data allocated for the data descriptor and the handle itself. After this
976 * call the descriptor is no longer valid.
980 EAPI void eet_data_descriptor_free(Eet_Data_Descriptor *edd);
983 * This function is an internal used by macros.
985 * This function is used by macros EET_DATA_DESCRIPTOR_ADD_BASIC(),
986 * EET_DATA_DESCRIPTOR_ADD_SUB() and EET_DATA_DESCRIPTOR_ADD_LIST(). It is
987 * complex to use by hand and should be left to be used by the macros, and
988 * thus is not documented.
992 EAPI void eet_data_descriptor_element_add(Eet_Data_Descriptor *edd, const char *name, int type, int group_type, int offset, /* int count_offset, */int count, const char *counter_name, Eet_Data_Descriptor *subtype);
995 * Read a data structure from an eet file and decodes it.
996 * @param ef The eet file handle to read from.
997 * @param edd The data descriptor handle to use when decoding.
998 * @param name The key the data is stored under in the eet file.
999 * @return A pointer to the decoded data structure.
1001 * This function decodes a data structure stored in an eet file, returning
1002 * a pointer to it if it decoded successfully, or NULL on failure. This
1003 * can save a programmer dozens of hours of work in writing configuration
1004 * file parsing and writing code, as eet does all that work for the program
1005 * and presents a program-friendly data structure, just as the programmer
1006 * likes. Eet can handle members being added or deleted from the data in
1007 * storage and safely zero-fills unfilled members if they were not found
1008 * in the data. It checks sizes and headers whenever it reads data, allowing
1009 * the programmer to not worry about corrupt data.
1011 * Once a data structure has been described by the programmer with the
1012 * fields they wish to save or load, storing or retrieving a data structure
1013 * from an eet file, or from a chunk of memory is as simple as a single
1018 EAPI void *eet_data_read_cipher(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, const char *key);
1019 EAPI void *eet_data_read(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name);
1022 * Write a data structure from memory and store in an eet file.
1023 * @param ef The eet file handle to write to.
1024 * @param edd The data descriptor to use when encoding.
1025 * @param name The key to store the data under in the eet file.
1026 * @param data A pointer to the data structure to ssave and encode.
1027 * @param compress Compression flags for storage.
1028 * @return 1 on successful write, 0 on failure.
1030 * This function is the reverse of eet_data_read(), saving a data structure
1035 EAPI int eet_data_write_cipher(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, const char *key, const void *data, int compress);
1036 EAPI int eet_data_write(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, const void *data, int compress);
1039 * Dump an eet encoded data structure into ascii text
1040 * @param data_in The pointer to the data to decode into a struct.
1041 * @param size_in The size of the data pointed to in bytes.
1042 * @param dumpfunc The function to call passed a string when new data is converted to text
1043 * @param dumpdata The data to pass to the @p dumpfunc callback.
1044 * @return 1 on success, 0 on failure
1046 * This function will take a chunk of data encoded by
1047 * eet_data_descriptor_encode() and convert it into human readable ascii text.
1048 * It does this by calling the @p dumpfunc callback for all new text that is
1049 * generated. This callback should append to any existing text buffer and
1050 * will be passed the pointer @p dumpdata as a parameter as well as a string
1051 * with new text to be appended.
1057 * void output(void *data, const char *string)
1059 * printf("%s", string);
1062 * void dump(const char *file)
1068 * f = fopen(file, "r");
1069 * fseek(f, 0, SEEK_END);
1072 * data = malloc(len);
1073 * fread(data, len, 1, f);
1075 * eet_data_text_dump(data, len, output, NULL);
1081 EAPI int eet_data_text_dump_cipher(const void *data_in, const char *key, int size_in, void (*dumpfunc) (void *data, const char *str), void *dumpdata);
1082 EAPI int eet_data_text_dump(const void *data_in, int size_in, void (*dumpfunc) (void *data, const char *str), void *dumpdata);
1085 * Take an ascii encoding from eet_data_text_dump() and re-encode in binary.
1086 * @param text The pointer to the string data to parse and encode.
1087 * @param textlen The size of the string in bytes (not including 0 byte terminator).
1088 * @param size_ret This gets filled in with the encoded data blob size in bytes.
1089 * @return The encoded data on success, NULL on failure.
1091 * This function will parse the string pointed to by @p text and return
1092 * an encoded data lump the same way eet_data_descriptor_encode() takes an
1093 * in-memory data struct and encodes into a binary blob. @p text is a normal
1098 EAPI void *eet_data_text_undump_cipher(const char *text, const char *key, int textlen, int *size_ret);
1099 EAPI void *eet_data_text_undump(const char *text, int textlen, int *size_ret);
1102 * Dump an eet encoded data structure from an eet file into ascii text
1103 * @param ef A valid eet file handle.
1104 * @param name Name of the entry. eg: "/base/file_i_want".
1105 * @param dumpfunc The function to call passed a string when new data is converted to text
1106 * @param dumpdata The data to pass to the @p dumpfunc callback.
1107 * @return 1 on success, 0 on failure
1109 * This function will take an open and valid eet file from eet_open() request
1110 * the data encoded by eet_data_descriptor_encode() corresponding to the key @p name
1111 * and convert it into human readable ascii text. It does this by calling the
1112 * @p dumpfunc callback for all new text that is generated. This callback should
1113 * append to any existing text buffer and will be passed the pointer @p dumpdata
1114 * as a parameter as well as a string with new text to be appended.
1118 EAPI int eet_data_dump_cipher(Eet_File *ef, const char *name, const char *key, void (*dumpfunc) (void *data, const char *str), void *dumpdata);
1119 EAPI int eet_data_dump(Eet_File *ef, const char *name, void (*dumpfunc) (void *data, const char *str), void *dumpdata);
1122 * Take an ascii encoding from eet_data_dump() and re-encode in binary.
1123 * @param ef A valid eet file handle.
1124 * @param name Name of the entry. eg: "/base/file_i_want".
1125 * @param text The pointer to the string data to parse and encode.
1126 * @param textlen The size of the string in bytes (not including 0 byte terminator).
1127 * @param compress Compression flags (1 == compress, 0 = don't compress).
1128 * @return 1 on success, 0 on failure
1130 * This function will parse the string pointed to by @p text, encode it the same
1131 * way eet_data_descriptor_encode() takes an in-memory data struct and encodes into a
1134 * The data (optionally compressed) will be in ram, pending a flush to
1135 * disk (it will stay in ram till the eet file handle is closed though).
1139 EAPI int eet_data_undump_cipher(Eet_File *ef, const char *name, const char *key, const char *text, int textlen, int compress);
1140 EAPI int eet_data_undump(Eet_File *ef, const char *name, const char *text, int textlen, int compress);
1143 * Decode a data structure from an arbitary location in memory.
1144 * @param edd The data descriptor to use when decoding.
1145 * @param data_in The pointer to the data to decode into a struct.
1146 * @param size_in The size of the data pointed to in bytes.
1147 * @return NULL on failure, or a valid decoded struct pointer on success.
1149 * This function will decode a data structure that has been encoded using
1150 * eet_data_descriptor_encode(), and return a data structure with all its
1151 * elements filled out, if successful, or NULL on failure.
1153 * The data to be decoded is stored at the memory pointed to by @p data_in,
1154 * and is described by the descriptor pointed to by @p edd. The data size is
1155 * passed in as the value to @p size_in, ande must be greater than 0 to
1158 * This function is useful for decoding data structures delivered to the
1159 * application by means other than an eet file, such as an IPC or socket
1160 * connection, raw files, shared memory etc.
1162 * Please see eet_data_read() for more information.
1166 EAPI void *eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd, const void *data_in, const char *key, int size_in);
1167 EAPI void *eet_data_descriptor_decode(Eet_Data_Descriptor *edd, const void *data_in, int size_in);
1170 * Encode a dsata struct to memory and return that encoded data.
1171 * @param edd The data descriptor to use when encoding.
1172 * @param data_in The pointer to the struct to encode into data.
1173 * @param size_ret A pointer to the an int to be filled with the decoded size.
1174 * @return NULL on failure, or a valid encoded data chunk on success.
1176 * This function takes a data structutre in memory and encodes it into a
1177 * serialised chunk of data that can be decoded again by
1178 * eet_data_descriptor_decode(). This is useful for being able to transmit
1179 * data structures across sockets, pipes, IPC or shared file mechanisms,
1180 * without having to worry about memory space, machine type, endianess etc.
1182 * The parameter @p edd must point to a valid data descriptor, and
1183 * @p data_in must point to the right data structure to encode. If not, the
1184 * encoding may fail.
1186 * On success a non NULL valid pointer is returned and what @p size_ret
1187 * points to is set to the size of this decoded data, in bytes. When the
1188 * encoded data is no longer needed, call free() on it. On failure NULL is
1189 * returned and what @p size_ret points to is set to 0.
1191 * Please see eet_data_write() for more information.
1195 EAPI void *eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd, const void *data_in, const char *key, int *size_ret);
1196 EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd, const void *data_in, int *size_ret);
1199 * Add a basic data element to a data descriptor.
1200 * @param edd The data descriptor to add the type to.
1201 * @param struct_type The type of the struct.
1202 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1203 * @param member The struct member itself to be encoded.
1204 * @param type The type of the member to encode.
1206 * This macro is a convenience macro provided to add a member to the data
1207 * descriptor @p edd. The type of the structure is provided as the
1208 * @p struct_type parameter (for example: struct my_struct). The @p name
1209 * parameter defines a string that will be used to uniquely name that
1210 * member of the struct (it is suggested to use the struct member itself).
1211 * The @p member parameter is the actual struct member itself (for
1212 eet_dictionary_string_check * example: values), and @p type is the basic data type of the member which
1213 * must be one of: EET_T_CHAR, EET_T_SHORT, EET_T_INT, EET_T_LONG_LONG,
1214 * EET_T_FLOAT, EET_T_DOUBLE, EET_T_UCHAR, EET_T_USHORT, EET_T_UINT,
1215 * EET_T_ULONG_LONG or EET_T_STRING.
1219 #define EET_DATA_DESCRIPTOR_ADD_BASIC(edd, struct_type, name, member, type) \
1221 struct_type ___ett; \
1223 eet_data_descriptor_element_add(edd, name, type, EET_G_UNKNOWN, \
1224 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1225 0, /* 0, */NULL, NULL); \
1229 * Add a sub-element type to a data descriptor
1230 * @param edd The data descriptor to add the type to.
1231 * @param struct_type The type of the struct.
1232 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1233 * @param member The struct member itself to be encoded.
1234 * @param subtype The type of sub-type struct to add.
1236 * This macro lets you easily add a sub-type (a struct that's pointed to
1237 * by this one). All the parameters are the same as for
1238 * EET_DATA_DESCRIPTOR_ADD_BASIC(), with the @p subtype being the exception.
1239 * This must be the data descriptor of the struct that is pointed to by
1244 #define EET_DATA_DESCRIPTOR_ADD_SUB(edd, struct_type, name, member, subtype) \
1246 struct_type ___ett; \
1248 eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_UNKNOWN, \
1249 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1250 0, /* 0, */NULL, subtype); \
1254 * Add a linked list type to a data descriptor
1255 * @param edd The data descriptor to add the type to.
1256 * @param struct_type The type of the struct.
1257 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1258 * @param member The struct member itself to be encoded.
1259 * @param subtype The type of linked list member to add.
1261 * This macro lets you easily add a linked list of other data types. All the
1262 * parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with the
1263 * @p subtype being the exception. This must be the data descriptor of the
1264 * element that is in each member of the linked list to be stored.
1268 #define EET_DATA_DESCRIPTOR_ADD_LIST(edd, struct_type, name, member, subtype) \
1270 struct_type ___ett; \
1272 eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_LIST, \
1273 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1274 0, /* 0, */NULL, subtype); \
1278 * Add a hash type to a data descriptor
1279 * @param edd The data descriptor to add the type to.
1280 * @param struct_type The type of the struct.
1281 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1282 * @param member The struct member itself to be encoded.
1283 * @param subtype The type of hash member to add.
1285 * This macro lets you easily add a hash of other data types. All the
1286 * parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with the
1287 * @p subtype being the exception. This must be the data descriptor of the
1288 * element that is in each member of the hash to be stored.
1292 #define EET_DATA_DESCRIPTOR_ADD_HASH(edd, struct_type, name, member, subtype) \
1294 struct_type ___ett; \
1296 eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_HASH, \
1297 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1298 0, /* 0, */NULL, subtype); \
1302 * Add a fixed size array type to a data descriptor
1303 * @param edd The data descriptor to add the type to.
1304 * @param struct_type The type of the struct.
1305 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1306 * @param member The struct member itself to be encoded.
1307 * @param subtype The type of hash member to add.
1309 * This macro lets you easily add a fixed size array of other data types. All the
1310 * parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with the
1311 * @p subtype being the exception. This must be the data descriptor of the
1312 * element that is in each member of the hash to be stored.
1316 #define EET_DATA_DESCRIPTOR_ADD_ARRAY(edd, struct_type, name, member, subtype) \
1318 struct_type ___ett; \
1320 eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_ARRAY, \
1321 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1322 /* 0, */sizeof(___ett.member)/sizeof(___ett.member[0]), NULL, subtype); \
1326 * Add a variable size array type to a data descriptor
1327 * @param edd The data descriptor to add the type to.
1328 * @param struct_type The type of the struct.
1329 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1330 * @param member The struct member itself to be encoded.
1331 * @param subtype The type of hash member to add.
1333 * This macro lets you easily add a fixed size array of other data types. All the
1334 * parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with the
1335 * @p subtype being the exception. This must be the data descriptor of the
1336 * element that is in each member of the hash to be stored.
1340 #define EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(edd, struct_type, name, member, subtype) \
1342 struct_type ___ett; \
1344 eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_VAR_ARRAY, \
1345 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1346 (char *)(&(___ett.member ## _count)) - (char *)(&(___ett)), /* 0, */NULL, subtype); \
1349 /***************************************************************************/