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 * Display the x509 der certificate to out.
315 EAPI void eet_identity_certificate_print(const unsigned char *certificate, int der_length, FILE *out);
318 * Return a handle to the shared string dictionary of the Eet file
319 * @param ef A valid eet file handle.
320 * @return A handle to the dictionary of the file
322 * This function returns a handle to the dictionary of an Eet file whose
323 * handle is @p ef, if a dictionary exists. NULL is returned otherwise or
324 * if the file handle is known to be invalid.
328 EAPI Eet_Dictionary *eet_dictionary_get(Eet_File *ef);
331 * Check if a given string comes from a given dictionary
332 * @param ed A valid dictionary handle
333 * @param string A valid 0 byte terminated C string
334 * @return 1 if it is in the dictionary, 0 otherwise
336 * This checks the given dictionary to see if the given string is actually
337 * inside that dictionary (i.e. comes from it) and returns 1 if it does.
338 * If the dictionary handle is invlide, the string is NULL or the string is
339 * not in the dictionary, 0 is returned.
343 EAPI int eet_dictionary_string_check(Eet_Dictionary *ed, const char *string);
346 * Read a specified entry from an eet file and return data
347 * @param ef A valid eet file handle opened for reading.
348 * @param name Name of the entry. eg: "/base/file_i_want".
349 * @param size_ret Number of bytes read from entry and returned.
350 * @return The data stored in that entry in the eet file.
352 * This function finds an entry in the eet file that is stored under the
353 * name specified, and returns that data, decompressed, if successful.
354 * NULL is returned if the lookup fails or if memory errors are
355 * encountered. It is the job of the calling program to call free() on
356 * the returned data. The number of bytes in the returned data chunk are
357 * placed in size_ret.
359 * If the eet file handle is not valid NULL is returned and size_ret is
364 EAPI void *eet_read_cipher(Eet_File *ef, const char *name, int *size_ret, const char *cipher_key);
365 EAPI void *eet_read(Eet_File *ef, const char *name, int *size_ret);
368 * Read a specified entry from an eet file and return data
369 * @param ef A valid eet file handle opened for reading.
370 * @param name Name of the entry. eg: "/base/file_i_want".
371 * @param size_ret Number of bytes read from entry and returned.
372 * @return The data stored in that entry in the eet file.
374 * This function finds an entry in the eet file that is stored under the
375 * name specified, and returns that data if not compressed and successful.
376 * NULL is returned if the lookup fails or if memory errors are
377 * encountered or if the data is comrpessed. The calling program must never
378 * call free() on the returned data. The number of bytes in the returned
379 * data chunk are placed in size_ret.
381 * If the eet file handle is not valid NULL is returned and size_ret is
386 EAPI const void *eet_read_direct(Eet_File *ef, const char *name, int *size_ret);
389 * Write a specified entry to an eet file handle
390 * @param ef A valid eet file handle opened for writing.
391 * @param name Name of the entry. eg: "/base/file_i_want".
392 * @param data Pointer to the data to be stored.
393 * @param size Length in bytes in the data to be stored.
394 * @param compress Compression flags (1 == compress, 0 = don't compress).
395 * @return Success or failure of the write.
397 * This function will write the specified chunk of data to the eet file
398 * and return greater than 0 on success. 0 will be returned on failure.
400 * The eet file handle must be a valid file handle for an eet file opened
401 * for writing. If it is not, 0 will be returned and no action will be
404 * Name, and data must not be NULL, and size must be > 0. If these
405 * conditions are not met, 0 will be returned.
407 * The data will be copied (and optionally compressed) in ram, pending
408 * a flush to disk (it will stay in ram till the eet file handle is
413 EAPI int eet_write_cipher(Eet_File *ef, const char *name, const void *data, int size, int compress, const char *cipher_key);
414 EAPI int eet_write(Eet_File *ef, const char *name, const void *data, int size, int compress);
417 * Delete a specified entry from an Eet file being written or re-written
418 * @param ef A valid eet file handle opened for writing.
419 * @param name Name of the entry. eg: "/base/file_i_want".
420 * @return Success or failure of the delete.
422 * This function will delete the specified chunk of data from the eet file
423 * and return greater than 0 on success. 0 will be returned on failure.
425 * The eet file handle must be a valid file handle for an eet file opened
426 * for writing. If it is not, 0 will be returned and no action will be
429 * Name, must not be NULL, otherwise 0 will be returned.
433 EAPI int eet_delete(Eet_File *ef, const char *name);
436 * List all entries in eet file matching shell glob.
437 * @param ef A valid eet file handle.
438 * @param glob A shell glob to match against.
439 * @param count_ret Number of entries found to match.
440 * @return Pointer to an array of strings.
442 * This function will list all entries in the eet file matching the
443 * supplied shell glob and return an allocated list of their names, if
444 * there are any, and if no memory errors occur.
446 * The eet file handle must be valid and glob must not be NULL, or NULL
447 * will be returned and count_ret will be filled with 0.
449 * The calling program must call free() on the array returned, but NOT
450 * on the string pointers in the array. They are taken as read-only
451 * internals from the eet file handle. They are only valid as long as
452 * the file handle is not closed. When it is closed those pointers in the
453 * array are now not valid and should not be used.
455 * On success the array returned will have a list of string pointers
456 * that are the names of the entries that matched, and count_ret will have
457 * the number of entries in this array placed in it.
459 * Hint: an easy way to list all entries in an eet file is to use a glob
464 EAPI char **eet_list(Eet_File *ef, const char *glob, int *count_ret);
467 * Return the number of entries in the specified eet file.
468 * @param ef A valid eet file handle.
469 * @return Number of entries in ef or -1 if the number of entries
470 * cannot be read due to open mode restrictions.
474 EAPI int eet_num_entries(Eet_File *ef);
476 /***************************************************************************/
479 * Read just the header data for an image and dont decode the pixels.
480 * @param ef A valid eet file handle opened for reading.
481 * @param name Name of the entry. eg: "/base/file_i_want".
482 * @param w A pointer to the unsigned int to hold the width in pixels.
483 * @param h A pointer to the unsigned int to hold the height in pixels.
484 * @param alpha A pointer to the int to hold the alpha flag.
485 * @param compress A pointer to the int to hold the compression amount.
486 * @param quality A pointer to the int to hold the quality amount.
487 * @param lossy A pointer to the int to hold the lossiness flag.
488 * @return 1 on successfull decode, 0 otherwise
490 * This function reads an image from an eet file stored under the named
491 * key in the eet file and return a pointer to the decompressed pixel data.
493 * The other parameters of the image (width, height etc.) are placed into
494 * the values pointed to (they must be supplied). The pixel data is a linear
495 * array of pixels starting from the top-left of the image scanning row by
496 * row from left to right. Each pile is a 32bit value, with the high byte
497 * being the alpha channel, the next being red, then green, and the low byte
498 * being blue. The width and height are measured in pixels and will be
499 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
500 * that the alpha channel is not used. 1 denotes that it is significant.
501 * Compress is filled with the compression value/amount the image was
502 * stored with. The quality value is filled with the quality encoding of
503 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
504 * the image was encoded lossily or not.
506 * On success the function returns 1 indicating the header was read and
507 * decoded properly, or 0 on failure.
511 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);
512 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);
515 * Read image data from the named key in the eet file.
516 * @param ef A valid eet file handle opened for reading.
517 * @param name Name of the entry. eg: "/base/file_i_want".
518 * @param w A pointer to the unsigned int to hold the width in pixels.
519 * @param h A pointer to the unsigned int to hold the height in pixels.
520 * @param alpha A pointer to the int to hold the alpha flag.
521 * @param compress A pointer to the int to hold the compression amount.
522 * @param quality A pointer to the int to hold the quality amount.
523 * @param lossy A pointer to the int to hold the lossiness flag.
524 * @return The image pixel data decoded
526 * This function reads an image from an eet file stored under the named
527 * key in the eet file and return a pointer to the decompressed pixel data.
529 * The other parameters of the image (width, height etc.) are placed into
530 * the values pointed to (they must be supplied). The pixel data is a linear
531 * array of pixels starting from the top-left of the image scanning row by
532 * row from left to right. Each pile is a 32bit value, with the high byte
533 * being the alpha channel, the next being red, then green, and the low byte
534 * being blue. The width and height are measured in pixels and will be
535 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
536 * that the alpha channel is not used. 1 denotes that it is significant.
537 * Compress is filled with the compression value/amount the image was
538 * stored with. The quality value is filled with the quality encoding of
539 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
540 * the image was encoded lossily or not.
542 * On success the function returns a pointer to the image data decoded. The
543 * calling application is responsible for calling free() on the image data
544 * when it is done with it. On failure NULL is returned and the parameter
545 * values may not contain any sensible data.
549 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);
550 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);
553 * Read image data from the named key in the eet file.
554 * @param ef A valid eet file handle opened for reading.
555 * @param name Name of the entry. eg: "/base/file_i_want".
556 * @param src_x The starting x coordinate from where to dump the stream.
557 * @param src_y The starting y coordinate from where to dump the stream.
558 * @param d A pointer to the pixel surface.
559 * @param w The expected width in pixels of the pixel surface to decode.
560 * @param h The expected height in pixels of the pixel surface to decode.
561 * @param row_stride The length of a pixels line in the destination surface.
562 * @param alpha A pointer to the int to hold the alpha flag.
563 * @param compress A pointer to the int to hold the compression amount.
564 * @param quality A pointer to the int to hold the quality amount.
565 * @param lossy A pointer to the int to hold the lossiness flag.
566 * @return 1 on success, 0 otherwise.
568 * This function reads an image from an eet file stored under the named
569 * key in the eet file and return a pointer to the decompressed pixel data.
571 * The other parameters of the image (width, height etc.) are placed into
572 * the values pointed to (they must be supplied). The pixel data is a linear
573 * array of pixels starting from the top-left of the image scanning row by
574 * row from left to right. Each pile is a 32bit value, with the high byte
575 * being the alpha channel, the next being red, then green, and the low byte
576 * being blue. The width and height are measured in pixels and will be
577 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
578 * that the alpha channel is not used. 1 denotes that it is significant.
579 * Compress is filled with the compression value/amount the image was
580 * stored with. The quality value is filled with the quality encoding of
581 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
582 * the image was encoded lossily or not.
584 * On success the function returns 1, and 0 on failure. On failure the
585 * parameter values may not contain any sensible data.
589 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);
590 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);
593 * Write image data to the named key in an eet file.
594 * @param ef A valid eet file handle opened for writing.
595 * @param name Name of the entry. eg: "/base/file_i_want".
596 * @param data A pointer to the image pixel data.
597 * @param w The width of the image in pixels.
598 * @param h The height of the image in pixels.
599 * @param alpha The alpha channel flag.
600 * @param compress The compression amount.
601 * @param quality The quality encoding amount.
602 * @param lossy The lossiness flag.
603 * @return Success if the data was encoded and written or not.
605 * This function takes image pixel data and encodes it in an eet file
606 * stored under the supplied name key, and returns how many bytes were
607 * actually written to encode the image data.
609 * The data expected is the same format as returned by eet_data_image_read.
610 * If this is not the case weird things may happen. Width and height must
611 * be between 1 and 8000 pixels. The alpha flags can be 0 or 1 (0 meaning
612 * the alpha values are not useful and 1 meaning they are). Compress can
613 * be from 0 to 9 (0 meaning no compression, 9 meaning full compression).
614 * This is only used if the image is not lossily encoded. Quality is used on
615 * lossy compression and should be a value from 0 to 100. The lossy flag
616 * can be 0 or 1. 0 means encode losslessly and 1 means to encode with
617 * image quality loss (but then have a much smaller encoding).
619 * On success this function returns the number of bytes that were required
620 * to encode the image data, or on failure it returns 0.
624 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);
625 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);
628 * Decode Image data header only to get information.
629 * @param data The encoded pixel data.
630 * @param size The size, in bytes, of the encoded pixel data.
631 * @param w A pointer to the unsigned int to hold the width in pixels.
632 * @param h A pointer to the unsigned int to hold the height in pixels.
633 * @param alpha A pointer to the int to hold the alpha flag.
634 * @param compress A pointer to the int to hold the compression amount.
635 * @param quality A pointer to the int to hold the quality amount.
636 * @param lossy A pointer to the int to hold the lossiness flag.
637 * @return 1 on success, 0 on failure.
639 * This function takes encoded pixel data and decodes it into raw RGBA
642 * The other parameters of the image (width, height etc.) are placed into
643 * the values pointed to (they must be supplied). The pixel data is a linear
644 * array of pixels starting from the top-left of the image scanning row by
645 * row from left to right. Each pixel is a 32bit value, with the high byte
646 * being the alpha channel, the next being red, then green, and the low byte
647 * being blue. The width and height are measured in pixels and will be
648 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
649 * that the alpha channel is not used. 1 denotes that it is significant.
650 * Compress is filled with the compression value/amount the image was
651 * stored with. The quality value is filled with the quality encoding of
652 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
653 * the image was encoded lossily or not.
655 * On success the function returns 1 indicating the header was read and
656 * decoded properly, or 0 on failure.
660 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);
661 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);
664 * Decode Image data into pixel data.
665 * @param data The encoded pixel data.
666 * @param size The size, in bytes, of the encoded pixel data.
667 * @param w A pointer to the unsigned int to hold the width in pixels.
668 * @param h A pointer to the unsigned int to hold the height in pixels.
669 * @param alpha A pointer to the int to hold the alpha flag.
670 * @param compress A pointer to the int to hold the compression amount.
671 * @param quality A pointer to the int to hold the quality amount.
672 * @param lossy A pointer to the int to hold the lossiness flag.
673 * @return The image pixel data decoded
675 * This function takes encoded pixel data and decodes it into raw RGBA
678 * The other parameters of the image (width, height etc.) are placed into
679 * the values pointed to (they must be supplied). The pixel data is a linear
680 * array of pixels starting from the top-left of the image scanning row by
681 * row from left to right. Each pixel is a 32bit value, with the high byte
682 * being the alpha channel, the next being red, then green, and the low byte
683 * being blue. The width and height are measured in pixels and will be
684 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
685 * that the alpha channel is not used. 1 denotes that it is significant.
686 * Compress is filled with the compression value/amount the image was
687 * stored with. The quality value is filled with the quality encoding of
688 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
689 * the image was encoded lossily or not.
691 * On success the function returns a pointer to the image data decoded. The
692 * calling application is responsible for calling free() on the image data
693 * when it is done with it. On failure NULL is returned and the parameter
694 * values may not contain any sensible data.
698 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);
699 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);
702 * Decode Image data into pixel data.
703 * @param data The encoded pixel data.
704 * @param size The size, in bytes, of the encoded pixel data.
705 * @param src_x The starting x coordinate from where to dump the stream.
706 * @param src_y The starting y coordinate from where to dump the stream.
707 * @param d A pointer to the pixel surface.
708 * @param w The expected width in pixels of the pixel surface to decode.
709 * @param h The expected height in pixels of the pixel surface to decode.
710 * @param row_stride The length of a pixels line in the destination surface.
711 * @param alpha A pointer to the int to hold the alpha flag.
712 * @param compress A pointer to the int to hold the compression amount.
713 * @param quality A pointer to the int to hold the quality amount.
714 * @param lossy A pointer to the int to hold the lossiness flag.
715 * @return 1 on success, 0 otherwise.
717 * This function takes encoded pixel data and decodes it into raw RGBA
720 * The other parameters of the image (alpha, compress etc.) are placed into
721 * the values pointed to (they must be supplied). The pixel data is a linear
722 * array of pixels starting from the top-left of the image scanning row by
723 * row from left to right. Each pixel is a 32bit value, with the high byte
724 * being the alpha channel, the next being red, then green, and the low byte
725 * being blue. The width and height are measured in pixels and will be
726 * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
727 * that the alpha channel is not used. 1 denotes that it is significant.
728 * Compress is filled with the compression value/amount the image was
729 * stored with. The quality value is filled with the quality encoding of
730 * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
731 * the image was encoded lossily or not.
733 * On success the function returns 1, and 0 on failure. On failure the
734 * parameter values may not contain any sensible data.
738 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);
739 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);
742 * Encode image data for storage or transmission.
743 * @param data A pointer to the image pixel data.
744 * @param size_ret A pointer to an int to hold the size of the returned data.
745 * @param w The width of the image in pixels.
746 * @param h The height of the image in pixels.
747 * @param alpha The alpha channel flag.
748 * @param compress The compression amount.
749 * @param quality The quality encoding amount.
750 * @param lossy The lossiness flag.
751 * @return The encoded image data.
753 * This function stakes image pixel data and encodes it with compression and
754 * possible loss of quality (as a trade off for size) for storage or
755 * transmission to another system.
757 * The data expected is the same format as returned by eet_data_image_read.
758 * If this is not the case weird things may happen. Width and height must
759 * be between 1 and 8000 pixels. The alpha flags can be 0 or 1 (0 meaning
760 * the alpha values are not useful and 1 meaning they are). Compress can
761 * be from 0 to 9 (0 meaning no compression, 9 meaning full compression).
762 * This is only used if the image is not lossily encoded. Quality is used on
763 * lossy compression and should be a value from 0 to 100. The lossy flag
764 * can be 0 or 1. 0 means encode losslessly and 1 means to encode with
765 * image quality loss (but then have a much smaller encoding).
767 * On success this function returns a pointer to the encoded data that you
768 * can free with free() when no longer needed.
772 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);
773 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);
775 /***************************************************************************/
778 * Create a new empty data structure descriptor.
779 * @param name The string name of this data structure (most be a global constant and never change).
780 * @param size The size of the struct (in bytes).
781 * @param func_list_next The function to get the next list node.
782 * @param func_list_append The function to append a member to a list.
783 * @param func_list_data The function to get the data from a list node.
784 * @param func_list_free The function to free an entire linked list.
785 * @param func_hash_foreach The function to iterate through all hash table entries.
786 * @param func_hash_add The function to add a member to a hash table.
787 * @param func_hash_free The function to free an entire hash table.
788 * @return A new empty data descriptor.
790 * This function creates a new data descriptore and returns a handle to the
791 * new data descriptor. On creation it will be empty, containing no contents
792 * describing anything other than the shell of the data structure.
794 * You add structure members to the data descriptor using the macros
795 * EET_DATA_DESCRIPTOR_ADD_BASIC(), EET_DATA_DESCRIPTOR_ADD_SUB() and
796 * EET_DATA_DESCRIPTOR_ADD_LIST(), depending on what type of member you are
797 * adding to the description.
799 * Once you have described all the members of a struct you want loaded, or
800 * saved eet can load and save those members for you, encode them into
801 * endian-independant serialised data chunks for transmission across a
804 * The function pointers to the list and hash table functions are only
805 * needed if you use those data types, else you can pass NULL instead.
813 * typedef struct _blah2
819 * typedef struct _blah3
825 * typedef struct _blah
832 * double floating_lots;
840 * main(int argc, char **argv)
845 * Eet_Data_Descriptor *edd, *edd2, *edd3;
851 * edd3 = eet_data_descriptor_new("blah3", sizeof(Blah3),
854 * eina_list_data_get,
859 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd3, Blah3, "string3", string, EET_T_STRING);
861 * edd2 = eet_data_descriptor_new("blah2", sizeof(Blah2),
864 * eina_list_data_get,
869 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd2, Blah2, "string2", string, EET_T_STRING);
871 * edd = eet_data_descriptor_new("blah", sizeof(Blah),
874 * eina_list_data_get,
879 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "character", character, EET_T_CHAR);
880 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "sixteen", sixteen, EET_T_SHORT);
881 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "integer", integer, EET_T_INT);
882 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "lots", lots, EET_T_LONG_LONG);
883 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "floating", floating, EET_T_FLOAT);
884 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "floating_lots", floating_lots, EET_T_DOUBLE);
885 * EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "string", string, EET_T_STRING);
886 * EET_DATA_DESCRIPTOR_ADD_SUB(edd, Blah, "blah2", blah2, edd2);
887 * EET_DATA_DESCRIPTOR_ADD_LIST(edd, Blah, "blah3", blah3, edd3);
889 * blah3.string="PANTS";
891 * blah2.string="subtype string here!";
893 * blah.character='7';
894 * blah.sixteen=0x7777;
895 * blah.integer=0xc0def00d;
896 * blah.lots=0xdeadbeef31337777;
897 * blah.floating=3.141592654;
898 * blah.floating_lots=0.777777777777777;
899 * blah.string="bite me like a turnip";
900 * blah.blah2 = &blah2;
901 * blah.blah3 = eina_list_append(NULL, &blah3);
902 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
903 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
904 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
905 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
906 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
907 * blah.blah3 = eina_list_append(blah.blah3, &blah3);
909 * data = eet_data_descriptor_encode(edd, &blah, &size);
910 * printf("-----DECODING\n");
911 * blah_in = eet_data_descriptor_decode(edd, data, size);
913 * printf("-----DECODED!\n");
914 * printf("%c\n", blah_in->character);
915 * printf("%x\n", (int)blah_in->sixteen);
916 * printf("%x\n", blah_in->integer);
917 * printf("%lx\n", blah_in->lots);
918 * printf("%f\n", (double)blah_in->floating);
919 * printf("%f\n", (double)blah_in->floating_lots);
920 * printf("%s\n", blah_in->string);
921 * printf("%p\n", blah_in->blah2);
922 * printf(" %s\n", blah_in->blah2->string);
927 * EINA_LIST_FOREACH(blah_in->blah3, l, blah3_in)
929 * printf("%p\n", blah3_in);
930 * printf(" %s\n", blah3_in->string);
933 * eet_data_descriptor_free(edd);
934 * eet_data_descriptor_free(edd2);
935 * eet_data_descriptor_free(edd3);
944 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));
948 * moving to this api from the old above. this will break things when the
949 * move happens - but be warned
951 EAPI Eet_Data_Descriptor *eet_data_descriptor2_new(Eet_Data_Descriptor_Class *eddc);
952 EAPI Eet_Data_Descriptor *eet_data_descriptor3_new(Eet_Data_Descriptor_Class *eddc);
955 * This function frees a data descriptor when it is not needed anymore.
956 * @param edd The data descriptor to free.
958 * This function takes a data descriptor handle as a parameter and frees all
959 * data allocated for the data descriptor and the handle itself. After this
960 * call the descriptor is no longer valid.
964 EAPI void eet_data_descriptor_free(Eet_Data_Descriptor *edd);
967 * This function is an internal used by macros.
969 * This function is used by macros EET_DATA_DESCRIPTOR_ADD_BASIC(),
970 * EET_DATA_DESCRIPTOR_ADD_SUB() and EET_DATA_DESCRIPTOR_ADD_LIST(). It is
971 * complex to use by hand and should be left to be used by the macros, and
972 * thus is not documented.
976 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);
979 * Read a data structure from an eet file and decodes it.
980 * @param ef The eet file handle to read from.
981 * @param edd The data descriptor handle to use when decoding.
982 * @param name The key the data is stored under in the eet file.
983 * @return A pointer to the decoded data structure.
985 * This function decodes a data structure stored in an eet file, returning
986 * a pointer to it if it decoded successfully, or NULL on failure. This
987 * can save a programmer dozens of hours of work in writing configuration
988 * file parsing and writing code, as eet does all that work for the program
989 * and presents a program-friendly data structure, just as the programmer
990 * likes. Eet can handle members being added or deleted from the data in
991 * storage and safely zero-fills unfilled members if they were not found
992 * in the data. It checks sizes and headers whenever it reads data, allowing
993 * the programmer to not worry about corrupt data.
995 * Once a data structure has been described by the programmer with the
996 * fields they wish to save or load, storing or retrieving a data structure
997 * from an eet file, or from a chunk of memory is as simple as a single
1002 EAPI void *eet_data_read_cipher(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, const char *key);
1003 EAPI void *eet_data_read(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name);
1006 * Write a data structure from memory and store in an eet file.
1007 * @param ef The eet file handle to write to.
1008 * @param edd The data descriptor to use when encoding.
1009 * @param name The key to store the data under in the eet file.
1010 * @param data A pointer to the data structure to ssave and encode.
1011 * @param compress Compression flags for storage.
1012 * @return 1 on successful write, 0 on failure.
1014 * This function is the reverse of eet_data_read(), saving a data structure
1019 EAPI int eet_data_write_cipher(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, const char *key, const void *data, int compress);
1020 EAPI int eet_data_write(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, const void *data, int compress);
1023 * Dump an eet encoded data structure into ascii text
1024 * @param data_in The pointer to the data to decode into a struct.
1025 * @param size_in The size of the data pointed to in bytes.
1026 * @param dumpfunc The function to call passed a string when new data is converted to text
1027 * @param dumpdata The data to pass to the @p dumpfunc callback.
1028 * @return 1 on success, 0 on failure
1030 * This function will take a chunk of data encoded by
1031 * eet_data_descriptor_encode() and convert it into human readable ascii text.
1032 * It does this by calling the @p dumpfunc callback for all new text that is
1033 * generated. This callback should append to any existing text buffer and
1034 * will be passed the pointer @p dumpdata as a parameter as well as a string
1035 * with new text to be appended.
1041 * void output(void *data, const char *string)
1043 * printf("%s", string);
1046 * void dump(const char *file)
1052 * f = fopen(file, "r");
1053 * fseek(f, 0, SEEK_END);
1056 * data = malloc(len);
1057 * fread(data, len, 1, f);
1059 * eet_data_text_dump(data, len, output, NULL);
1065 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);
1066 EAPI int eet_data_text_dump(const void *data_in, int size_in, void (*dumpfunc) (void *data, const char *str), void *dumpdata);
1069 * Take an ascii encoding from eet_data_text_dump() and re-encode in binary.
1070 * @param text The pointer to the string data to parse and encode.
1071 * @param textlen The size of the string in bytes (not including 0 byte terminator).
1072 * @param size_ret This gets filled in with the encoded data blob size in bytes.
1073 * @return The encoded data on success, NULL on failure.
1075 * This function will parse the string pointed to by @p text and return
1076 * an encoded data lump the same way eet_data_descriptor_encode() takes an
1077 * in-memory data struct and encodes into a binary blob. @p text is a normal
1082 EAPI void *eet_data_text_undump_cipher(const char *text, const char *key, int textlen, int *size_ret);
1083 EAPI void *eet_data_text_undump(const char *text, int textlen, int *size_ret);
1086 * Dump an eet encoded data structure from an eet file into ascii text
1087 * @param ef A valid eet file handle.
1088 * @param name Name of the entry. eg: "/base/file_i_want".
1089 * @param dumpfunc The function to call passed a string when new data is converted to text
1090 * @param dumpdata The data to pass to the @p dumpfunc callback.
1091 * @return 1 on success, 0 on failure
1093 * This function will take an open and valid eet file from eet_open() request
1094 * the data encoded by eet_data_descriptor_encode() corresponding to the key @p name
1095 * and convert it into human readable ascii text. It does this by calling the
1096 * @p dumpfunc callback for all new text that is generated. This callback should
1097 * append to any existing text buffer and will be passed the pointer @p dumpdata
1098 * as a parameter as well as a string with new text to be appended.
1102 EAPI int eet_data_dump_cipher(Eet_File *ef, const char *name, const char *key, void (*dumpfunc) (void *data, const char *str), void *dumpdata);
1103 EAPI int eet_data_dump(Eet_File *ef, const char *name, void (*dumpfunc) (void *data, const char *str), void *dumpdata);
1106 * Take an ascii encoding from eet_data_dump() and re-encode in binary.
1107 * @param ef A valid eet file handle.
1108 * @param name Name of the entry. eg: "/base/file_i_want".
1109 * @param text The pointer to the string data to parse and encode.
1110 * @param textlen The size of the string in bytes (not including 0 byte terminator).
1111 * @param compress Compression flags (1 == compress, 0 = don't compress).
1112 * @return 1 on success, 0 on failure
1114 * This function will parse the string pointed to by @p text, encode it the same
1115 * way eet_data_descriptor_encode() takes an in-memory data struct and encodes into a
1118 * The data (optionally compressed) will be in ram, pending a flush to
1119 * disk (it will stay in ram till the eet file handle is closed though).
1123 EAPI int eet_data_undump_cipher(Eet_File *ef, const char *name, const char *key, const char *text, int textlen, int compress);
1124 EAPI int eet_data_undump(Eet_File *ef, const char *name, const char *text, int textlen, int compress);
1127 * Decode a data structure from an arbitary location in memory.
1128 * @param edd The data descriptor to use when decoding.
1129 * @param data_in The pointer to the data to decode into a struct.
1130 * @param size_in The size of the data pointed to in bytes.
1131 * @return NULL on failure, or a valid decoded struct pointer on success.
1133 * This function will decode a data structure that has been encoded using
1134 * eet_data_descriptor_encode(), and return a data structure with all its
1135 * elements filled out, if successful, or NULL on failure.
1137 * The data to be decoded is stored at the memory pointed to by @p data_in,
1138 * and is described by the descriptor pointed to by @p edd. The data size is
1139 * passed in as the value to @p size_in, ande must be greater than 0 to
1142 * This function is useful for decoding data structures delivered to the
1143 * application by means other than an eet file, such as an IPC or socket
1144 * connection, raw files, shared memory etc.
1146 * Please see eet_data_read() for more information.
1150 EAPI void *eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd, const void *data_in, const char *key, int size_in);
1151 EAPI void *eet_data_descriptor_decode(Eet_Data_Descriptor *edd, const void *data_in, int size_in);
1154 * Encode a dsata struct to memory and return that encoded data.
1155 * @param edd The data descriptor to use when encoding.
1156 * @param data_in The pointer to the struct to encode into data.
1157 * @param size_ret A pointer to the an int to be filled with the decoded size.
1158 * @return NULL on failure, or a valid encoded data chunk on success.
1160 * This function takes a data structutre in memory and encodes it into a
1161 * serialised chunk of data that can be decoded again by
1162 * eet_data_descriptor_decode(). This is useful for being able to transmit
1163 * data structures across sockets, pipes, IPC or shared file mechanisms,
1164 * without having to worry about memory space, machine type, endianess etc.
1166 * The parameter @p edd must point to a valid data descriptor, and
1167 * @p data_in must point to the right data structure to encode. If not, the
1168 * encoding may fail.
1170 * On success a non NULL valid pointer is returned and what @p size_ret
1171 * points to is set to the size of this decoded data, in bytes. When the
1172 * encoded data is no longer needed, call free() on it. On failure NULL is
1173 * returned and what @p size_ret points to is set to 0.
1175 * Please see eet_data_write() for more information.
1179 EAPI void *eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd, const void *data_in, const char *key, int *size_ret);
1180 EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd, const void *data_in, int *size_ret);
1183 * Add a basic data element to a data descriptor.
1184 * @param edd The data descriptor to add the type to.
1185 * @param struct_type The type of the struct.
1186 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1187 * @param member The struct member itself to be encoded.
1188 * @param type The type of the member to encode.
1190 * This macro is a convenience macro provided to add a member to the data
1191 * descriptor @p edd. The type of the structure is provided as the
1192 * @p struct_type parameter (for example: struct my_struct). The @p name
1193 * parameter defines a string that will be used to uniquely name that
1194 * member of the struct (it is suggested to use the struct member itself).
1195 * The @p member parameter is the actual struct member itself (for
1196 eet_dictionary_string_check * example: values), and @p type is the basic data type of the member which
1197 * must be one of: EET_T_CHAR, EET_T_SHORT, EET_T_INT, EET_T_LONG_LONG,
1198 * EET_T_FLOAT, EET_T_DOUBLE, EET_T_UCHAR, EET_T_USHORT, EET_T_UINT,
1199 * EET_T_ULONG_LONG or EET_T_STRING.
1203 #define EET_DATA_DESCRIPTOR_ADD_BASIC(edd, struct_type, name, member, type) \
1205 struct_type ___ett; \
1207 eet_data_descriptor_element_add(edd, name, type, EET_G_UNKNOWN, \
1208 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1209 0, /* 0, */NULL, NULL); \
1213 * Add a sub-element type to a data descriptor
1214 * @param edd The data descriptor to add the type to.
1215 * @param struct_type The type of the struct.
1216 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1217 * @param member The struct member itself to be encoded.
1218 * @param subtype The type of sub-type struct to add.
1220 * This macro lets you easily add a sub-type (a struct that's pointed to
1221 * by this one). All the parameters are the same as for
1222 * EET_DATA_DESCRIPTOR_ADD_BASIC(), with the @p subtype being the exception.
1223 * This must be the data descriptor of the struct that is pointed to by
1228 #define EET_DATA_DESCRIPTOR_ADD_SUB(edd, struct_type, name, member, subtype) \
1230 struct_type ___ett; \
1232 eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_UNKNOWN, \
1233 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1234 0, /* 0, */NULL, subtype); \
1238 * Add a linked list type to a data descriptor
1239 * @param edd The data descriptor to add the type to.
1240 * @param struct_type The type of the struct.
1241 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1242 * @param member The struct member itself to be encoded.
1243 * @param subtype The type of linked list member to add.
1245 * This macro lets you easily add a linked list of other data types. All the
1246 * parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with the
1247 * @p subtype being the exception. This must be the data descriptor of the
1248 * element that is in each member of the linked list to be stored.
1252 #define EET_DATA_DESCRIPTOR_ADD_LIST(edd, struct_type, name, member, subtype) \
1254 struct_type ___ett; \
1256 eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_LIST, \
1257 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1258 0, /* 0, */NULL, subtype); \
1262 * Add a hash type to a data descriptor
1263 * @param edd The data descriptor to add the type to.
1264 * @param struct_type The type of the struct.
1265 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1266 * @param member The struct member itself to be encoded.
1267 * @param subtype The type of hash member to add.
1269 * This macro lets you easily add a hash of other data types. All the
1270 * parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with the
1271 * @p subtype being the exception. This must be the data descriptor of the
1272 * element that is in each member of the hash to be stored.
1276 #define EET_DATA_DESCRIPTOR_ADD_HASH(edd, struct_type, name, member, subtype) \
1278 struct_type ___ett; \
1280 eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_HASH, \
1281 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1282 0, /* 0, */NULL, subtype); \
1286 * Add a fixed size array type to a data descriptor
1287 * @param edd The data descriptor to add the type to.
1288 * @param struct_type The type of the struct.
1289 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1290 * @param member The struct member itself to be encoded.
1291 * @param subtype The type of hash member to add.
1293 * This macro lets you easily add a fixed size array of other data types. All the
1294 * parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with the
1295 * @p subtype being the exception. This must be the data descriptor of the
1296 * element that is in each member of the hash to be stored.
1300 #define EET_DATA_DESCRIPTOR_ADD_ARRAY(edd, struct_type, name, member, subtype) \
1302 struct_type ___ett; \
1304 eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_ARRAY, \
1305 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1306 /* 0, */sizeof(___ett.member)/sizeof(___ett.member[0]), NULL, subtype); \
1310 * Add a variable size array type to a data descriptor
1311 * @param edd The data descriptor to add the type to.
1312 * @param struct_type The type of the struct.
1313 * @param name The string name to use to encode/decode this member (must be a constant global and never change).
1314 * @param member The struct member itself to be encoded.
1315 * @param subtype The type of hash member to add.
1317 * This macro lets you easily add a fixed size array of other data types. All the
1318 * parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with the
1319 * @p subtype being the exception. This must be the data descriptor of the
1320 * element that is in each member of the hash to be stored.
1324 #define EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(edd, struct_type, name, member, subtype) \
1326 struct_type ___ett; \
1328 eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_VAR_ARRAY, \
1329 (char *)(&(___ett.member)) - (char *)(&(___ett)), \
1330 (char *)(&(___ett.member ## _count)) - (char *)(&(___ett)), /* 0, */NULL, subtype); \
1333 /***************************************************************************/