Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/edje
Dir : e17/libs/edje/src/bin
Modified Files:
Makefile.am edje_cc.c edje_cc.h edje_cc_handlers.c
edje_cc_out.c edje_cc_parse.c
Added Files:
edje_cc_mem.c
Log Message:
mem allocs guaranteed now... they are wrapped and errors handled centrally
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- Makefile.am 11 Jun 2003 13:20:47 -0000 1.4
+++ Makefile.am 12 Jun 2003 22:34:51 -0000 1.5
@@ -30,6 +30,7 @@
edje_cc.h \
edje_cc_out.c \
edje_cc_parse.c \
+edje_cc_mem.c \
edje_cc_handlers.c
edje_cc_LDADD = \
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_cc.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- edje_cc.c 11 Jun 2003 13:20:48 -0000 1.4
+++ edje_cc.c 12 Jun 2003 22:34:51 -0000 1.5
@@ -56,16 +56,11 @@
exit(-1);
}
- edje_file = calloc(1, sizeof(Edje_File));
- if (!edje_file)
- {
- fprintf(stderr, "%s: Error. memory allocation of %i bytes failed. %s\n",
- progname, sizeof(Edje_File), strerror(errno));
- exit(-1);
- }
+ edje_file = mem_alloc(SZ(Edje_File));
data_setup();
compile();
data_write();
+
return 0;
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_cc.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- edje_cc.h 12 Jun 2003 13:02:28 -0000 1.2
+++ edje_cc.h 12 Jun 2003 22:34:51 -0000 1.3
@@ -17,6 +17,7 @@
#include <sys/stat.h>
#include <stdarg.h>
+/* types */
typedef struct _New_Object_Handler New_Object_Handler;
typedef struct _New_Statement_Handler New_Statement_Handler;
@@ -32,19 +33,26 @@
void (*func)(void);
};
-void data_setup(void);
-void data_write(void);
-void compile(void);
-int object_handler_num(void);
-int statement_handler_num(void);
+/* global fn calls */
+void data_setup(void);
+void data_write(void);
+void compile(void);
char *parse_str(int n);
int parse_enum(int n, ...);
int parse_int(int n);
int parse_int_range(int n, int f, int t);
double parse_float(int n);
double parse_float_range(int n, int f, int t);
-
+
+int object_handler_num(void);
+int statement_handler_num(void);
+
+void *mem_alloc(size_t size);
+char *mem_strdup(const char *s);
+#define SZ sizeof
+
+/* global vars */
extern Evas_List *img_dirs;
extern char *file_in;
extern char *file_out;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_cc_handlers.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- edje_cc_handlers.c 12 Jun 2003 13:02:28 -0000 1.3
+++ edje_cc_handlers.c 12 Jun 2003 22:34:51 -0000 1.4
@@ -5,6 +5,12 @@
static void st_images_image(void);
static void ob_collections(void);
+static void ob_collections_group(void);
+static void ob_collections_group_parts(void);
+static void ob_collections_group_parts_part(void);
+static void ob_collections_group_parts_part_description(void);
+static void ob_collections_group_programs(void);
+static void ob_collections_group_programs_program(void);
/*****/
@@ -13,23 +19,23 @@
{"images", ob_images},
{"images.image", ob_images_image},
{"collections", ob_collections},
- {"collections.group", NULL},
+ {"collections.group", ob_collections_group},
{"collections.group.name", NULL},
- {"collections.group.parts", NULL},
- {"collections.group.parts.part", NULL},
+ {"collections.group.parts", ob_collections_group_parts},
+ {"collections.group.parts.part", ob_collections_group_parts_part},
{"collections.group.parts.part.name", NULL},
{"collections.group.parts.part.type", NULL},
{"collections.group.parts.part.mouse_events", NULL},
{"collections.group.parts.part.color_class", NULL},
- {"collections.group.parts.part.description", NULL},
+ {"collections.group.parts.part.description",
ob_collections_group_parts_part_description},
{"collections.group.parts.part.description.state", NULL},
{"collections.group.parts.part.description.visible", NULL},
{"collections.group.parts.part.description.dragable", NULL},
{"collections.group.parts.part.description.dragable.x", NULL},
{"collections.group.parts.part.description.dragable.y", NULL},
{"collections.group.parts.part.description.dragable.confine", NULL},
- {"collections.group.programs", NULL},
- {"collections.group.programs.program", NULL}
+ {"collections.group.programs", ob_collections_group_programs},
+ {"collections.group.programs.program", ob_collections_group_programs_program}
};
New_Statement_Handler statement_handlers[] =
@@ -66,13 +72,7 @@
static void
ob_images(void)
{
- edje_file->image_dir = calloc(1, sizeof(Edje_Image_Directory));
- if (!edje_file->image_dir)
- {
- fprintf(stderr, "%s: Error. memory allocation of %i bytes failed. %s\n",
- progname, sizeof(Edje_Image_Directory), strerror(errno));
- exit(-1);
- }
+ edje_file->image_dir = mem_alloc(SZ(Edje_Image_Directory));
}
static void
@@ -125,5 +125,40 @@
static void
ob_collections(void)
+{
+ edje_file->collection_dir = mem_alloc(SZ(Edje_Part_Collection_Directory));
+}
+
+static void
+ob_collections_group(void)
+{
+ Edje_Part_Collection_Directory_Entry *de;
+
+ de = mem_alloc(SZ(Edje_Part_Collection_Directory_Entry));
+}
+
+static void
+ob_collections_group_parts(void)
+{
+ Edje_Part_Collection *pc;
+}
+
+static void
+ob_collections_group_parts_part(void)
+{
+}
+
+static void
+ob_collections_group_parts_part_description(void)
+{
+}
+
+static void
+ob_collections_group_programs(void)
+{
+}
+
+static void
+ob_collections_group_programs_program(void)
{
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_cc_out.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- edje_cc_out.c 11 Jun 2003 13:20:48 -0000 1.1
+++ edje_cc_out.c 12 Jun 2003 22:34:51 -0000 1.2
@@ -63,6 +63,7 @@
Evas_List *l;
im = NULL;
+ imlib_set_cache_size(0);
for (l = img_dirs; l; l = l->next)
{
char buf[4096];
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_cc_parse.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- edje_cc_parse.c 12 Jun 2003 13:02:28 -0000 1.3
+++ edje_cc_parse.c 12 Jun 2003 22:34:51 -0000 1.4
@@ -177,13 +177,7 @@
done:
*new_p = p;
- tok = malloc(tok_end - tok_start + 2);
- if (!tok)
- {
- fprintf(stderr, "%s: Error. memory allocation of %i bytes failed. %s\n",
- progname, tok_end - tok_start + 2, strerror(errno));
- exit(-1);
- }
+ tok = mem_alloc(tok_end - tok_start + 2);
strncpy(tok, tok_start, tok_end - tok_start + 1);
tok[tok_end - tok_start + 1] = 0;
@@ -215,13 +209,7 @@
len = 0;
for (l = stack; l; l = l->next)
len += strlen(l->data) + 1;
- id = malloc(len);
- if (!id)
- {
- fprintf(stderr, "%s: Error. memory allocation of %i bytes failed. %s\n",
- progname, len, strerror(errno));
- exit(-1);
- }
+ id = mem_alloc(len);
id[0] = 0;
for (l = stack; l; l = l->next)
{
@@ -362,13 +350,7 @@
progname, file_in, line, n + 1);
exit(-1);
}
- s = strdup(str);
- if (!s)
- {
- fprintf(stderr, "%s: Error. memory allocation of %i bytes failed. %s\n",
- progname, strlen(str) + 1, strerror(errno));
- exit(-1);
- }
+ s = mem_strdup(str);
return s;
}
-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs