add cedrics dict check patch

SVN revision: 33946
This commit is contained in:
Carsten Haitzler 2008-03-06 17:52:59 +00:00
parent 69f298c228
commit b65d63440f
12 changed files with 85 additions and 28 deletions

View File

@ -1,7 +1,7 @@
PROJECT_NAME = Edje
PROJECT_NUMBER =
OUTPUT_DIRECTORY = doc
INPUT = edje.c ./src/bin/edje_cc_handlers.c
INPUT = edje.c ./src/bin/edje_cc_handlers.c ./src/lib/Edje_Edit.h
IMAGE_PATH = doc/img
OUTPUT_LANGUAGE = English
GENERATE_HTML = YES
@ -41,7 +41,7 @@ VERBATIM_HEADERS = NO
SHOW_INCLUDE_FILES = NO
JAVADOC_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
DETAILS_AT_TOP = YES
INHERIT_DOCS = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES

View File

@ -1,7 +1,7 @@
#!/bin/sh
cp ./edje.c.in ./edje.c
cat ./src/lib/Edje.h >> ./edje.c
for I in `find ./src/lib -name "*.c" -print`; do
for I in `find ./src/lib -name "*.c" -print | grep -v edje_edit.c`; do
cat $I >> ./edje.c
done
rm -rf ./doc/html ./doc/latex ./doc/man
@ -9,6 +9,8 @@ mkdir -p ./doc/html ./doc/latex ./doc/man
doxygen
cp doc/img/*.png doc/html/
cp doc/img/*.gif doc/html/
cp doc/img/*.jpg doc/html/
cp doc/*.css doc/html/
rm -f edje_docs.tar edje_docs.tar.gz
tar -cvf edje_docs.tar doc/html doc/man doc/latex
gzip -9 edje_docs.tar

View File

@ -14,7 +14,8 @@ lib_LTLIBRARIES = \
libedje.la
include_HEADERS = \
Edje.h
Edje.h \
Edje_Edit.h
libedje_la_SOURCES = \
edje_calc.c \
@ -35,7 +36,8 @@ edje_message_queue.c \
edje_private.h \
edje_cache.c \
edje_match.c \
edje_textblock_styles.c
edje_textblock_styles.c \
edje_edit.c
libedje_la_LIBADD = -lm @EDJE_LIBS@
libedje_la_DEPENDENCIES = $(top_builddir)/config.h

View File

@ -847,7 +847,7 @@ _edje_embryo_fn_get_state(Embryo_Program *ep, Embryo_Cell *params)
Edje *ed;
int part_id = 0;
Edje_Real_Part *rp;
char *s;
const char *s;
CHKPARAM(4);
ed = embryo_program_data_get(ep);

View File

@ -5,7 +5,7 @@
#include "Edje.h"
#include "edje_private.h"
static void _edje_collection_free_part_description_free(Edje_Part_Description *desc, unsigned int free_strings);
void _edje_collection_free_part_description_free(Edje_Part_Description *desc, unsigned int free_strings);
static Evas_Bool _edje_file_collection_hash_foreach(const Evas_Hash *hash, const char *key, void *data, void *fdata);
#ifdef EDJE_PROGRAM_CACHE
static int _edje_collection_free_prog_cache_matches_free_cb(Evas_Hash *hash, const char *key, void *data, void *fdata);
@ -948,7 +948,7 @@ _edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec)
free(ec);
}
static void
void
_edje_collection_free_part_description_free(Edje_Part_Description *desc, unsigned int free_strings)
{
while (desc->image.tween_list)

View File

@ -380,31 +380,31 @@ struct _Edje_Spectrum_Color
struct _Edje_Program /* a conditional program to be run */
{
int id; /* id of program */
char *name; /* name of the action */
int id; /* id of program */
const char *name; /* name of the action */
char *signal; /* if signal emission name matches the glob here... */
char *source; /* if part that emitted this (name) matches this glob */
const char *signal; /* if signal emission name matches the glob here... */
const char *source; /* if part that emitted this (name) matches this glob */
struct {
double from;
double range;
double from;
double range;
} in;
int action; /* type - set state, stop action, set drag pos etc. */
char *state; /* what state of alternates to apply, NULL = default */
char *state2; /* what other state to use - for signal emit action */
double value; /* value of state to apply (if multiple names match) */
double value2; /* other value for drag actions */
int action; /* type - set state, stop action, set drag pos etc. */
const char *state; /* what state of alternates to apply, NULL = default */
const char *state2; /* what other state to use - for signal emit action */
double value; /* value of state to apply (if multiple names match) */
double value2; /* other value for drag actions */
struct {
int mode; /* how to tween - linear, sinusoidal etc. */
double time; /* time to graduate between current and new state */
int mode; /* how to tween - linear, sinusoidal etc. */
double time; /* time to graduate between current and new state */
} tween;
Evas_List *targets; /* list of target parts to apply the state to */
Evas_List *targets; /* list of target parts to apply the state to */
Evas_List *after; /* list of actions to run at the end of this, for looping */
Evas_List *after; /* list of actions to run at the end of this, for looping */
};
struct _Edje_Program_Target /* the target of an action */
@ -461,7 +461,7 @@ struct _Edje_Part_Collection
struct _Edje_Part
{
char *name; /* the name if any of the part */
const char *name; /* the name if any of the part */
Edje_Part_Description *default_desc; /* the part descriptor for default */
Evas_List *other_desc; /* other possible descriptors */
char *source;
@ -500,7 +500,7 @@ struct _Edje_Part_Description
{
struct {
double value; /* the value of the state (for ranges) */
char *name; /* the named state if any */
const char *name; /* the named state if any */
} state;
Edje_Alignment align; /* 0 <-> 1.0 alignment within allocated space */

View File

@ -426,8 +426,8 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf)
/* Add and Handle tag parsed data */
if (ts)
{
/* FIXME: How to know if the previous value was a stringshare */
/* evas_stringshare_del(tag->value); */
if (eet_dictionary_string_check(eet_dictionary_get(edf->ef), tag->value) == 0)
evas_stringshare_del(tag->value);
tag->value = evas_stringshare_add(ts);
buf = _edje_strbuf_append(buf, tag->value, &buflen, &bufalloc);
free(ts);

View File

@ -224,6 +224,7 @@ extern "C" {
/* FIXME: Add some documentation */
EAPI Eet_Dictionary* eet_dictionary_get(Eet_File *ef);
EAPI int eet_dictionary_string_check(Eet_Dictionary *ed, const char *string);
/**
* Read a specified entry from an eet file and return data

View File

@ -87,6 +87,9 @@ struct _Eet_Dictionary
int count;
int total;
const char *start;
const char *end;
};
Eet_Dictionary *eet_dictionary_add(void);

View File

@ -1437,6 +1437,7 @@ _eet_data_dump_free(Node *node)
case EET_T_UINT:
case EET_T_ULONG_LONG:
break;
case EET_T_INLINED_STRING:
case EET_T_STRING:
if (node->data.str) free(node->data.str);
break;
@ -1620,6 +1621,7 @@ _eet_data_dump_encode(Eet_Dictionary *ed,
free(data);
}
break;
case EET_T_INLINED_STRING:
case EET_T_STRING:
data = eet_data_put_type(ed, node->type, &(node->data.str), &size);
if (data)
@ -2033,6 +2035,18 @@ _eet_data_descriptor_decode(const Eet_Dictionary *ed,
}
}
}
else
if (type == EET_T_INLINED_STRING)
{
char **str;
str = (char **)(((char *)data) + ede->offset);
if (*str)
{
*str = edd->func.str_alloc(*str);
_eet_freelist_str_add(*str);
}
}
}
else if (ede->subtype)
{
@ -2244,6 +2258,7 @@ _eet_data_descriptor_decode(const Eet_Dictionary *ed,
dumpfunc(dumpdata, "ulong_long: ");
snprintf(tbuf, sizeof(tbuf), "%llu", *((unsigned long long *)dd));
dumpfunc(dumpdata, tbuf); break;
case EET_T_INLINED_STRING:
case EET_T_STRING:
{
char *s;

View File

@ -170,8 +170,17 @@ eet_dictionary_string_get_char(const Eet_Dictionary *ed, int index)
return NULL;
if (index < ed->count)
{
#ifdef _WIN32
/* Windows file system could change the mmaped file when replacing a file. So we need to copy all string in memory to avoid bugs. */
if (ed->all[index].str == NULL)
{
ed->all[index].str = strdup(ed->all[index].mmap);
ed->all[index].mmap = NULL;
}
#else
if (ed->all[index].mmap)
return ed->all[index].mmap;
#endif
return ed->all[index].str;
}
return NULL;
@ -291,3 +300,23 @@ eet_dictionary_string_get_double(const Eet_Dictionary *ed, int index, double *re
}
return 0;
}
EAPI int
eet_dictionary_string_check(Eet_Dictionary *ed, const char *string)
{
int i;
if (ed == NULL
|| string == NULL)
return 0;
if (ed->start <= string
&& string < ed->end)
return 1;
for (i = 0; i < ed->count; ++i)
if (ed->all[i].str == string)
return 1;
return 0;
}

View File

@ -814,7 +814,9 @@ eet_internal_read2(Eet_File *ef)
if (eet_test_close(!ef->ed->all, ef)) return NULL;
ef->ed->count = num_dictionary_entries;
ef->ed->start = start + bytes_dictionary_entries + bytes_directory_entries;
ef->ed->end = ef->ed->start;
for (j = 0; j < ef->ed->count; ++j)
{
int hash;
@ -839,6 +841,9 @@ eet_internal_read2(Eet_File *ef)
ef->ed->all[j].mmap = start + offset;
ef->ed->all[j].str = NULL;
if (ef->ed->all[j].mmap + ef->ed->all[j].len > ef->ed->end)
ef->ed->end = ef->ed->all[j].mmap + ef->ed->all[j].len;
/* Check '\0' at the end of the string */
if (eet_test_close(ef->ed->all[j].mmap[ef->ed->all[j].len - 1] != '\0', ef)) return NULL;