Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/engrave
Dir : e17/libs/engrave/src/lib Modified Files: Engrave.h engrave.l engrave.y engrave_data.c engrave_enums.h engrave_file.c engrave_font.c engrave_group.c engrave_image.c engrave_load.c engrave_macros.h engrave_out.c engrave_out.h engrave_part.c engrave_part_state.c engrave_program.c Log Message: - Add some documentation. Everything but engrave_part_state.c should be doc'd. - Rename engrave_file_output -> engrave_edc_output. - Remove the EXTERNAL image type as it dosen't exist in Edje at the moment. - Do some sanity checking on values returned from calloc. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/engrave/src/lib/Engrave.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- Engrave.h 21 Oct 2004 06:56:38 -0000 1.5 +++ Engrave.h 24 Oct 2004 06:28:37 -0000 1.6 @@ -1,6 +1,70 @@ #ifndef ENGRAVE_H #define ENGRAVE_H +/** + * @file Engrave.h + * @brief The file that should be included by any project using Engrave. + * It provides all the necessary headers and includes to work with Engrave. + */ + +/** + * @mainpage Engrave Library Documentation + * + * @image html e_mini.png + * + * @section intro Introduction + * + * Engrave is a designed to allow you the ability to easily create and edit + * Edje EET files. + * + * As an example of how easy Engrave is to work with, the following example + * will read in either an EDC file or an EET file and attempt to write out + * an EET and EDC version of the given file. + * + * @code + * #include "Engrave.h" + * + * int + * main(int argc, char ** argv) + * { + * Engrave_File *ef = NULL; + * + * if (argc < 2) { + * printf("need file\n"); + * return 1; + * } + * + * if (strstr(argv[1], ".eet")) + * ef = engrave_load_eet(argv[1]); + * else { + * if (argc < 4) { + * printf("need img and font dirs with .edc file\n"); + * return 1; + * } + * ef = engrave_load_edc(argv[1], argv[2], argv[3]); + * } + * + * if (!engrave_eet_output(ef, "test.eet")) + * printf("failed to write test.eet\n"); + * + * if (!engrave_edc_output(ef, "test.out")) + * printf("failed to write test.out\n"); + * + * return 0; + * } + * @endcode + * + * Compiling with the Engrave library is pretty simple, assuming you've + * named your app engrave_test.c the following command will do the trick: + * + * gcc -o engrave_test `engrave-config --cflags --libs` engrave_test.c + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -20,5 +84,8 @@ #include <engrave_load.h> #include <engrave_out.h> +#ifdef __cplusplus +} +#endif #endif =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/engrave/src/lib/engrave.l,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- engrave.l 24 Sep 2004 04:01:46 -0000 1.2 +++ engrave.l 24 Oct 2004 06:28:37 -0000 1.3 @@ -169,7 +169,6 @@ transition { KEYWORD_RETURN(TRANSITION); } tween { KEYWORD_RETURN(TWEEN); } type { KEYWORD_RETURN(TYPE); } -USER { KEYWORD_RETURN(USER); } VERTICAL { KEYWORD_RETURN(VERTICAL); } visible { KEYWORD_RETURN(VISIBLE); } x { KEYWORD_RETURN(X); } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/engrave/src/lib/engrave.y,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- engrave.y 7 Oct 2004 15:43:38 -0000 1.4 +++ engrave.y 24 Oct 2004 06:28:37 -0000 1.5 @@ -42,7 +42,7 @@ %token COLON QUOTE SEMICOLON STATE_SET ACTION_STOP SIGNAL_EMIT %token DRAG_VAL_SET DRAG_VAL_STEP DRAG_VAL_PAGE LINEAR %token SINUSOIDAL ACCELERATE DECELERATE IMAGE RECT SWALLOW -%token NONE PLAIN OUTLINE SOFT_OUTLINE SHADOW SOFT_SHADOW USER +%token NONE PLAIN OUTLINE SOFT_OUTLINE SHADOW SOFT_SHADOW %token OUTLINE_SHADOW OUTLINE_SOFT_SHADOW VERTICAL HORIZONTAL BOTH %left MINUS PLUS %left TIMES DIVIDE @@ -108,7 +108,6 @@ image_type: RAW { $$ = ENGRAVE_IMAGE_TYPE_RAW; } | COMP { $$ = ENGRAVE_IMAGE_TYPE_COMP; } | LOSSY { $$ = ENGRAVE_IMAGE_TYPE_LOSSY; } - | USER { $$ = ENGRAVE_IMAGE_TYPE_EXTERNAL; } ; /* don't set a section here yet (since BASE and GROUP have data sects) */ =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/engrave/src/lib/engrave_data.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- engrave_data.c 21 Oct 2004 06:56:38 -0000 1.1 +++ engrave_data.c 24 Oct 2004 06:28:37 -0000 1.2 @@ -1,12 +1,37 @@ #include <Engrave.h> +/** + * @file engrave_data.h Engrave_Data block object + * @brief Contains all of the functions to manipulate Engrave_Data objects. + */ + +/** + * @defgroup Engrave_Data Engrave_Data: Functions to work with data blocks + * + * @{ + */ + +/** + * engrave_data_new - create a new data block + * @param key: the key to access the block + * @param value: the value to store in the block + * + * @return Returns a pointer to a newly allocated data block on success, + * NULL on failure. + */ Engrave_Data * engrave_data_new(char *key, char *value) { Engrave_Data *data; data = NEW(Engrave_Data, 1); + if (!data) return NULL; + data->key = (key ? strdup(key) : NULL); data->value = (value ? strdup(value) : NULL); return data; } +/** + * @} + */ + =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/engrave/src/lib/engrave_enums.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- engrave_enums.h 21 Oct 2004 06:56:38 -0000 1.1 +++ engrave_enums.h 24 Oct 2004 06:28:37 -0000 1.2 @@ -1,6 +1,16 @@ #ifndef ENGRAVE_ENUMS_H #define ENGRAVE_ENUMS_H +/** + * @file engrave_enums.h + * @brief Contains all of the enumerations used in Engrave + */ + +/** + * @defgroup Engrave_Enums Enums: Various Flags and Enumerations used in Engrave. + * @{ + */ + typedef enum _Engrave_Image_Type Engrave_Image_Type; typedef enum _Engrave_Part_Type Engrave_Part_Type; typedef enum _Engrave_Text_Effect Engrave_Text_Effect; @@ -9,67 +19,94 @@ typedef enum _Engrave_Aspect_Preference Engrave_Aspect_Preference; typedef enum _Engrave_Parse_Section Engrave_Parse_Section; +/** + * @enum Engrave_Image_Type + * This defines the various types of image compression available. + */ enum _Engrave_Image_Type { - ENGRAVE_IMAGE_TYPE_RAW, - ENGRAVE_IMAGE_TYPE_COMP, - ENGRAVE_IMAGE_TYPE_LOSSY, - ENGRAVE_IMAGE_TYPE_EXTERNAL, + ENGRAVE_IMAGE_TYPE_RAW, /**< No compression, no loss of detail */ + ENGRAVE_IMAGE_TYPE_COMP, /**< Compress image, no loss of detail */ + ENGRAVE_IMAGE_TYPE_LOSSY, /**< Lossy compression of image */ ENGRAVE_IMAGE_TYPE_NUM - }; +/** + * @enum Engrave_Part_Type + * This defines the different part types available. + */ enum _Engrave_Part_Type { - ENGRAVE_PART_TYPE_IMAGE, - ENGRAVE_PART_TYPE_TEXT, - ENGRAVE_PART_TYPE_RECT, - ENGRAVE_PART_TYPE_SWALLOW, + ENGRAVE_PART_TYPE_IMAGE, /**< Part is an image */ + ENGRAVE_PART_TYPE_TEXT, /**< Part is text */ + ENGRAVE_PART_TYPE_RECT, /**< Part is a rectangle */ + ENGRAVE_PART_TYPE_SWALLOW, /**< Part is a swallow */ ENGRAVE_PART_TYPE_NUM }; +/** + * @enum Engrave_Text_Effect + * This defines the different types of effects that can be applied to a + * chunk of text. + */ enum _Engrave_Text_Effect { - ENGRAVE_TEXT_EFFECT_NONE, - ENGRAVE_TEXT_EFFECT_PLAIN, - ENGRAVE_TEXT_EFFECT_OUTLINE, - ENGRAVE_TEXT_EFFECT_SOFT_OUTLINE, - ENGRAVE_TEXT_EFFECT_SHADOW, - ENGRAVE_TEXT_EFFECT_OUTLINE_SHADOW, - ENGRAVE_TEXT_EFFECT_SOFT_SHADOW, - ENGRAVE_TEXT_EFFECT_OUTLINE_SOFT_SHADOW, + ENGRAVE_TEXT_EFFECT_NONE, /**< No text effect */ + ENGRAVE_TEXT_EFFECT_PLAIN, /**< Normal text */ + ENGRAVE_TEXT_EFFECT_OUTLINE, /**< Outlined text */ + ENGRAVE_TEXT_EFFECT_SOFT_OUTLINE, /**< Soft outlined text */ + ENGRAVE_TEXT_EFFECT_SHADOW, /**< Shadowed text */ + ENGRAVE_TEXT_EFFECT_OUTLINE_SHADOW, /**< Outlined and shadowed text */ + ENGRAVE_TEXT_EFFECT_SOFT_SHADOW, /**< Soft shadowed text */ + ENGRAVE_TEXT_EFFECT_OUTLINE_SOFT_SHADOW, /**< Outlined and soft shadowed text */ ENGRAVE_TEXT_EFFECT_NUM }; +/** + * @enum Engrave_Action + * The different types of actions that can be performed in a program. + */ enum _Engrave_Action { - ENGRAVE_ACTION_STATE_SET, - ENGRAVE_ACTION_STOP, - ENGRAVE_ACTION_SIGNAL_EMIT, - ENGRAVE_ACTION_DRAG_VAL_SET, - ENGRAVE_ACTION_DRAG_VAL_STEP, - ENGRAVE_ACTION_DRAG_VAL_PAGE, - ENGRAVE_ACTION_SCRIPT, + ENGRAVE_ACTION_STATE_SET, /**< Set the state of a given part */ + ENGRAVE_ACTION_STOP, /**< Stop the given action */ + ENGRAVE_ACTION_SIGNAL_EMIT, /**< Emit the given signal */ + ENGRAVE_ACTION_DRAG_VAL_SET, /**< Set the drag value of a given part */ + ENGRAVE_ACTION_DRAG_VAL_STEP, /**< Set the drag step of a given part */ + ENGRAVE_ACTION_DRAG_VAL_PAGE, /**< Set the drag page of a given part */ + ENGRAVE_ACTION_SCRIPT, /**< Set implictly if a script {} block is included */ ENGRAVE_ACTION_NUM }; +/** + * @enum Engrave_Transition + * The different types of transitions available to a program + */ enum _Engrave_Transition { - ENGRAVE_TRANSITION_LINEAR, - ENGRAVE_TRANSITION_SINUSOIDAL, - ENGRAVE_TRANSITION_ACCELERATE, - ENGRAVE_TRANSITION_DECELERATE, + ENGRAVE_TRANSITION_LINEAR, /**< A linear transtion */ + ENGRAVE_TRANSITION_SINUSOIDAL, /**< A sinusoidal transition */ + ENGRAVE_TRANSITION_ACCELERATE, /**< An accelerating transition */ + ENGRAVE_TRANSITION_DECELERATE, /**< A decelerating transition */ ENGRAVE_TRANSITION_NUM }; +/** + * @enum Engrave_Aspect_Preference + * The differenty aspect preferences available + */ enum _Engrave_Aspect_Preference { - ENGRAVE_ASPECT_PREFERENCE_NONE, - ENGRAVE_ASPECT_PREFERENCE_VERTICAL, - ENGRAVE_ASPECT_PREFERENCE_HORIZONTAL, - ENGRAVE_ASPECT_PREFERENCE_BOTH, + ENGRAVE_ASPECT_PREFERENCE_NONE, /**< No aspect preference */ + ENGRAVE_ASPECT_PREFERENCE_VERTICAL, /**< Vertical aspect preference */ + ENGRAVE_ASPECT_PREFERENCE_HORIZONTAL, /**< Horizontal aspect preference */ + ENGRAVE_ASPECT_PREFERENCE_BOTH, /**< Vertical and Horizontal aspect preference */ ENGRAVE_ASPECT_PREFERENCE_NUM }; +/** + * @} + */ + #endif =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/engrave/src/lib/engrave_file.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- engrave_file.c 22 Oct 2004 01:43:14 -0000 1.2 +++ engrave_file.c 24 Oct 2004 06:28:37 -0000 1.3 @@ -1,5 +1,22 @@ #include <Engrave.h> +/** + * @file engrave_file.h Engrave_File object functions. + * @brief Contains all of the functions related to the Engrave file object + */ + +/** + * @defgroup Engrave_File Engrave_File: Functions to work with the Engrave file object + * + * @{ + */ + +/** + * engrave_file_new - create a new Engrave_File object + * + * @return Returns a pointer to a newly allocated file object on success, NULL on + * failure. + */ Engrave_File * engrave_file_new(void) { @@ -8,6 +25,13 @@ return ef; } +/** + * engrave_file_font_add - add the font to the engrave file. + * @param e: The Engrave_File to add the font too. + * @param ef: The Engrave_Font to add to the file. + * + * @return Returns no value. + */ void engrave_file_font_add(Engrave_File *e, Engrave_Font *ef) { @@ -15,6 +39,13 @@ e->fonts = evas_list_append(e->fonts, ef); } +/** + * engrave_file_image_add - add the image to the engrave file. + * @param ef: The Engrave_File to add the image too. + * @param ei: The Engrave_Image to add to the file. + * + * @return Returns no value. + */ void engrave_file_image_add(Engrave_File *ef, Engrave_Image *ei) { @@ -22,6 +53,13 @@ ef->images = evas_list_append(ef->images, ei); } +/** + * engrave_file_data_add - add the data to the engrave file. + * @param ef: The Engrave_File to add the data too. + * @param ed: The Engrave_Data to add to the file. + * + * @return Returns no value. + */ void engrave_file_data_add(Engrave_File *ef, Engrave_Data *ed) { @@ -29,6 +67,13 @@ ef->data = evas_list_append(ef->data, ed); } +/** + * engrave_file_group_add - add the group to the given file + * @param ef: The Engrave_File to add the group too. + * @param eg: The Engrave_Group to add to the file. + * + * @return Returns no value. + */ void engrave_file_group_add(Engrave_File *ef, Engrave_Group *eg) { @@ -36,12 +81,27 @@ ef->groups = evas_list_append(ef->groups, eg); } +/** + * engrave_file_group_last_get - returns the last group in the file + * @param ef: The Engrave_File from which to retrieve the group + * + * @return Returns the last Engrave_Group in the engrave file @a ef or NULL + * if there are no available groups. + */ Engrave_Group * engrave_file_group_last_get(Engrave_File *ef) { return evas_list_data(evas_list_last(ef->groups)); } +/** + * engrave_file_image_by_name_find - returns the Engrave_Image with the given name. + * @param ef: The Engrave_File to search for the image in. + * @param name: The name of the image to search for. + * + * @return Returns the Engrave_Image with the given @a name or NULL if no + * corresponding image can be found. + */ Engrave_Image * engrave_file_image_by_name_find(Engrave_File *ef, char *name) { @@ -55,3 +115,7 @@ return NULL; } +/** + * @} + */ + =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/engrave/src/lib/engrave_font.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- engrave_font.c 21 Oct 2004 06:56:38 -0000 1.1 +++ engrave_font.c 24 Oct 2004 06:28:37 -0000 1.2 @@ -1,13 +1,37 @@ #include <Engrave.h> +/** + * @file engrave_font.h Engrave_Font block + * @brief Contains all of the functions to maniuplate Engrave_Font blocks + */ + +/** + * @defgroup Engrave_Font Engrave_Font: Functions to work with engrave font objects + * + * @{ + */ + +/** + * engrave_font_new - create a new Engrave_Font object. + * @param path: The path to the font + * @param name: The name for the font + * + * @return Returns a pointer to a newly allocated Engrave_Font on success, + * or NULL on failure. + */ Engrave_Font * engrave_font_new(char *path, char *name) { Engrave_Font *ef; ef = NEW(Engrave_Font, 1); + if (!ef) return NULL; + ef->name = (name ? strdup(name) : NULL); ef->path = (path ? strdup(path) : NULL); return ef; } +/** + * @} + */ =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/engrave/src/lib/engrave_group.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- engrave_group.c 22 Oct 2004 01:43:14 -0000 1.2 +++ engrave_group.c 24 Oct 2004 06:28:37 -0000 1.3 @@ -1,10 +1,28 @@ #include <Engrave.h> +/** + * @file engrave_group.h Engrave_Group functions + * @brief Contains all of the functions to maniuplate Engrave_Group objects. + */ + +/** + * @defgroup Engrave_Group Engrave_Group: Functions to work with an Engrave_Group. + * + * @{ + */ + +/** + * engrave_group_new - create a new Engrave_Group object. + * + * @return Returns a pointer to a newly allocated Engrave_Group object on success or + * NULL on failure. + */ Engrave_Group * engrave_group_new(void) { Engrave_Group *group; group = NEW(Engrave_Group, 1); + if (!group) return NULL; /* defaults */ group->max.w = -1; @@ -12,6 +30,13 @@ return group; } +/** + * engrave_group_data_add - add the Engrave_Data to the group + * @param eg: The Engrave_Group to add the data too. + * @param ed: The Engrave_Data to add to the group. + * + * @return Returns no value. + */ void engrave_group_data_add(Engrave_Group *eg, Engrave_Data *ed) { @@ -19,6 +44,13 @@ eg->data = evas_list_append(eg->data, ed); } +/** + * engrave_group_script_set - attach the script to the given group + * @param eg: The Engrave_Group to attach the script too. + * @param script: The script to attach to the group. + * + * @return Returns no value. + */ void engrave_group_script_set(Engrave_Group *eg, char *script) { @@ -27,6 +59,13 @@ eg->script = (script ? strdup(script) : NULL); } +/** + * engrave_group_name_set - set the name of the group to the given name. + * @param eg: The Engrave_Group to attach the name too. + * @param name: The name to attach to the group. + * + * @return Returns no value. + */ void engrave_group_name_set(Engrave_Group *eg, char *name) { @@ -35,6 +74,14 @@ eg->name = (name ? strdup(name) : NULL); } +/** + * engrave_group_min_size_set - set the min size of the group. + * @param eg: The Engrave_Group on which to set the min size. + * @param w: The min width to set on the group. + * @param h: The min height to set on the group. + * + * @return Returns no value. + */ void engrave_group_min_size_set(Engrave_Group *eg, int w, int h) { @@ -43,6 +90,14 @@ eg->min.h = h; } +/** + * engrave_group_max_size_set - set the max size of the group. + * @param eg: The Engrave_Group on which to set the max size. + * @param w: The max width to set on the group. + * @param h: The max height to set on the group. + * + * @return Returns no value. + */ void engrave_group_max_size_set(Engrave_Group *eg, int w, int h) { @@ -51,6 +106,13 @@ eg->max.h = h; } +/** + * engrave_group_part_add - add the given part to the group + * @param eg: The Engrave_Group to attach the part too. + * @param ep: The Engrave_Part to add too the group. + * + * @return Returns no value. + */ void engrave_group_part_add(Engrave_Group *eg, Engrave_Part *ep) { @@ -58,6 +120,13 @@ eg->parts = evas_list_append(eg->parts, ep); } +/** + * engrave_group_part_last_get - retrieve the last part in the group. + * @param eg: The Engrave_Group to retrieve the last part from. + * + * @return Returns the last Engrave_Part in the group or NULL if no such + * part exists. + */ Engrave_Part * engrave_group_part_last_get(Engrave_Group *eg) { @@ -65,6 +134,13 @@ return evas_list_data(evas_list_last(eg->parts)); } +/** + * engrave_group_program_last_get - retrieve the last program in the group. + * @param eg: The Engrave_Group to retrieve the last program from. + * + * @return Returns the last Engrave_Program in the group or NULL if no such + * program exists. + */ Engrave_Program * engrave_group_program_last_get(Engrave_Group *eg) { @@ -72,4 +148,8 @@ return evas_list_data(evas_list_last(eg->programs)); } +/** + * @} + */ + =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/engrave/src/lib/engrave_image.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- engrave_image.c 21 Oct 2004 06:56:38 -0000 1.1 +++ engrave_image.c 24 Oct 2004 06:28:37 -0000 1.2 @@ -1,14 +1,40 @@ #include <Engrave.h> +/** + * @file engrave_image.h Engrave_Image object functions. + * @brief Contains all of the functions to manipulate Engrave_Image objects. + */ + +/** + * @defgroup Engrave_Image Engrave_Image: Functions to work with Engrave_Image blocks. + * + * @{ + */ + +/** + * engrave_image_new - create a new Engrave_Image object. + * @param name: The name of the given image + * @param type: The Engrave_Image_Type of the given image. + * @param value: A compression value for the given image (if applicable) + * + * @return Returns a pointer to a newly allocated Engrave_Image object on + * success or NULL on failure. + */ Engrave_Image * engrave_image_new(char *name, Engrave_Image_Type type, double value) { Engrave_Image *image; image = NEW(Engrave_Image, 1); + if (!image) return NULL; + image->name = (name ? strdup(name) : NULL); image->type = type; image->value = value; return image; } +/** + * @} + */ + =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/engrave/src/lib/engrave_load.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- engrave_load.c 22 Oct 2004 01:43:14 -0000 1.5 +++ engrave_load.c 24 Oct 2004 06:28:37 -0000 1.6 @@ -3,10 +3,31 @@ #include "Engrave.h" #include "engrave_parse.h" +/** + * @file engrave_load.h Engrave loading functions + * @brief Contains the functions to load either an EDC or EET into Engrave. + */ + +/** + * @defgroup Engrave_Load Engrave_Load: Contains the functions to load EDC + * and EET files into Engrave. + * + * @{ + */ + #define MAIN_EDC_NAME "main_edje_source.edc" char *engrave_filename = NULL; +/** + * engrave_load_edc - load the given edc file into memory. + * @param file: The EDC file to load. + * @param imdir: The image directory for the EDC file. + * @param fontdir: The font directory for the EDC file. + * + * @return Returns a pointer to a newly allocated Engrave_File object on + * success or NULL on failure. + */ Engrave_File * engrave_load_edc(char *file, char *imdir, char *fontdir) { @@ -15,6 +36,7 @@ char buf[4096]; char tmpf[4096]; + if (!file) return NULL; strcpy(tmpf, "/tmp/engrave_parse.edc-tmp-XXXXXX"); fd = mkstemp(tmpf); if (fd >= 0) @@ -40,12 +62,19 @@ return(enf); } +/** + * engrave_load_eet - load the given EET file into memory. + * @param filename: The filename of the EET file to load. + * + * @return Returns a pointer to a newly allocated Engrave_File object on + * success or NULL on failure. + */ Engrave_File * engrave_load_eet(char *filename) { Engrave_File *enf = NULL; char *cmd = NULL; - char *old_fname = (char *)strdup(filename); + char *old_fname; char *new_fname = NULL; char *ptr = NULL; int len = 0; @@ -54,6 +83,9 @@ static char tmpn[4096]; char *cpp_extra = NULL; + if (!filename) return NULL; + old_fname = strdup(filename); + memset(tmpn, '\0', sizeof(tmpn)); strcpy(tmpn, "/tmp/engrave.edc-tmp-XXXXXX"); if (mkdtemp(tmpn) == NULL) { @@ -61,7 +93,7 @@ strerror(errno)); return 0; } - work_dir = (char *)strdup(tmpn); + work_dir = strdup(tmpn); ptr = strrchr(old_fname, '/'); if (ptr == NULL) =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/engrave/src/lib/engrave_macros.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- engrave_macros.h 22 Oct 2004 01:43:14 -0000 1.2 +++ engrave_macros.h 24 Oct 2004 06:28:37 -0000 1.3 @@ -1,6 +1,22 @@ #ifndef ENGRAVE_MACROS_H #define ENGRAVE_MACROS_H +/** + * @file engrave_macros.h Macros used in the code and available to programs. + * @brief Contains a set of macros that are used in Engrave and available to programs. + */ + +/** + * @defgroup Engrave_Macros Macros: Macros used internally and available externally + * + * @{ + */ + +#undef NEW +/** +* @def NEW(type, num) +* Allocates memory of @a num elements of sizeof(@a type). +*/ #define NEW(type, num) calloc(num, sizeof(type)) #undef FREE @@ -23,5 +39,9 @@ if (val) FREE(val) \ } +/** + * @} + */ + #endif =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/engrave/src/lib/engrave_out.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- engrave_out.c 22 Oct 2004 21:47:30 -0000 1.6 +++ engrave_out.c 24 Oct 2004 06:28:37 -0000 1.7 @@ -3,6 +3,18 @@ #include <stdarg.h> #include "Engrave.h" +/** + * @file engrave_out.h Functions to faciliate outputing the Engrave information. + * @brief Provided the needed functions to output the Engrave information into various formats. + */ + +/** + * @defgroup Engrave_Out Functions needed to output the Engrave data into + * different file formats. + * + * @{ + */ + static void _engrave_output_group(Engrave_Group *group, FILE *out); static void _engrave_output_part(Engrave_Part *part, FILE *out); static void _engrave_output_program(Engrave_Program *program, FILE *out); @@ -10,21 +22,20 @@ static int level = 0; -char *_image_type_string[ENGRAVE_IMAGE_TYPE_NUM] = { +static char *_image_type_string[ENGRAVE_IMAGE_TYPE_NUM] = { "RAW", "COMP", - "LOSSY", - "USER" + "LOSSY" }; -char *_part_type_string[ENGRAVE_PART_TYPE_NUM] = { +static char *_part_type_string[ENGRAVE_PART_TYPE_NUM] = { "IMAGE", "TEXT", "RECT", "SWALLOW" }; -char *_text_effect_string[ENGRAVE_TEXT_EFFECT_NUM] = { +static char *_text_effect_string[ENGRAVE_TEXT_EFFECT_NUM] = { "NONE", "PLAIN", "OUTLINE", @@ -35,7 +46,7 @@ "OUTLINE_SOFT_SHADOW" }; -char *_action_string[ENGRAVE_ACTION_NUM] = { +static char *_action_string[ENGRAVE_ACTION_NUM] = { "STATE_SET", "ACTION_STOP", "SIGNAL_EMIT", @@ -45,14 +56,14 @@ "SCRIPT" }; -char *_transition_string[ENGRAVE_TRANSITION_NUM] = { +static char *_transition_string[ENGRAVE_TRANSITION_NUM] = { "LINEAR", "SINUSOIDAL", "ACCELERATE", "DECELERATE" }; -char *_aspect_preference_string[ENGRAVE_ASPECT_PREFERENCE_NUM] = { +static char *_aspect_preference_string[ENGRAVE_ASPECT_PREFERENCE_NUM] = { "NONE", "VERTICAL", "HORIZONTAL", @@ -102,6 +113,13 @@ FREE(buf); } +/** + * engrave_eet_output -- Create an EET file from the in-memory data. + * @param engrave_file: The Engrave_File to use to create the EET file. + * @param path: The filename to save the EET file too. + * + * @return Returns 1 on success 0 otherwise. + */ int engrave_eet_output(Engrave_File *engrave_file, char *path) { @@ -117,7 +135,7 @@ } close(fd); - engrave_file_output(engrave_file, tmpn); + engrave_edc_output(engrave_file, tmpn); /* FIXME images and fonts ??? */ len = strlen(tmpn) + strlen(path) + 13; @@ -135,8 +153,15 @@ return 1; } +/** + * engrave_edc_output -- Create an EDC file from the in-memory data. + * @param engrave_file: The Engrave_File to use to create the EET file. + * @param path: The filename to save the EDC file too. + * + * @return Returns 1 on success 0 otherwise. + */ int -engrave_file_output(Engrave_File *engrave_file, char *path) +engrave_edc_output(Engrave_File *engrave_file, char *path) { FILE *out = NULL; Evas_List *l; @@ -210,7 +235,7 @@ return 1; } -void +static void _engrave_output_group(Engrave_Group *group, FILE *out) { Evas_List *l; @@ -276,7 +301,7 @@ engrave_out_end(out); /* group */ } -void +static void _engrave_output_part(Engrave_Part *part, FILE *out) { Evas_List *l; @@ -320,7 +345,7 @@ } -void +static void _engrave_output_program(Engrave_Program *program, FILE *out) { Evas_List *l; @@ -397,7 +422,7 @@ } -void +static void _engrave_output_state(Engrave_Part *part, Engrave_Part_State *state, FILE *out) { Evas_List *l; @@ -538,4 +563,8 @@ engrave_out_end(out); } +/** + * @} + */ + =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/engrave/src/lib/engrave_out.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- engrave_out.h 21 Oct 2004 06:56:38 -0000 1.1 +++ engrave_out.h 24 Oct 2004 06:28:37 -0000 1.2 @@ -2,7 +2,7 @@ #define ENGRAVE_OUT_H int engrave_eet_output(Engrave_File *engrave_file, char *path); -int engrave_file_output(Engrave_File *engrave_file, char *path); +int engrave_edc_output(Engrave_File *engrave_file, char *path); #endif =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/engrave/src/lib/engrave_part.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- engrave_part.c 22 Oct 2004 01:43:14 -0000 1.2 +++ engrave_part.c 24 Oct 2004 06:28:37 -0000 1.3 @@ -1,14 +1,41 @@ #include <Engrave.h> +/** + * @file engrave_part.h Engrave_Part object functions. + * @brief Contains all functions to maniuplate the Engrave_Part object. + */ + +/** + * @defgroup Engrave_Part Engrave_Part: Functions to work with part objects + * + * @{ + */ + +/** + * engrave_part_new - create a new part object. + * @param type: The Engrave_Part_Type for the part. + * + * @return Returns a pointer to the newly allocated Engrave_Part on sucess + * or NULL on failure. + */ Engrave_Part * engrave_part_new(Engrave_Part_Type type) { Engrave_Part *part; part = NEW(Engrave_Part, 1); + if (!part) return NULL; + part->type = type; return part; } +/** + * engrave_part_mouse_events_set - set the mouse events flag for the part. + * @param ep: The Engrave_Part to set the mouse events flag on. + * @param val: The value to set the mouse events flag too. + * + * @return Returns no value. + */ void engrave_part_mouse_events_set(Engrave_Part *ep, int val) { @@ -16,6 +43,13 @@ ep->mouse_events = val; } +/** + * engrave_part_repeat_events_set - set the repeat events flag for the part. + * @param ep: The Engrave_Part to set the repeat events flag on. + * @param val: The value to set the repeat events flag too. + * + * @return Returns no value. + */ void engrave_part_repeat_events_set(Engrave_Part *ep, int val) { @@ -23,6 +57,13 @@ ep->repeat_events = val; } +/** + * engrave_part_name_set - set the name of the part. + * @param ep: The Engrave_Part to set the name off + * @param name: The name to attach to the part. + * + * @return Returns no value. + */ void engrave_part_name_set(Engrave_Part *ep, char *name) { @@ -31,6 +72,13 @@ ep->name = (name ? strdup(name) : NULL); } +/** + * engrave_part_type_set - set the type of the part + * @param ep: The Engrave_Part to set the type on. + * @param type: The Engrave_Part_Type to set on the part + * + * @return Returns no value. + */ void engrave_part_type_set(Engrave_Part *ep, Engrave_Part_Type type) { @@ -38,6 +86,13 @@ ep->type = type; } +/** + * engrave_part_effect_set - set the effect on the given part. + * @param ep: The Engrave_Part to set the effect upon. + * @param effect: The Engrave_Text_Effect to set on the part. + * + * @return Returns no value. + */ void engrave_part_effect_set(Engrave_Part *ep, Engrave_Text_Effect effect) { @@ -45,6 +100,13 @@ ep->effect = effect; } +/** + * engrave_part_clip_set - set the clip of the given part. + * @param ep: The Engrave_Part to set the clip on + * @param clip_to: The name of the part to clip too. + * + * @return Returns no value. + */ void engrave_part_clip_to_set(Engrave_Part *ep, char *clip_to) { @@ -53,13 +115,15 @@ ep->clip_to = (clip_to ? strdup(clip_to) : NULL); } -Engrave_Part_State * -engrave_part_state_last_get(Engrave_Part *ep) -{ - if (!ep) return NULL; - return evas_list_data(evas_list_last(ep->states)); -} - +/** + * engrave_part_dragable_x_set - set the dragable x value on the part. + * @param ep: The Engrave_Part to set the x dragable on. + * @param x: The x value to set on the dragable. + * @param step: The step value to set on the dragable. + * @param count: The count value to set on the dragable. + * + * @return Returns no value. + */ void engrave_part_dragable_x_set(Engrave_Part *ep, int x, int step, int count) { @@ -69,6 +133,15 @@ ep->dragable.count.x = count; } +/** + * engrave_part_dragable_y_set - set the dragable y value on the part. + * @param ep: The Engrave_Part to set the y dragable on. + * @param y: The y value to set on the dragable. + * @param step: The step value to set on the dragable. + * @param count: The count value to set on the dragable. + * + * @return Returns no value. + */ void engrave_part_dragable_y_set(Engrave_Part *ep, int y, int step, int count) { @@ -78,6 +151,13 @@ ep->dragable.count.y = count; } +/** + * engrave_part_dragable_confine_set - set the confine of the parts dragable. + * @param ep: The Engrave_Part to confine the dragable on. + * @param confine: The name of the part to confine the dragable to. + * + * @return Returns no value. + */ void engrave_part_dragable_confine_set(Engrave_Part *ep, char *confine) { @@ -86,6 +166,27 @@ ep->dragable.confine = (confine ? strdup(confine) : NULL); } +/** + * engrave_part_state_last_get - get the last state in the part. + * @param ep: The Engrave_Part to retrieve the state from. + * + * @return Returns the last @a Engrave_Part_State value in the part or NULL if no + * such value exists. + */ +Engrave_Part_State * +engrave_part_state_last_get(Engrave_Part *ep) +{ + if (!ep) return NULL; + return evas_list_data(evas_list_last(ep->states)); +} + +/** + * engrave_part_state_add - add the state to the part. + * @param ep: The Engrave_Part to add the state too. + * @param eps: The Engrave_Part_State to add to the part. + * + * @return Returns no value. + */ void engrave_part_state_add(Engrave_Part *ep, Engrave_Part_State *eps) { @@ -93,5 +194,7 @@ ep->states = evas_list_append(ep->states, eps); } - +/** + * @} + */ =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/engrave/src/lib/engrave_part_state.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- engrave_part_state.c 22 Oct 2004 01:43:14 -0000 1.2 +++ engrave_part_state.c 24 Oct 2004 06:28:37 -0000 1.3 @@ -6,6 +6,7 @@ Engrave_Part_State *state; state = NEW(Engrave_Part_State, 1); + if (!state) return NULL; /* defaults */ state->visible = 1; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/engrave/src/lib/engrave_program.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- engrave_program.c 22 Oct 2004 01:43:14 -0000 1.1 +++ engrave_program.c 24 Oct 2004 06:28:37 -0000 1.2 @@ -1,5 +1,22 @@ #include <Engrave.h> +/** + * @file engrave_program.h Engrave_Program object functions. + * @brief Contains all of the functions to mainuplulate Engrave_Program objects. + */ + +/** + * @defgroup Engrave_Program Engrave_Program: Functions to work with Engrave_Program objects. + * + * @{ + */ + +/** + * engrave_program_new - create a new Engrave_Program object. + * + * @return Returns a pointer to the newly allocated Engrave_Program object + * on success or NULL on failure. + */ Engrave_Program * engrave_program_new(void) { @@ -8,6 +25,13 @@ return ep; } +/** + * engrave_program_script_set - attach a script to the program. + * @param ep: The Engrave_Program to attach the script too. + * @param script: The script to attach to the program. + * + * @return Returns no value. + */ void engrave_program_script_set(Engrave_Program *ep, char *script) { @@ -17,6 +41,13 @@ ep->script = (script ? strdup(script) : NULL); } +/** + * engrave_program_name_set - set the name of the program. + * @param ep: The Engrave_Program to attach the name too. + * @param name: The name to attach to the program. + * + * @return Returns no value. + */ void engrave_program_name_set(Engrave_Program *ep, char *name) { @@ -25,6 +56,13 @@ ep->name = (name ? strdup(ep->name) : NULL); } +/** + * engrave_program_signal_set - set the given signal on the program + * @param ep: The Engrave_Program to attach the signal too. + * @param signal: The signal to attach to the program. + * + * @return Returns no value. + */ void engrave_program_signal_set(Engrave_Program *ep, char *signal) { @@ -33,6 +71,13 @@ ep->signal = (signal ? strdup(signal) : NULL); } +/** + * engrave_program_source_set - set the source of the program. + * @param ep: The Engrave_Program to attach the souce too. + * @param source: The name to attach to the group. + * + * @return Returns no value. + */ void engrave_program_source_set(Engrave_Program *ep, char *source) { @@ -41,6 +86,13 @@ ep->source = (source ? strdup(source) : NULL); } +/** + * engrave_program_target_add - set the target on the program. + * @param ep: The Engrave_Program to set the target on. + * @param target: The target to set on the program. + * + * @return Returns no value. + */ void engrave_program_target_add(Engrave_Program *ep, char *target) { @@ -48,6 +100,13 @@ ep->targets = evas_list_append(ep->targets, strdup(target)); } +/** + * engrave_program_after_add - add the after to the program. + * @param ep: The Engrave_Program to add the after too. + * @param after: The after to add to the program. + * + * @return Returns no value. + */ void engrave_program_after_add(Engrave_Program *ep, char *after) { @@ -55,6 +114,14 @@ ep->afters = evas_list_append(ep->afters, strdup(after)); } +/** + * engrave_program_in_set - set the in value of the program. + * @param ep: The Engrave_Program to set the in value on. + * @param from: The from value to set. + * @param range: The range value to set. + * + * @return Returns no value. + */ void engrave_program_in_set(Engrave_Program *ep, double from, double range) { @@ -63,6 +130,17 @@ ep->in.range = range; } +/** + * engrave_program_action_set - set the action for the program. + * @param ep: The Engrave_Program to set the action on. + * @param action: The Engrave_Action to set on the program. + * @param state: The state value to set. + * @param state2: The state2 value to set. + * @param value: The value value to set. + * @param value2: The value2 value to set. + * + * @return Returns no value. + */ void engrave_program_action_set(Engrave_Program *ep, Engrave_Action action, char *state, char *state2, @@ -78,6 +156,14 @@ ep->value2 = value2; } +/** + * engrave_program_transition_set - set the transition on the program + * @param ep: The Engrave_Program to set the transition on. + * @param trans: The Engrave_Transition to set on the program. + * @param duration: The duration of the given transition. + * + * @return Returns no value. + */ void engrave_program_transition_set(Engrave_Program *ep, Engrave_Transition trans, double duration) @@ -87,4 +173,7 @@ ep->duration = duration; } - +/** + * @} + */ + ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs