aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/edje/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/edje/src/bin')
-rw-r--r--libraries/edje/src/bin/Makefile.am72
-rw-r--r--libraries/edje/src/bin/Makefile.in1149
-rw-r--r--libraries/edje/src/bin/edje_cc.c250
-rw-r--r--libraries/edje/src/bin/edje_cc.h229
-rw-r--r--libraries/edje/src/bin/edje_cc_handlers.c7929
-rw-r--r--libraries/edje/src/bin/edje_cc_mem.c34
-rw-r--r--libraries/edje/src/bin/edje_cc_out.c2162
-rw-r--r--libraries/edje/src/bin/edje_cc_parse.c1546
-rw-r--r--libraries/edje/src/bin/edje_cc_sources.c259
-rw-r--r--libraries/edje/src/bin/edje_convert.c459
-rw-r--r--libraries/edje/src/bin/edje_convert.h154
-rw-r--r--libraries/edje/src/bin/edje_data_convert.c451
-rw-r--r--libraries/edje/src/bin/edje_decc.c471
-rw-r--r--libraries/edje/src/bin/edje_decc.h61
-rw-r--r--libraries/edje/src/bin/edje_external_inspector.c663
-rw-r--r--libraries/edje/src/bin/edje_inspector.c1633
-rw-r--r--libraries/edje/src/bin/edje_multisense_convert.c329
-rw-r--r--libraries/edje/src/bin/edje_multisense_convert.h25
-rw-r--r--libraries/edje/src/bin/edje_player.c789
-rw-r--r--libraries/edje/src/bin/edje_recc69
-rw-r--r--libraries/edje/src/bin/epp/Makefile.am59
-rw-r--r--libraries/edje/src/bin/epp/Makefile.in756
-rw-r--r--libraries/edje/src/bin/epp/cppalloc.c70
-rw-r--r--libraries/edje/src/bin/epp/cpperror.c147
-rw-r--r--libraries/edje/src/bin/epp/cppexp.c1090
-rw-r--r--libraries/edje/src/bin/epp/cpphash.c198
-rw-r--r--libraries/edje/src/bin/epp/cpphash.h41
-rw-r--r--libraries/edje/src/bin/epp/cpplib.c7427
-rw-r--r--libraries/edje/src/bin/epp/cpplib.h641
-rw-r--r--libraries/edje/src/bin/epp/cppmain.c147
30 files changed, 0 insertions, 29310 deletions
diff --git a/libraries/edje/src/bin/Makefile.am b/libraries/edje/src/bin/Makefile.am
deleted file mode 100644
index a936d5a..0000000
--- a/libraries/edje/src/bin/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3if BUILD_EPP
4 SUBDIRS = epp
5endif
6
7bin_SCRIPTS = @EDJE_RECC_PRG@
8
9bin_PROGRAMS = @EDJE_CC_PRG@ @EDJE_DECC_PRG@ @EDJE_PLAYER_PRG@ @EDJE_INSPECTOR_PRG@ @EDJE_EXTERNAL_INSPECTOR_PRG@
10
11EXTRA_PROGRAMS = edje_cc edje_decc edje_player edje_inspector edje_external_inspector
12
13edje_cc_SOURCES = \
14edje_cc.c \
15edje_cc_out.c \
16edje_cc_parse.c \
17edje_cc_mem.c \
18edje_cc_handlers.c \
19edje_cc_sources.c \
20edje_multisense_convert.c
21
22edje_cc_CPPFLAGS = \
23-I$(top_srcdir)/src/bin \
24-I$(top_srcdir)/src/lib \
25-DPACKAGE_BIN_DIR=\"$(bindir)\" \
26-DPACKAGE_LIB_DIR=\"$(libdir)\" \
27-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
28-DEPP_DIR=\"$(libdir)/$(PACKAGE)/utils\" \
29@EDJE_CFLAGS@ @EDJE_CC_CFLAGS@ @EVIL_CFLAGS@ @SNDFILE_CFLAGS@
30edje_cc_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_CC_LIBS@ @EVIL_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@ -lm
31edje_cc_LDFLAGS = @lt_enable_auto_import@
32
33
34edje_decc_SOURCES = \
35edje_decc.c \
36edje_decc.h \
37edje_cc_mem.c \
38edje_cc_sources.c
39
40edje_decc_CPPFLAGS = \
41-I$(top_srcdir)/src/bin \
42-I$(top_srcdir)/src/lib \
43@EDJE_CFLAGS@ @EDJE_DECC_CFLAGS@ @EVIL_CFLAGS@
44edje_decc_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_DECC_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@
45edje_decc_LDFLAGS = @lt_enable_auto_import@
46
47edje_player_SOURCES = edje_player.c
48edje_player_CPPFLAGS = \
49-I$(top_srcdir)/src/bin \
50-I$(top_srcdir)/src/lib \
51@EDJE_PLAYER_CFLAGS@ @EVIL_CFLAGS@
52edje_player_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_PLAYER_LIBS@ @EVIL_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@
53edje_player_LDFLAGS = @lt_enable_auto_import@
54
55edje_inspector_SOURCES = edje_inspector.c
56edje_inspector_CPPFLAGS = \
57-I$(top_srcdir)/src/bin \
58-I$(top_srcdir)/src/lib \
59@EDJE_INSPECTOR_CFLAGS@
60edje_inspector_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_INSPECTOR_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@
61edje_inspector_LDFLAGS = @lt_enable_auto_import@
62
63edje_external_inspector_SOURCES = edje_external_inspector.c
64edje_external_inspector_CPPFLAGS = \
65-I$(top_srcdir)/src/bin \
66-I$(top_srcdir)/src/lib \
67@EDJE_EXTERNAL_INSPECTOR_CFLAGS@
68edje_external_inspector_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_EXTERNAL_INSPECTOR_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@
69edje_external_inspector_LDFLAGS = @lt_enable_auto_import@
70
71EXTRA_DIST = @EDJE_RECC_PRG@ edje_cc.h edje_convert.h edje_convert.c edje_multisense_convert.h edje_data_convert.c
72EXTRA_SCRIPTS = edje_recc
diff --git a/libraries/edje/src/bin/Makefile.in b/libraries/edje/src/bin/Makefile.in
deleted file mode 100644
index 877bcb2..0000000
--- a/libraries/edje/src/bin/Makefile.in
+++ /dev/null
@@ -1,1149 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18
19VPATH = @srcdir@
20pkgdatadir = $(datadir)/@PACKAGE@
21pkgincludedir = $(includedir)/@PACKAGE@
22pkglibdir = $(libdir)/@PACKAGE@
23pkglibexecdir = $(libexecdir)/@PACKAGE@
24am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
25install_sh_DATA = $(install_sh) -c -m 644
26install_sh_PROGRAM = $(install_sh) -c
27install_sh_SCRIPT = $(install_sh) -c
28INSTALL_HEADER = $(INSTALL_DATA)
29transform = $(program_transform_name)
30NORMAL_INSTALL = :
31PRE_INSTALL = :
32POST_INSTALL = :
33NORMAL_UNINSTALL = :
34PRE_UNINSTALL = :
35POST_UNINSTALL = :
36build_triplet = @build@
37host_triplet = @host@
38EXTRA_PROGRAMS = edje_cc$(EXEEXT) edje_decc$(EXEEXT) \
39 edje_player$(EXEEXT) edje_inspector$(EXEEXT) \
40 edje_external_inspector$(EXEEXT)
41subdir = src/bin
42DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
43ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
44am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
45 $(top_srcdir)/m4/efl_binary.m4 \
46 $(top_srcdir)/m4/efl_coverage.m4 \
47 $(top_srcdir)/m4/efl_doxygen.m4 \
48 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
49 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
50 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
51 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
52am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
53 $(ACLOCAL_M4)
54mkinstalldirs = $(install_sh) -d
55CONFIG_HEADER = $(top_builddir)/config.h
56CONFIG_CLEAN_FILES =
57CONFIG_CLEAN_VPATH_FILES =
58am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"
59PROGRAMS = $(bin_PROGRAMS)
60am_edje_cc_OBJECTS = edje_cc-edje_cc.$(OBJEXT) \
61 edje_cc-edje_cc_out.$(OBJEXT) edje_cc-edje_cc_parse.$(OBJEXT) \
62 edje_cc-edje_cc_mem.$(OBJEXT) \
63 edje_cc-edje_cc_handlers.$(OBJEXT) \
64 edje_cc-edje_cc_sources.$(OBJEXT) \
65 edje_cc-edje_multisense_convert.$(OBJEXT)
66edje_cc_OBJECTS = $(am_edje_cc_OBJECTS)
67edje_cc_DEPENDENCIES = $(top_builddir)/src/lib/libedje.la
68AM_V_lt = $(am__v_lt_$(V))
69am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
70am__v_lt_0 = --silent
71edje_cc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
72 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
73 $(edje_cc_LDFLAGS) $(LDFLAGS) -o $@
74am_edje_decc_OBJECTS = edje_decc-edje_decc.$(OBJEXT) \
75 edje_decc-edje_cc_mem.$(OBJEXT) \
76 edje_decc-edje_cc_sources.$(OBJEXT)
77edje_decc_OBJECTS = $(am_edje_decc_OBJECTS)
78edje_decc_DEPENDENCIES = $(top_builddir)/src/lib/libedje.la
79edje_decc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
80 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
81 $(edje_decc_LDFLAGS) $(LDFLAGS) -o $@
82am_edje_external_inspector_OBJECTS = \
83 edje_external_inspector-edje_external_inspector.$(OBJEXT)
84edje_external_inspector_OBJECTS = \
85 $(am_edje_external_inspector_OBJECTS)
86edje_external_inspector_DEPENDENCIES = \
87 $(top_builddir)/src/lib/libedje.la
88edje_external_inspector_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
89 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
90 $(AM_CFLAGS) $(CFLAGS) $(edje_external_inspector_LDFLAGS) \
91 $(LDFLAGS) -o $@
92am_edje_inspector_OBJECTS = edje_inspector-edje_inspector.$(OBJEXT)
93edje_inspector_OBJECTS = $(am_edje_inspector_OBJECTS)
94edje_inspector_DEPENDENCIES = $(top_builddir)/src/lib/libedje.la
95edje_inspector_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
96 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
97 $(AM_CFLAGS) $(CFLAGS) $(edje_inspector_LDFLAGS) $(LDFLAGS) -o \
98 $@
99am_edje_player_OBJECTS = edje_player-edje_player.$(OBJEXT)
100edje_player_OBJECTS = $(am_edje_player_OBJECTS)
101edje_player_DEPENDENCIES = $(top_builddir)/src/lib/libedje.la
102edje_player_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
103 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
104 $(edje_player_LDFLAGS) $(LDFLAGS) -o $@
105am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
106am__vpath_adj = case $$p in \
107 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
108 *) f=$$p;; \
109 esac;
110am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
111am__install_max = 40
112am__nobase_strip_setup = \
113 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
114am__nobase_strip = \
115 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
116am__nobase_list = $(am__nobase_strip_setup); \
117 for p in $$list; do echo "$$p $$p"; done | \
118 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
119 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
120 if (++n[$$2] == $(am__install_max)) \
121 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
122 END { for (dir in files) print dir, files[dir] }'
123am__base_list = \
124 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
125 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
126SCRIPTS = $(bin_SCRIPTS)
127DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
128depcomp = $(SHELL) $(top_srcdir)/depcomp
129am__depfiles_maybe = depfiles
130am__mv = mv -f
131COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
132 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
133LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
134 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
135 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
136 $(AM_CFLAGS) $(CFLAGS)
137AM_V_CC = $(am__v_CC_$(V))
138am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
139am__v_CC_0 = @echo " CC " $@;
140AM_V_at = $(am__v_at_$(V))
141am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
142am__v_at_0 = @
143CCLD = $(CC)
144LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
145 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
146 $(AM_LDFLAGS) $(LDFLAGS) -o $@
147AM_V_CCLD = $(am__v_CCLD_$(V))
148am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
149am__v_CCLD_0 = @echo " CCLD " $@;
150AM_V_GEN = $(am__v_GEN_$(V))
151am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
152am__v_GEN_0 = @echo " GEN " $@;
153SOURCES = $(edje_cc_SOURCES) $(edje_decc_SOURCES) \
154 $(edje_external_inspector_SOURCES) $(edje_inspector_SOURCES) \
155 $(edje_player_SOURCES)
156DIST_SOURCES = $(edje_cc_SOURCES) $(edje_decc_SOURCES) \
157 $(edje_external_inspector_SOURCES) $(edje_inspector_SOURCES) \
158 $(edje_player_SOURCES)
159RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
160 html-recursive info-recursive install-data-recursive \
161 install-dvi-recursive install-exec-recursive \
162 install-html-recursive install-info-recursive \
163 install-pdf-recursive install-ps-recursive install-recursive \
164 installcheck-recursive installdirs-recursive pdf-recursive \
165 ps-recursive uninstall-recursive
166RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
167 distclean-recursive maintainer-clean-recursive
168AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
169 $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
170 distdir
171ETAGS = etags
172CTAGS = ctags
173DIST_SUBDIRS = epp
174DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
175am__relativize = \
176 dir0=`pwd`; \
177 sed_first='s,^\([^/]*\)/.*$$,\1,'; \
178 sed_rest='s,^[^/]*/*,,'; \
179 sed_last='s,^.*/\([^/]*\)$$,\1,'; \
180 sed_butlast='s,/*[^/]*$$,,'; \
181 while test -n "$$dir1"; do \
182 first=`echo "$$dir1" | sed -e "$$sed_first"`; \
183 if test "$$first" != "."; then \
184 if test "$$first" = ".."; then \
185 dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
186 dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
187 else \
188 first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
189 if test "$$first2" = "$$first"; then \
190 dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
191 else \
192 dir2="../$$dir2"; \
193 fi; \
194 dir0="$$dir0"/"$$first"; \
195 fi; \
196 fi; \
197 dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
198 done; \
199 reldir="$$dir2"
200ACLOCAL = @ACLOCAL@
201ALLOCA = @ALLOCA@
202ALSA_CFLAGS = @ALSA_CFLAGS@
203ALSA_LIBS = @ALSA_LIBS@
204AMTAR = @AMTAR@
205AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
206AR = @AR@
207AS = @AS@
208AUTOCONF = @AUTOCONF@
209AUTOHEADER = @AUTOHEADER@
210AUTOMAKE = @AUTOMAKE@
211AWK = @AWK@
212CC = @CC@
213CCDEPMODE = @CCDEPMODE@
214CFLAGS = @CFLAGS@
215CHECK_CFLAGS = @CHECK_CFLAGS@
216CHECK_LIBS = @CHECK_LIBS@
217CPP = @CPP@
218CPPFLAGS = @CPPFLAGS@
219CYGPATH_W = @CYGPATH_W@
220DEFS = @DEFS@
221DEPDIR = @DEPDIR@
222DLLTOOL = @DLLTOOL@
223DSYMUTIL = @DSYMUTIL@
224DUMPBIN = @DUMPBIN@
225ECHO_C = @ECHO_C@
226ECHO_N = @ECHO_N@
227ECHO_T = @ECHO_T@
228ECORE_IMF_CFLAGS = @ECORE_IMF_CFLAGS@
229ECORE_IMF_LIBS = @ECORE_IMF_LIBS@
230EDJE_CC_CFLAGS = @EDJE_CC_CFLAGS@
231EDJE_CC_LIBS = @EDJE_CC_LIBS@
232EDJE_CC_PRG = @EDJE_CC_PRG@
233EDJE_CFLAGS = @EDJE_CFLAGS@
234EDJE_DECC_CFLAGS = @EDJE_DECC_CFLAGS@
235EDJE_DECC_LIBS = @EDJE_DECC_LIBS@
236EDJE_DECC_PRG = @EDJE_DECC_PRG@
237EDJE_EXTERNAL_INSPECTOR_CFLAGS = @EDJE_EXTERNAL_INSPECTOR_CFLAGS@
238EDJE_EXTERNAL_INSPECTOR_LIBS = @EDJE_EXTERNAL_INSPECTOR_LIBS@
239EDJE_EXTERNAL_INSPECTOR_PRG = @EDJE_EXTERNAL_INSPECTOR_PRG@
240EDJE_INSPECTOR_CFLAGS = @EDJE_INSPECTOR_CFLAGS@
241EDJE_INSPECTOR_LIBS = @EDJE_INSPECTOR_LIBS@
242EDJE_INSPECTOR_PRG = @EDJE_INSPECTOR_PRG@
243EDJE_LIBS = @EDJE_LIBS@
244EDJE_PLAYER_CFLAGS = @EDJE_PLAYER_CFLAGS@
245EDJE_PLAYER_LIBS = @EDJE_PLAYER_LIBS@
246EDJE_PLAYER_PRG = @EDJE_PLAYER_PRG@
247EDJE_RECC_PRG = @EDJE_RECC_PRG@
248EFL_COVERAGE_CFLAGS = @EFL_COVERAGE_CFLAGS@
249EFL_COVERAGE_LIBS = @EFL_COVERAGE_LIBS@
250EFL_EDJE_BUILD = @EFL_EDJE_BUILD@
251EGREP = @EGREP@
252EVIL_CFLAGS = @EVIL_CFLAGS@
253EVIL_LIBS = @EVIL_LIBS@
254EXEEXT = @EXEEXT@
255FGREP = @FGREP@
256FLAC_CFLAGS = @FLAC_CFLAGS@
257FLAC_LIBS = @FLAC_LIBS@
258GREP = @GREP@
259INSTALL = @INSTALL@
260INSTALL_DATA = @INSTALL_DATA@
261INSTALL_PROGRAM = @INSTALL_PROGRAM@
262INSTALL_SCRIPT = @INSTALL_SCRIPT@
263INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
264LD = @LD@
265LDFLAGS = @LDFLAGS@
266LIBOBJS = @LIBOBJS@
267LIBS = @LIBS@
268LIBTOOL = @LIBTOOL@
269LIPO = @LIPO@
270LN_S = @LN_S@
271LTLIBOBJS = @LTLIBOBJS@
272LUA_CFLAGS = @LUA_CFLAGS@
273LUA_LIBS = @LUA_LIBS@
274MAKEINFO = @MAKEINFO@
275MINIMAL_CFLAGS = @MINIMAL_CFLAGS@
276MINIMAL_LIBS = @MINIMAL_LIBS@
277MKDIR_P = @MKDIR_P@
278MODULE_ARCH = @MODULE_ARCH@
279NM = @NM@
280NMEDIT = @NMEDIT@
281OBJDUMP = @OBJDUMP@
282OBJEXT = @OBJEXT@
283OTOOL = @OTOOL@
284OTOOL64 = @OTOOL64@
285PACKAGE = @PACKAGE@
286PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
287PACKAGE_NAME = @PACKAGE_NAME@
288PACKAGE_STRING = @PACKAGE_STRING@
289PACKAGE_TARNAME = @PACKAGE_TARNAME@
290PACKAGE_URL = @PACKAGE_URL@
291PACKAGE_VERSION = @PACKAGE_VERSION@
292PATH_SEPARATOR = @PATH_SEPARATOR@
293PKG_CONFIG = @PKG_CONFIG@
294PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
295PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
296PYTHON = @PYTHON@
297PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
298PYTHON_PLATFORM = @PYTHON_PLATFORM@
299PYTHON_PREFIX = @PYTHON_PREFIX@
300PYTHON_VERSION = @PYTHON_VERSION@
301RANLIB = @RANLIB@
302REMIX_CFLAGS = @REMIX_CFLAGS@
303REMIX_LIBS = @REMIX_LIBS@
304REMIX_PLUGIN_DIR = @REMIX_PLUGIN_DIR@
305SED = @SED@
306SET_MAKE = @SET_MAKE@
307SHELL = @SHELL@
308SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
309SNDFILE_LIBS = @SNDFILE_LIBS@
310STRIP = @STRIP@
311VERSION = @VERSION@
312VMAJ = @VMAJ@
313VORBISENC_CFLAGS = @VORBISENC_CFLAGS@
314VORBISENC_LIBS = @VORBISENC_LIBS@
315abs_builddir = @abs_builddir@
316abs_srcdir = @abs_srcdir@
317abs_top_builddir = @abs_top_builddir@
318abs_top_srcdir = @abs_top_srcdir@
319ac_ct_CC = @ac_ct_CC@
320ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
321am__include = @am__include@
322am__leading_dot = @am__leading_dot@
323am__quote = @am__quote@
324am__tar = @am__tar@
325am__untar = @am__untar@
326bindir = @bindir@
327build = @build@
328build_alias = @build_alias@
329build_cpu = @build_cpu@
330build_os = @build_os@
331build_vendor = @build_vendor@
332builddir = @builddir@
333datadir = @datadir@
334datarootdir = @datarootdir@
335docdir = @docdir@
336dvidir = @dvidir@
337edje_cc = @edje_cc@
338efl_doxygen = @efl_doxygen@
339efl_have_doxygen = @efl_have_doxygen@
340exec_prefix = @exec_prefix@
341have_lcov = @have_lcov@
342host = @host@
343host_alias = @host_alias@
344host_cpu = @host_cpu@
345host_os = @host_os@
346host_vendor = @host_vendor@
347htmldir = @htmldir@
348includedir = @includedir@
349infodir = @infodir@
350install_sh = @install_sh@
351libdir = @libdir@
352libexecdir = @libexecdir@
353localedir = @localedir@
354localstatedir = @localstatedir@
355lt_ECHO = @lt_ECHO@
356lt_enable_auto_import = @lt_enable_auto_import@
357lua_libs = @lua_libs@
358mandir = @mandir@
359mkdir_p = @mkdir_p@
360oldincludedir = @oldincludedir@
361pdfdir = @pdfdir@
362pkgconfig_requires_private = @pkgconfig_requires_private@
363pkgpyexecdir = @pkgpyexecdir@
364pkgpythondir = @pkgpythondir@
365prefix = @prefix@
366program_transform_name = @program_transform_name@
367psdir = @psdir@
368pyexecdir = @pyexecdir@
369pythondir = @pythondir@
370release_info = @release_info@
371requirement_edje = @requirement_edje@
372sbindir = @sbindir@
373sharedstatedir = @sharedstatedir@
374srcdir = @srcdir@
375sysconfdir = @sysconfdir@
376target_alias = @target_alias@
377top_build_prefix = @top_build_prefix@
378top_builddir = @top_builddir@
379top_srcdir = @top_srcdir@
380version_info = @version_info@
381vimdir = @vimdir@
382MAINTAINERCLEANFILES = Makefile.in
383@BUILD_EPP_TRUE@SUBDIRS = epp
384bin_SCRIPTS = @EDJE_RECC_PRG@
385bin_PROGRAMS = @EDJE_CC_PRG@ @EDJE_DECC_PRG@ @EDJE_PLAYER_PRG@ @EDJE_INSPECTOR_PRG@ @EDJE_EXTERNAL_INSPECTOR_PRG@
386edje_cc_SOURCES = \
387edje_cc.c \
388edje_cc_out.c \
389edje_cc_parse.c \
390edje_cc_mem.c \
391edje_cc_handlers.c \
392edje_cc_sources.c \
393edje_multisense_convert.c
394
395edje_cc_CPPFLAGS = \
396-I$(top_srcdir)/src/bin \
397-I$(top_srcdir)/src/lib \
398-DPACKAGE_BIN_DIR=\"$(bindir)\" \
399-DPACKAGE_LIB_DIR=\"$(libdir)\" \
400-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
401-DEPP_DIR=\"$(libdir)/$(PACKAGE)/utils\" \
402@EDJE_CFLAGS@ @EDJE_CC_CFLAGS@ @EVIL_CFLAGS@ @SNDFILE_CFLAGS@
403
404edje_cc_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_CC_LIBS@ @EVIL_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@ -lm
405edje_cc_LDFLAGS = @lt_enable_auto_import@
406edje_decc_SOURCES = \
407edje_decc.c \
408edje_decc.h \
409edje_cc_mem.c \
410edje_cc_sources.c
411
412edje_decc_CPPFLAGS = \
413-I$(top_srcdir)/src/bin \
414-I$(top_srcdir)/src/lib \
415@EDJE_CFLAGS@ @EDJE_DECC_CFLAGS@ @EVIL_CFLAGS@
416
417edje_decc_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_DECC_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@
418edje_decc_LDFLAGS = @lt_enable_auto_import@
419edje_player_SOURCES = edje_player.c
420edje_player_CPPFLAGS = \
421-I$(top_srcdir)/src/bin \
422-I$(top_srcdir)/src/lib \
423@EDJE_PLAYER_CFLAGS@ @EVIL_CFLAGS@
424
425edje_player_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_PLAYER_LIBS@ @EVIL_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@
426edje_player_LDFLAGS = @lt_enable_auto_import@
427edje_inspector_SOURCES = edje_inspector.c
428edje_inspector_CPPFLAGS = \
429-I$(top_srcdir)/src/bin \
430-I$(top_srcdir)/src/lib \
431@EDJE_INSPECTOR_CFLAGS@
432
433edje_inspector_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_INSPECTOR_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@
434edje_inspector_LDFLAGS = @lt_enable_auto_import@
435edje_external_inspector_SOURCES = edje_external_inspector.c
436edje_external_inspector_CPPFLAGS = \
437-I$(top_srcdir)/src/bin \
438-I$(top_srcdir)/src/lib \
439@EDJE_EXTERNAL_INSPECTOR_CFLAGS@
440
441edje_external_inspector_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_EXTERNAL_INSPECTOR_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@
442edje_external_inspector_LDFLAGS = @lt_enable_auto_import@
443EXTRA_DIST = @EDJE_RECC_PRG@ edje_cc.h edje_convert.h edje_convert.c edje_multisense_convert.h edje_data_convert.c
444EXTRA_SCRIPTS = edje_recc
445all: all-recursive
446
447.SUFFIXES:
448.SUFFIXES: .c .lo .o .obj
449$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
450 @for dep in $?; do \
451 case '$(am__configure_deps)' in \
452 *$$dep*) \
453 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
454 && { if test -f $@; then exit 0; else break; fi; }; \
455 exit 1;; \
456 esac; \
457 done; \
458 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/bin/Makefile'; \
459 $(am__cd) $(top_srcdir) && \
460 $(AUTOMAKE) --gnu src/bin/Makefile
461.PRECIOUS: Makefile
462Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
463 @case '$?' in \
464 *config.status*) \
465 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
466 *) \
467 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
468 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
469 esac;
470
471$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
472 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
473
474$(top_srcdir)/configure: $(am__configure_deps)
475 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
476$(ACLOCAL_M4): $(am__aclocal_m4_deps)
477 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
478$(am__aclocal_m4_deps):
479install-binPROGRAMS: $(bin_PROGRAMS)
480 @$(NORMAL_INSTALL)
481 test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
482 @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
483 for p in $$list; do echo "$$p $$p"; done | \
484 sed 's/$(EXEEXT)$$//' | \
485 while read p p1; do if test -f $$p || test -f $$p1; \
486 then echo "$$p"; echo "$$p"; else :; fi; \
487 done | \
488 sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
489 -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
490 sed 'N;N;N;s,\n, ,g' | \
491 $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
492 { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
493 if ($$2 == $$4) files[d] = files[d] " " $$1; \
494 else { print "f", $$3 "/" $$4, $$1; } } \
495 END { for (d in files) print "f", d, files[d] }' | \
496 while read type dir files; do \
497 if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
498 test -z "$$files" || { \
499 echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
500 $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
501 } \
502 ; done
503
504uninstall-binPROGRAMS:
505 @$(NORMAL_UNINSTALL)
506 @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
507 files=`for p in $$list; do echo "$$p"; done | \
508 sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
509 -e 's/$$/$(EXEEXT)/' `; \
510 test -n "$$list" || exit 0; \
511 echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
512 cd "$(DESTDIR)$(bindir)" && rm -f $$files
513
514clean-binPROGRAMS:
515 @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
516 echo " rm -f" $$list; \
517 rm -f $$list || exit $$?; \
518 test -n "$(EXEEXT)" || exit 0; \
519 list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
520 echo " rm -f" $$list; \
521 rm -f $$list
522edje_cc$(EXEEXT): $(edje_cc_OBJECTS) $(edje_cc_DEPENDENCIES)
523 @rm -f edje_cc$(EXEEXT)
524 $(AM_V_CCLD)$(edje_cc_LINK) $(edje_cc_OBJECTS) $(edje_cc_LDADD) $(LIBS)
525edje_decc$(EXEEXT): $(edje_decc_OBJECTS) $(edje_decc_DEPENDENCIES)
526 @rm -f edje_decc$(EXEEXT)
527 $(AM_V_CCLD)$(edje_decc_LINK) $(edje_decc_OBJECTS) $(edje_decc_LDADD) $(LIBS)
528edje_external_inspector$(EXEEXT): $(edje_external_inspector_OBJECTS) $(edje_external_inspector_DEPENDENCIES)
529 @rm -f edje_external_inspector$(EXEEXT)
530 $(AM_V_CCLD)$(edje_external_inspector_LINK) $(edje_external_inspector_OBJECTS) $(edje_external_inspector_LDADD) $(LIBS)
531edje_inspector$(EXEEXT): $(edje_inspector_OBJECTS) $(edje_inspector_DEPENDENCIES)
532 @rm -f edje_inspector$(EXEEXT)
533 $(AM_V_CCLD)$(edje_inspector_LINK) $(edje_inspector_OBJECTS) $(edje_inspector_LDADD) $(LIBS)
534edje_player$(EXEEXT): $(edje_player_OBJECTS) $(edje_player_DEPENDENCIES)
535 @rm -f edje_player$(EXEEXT)
536 $(AM_V_CCLD)$(edje_player_LINK) $(edje_player_OBJECTS) $(edje_player_LDADD) $(LIBS)
537install-binSCRIPTS: $(bin_SCRIPTS)
538 @$(NORMAL_INSTALL)
539 test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
540 @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
541 for p in $$list; do \
542 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
543 if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
544 done | \
545 sed -e 'p;s,.*/,,;n' \
546 -e 'h;s|.*|.|' \
547 -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
548 $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
549 { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
550 if ($$2 == $$4) { files[d] = files[d] " " $$1; \
551 if (++n[d] == $(am__install_max)) { \
552 print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
553 else { print "f", d "/" $$4, $$1 } } \
554 END { for (d in files) print "f", d, files[d] }' | \
555 while read type dir files; do \
556 if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
557 test -z "$$files" || { \
558 echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
559 $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
560 } \
561 ; done
562
563uninstall-binSCRIPTS:
564 @$(NORMAL_UNINSTALL)
565 @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
566 files=`for p in $$list; do echo "$$p"; done | \
567 sed -e 's,.*/,,;$(transform)'`; \
568 test -n "$$list" || exit 0; \
569 echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
570 cd "$(DESTDIR)$(bindir)" && rm -f $$files
571
572mostlyclean-compile:
573 -rm -f *.$(OBJEXT)
574
575distclean-compile:
576 -rm -f *.tab.c
577
578@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_cc-edje_cc.Po@am__quote@
579@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_cc-edje_cc_handlers.Po@am__quote@
580@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_cc-edje_cc_mem.Po@am__quote@
581@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_cc-edje_cc_out.Po@am__quote@
582@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_cc-edje_cc_parse.Po@am__quote@
583@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_cc-edje_cc_sources.Po@am__quote@
584@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_cc-edje_multisense_convert.Po@am__quote@
585@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_decc-edje_cc_mem.Po@am__quote@
586@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_decc-edje_cc_sources.Po@am__quote@
587@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_decc-edje_decc.Po@am__quote@
588@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_external_inspector-edje_external_inspector.Po@am__quote@
589@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_inspector-edje_inspector.Po@am__quote@
590@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edje_player-edje_player.Po@am__quote@
591
592.c.o:
593@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
594@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
595@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
596@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
597@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
598@am__fastdepCC_FALSE@ $(COMPILE) -c $<
599
600.c.obj:
601@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
602@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
603@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
604@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
605@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
606@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
607
608.c.lo:
609@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
610@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
611@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
612@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
613@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
614@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
615
616edje_cc-edje_cc.o: edje_cc.c
617@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc.o -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc.Tpo -c -o edje_cc-edje_cc.o `test -f 'edje_cc.c' || echo '$(srcdir)/'`edje_cc.c
618@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc.Tpo $(DEPDIR)/edje_cc-edje_cc.Po
619@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
620@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc.c' object='edje_cc-edje_cc.o' libtool=no @AMDEPBACKSLASH@
621@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
622@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc.o `test -f 'edje_cc.c' || echo '$(srcdir)/'`edje_cc.c
623
624edje_cc-edje_cc.obj: edje_cc.c
625@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc.obj -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc.Tpo -c -o edje_cc-edje_cc.obj `if test -f 'edje_cc.c'; then $(CYGPATH_W) 'edje_cc.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc.c'; fi`
626@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc.Tpo $(DEPDIR)/edje_cc-edje_cc.Po
627@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
628@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc.c' object='edje_cc-edje_cc.obj' libtool=no @AMDEPBACKSLASH@
629@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
630@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc.obj `if test -f 'edje_cc.c'; then $(CYGPATH_W) 'edje_cc.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc.c'; fi`
631
632edje_cc-edje_cc_out.o: edje_cc_out.c
633@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_out.o -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_out.Tpo -c -o edje_cc-edje_cc_out.o `test -f 'edje_cc_out.c' || echo '$(srcdir)/'`edje_cc_out.c
634@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_out.Tpo $(DEPDIR)/edje_cc-edje_cc_out.Po
635@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
636@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_out.c' object='edje_cc-edje_cc_out.o' libtool=no @AMDEPBACKSLASH@
637@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
638@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_out.o `test -f 'edje_cc_out.c' || echo '$(srcdir)/'`edje_cc_out.c
639
640edje_cc-edje_cc_out.obj: edje_cc_out.c
641@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_out.obj -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_out.Tpo -c -o edje_cc-edje_cc_out.obj `if test -f 'edje_cc_out.c'; then $(CYGPATH_W) 'edje_cc_out.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_out.c'; fi`
642@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_out.Tpo $(DEPDIR)/edje_cc-edje_cc_out.Po
643@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
644@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_out.c' object='edje_cc-edje_cc_out.obj' libtool=no @AMDEPBACKSLASH@
645@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
646@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_out.obj `if test -f 'edje_cc_out.c'; then $(CYGPATH_W) 'edje_cc_out.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_out.c'; fi`
647
648edje_cc-edje_cc_parse.o: edje_cc_parse.c
649@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_parse.o -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_parse.Tpo -c -o edje_cc-edje_cc_parse.o `test -f 'edje_cc_parse.c' || echo '$(srcdir)/'`edje_cc_parse.c
650@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_parse.Tpo $(DEPDIR)/edje_cc-edje_cc_parse.Po
651@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
652@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_parse.c' object='edje_cc-edje_cc_parse.o' libtool=no @AMDEPBACKSLASH@
653@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
654@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_parse.o `test -f 'edje_cc_parse.c' || echo '$(srcdir)/'`edje_cc_parse.c
655
656edje_cc-edje_cc_parse.obj: edje_cc_parse.c
657@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_parse.obj -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_parse.Tpo -c -o edje_cc-edje_cc_parse.obj `if test -f 'edje_cc_parse.c'; then $(CYGPATH_W) 'edje_cc_parse.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_parse.c'; fi`
658@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_parse.Tpo $(DEPDIR)/edje_cc-edje_cc_parse.Po
659@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
660@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_parse.c' object='edje_cc-edje_cc_parse.obj' libtool=no @AMDEPBACKSLASH@
661@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
662@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_parse.obj `if test -f 'edje_cc_parse.c'; then $(CYGPATH_W) 'edje_cc_parse.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_parse.c'; fi`
663
664edje_cc-edje_cc_mem.o: edje_cc_mem.c
665@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_mem.o -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_mem.Tpo -c -o edje_cc-edje_cc_mem.o `test -f 'edje_cc_mem.c' || echo '$(srcdir)/'`edje_cc_mem.c
666@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_mem.Tpo $(DEPDIR)/edje_cc-edje_cc_mem.Po
667@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
668@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_mem.c' object='edje_cc-edje_cc_mem.o' libtool=no @AMDEPBACKSLASH@
669@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
670@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_mem.o `test -f 'edje_cc_mem.c' || echo '$(srcdir)/'`edje_cc_mem.c
671
672edje_cc-edje_cc_mem.obj: edje_cc_mem.c
673@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_mem.obj -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_mem.Tpo -c -o edje_cc-edje_cc_mem.obj `if test -f 'edje_cc_mem.c'; then $(CYGPATH_W) 'edje_cc_mem.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_mem.c'; fi`
674@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_mem.Tpo $(DEPDIR)/edje_cc-edje_cc_mem.Po
675@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
676@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_mem.c' object='edje_cc-edje_cc_mem.obj' libtool=no @AMDEPBACKSLASH@
677@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
678@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_mem.obj `if test -f 'edje_cc_mem.c'; then $(CYGPATH_W) 'edje_cc_mem.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_mem.c'; fi`
679
680edje_cc-edje_cc_handlers.o: edje_cc_handlers.c
681@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_handlers.o -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_handlers.Tpo -c -o edje_cc-edje_cc_handlers.o `test -f 'edje_cc_handlers.c' || echo '$(srcdir)/'`edje_cc_handlers.c
682@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_handlers.Tpo $(DEPDIR)/edje_cc-edje_cc_handlers.Po
683@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
684@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_handlers.c' object='edje_cc-edje_cc_handlers.o' libtool=no @AMDEPBACKSLASH@
685@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
686@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_handlers.o `test -f 'edje_cc_handlers.c' || echo '$(srcdir)/'`edje_cc_handlers.c
687
688edje_cc-edje_cc_handlers.obj: edje_cc_handlers.c
689@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_handlers.obj -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_handlers.Tpo -c -o edje_cc-edje_cc_handlers.obj `if test -f 'edje_cc_handlers.c'; then $(CYGPATH_W) 'edje_cc_handlers.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_handlers.c'; fi`
690@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_handlers.Tpo $(DEPDIR)/edje_cc-edje_cc_handlers.Po
691@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
692@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_handlers.c' object='edje_cc-edje_cc_handlers.obj' libtool=no @AMDEPBACKSLASH@
693@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
694@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_handlers.obj `if test -f 'edje_cc_handlers.c'; then $(CYGPATH_W) 'edje_cc_handlers.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_handlers.c'; fi`
695
696edje_cc-edje_cc_sources.o: edje_cc_sources.c
697@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_sources.o -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_sources.Tpo -c -o edje_cc-edje_cc_sources.o `test -f 'edje_cc_sources.c' || echo '$(srcdir)/'`edje_cc_sources.c
698@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_sources.Tpo $(DEPDIR)/edje_cc-edje_cc_sources.Po
699@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
700@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_sources.c' object='edje_cc-edje_cc_sources.o' libtool=no @AMDEPBACKSLASH@
701@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
702@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_sources.o `test -f 'edje_cc_sources.c' || echo '$(srcdir)/'`edje_cc_sources.c
703
704edje_cc-edje_cc_sources.obj: edje_cc_sources.c
705@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_cc_sources.obj -MD -MP -MF $(DEPDIR)/edje_cc-edje_cc_sources.Tpo -c -o edje_cc-edje_cc_sources.obj `if test -f 'edje_cc_sources.c'; then $(CYGPATH_W) 'edje_cc_sources.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_sources.c'; fi`
706@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_cc_sources.Tpo $(DEPDIR)/edje_cc-edje_cc_sources.Po
707@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
708@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_sources.c' object='edje_cc-edje_cc_sources.obj' libtool=no @AMDEPBACKSLASH@
709@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
710@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_cc_sources.obj `if test -f 'edje_cc_sources.c'; then $(CYGPATH_W) 'edje_cc_sources.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_sources.c'; fi`
711
712edje_cc-edje_multisense_convert.o: edje_multisense_convert.c
713@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_multisense_convert.o -MD -MP -MF $(DEPDIR)/edje_cc-edje_multisense_convert.Tpo -c -o edje_cc-edje_multisense_convert.o `test -f 'edje_multisense_convert.c' || echo '$(srcdir)/'`edje_multisense_convert.c
714@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_multisense_convert.Tpo $(DEPDIR)/edje_cc-edje_multisense_convert.Po
715@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
716@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_multisense_convert.c' object='edje_cc-edje_multisense_convert.o' libtool=no @AMDEPBACKSLASH@
717@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
718@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_multisense_convert.o `test -f 'edje_multisense_convert.c' || echo '$(srcdir)/'`edje_multisense_convert.c
719
720edje_cc-edje_multisense_convert.obj: edje_multisense_convert.c
721@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_cc-edje_multisense_convert.obj -MD -MP -MF $(DEPDIR)/edje_cc-edje_multisense_convert.Tpo -c -o edje_cc-edje_multisense_convert.obj `if test -f 'edje_multisense_convert.c'; then $(CYGPATH_W) 'edje_multisense_convert.c'; else $(CYGPATH_W) '$(srcdir)/edje_multisense_convert.c'; fi`
722@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_cc-edje_multisense_convert.Tpo $(DEPDIR)/edje_cc-edje_multisense_convert.Po
723@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
724@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_multisense_convert.c' object='edje_cc-edje_multisense_convert.obj' libtool=no @AMDEPBACKSLASH@
725@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
726@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_cc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_cc-edje_multisense_convert.obj `if test -f 'edje_multisense_convert.c'; then $(CYGPATH_W) 'edje_multisense_convert.c'; else $(CYGPATH_W) '$(srcdir)/edje_multisense_convert.c'; fi`
727
728edje_decc-edje_decc.o: edje_decc.c
729@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_decc-edje_decc.o -MD -MP -MF $(DEPDIR)/edje_decc-edje_decc.Tpo -c -o edje_decc-edje_decc.o `test -f 'edje_decc.c' || echo '$(srcdir)/'`edje_decc.c
730@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_decc-edje_decc.Tpo $(DEPDIR)/edje_decc-edje_decc.Po
731@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
732@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_decc.c' object='edje_decc-edje_decc.o' libtool=no @AMDEPBACKSLASH@
733@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
734@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_decc-edje_decc.o `test -f 'edje_decc.c' || echo '$(srcdir)/'`edje_decc.c
735
736edje_decc-edje_decc.obj: edje_decc.c
737@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_decc-edje_decc.obj -MD -MP -MF $(DEPDIR)/edje_decc-edje_decc.Tpo -c -o edje_decc-edje_decc.obj `if test -f 'edje_decc.c'; then $(CYGPATH_W) 'edje_decc.c'; else $(CYGPATH_W) '$(srcdir)/edje_decc.c'; fi`
738@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_decc-edje_decc.Tpo $(DEPDIR)/edje_decc-edje_decc.Po
739@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
740@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_decc.c' object='edje_decc-edje_decc.obj' libtool=no @AMDEPBACKSLASH@
741@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
742@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_decc-edje_decc.obj `if test -f 'edje_decc.c'; then $(CYGPATH_W) 'edje_decc.c'; else $(CYGPATH_W) '$(srcdir)/edje_decc.c'; fi`
743
744edje_decc-edje_cc_mem.o: edje_cc_mem.c
745@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_decc-edje_cc_mem.o -MD -MP -MF $(DEPDIR)/edje_decc-edje_cc_mem.Tpo -c -o edje_decc-edje_cc_mem.o `test -f 'edje_cc_mem.c' || echo '$(srcdir)/'`edje_cc_mem.c
746@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_decc-edje_cc_mem.Tpo $(DEPDIR)/edje_decc-edje_cc_mem.Po
747@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
748@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_mem.c' object='edje_decc-edje_cc_mem.o' libtool=no @AMDEPBACKSLASH@
749@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
750@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_decc-edje_cc_mem.o `test -f 'edje_cc_mem.c' || echo '$(srcdir)/'`edje_cc_mem.c
751
752edje_decc-edje_cc_mem.obj: edje_cc_mem.c
753@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_decc-edje_cc_mem.obj -MD -MP -MF $(DEPDIR)/edje_decc-edje_cc_mem.Tpo -c -o edje_decc-edje_cc_mem.obj `if test -f 'edje_cc_mem.c'; then $(CYGPATH_W) 'edje_cc_mem.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_mem.c'; fi`
754@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_decc-edje_cc_mem.Tpo $(DEPDIR)/edje_decc-edje_cc_mem.Po
755@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
756@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_mem.c' object='edje_decc-edje_cc_mem.obj' libtool=no @AMDEPBACKSLASH@
757@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
758@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_decc-edje_cc_mem.obj `if test -f 'edje_cc_mem.c'; then $(CYGPATH_W) 'edje_cc_mem.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_mem.c'; fi`
759
760edje_decc-edje_cc_sources.o: edje_cc_sources.c
761@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_decc-edje_cc_sources.o -MD -MP -MF $(DEPDIR)/edje_decc-edje_cc_sources.Tpo -c -o edje_decc-edje_cc_sources.o `test -f 'edje_cc_sources.c' || echo '$(srcdir)/'`edje_cc_sources.c
762@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_decc-edje_cc_sources.Tpo $(DEPDIR)/edje_decc-edje_cc_sources.Po
763@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
764@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_sources.c' object='edje_decc-edje_cc_sources.o' libtool=no @AMDEPBACKSLASH@
765@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
766@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_decc-edje_cc_sources.o `test -f 'edje_cc_sources.c' || echo '$(srcdir)/'`edje_cc_sources.c
767
768edje_decc-edje_cc_sources.obj: edje_cc_sources.c
769@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_decc-edje_cc_sources.obj -MD -MP -MF $(DEPDIR)/edje_decc-edje_cc_sources.Tpo -c -o edje_decc-edje_cc_sources.obj `if test -f 'edje_cc_sources.c'; then $(CYGPATH_W) 'edje_cc_sources.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_sources.c'; fi`
770@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_decc-edje_cc_sources.Tpo $(DEPDIR)/edje_decc-edje_cc_sources.Po
771@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
772@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_cc_sources.c' object='edje_decc-edje_cc_sources.obj' libtool=no @AMDEPBACKSLASH@
773@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
774@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_decc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_decc-edje_cc_sources.obj `if test -f 'edje_cc_sources.c'; then $(CYGPATH_W) 'edje_cc_sources.c'; else $(CYGPATH_W) '$(srcdir)/edje_cc_sources.c'; fi`
775
776edje_external_inspector-edje_external_inspector.o: edje_external_inspector.c
777@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_external_inspector_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_external_inspector-edje_external_inspector.o -MD -MP -MF $(DEPDIR)/edje_external_inspector-edje_external_inspector.Tpo -c -o edje_external_inspector-edje_external_inspector.o `test -f 'edje_external_inspector.c' || echo '$(srcdir)/'`edje_external_inspector.c
778@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_external_inspector-edje_external_inspector.Tpo $(DEPDIR)/edje_external_inspector-edje_external_inspector.Po
779@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
780@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_external_inspector.c' object='edje_external_inspector-edje_external_inspector.o' libtool=no @AMDEPBACKSLASH@
781@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
782@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_external_inspector_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_external_inspector-edje_external_inspector.o `test -f 'edje_external_inspector.c' || echo '$(srcdir)/'`edje_external_inspector.c
783
784edje_external_inspector-edje_external_inspector.obj: edje_external_inspector.c
785@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_external_inspector_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_external_inspector-edje_external_inspector.obj -MD -MP -MF $(DEPDIR)/edje_external_inspector-edje_external_inspector.Tpo -c -o edje_external_inspector-edje_external_inspector.obj `if test -f 'edje_external_inspector.c'; then $(CYGPATH_W) 'edje_external_inspector.c'; else $(CYGPATH_W) '$(srcdir)/edje_external_inspector.c'; fi`
786@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_external_inspector-edje_external_inspector.Tpo $(DEPDIR)/edje_external_inspector-edje_external_inspector.Po
787@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
788@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_external_inspector.c' object='edje_external_inspector-edje_external_inspector.obj' libtool=no @AMDEPBACKSLASH@
789@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
790@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_external_inspector_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_external_inspector-edje_external_inspector.obj `if test -f 'edje_external_inspector.c'; then $(CYGPATH_W) 'edje_external_inspector.c'; else $(CYGPATH_W) '$(srcdir)/edje_external_inspector.c'; fi`
791
792edje_inspector-edje_inspector.o: edje_inspector.c
793@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_inspector_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_inspector-edje_inspector.o -MD -MP -MF $(DEPDIR)/edje_inspector-edje_inspector.Tpo -c -o edje_inspector-edje_inspector.o `test -f 'edje_inspector.c' || echo '$(srcdir)/'`edje_inspector.c
794@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_inspector-edje_inspector.Tpo $(DEPDIR)/edje_inspector-edje_inspector.Po
795@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
796@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_inspector.c' object='edje_inspector-edje_inspector.o' libtool=no @AMDEPBACKSLASH@
797@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
798@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_inspector_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_inspector-edje_inspector.o `test -f 'edje_inspector.c' || echo '$(srcdir)/'`edje_inspector.c
799
800edje_inspector-edje_inspector.obj: edje_inspector.c
801@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_inspector_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_inspector-edje_inspector.obj -MD -MP -MF $(DEPDIR)/edje_inspector-edje_inspector.Tpo -c -o edje_inspector-edje_inspector.obj `if test -f 'edje_inspector.c'; then $(CYGPATH_W) 'edje_inspector.c'; else $(CYGPATH_W) '$(srcdir)/edje_inspector.c'; fi`
802@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_inspector-edje_inspector.Tpo $(DEPDIR)/edje_inspector-edje_inspector.Po
803@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
804@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_inspector.c' object='edje_inspector-edje_inspector.obj' libtool=no @AMDEPBACKSLASH@
805@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
806@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_inspector_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_inspector-edje_inspector.obj `if test -f 'edje_inspector.c'; then $(CYGPATH_W) 'edje_inspector.c'; else $(CYGPATH_W) '$(srcdir)/edje_inspector.c'; fi`
807
808edje_player-edje_player.o: edje_player.c
809@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_player_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_player-edje_player.o -MD -MP -MF $(DEPDIR)/edje_player-edje_player.Tpo -c -o edje_player-edje_player.o `test -f 'edje_player.c' || echo '$(srcdir)/'`edje_player.c
810@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_player-edje_player.Tpo $(DEPDIR)/edje_player-edje_player.Po
811@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
812@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_player.c' object='edje_player-edje_player.o' libtool=no @AMDEPBACKSLASH@
813@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
814@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_player_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_player-edje_player.o `test -f 'edje_player.c' || echo '$(srcdir)/'`edje_player.c
815
816edje_player-edje_player.obj: edje_player.c
817@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_player_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT edje_player-edje_player.obj -MD -MP -MF $(DEPDIR)/edje_player-edje_player.Tpo -c -o edje_player-edje_player.obj `if test -f 'edje_player.c'; then $(CYGPATH_W) 'edje_player.c'; else $(CYGPATH_W) '$(srcdir)/edje_player.c'; fi`
818@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/edje_player-edje_player.Tpo $(DEPDIR)/edje_player-edje_player.Po
819@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
820@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edje_player.c' object='edje_player-edje_player.obj' libtool=no @AMDEPBACKSLASH@
821@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
822@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(edje_player_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o edje_player-edje_player.obj `if test -f 'edje_player.c'; then $(CYGPATH_W) 'edje_player.c'; else $(CYGPATH_W) '$(srcdir)/edje_player.c'; fi`
823
824mostlyclean-libtool:
825 -rm -f *.lo
826
827clean-libtool:
828 -rm -rf .libs _libs
829
830# This directory's subdirectories are mostly independent; you can cd
831# into them and run `make' without going through this Makefile.
832# To change the values of `make' variables: instead of editing Makefiles,
833# (1) if the variable is set in `config.status', edit `config.status'
834# (which will cause the Makefiles to be regenerated when you run `make');
835# (2) otherwise, pass the desired values on the `make' command line.
836$(RECURSIVE_TARGETS):
837 @fail= failcom='exit 1'; \
838 for f in x $$MAKEFLAGS; do \
839 case $$f in \
840 *=* | --[!k]*);; \
841 *k*) failcom='fail=yes';; \
842 esac; \
843 done; \
844 dot_seen=no; \
845 target=`echo $@ | sed s/-recursive//`; \
846 list='$(SUBDIRS)'; for subdir in $$list; do \
847 echo "Making $$target in $$subdir"; \
848 if test "$$subdir" = "."; then \
849 dot_seen=yes; \
850 local_target="$$target-am"; \
851 else \
852 local_target="$$target"; \
853 fi; \
854 ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
855 || eval $$failcom; \
856 done; \
857 if test "$$dot_seen" = "no"; then \
858 $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
859 fi; test -z "$$fail"
860
861$(RECURSIVE_CLEAN_TARGETS):
862 @fail= failcom='exit 1'; \
863 for f in x $$MAKEFLAGS; do \
864 case $$f in \
865 *=* | --[!k]*);; \
866 *k*) failcom='fail=yes';; \
867 esac; \
868 done; \
869 dot_seen=no; \
870 case "$@" in \
871 distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
872 *) list='$(SUBDIRS)' ;; \
873 esac; \
874 rev=''; for subdir in $$list; do \
875 if test "$$subdir" = "."; then :; else \
876 rev="$$subdir $$rev"; \
877 fi; \
878 done; \
879 rev="$$rev ."; \
880 target=`echo $@ | sed s/-recursive//`; \
881 for subdir in $$rev; do \
882 echo "Making $$target in $$subdir"; \
883 if test "$$subdir" = "."; then \
884 local_target="$$target-am"; \
885 else \
886 local_target="$$target"; \
887 fi; \
888 ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
889 || eval $$failcom; \
890 done && test -z "$$fail"
891tags-recursive:
892 list='$(SUBDIRS)'; for subdir in $$list; do \
893 test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
894 done
895ctags-recursive:
896 list='$(SUBDIRS)'; for subdir in $$list; do \
897 test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
898 done
899
900ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
901 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
902 unique=`for i in $$list; do \
903 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
904 done | \
905 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
906 END { if (nonempty) { for (i in files) print i; }; }'`; \
907 mkid -fID $$unique
908tags: TAGS
909
910TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
911 $(TAGS_FILES) $(LISP)
912 set x; \
913 here=`pwd`; \
914 if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
915 include_option=--etags-include; \
916 empty_fix=.; \
917 else \
918 include_option=--include; \
919 empty_fix=; \
920 fi; \
921 list='$(SUBDIRS)'; for subdir in $$list; do \
922 if test "$$subdir" = .; then :; else \
923 test ! -f $$subdir/TAGS || \
924 set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
925 fi; \
926 done; \
927 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
928 unique=`for i in $$list; do \
929 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
930 done | \
931 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
932 END { if (nonempty) { for (i in files) print i; }; }'`; \
933 shift; \
934 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
935 test -n "$$unique" || unique=$$empty_fix; \
936 if test $$# -gt 0; then \
937 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
938 "$$@" $$unique; \
939 else \
940 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
941 $$unique; \
942 fi; \
943 fi
944ctags: CTAGS
945CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
946 $(TAGS_FILES) $(LISP)
947 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
948 unique=`for i in $$list; do \
949 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
950 done | \
951 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
952 END { if (nonempty) { for (i in files) print i; }; }'`; \
953 test -z "$(CTAGS_ARGS)$$unique" \
954 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
955 $$unique
956
957GTAGS:
958 here=`$(am__cd) $(top_builddir) && pwd` \
959 && $(am__cd) $(top_srcdir) \
960 && gtags -i $(GTAGS_ARGS) "$$here"
961
962distclean-tags:
963 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
964
965distdir: $(DISTFILES)
966 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
967 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
968 list='$(DISTFILES)'; \
969 dist_files=`for file in $$list; do echo $$file; done | \
970 sed -e "s|^$$srcdirstrip/||;t" \
971 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
972 case $$dist_files in \
973 */*) $(MKDIR_P) `echo "$$dist_files" | \
974 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
975 sort -u` ;; \
976 esac; \
977 for file in $$dist_files; do \
978 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
979 if test -d $$d/$$file; then \
980 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
981 if test -d "$(distdir)/$$file"; then \
982 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
983 fi; \
984 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
985 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
986 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
987 fi; \
988 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
989 else \
990 test -f "$(distdir)/$$file" \
991 || cp -p $$d/$$file "$(distdir)/$$file" \
992 || exit 1; \
993 fi; \
994 done
995 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
996 if test "$$subdir" = .; then :; else \
997 test -d "$(distdir)/$$subdir" \
998 || $(MKDIR_P) "$(distdir)/$$subdir" \
999 || exit 1; \
1000 fi; \
1001 done
1002 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
1003 if test "$$subdir" = .; then :; else \
1004 dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
1005 $(am__relativize); \
1006 new_distdir=$$reldir; \
1007 dir1=$$subdir; dir2="$(top_distdir)"; \
1008 $(am__relativize); \
1009 new_top_distdir=$$reldir; \
1010 echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
1011 echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
1012 ($(am__cd) $$subdir && \
1013 $(MAKE) $(AM_MAKEFLAGS) \
1014 top_distdir="$$new_top_distdir" \
1015 distdir="$$new_distdir" \
1016 am__remove_distdir=: \
1017 am__skip_length_check=: \
1018 am__skip_mode_fix=: \
1019 distdir) \
1020 || exit 1; \
1021 fi; \
1022 done
1023check-am: all-am
1024check: check-recursive
1025all-am: Makefile $(PROGRAMS) $(SCRIPTS)
1026installdirs: installdirs-recursive
1027installdirs-am:
1028 for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"; do \
1029 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
1030 done
1031install: install-recursive
1032install-exec: install-exec-recursive
1033install-data: install-data-recursive
1034uninstall: uninstall-recursive
1035
1036install-am: all-am
1037 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
1038
1039installcheck: installcheck-recursive
1040install-strip:
1041 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
1042 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
1043 `test -z '$(STRIP)' || \
1044 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
1045mostlyclean-generic:
1046
1047clean-generic:
1048
1049distclean-generic:
1050 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
1051 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
1052
1053maintainer-clean-generic:
1054 @echo "This command is intended for maintainers to use"
1055 @echo "it deletes files that may require special tools to rebuild."
1056 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
1057clean: clean-recursive
1058
1059clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
1060
1061distclean: distclean-recursive
1062 -rm -rf ./$(DEPDIR)
1063 -rm -f Makefile
1064distclean-am: clean-am distclean-compile distclean-generic \
1065 distclean-tags
1066
1067dvi: dvi-recursive
1068
1069dvi-am:
1070
1071html: html-recursive
1072
1073html-am:
1074
1075info: info-recursive
1076
1077info-am:
1078
1079install-data-am:
1080
1081install-dvi: install-dvi-recursive
1082
1083install-dvi-am:
1084
1085install-exec-am: install-binPROGRAMS install-binSCRIPTS
1086
1087install-html: install-html-recursive
1088
1089install-html-am:
1090
1091install-info: install-info-recursive
1092
1093install-info-am:
1094
1095install-man:
1096
1097install-pdf: install-pdf-recursive
1098
1099install-pdf-am:
1100
1101install-ps: install-ps-recursive
1102
1103install-ps-am:
1104
1105installcheck-am:
1106
1107maintainer-clean: maintainer-clean-recursive
1108 -rm -rf ./$(DEPDIR)
1109 -rm -f Makefile
1110maintainer-clean-am: distclean-am maintainer-clean-generic
1111
1112mostlyclean: mostlyclean-recursive
1113
1114mostlyclean-am: mostlyclean-compile mostlyclean-generic \
1115 mostlyclean-libtool
1116
1117pdf: pdf-recursive
1118
1119pdf-am:
1120
1121ps: ps-recursive
1122
1123ps-am:
1124
1125uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS
1126
1127.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
1128 install-am install-strip tags-recursive
1129
1130.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
1131 all all-am check check-am clean clean-binPROGRAMS \
1132 clean-generic clean-libtool ctags ctags-recursive distclean \
1133 distclean-compile distclean-generic distclean-libtool \
1134 distclean-tags distdir dvi dvi-am html html-am info info-am \
1135 install install-am install-binPROGRAMS install-binSCRIPTS \
1136 install-data install-data-am install-dvi install-dvi-am \
1137 install-exec install-exec-am install-html install-html-am \
1138 install-info install-info-am install-man install-pdf \
1139 install-pdf-am install-ps install-ps-am install-strip \
1140 installcheck installcheck-am installdirs installdirs-am \
1141 maintainer-clean maintainer-clean-generic mostlyclean \
1142 mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
1143 pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
1144 uninstall-binPROGRAMS uninstall-binSCRIPTS
1145
1146
1147# Tell versions [3.59,3.63) of GNU make to not export all variables.
1148# Otherwise a system limit (for SysV at least) may be exceeded.
1149.NOEXPORT:
diff --git a/libraries/edje/src/bin/edje_cc.c b/libraries/edje/src/bin/edje_cc.c
deleted file mode 100644
index adcbbb6..0000000
--- a/libraries/edje/src/bin/edje_cc.c
+++ /dev/null
@@ -1,250 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <string.h>
6#include <locale.h>
7#include <limits.h>
8#include <sys/stat.h>
9
10#include "edje_cc.h"
11int _edje_cc_log_dom = -1;
12static void main_help(void);
13
14Eina_Prefix *pfx = NULL;
15Eina_List *snd_dirs = NULL;
16Eina_List *img_dirs = NULL;
17Eina_List *fnt_dirs = NULL;
18Eina_List *defines = NULL;
19char *file_in = NULL;
20char *tmp_dir = NULL;
21char *file_out = NULL;
22char *progname = NULL;
23int verbose = 0;
24
25int no_lossy = 0;
26int no_comp = 0;
27int no_raw = 0;
28int no_save = 0;
29int min_quality = 0;
30int max_quality = 100;
31
32static void
33main_help(void)
34{
35 printf
36 ("Usage:\n"
37 "\t%s [OPTIONS] input_file.edc [output_file.edj]\n"
38 "\n"
39 "Where OPTIONS is one or more of:\n"
40 "\n"
41 "-id image/directory Add a directory to look in for relative path images\n"
42 "-fd font/directory Add a directory to look in for relative path fonts\n"
43 "-sd sound/directory Add a directory to look in for relative path sounds samples\n"
44 "-td temp/directory Directory to store temporary files\n"
45 "-v Verbose output\n"
46 "-no-lossy Do NOT allow images to be lossy\n"
47 "-no-comp Do NOT allow images to be stored with lossless compression\n"
48 "-no-raw Do NOT allow images to be stored with zero compression (raw)\n"
49 "-no-save Do NOT store the input EDC file in the EDJ file\n"
50 "-min-quality VAL Do NOT allow lossy images with quality < VAL (0-100)\n"
51 "-max-quality VAL Do NOT allow lossy images with quality > VAL (0-100)\n"
52 "-Ddefine_val=to CPP style define to define input macro definitions to the .edc source\n"
53 ,progname);
54}
55
56int
57main(int argc, char **argv)
58{
59 int i;
60 struct stat st;
61 char rpath[PATH_MAX], rpath2[PATH_MAX];
62
63 setlocale(LC_NUMERIC, "C");
64
65 if (!eina_init())
66 return -1;
67
68 _edje_cc_log_dom = eina_log_domain_register
69 ("edje_cc", EDJE_CC_DEFAULT_LOG_COLOR);
70 if (_edje_cc_log_dom < 0)
71 {
72 EINA_LOG_ERR("Enable to create a log domain.");
73 exit(-1);
74 }
75 tmp_dir = getenv("TMPDIR");
76
77 img_dirs = eina_list_append(img_dirs, ".");
78
79 progname = argv[0];
80 for (i = 1; i < argc; i++)
81 {
82 if (!strcmp(argv[i], "-h"))
83 {
84 main_help();
85 exit(0);
86 }
87 else if (!strcmp(argv[i], "-v"))
88 {
89 verbose = 1;
90 }
91 else if (!strcmp(argv[i], "-no-lossy"))
92 {
93 no_lossy = 1;
94 }
95 else if (!strcmp(argv[i], "-no-comp"))
96 {
97 no_comp = 1;
98 }
99 else if (!strcmp(argv[i], "-no-raw"))
100 {
101 no_raw = 1;
102 }
103 else if (!strcmp(argv[i], "-no-save"))
104 {
105 no_save = 1;
106 }
107 else if ((!strcmp(argv[i], "-id") || !strcmp(argv[i], "--image_dir")) && (i < (argc - 1)))
108 {
109 i++;
110 img_dirs = eina_list_append(img_dirs, argv[i]);
111 }
112 else if ((!strcmp(argv[i], "-fd") || !strcmp(argv[i], "--font_dir")) && (i < (argc - 1)))
113 {
114 i++;
115 fnt_dirs = eina_list_append(fnt_dirs, argv[i]);
116 }
117 else if ((!strcmp(argv[i], "-sd") || !strcmp(argv[i], "--sound_dir")) && (i < (argc - 1)))
118 {
119 i++;
120 snd_dirs = eina_list_append(snd_dirs, argv[i]);
121 }
122 else if ((!strcmp(argv[i], "-td") || !strcmp(argv[i], "--tmp_dir")) && (i < (argc - 1)))
123 {
124 i++;
125 if (!tmp_dir)
126 tmp_dir = argv[i];
127 }
128 else if ((!strcmp(argv[i], "-min-quality")) && (i < (argc - 1)))
129 {
130 i++;
131 min_quality = atoi(argv[i]);
132 if (min_quality < 0) min_quality = 0;
133 if (min_quality > 100) min_quality = 100;
134 }
135 else if ((!strcmp(argv[i], "-max-quality")) && (i < (argc - 1)))
136 {
137 i++;
138 max_quality = atoi(argv[i]);
139 if (max_quality < 0) max_quality = 0;
140 if (max_quality > 100) max_quality = 100;
141 }
142 else if (!strncmp(argv[i], "-D", 2))
143 {
144 defines = eina_list_append(defines, mem_strdup(argv[i]));
145 }
146 else if ((!strcmp(argv[i], "-o")) && (i < (argc - 1)))
147 {
148 i++;
149 file_out = argv[i];
150 }
151 else if (!file_in)
152 file_in = argv[i];
153 else if (!file_out)
154 file_out = argv[i];
155 }
156 if (!file_in)
157 {
158 fprintf(stderr, "%s: Error: no input file specified.\n", progname);
159 main_help();
160 exit(-1);
161 }
162
163 pfx = eina_prefix_new(argv[0], /* argv[0] value (optional) */
164 main, /* an optional symbol to check path of */
165 "EDJE", /* env var prefix to use (XXX_PREFIX, XXX_BIN_DIR etc. */
166 "edje", /* dir to add after "share" (PREFIX/share/DIRNAME) */
167 "include/edje.inc", /* a magic file to check for in PREFIX/share/DIRNAME for success */
168 PACKAGE_BIN_DIR, /* package bin dir @ compile time */
169 PACKAGE_LIB_DIR, /* package lib dir @ compile time */
170 PACKAGE_DATA_DIR, /* package data dir @ compile time */
171 PACKAGE_DATA_DIR /* if locale needed use LOCALE_DIR */
172 );
173
174 /* check whether file_in exists */
175#ifdef HAVE_REALPATH
176 if (!realpath(file_in, rpath) || stat(rpath, &st) || !S_ISREG(st.st_mode))
177#else
178 if (stat(file_in, &st) || !S_ISREG(st.st_mode))
179#endif
180 {
181 fprintf(stderr, "%s: Error: file not found: %s.\n", progname, file_in);
182 main_help();
183 exit(-1);
184 }
185
186 if (!file_out)
187 {
188 char *suffix;
189
190 if ((suffix = strstr(file_in,".edc")) && (suffix[4] == 0))
191 {
192 file_out = strdup(file_in);
193 if (file_out)
194 {
195 suffix = strstr(file_out,".edc");
196 strcpy(suffix,".edj");
197 }
198 }
199 }
200 if (!file_out)
201 {
202 fprintf(stderr, "%s: Error: no output file specified.\n", progname);
203 main_help();
204 exit(-1);
205 }
206
207#ifdef HAVE_REALPATH
208 if (realpath(file_out, rpath2) && !strcmp (rpath, rpath2))
209#else
210 if (!strcmp (file_in, file_out))
211#endif
212 {
213 fprintf(stderr, "%s: Error: input file equals output file.\n", progname);
214 main_help();
215 exit(-1);
216 }
217
218 if (!edje_init())
219 exit(-1);
220
221 edje_file = mem_alloc(SZ(Edje_File));
222 edje_file->compiler = strdup("edje_cc");
223 edje_file->version = EDJE_FILE_VERSION;
224 edje_file->minor = EDJE_FILE_MINOR;
225 edje_file->feature_ver = 1; /* increment this every time we add a field
226 * or feature to the edje file format that
227 * does not load nicely as a NULL or 0 value
228 * and needs a special fallback initialization
229 */
230
231 source_edd();
232 source_fetch();
233
234 data_setup();
235 compile();
236 reorder_parts();
237 data_process_scripts();
238 data_process_lookups();
239 data_process_script_lookups();
240 data_write();
241
242 eina_prefix_free(pfx);
243 pfx = NULL;
244
245 edje_shutdown();
246 eina_log_domain_unregister(_edje_cc_log_dom);
247 eina_shutdown();
248
249 return 0;
250}
diff --git a/libraries/edje/src/bin/edje_cc.h b/libraries/edje/src/bin/edje_cc.h
deleted file mode 100644
index 0291f29..0000000
--- a/libraries/edje/src/bin/edje_cc.h
+++ /dev/null
@@ -1,229 +0,0 @@
1#ifndef EDJE_CC_H
2#define EDJE_CC_H
3
4#include <edje_private.h>
5
6extern Eina_Prefix *pfx;
7
8/*
9 * On Windows, if the file is not opened in binary mode,
10 * read does not return the correct size, because of
11 * CR / LF translation.
12 */
13#ifndef O_BINARY
14# define O_BINARY 0
15#endif
16
17/* logging variables */
18extern int _edje_cc_log_dom ;
19#define EDJE_CC_DEFAULT_LOG_COLOR EINA_COLOR_CYAN
20#ifdef ERR
21# undef ERR
22#endif
23#define ERR(...) EINA_LOG_DOM_ERR(_edje_cc_log_dom, __VA_ARGS__)
24#ifdef INF
25# undef INF
26#endif
27#define INF(...) EINA_LOG_DOM_INFO(_edje_cc_log_dom, __VA_ARGS__)
28#ifdef WRN
29# undef WRN
30#endif
31#define WRN(...) EINA_LOG_DOM_WARN(_edje_cc_log_dom, __VA_ARGS__)
32
33
34/* types */
35typedef struct _New_Object_Handler New_Object_Handler;
36typedef struct _New_Statement_Handler New_Statement_Handler;
37typedef struct _External_List External_List;
38typedef struct _External External;
39typedef struct _Font_List Font_List;
40typedef struct _Font Font;
41typedef struct _Code Code;
42typedef struct _Code_Program Code_Program;
43typedef struct _SrcFile SrcFile;
44typedef struct _SrcFile_List SrcFile_List;
45
46typedef struct _Edje_Program_Parser Edje_Program_Parser;
47typedef struct _Edje_Pack_Element_Parser Edje_Pack_Element_Parser;
48typedef struct _Edje_Part_Parser Edje_Part_Parser;
49
50struct _New_Object_Handler
51{
52 const char *type;
53 void (*func)(void);
54};
55
56struct _New_Statement_Handler
57{
58 const char *type;
59 void (*func)(void);
60};
61
62struct _External_List
63{
64 Eina_List *list;
65};
66
67struct _External
68{
69 char *name;
70};
71
72struct _Font_List
73{
74 Eina_List *list;
75};
76
77struct _Font
78{
79 char *name;
80 char *file;
81};
82
83struct _Code
84{
85 int l1, l2;
86 char *shared;
87 char *original;
88 Eina_List *programs;
89 int is_lua;
90};
91
92struct _Code_Program
93{
94 int l1, l2;
95 int id;
96 char *script;
97 char *original;
98};
99
100struct _SrcFile
101{
102 char *name;
103 char *file;
104};
105
106struct _SrcFile_List
107{
108 Eina_List *list;
109};
110
111struct _Edje_Program_Parser
112{
113 Edje_Program common;
114 Eina_Bool can_override;
115};
116
117struct _Edje_Pack_Element_Parser
118{
119 Edje_Pack_Element common;
120 Eina_Bool can_override;
121};
122
123struct _Edje_Part_Parser
124{
125 Edje_Part common;
126 struct {
127 Eina_Bool done;
128 const char *insert_before; /* the part name for insertion in front of */
129 const char *insert_after; /* the part name for insertion behind of */
130 Edje_Part_Parser *before;
131 Edje_Part_Parser *after;
132 int linked_prev; /* the number linked previous part for reorder */
133 int linked_next; /* the number linked next part for reorder */
134 } reorder;
135 Eina_Bool can_override;
136};
137
138/* global fn calls */
139void data_setup(void);
140void data_write(void);
141void data_queue_group_lookup(const char *name, Edje_Part *part);
142void data_queue_part_lookup(Edje_Part_Collection *pc, const char *name, int *dest);
143void data_queue_copied_part_lookup(Edje_Part_Collection *pc, int *src, int *dest);
144void data_queue_program_lookup(Edje_Part_Collection *pc, const char *name, int *dest);
145void data_queue_copied_program_lookup(Edje_Part_Collection *pc, int *src, int *dest);
146void data_queue_anonymous_lookup(Edje_Part_Collection *pc, Edje_Program *ep, int *dest);
147void data_queue_copied_anonymous_lookup(Edje_Part_Collection *pc, int *src, int *dest);
148void data_queue_image_lookup(char *name, int *dest, Eina_Bool *set);
149void data_queue_copied_image_lookup(int *src, int *dest, Eina_Bool *set);
150void data_queue_image_remove(int *dest, Eina_Bool *set);
151void data_queue_part_slave_lookup(int *master, int *slave);
152void data_queue_image_slave_lookup(int *master, int *slave);
153void data_queue_spectrum_lookup(char *name, int *dest);
154void data_queue_spectrum_slave_lookup(int *master, int *slave);
155void data_process_lookups(void);
156void data_process_scripts(void);
157void data_process_script_lookups(void);
158
159void part_description_image_cleanup(Edje_Part *ep);
160
161int is_verbatim(void);
162void track_verbatim(int on);
163void set_verbatim(char *s, int l1, int l2);
164char *get_verbatim(void);
165int get_verbatim_line1(void);
166int get_verbatim_line2(void);
167void compile(void);
168int is_param(int n);
169int is_num(int n);
170char *parse_str(int n);
171int parse_enum(int n, ...);
172int parse_flags(int n, ...);
173int parse_int(int n);
174int parse_int_range(int n, int f, int t);
175int parse_bool(int n);
176double parse_float(int n);
177double parse_float_range(int n, double f, double t);
178int get_arg_count(void);
179void check_arg_count(int n);
180void check_min_arg_count(int n);
181
182int object_handler_num(void);
183int statement_handler_num(void);
184
185void reorder_parts(void);
186void source_edd(void);
187void source_fetch(void);
188int source_append(Eet_File *ef);
189SrcFile_List *source_load(Eet_File *ef);
190int source_fontmap_save(Eet_File *ef, Eina_List *fonts);
191Font_List *source_fontmap_load(Eet_File *ef);
192
193void *mem_alloc(size_t size);
194char *mem_strdup(const char *s);
195#define SZ sizeof
196
197void error_and_abort(Eet_File *ef, const char *fmt, ...);
198
199/* global vars */
200extern Eina_List *ext_dirs;
201extern Eina_List *img_dirs;
202extern Eina_List *fnt_dirs;
203extern Eina_List *snd_dirs;
204extern char *file_in;
205extern char *tmp_dir;
206extern char *file_out;
207extern char *progname;
208extern int verbose;
209extern int no_lossy;
210extern int no_comp;
211extern int no_raw;
212extern int no_save;
213extern int min_quality;
214extern int max_quality;
215extern int line;
216extern Eina_List *stack;
217extern Eina_List *params;
218extern Edje_File *edje_file;
219extern Eina_List *edje_collections;
220extern Eina_List *externals;
221extern Eina_List *fonts;
222extern Eina_List *codes;
223extern Eina_List *defines;
224extern Eina_List *aliases;
225extern New_Object_Handler object_handlers[];
226extern New_Statement_Handler statement_handlers[];
227
228
229#endif
diff --git a/libraries/edje/src/bin/edje_cc_handlers.c b/libraries/edje/src/bin/edje_cc_handlers.c
deleted file mode 100644
index 14ac0b7..0000000
--- a/libraries/edje/src/bin/edje_cc_handlers.c
+++ /dev/null
@@ -1,7929 +0,0 @@
1/*
2 Concerning the EDC reference:
3
4 The formatting for blocks and properties has been implemented as a table
5 which is filled using ALIASES.
6 For maximum flexibility I implemented them in the \@code/\@encode style,
7 this means that missing one or changing the order most certainly cause
8 formatting errors.
9
10 \@block
11 block name
12 \@context
13 code sample of the block
14 \@description
15 the block's description
16 \@endblock
17
18 \@property
19 property name
20 \@parameters
21 property's parameter list
22 \@effect
23 the property description (lol)
24 \@endproperty
25*/
26
27#ifdef HAVE_CONFIG_H
28# include "config.h"
29#endif
30
31#include <string.h>
32#include <errno.h>
33#include <sys/stat.h>
34#include <fcntl.h>
35#include <sys/mman.h>
36#include <unistd.h>
37
38#include "edje_cc.h"
39
40/**
41 * @page edcref Edje Data Collection reference
42 * An Edje Data Collection, it's a plain text file (normally identified with the
43 * .edc extension),consisting of instructions for the Edje Compiler.
44 *
45 * The syntax for the edje data collection files follows a simple structure of
46 * "blocks { .. }" that can contain "properties: ..", more blocks, or both.
47 *
48 * @anchor sec_quickaccess Quick access to block descriptions:
49 * <ul>
50 * <li>@ref sec_toplevel "Top-Level"</li>
51 * <li>@ref sec_group "Group"</li>
52 * <li>@ref sec_description "State description"</li>
53 * <ul>
54 * <li>@ref sec_description_image "Image"</li>
55 * <li>@ref sec_description_text "Text"</li>
56 * <li>@ref sec_description_box "Box"</li>
57 * <li>@ref sec_description_table "Table"</li>
58 * <li>@ref sec_description_map "Map (3d/transformations)"</li>
59 * </ul>
60 * <li>@ref sec_program "Program block"</li>
61 * </ul>
62 *
63 * @author Andres Blanc (dresb) andresblanc@gmail.com
64 *
65 * <table class="edcref" border="0">
66 */
67
68static Edje_Part_Collection_Directory_Entry *current_de = NULL;
69static Edje_Part *current_part = NULL;
70static Edje_Pack_Element *current_item = NULL;
71static Edje_Part_Description_Common *current_desc = NULL;
72static Edje_Part_Description_Common *parent_desc = NULL;
73static Edje_Program *current_program = NULL;
74
75static void st_externals_external(void);
76
77static void st_images_image(void);
78static void ob_images_set(void);
79static void st_images_set_name(void);
80static void ob_images_set_image(void);
81static void st_images_set_image_image(void);
82static void st_images_set_image_size(void);
83
84static void st_fonts_font(void);
85
86static void st_data_item(void);
87static void st_data_file(void);
88
89static void ob_styles_style(void);
90static void st_styles_style_name(void);
91static void st_styles_style_base(void);
92static void st_styles_style_tag(void);
93
94static void ob_color_class(void);
95static void st_color_class_name(void);
96static void st_color_class_color(void);
97static void st_color_class_color2(void);
98static void st_color_class_color3(void);
99
100static void ob_collections(void);
101
102static void ob_collections_group(void);
103static void st_collections_group_name(void);
104static void st_collections_group_inherit(void);
105static void st_collections_group_script_only(void);
106static void st_collections_group_alias(void);
107static void st_collections_group_min(void);
108static void st_collections_group_max(void);
109static void st_collections_group_broadcast_signal(void);
110static void st_collections_group_data_item(void);
111static void st_collections_group_orientation(void);
112
113static void st_collections_group_limits_vertical(void);
114static void st_collections_group_limits_horizontal(void);
115
116static void ob_collections_group_script(void);
117static void ob_collections_group_lua_script(void);
118
119static void st_collections_group_parts_alias(void);
120
121static void ob_collections_group_parts_part(void);
122static void st_collections_group_parts_part_name(void);
123static void st_collections_group_parts_part_type(void);
124static void st_collections_group_parts_part_insert_before(void);
125static void st_collections_group_parts_part_insert_after(void);
126static void st_collections_group_parts_part_effect(void);
127static void st_collections_group_parts_part_mouse_events(void);
128static void st_collections_group_parts_part_repeat_events(void);
129static void st_collections_group_parts_part_ignore_flags(void);
130static void st_collections_group_parts_part_scale(void);
131static void st_collections_group_parts_part_pointer_mode(void);
132static void st_collections_group_parts_part_precise_is_inside(void);
133static void st_collections_group_parts_part_use_alternate_font_metrics(void);
134static void st_collections_group_parts_part_clip_to_id(void);
135static void st_collections_group_parts_part_source(void);
136static void st_collections_group_parts_part_source2(void);
137static void st_collections_group_parts_part_source3(void);
138static void st_collections_group_parts_part_source4(void);
139static void st_collections_group_parts_part_source5(void);
140static void st_collections_group_parts_part_source6(void);
141static void st_collections_group_parts_part_entry_mode(void);
142static void st_collections_group_parts_part_select_mode(void);
143static void st_collections_group_parts_part_cursor_mode(void);
144static void st_collections_group_parts_part_multiline(void);
145static void st_collections_group_parts_part_dragable_x(void);
146static void st_collections_group_parts_part_dragable_y(void);
147static void st_collections_group_parts_part_dragable_confine(void);
148static void st_collections_group_parts_part_dragable_events(void);
149
150/* box and table items share these */
151static void ob_collections_group_parts_part_box_items_item(void);
152static void st_collections_group_parts_part_box_items_item_type(void);
153static void st_collections_group_parts_part_box_items_item_name(void);
154static void st_collections_group_parts_part_box_items_item_source(void);
155static void st_collections_group_parts_part_box_items_item_min(void);
156static void st_collections_group_parts_part_box_items_item_prefer(void);
157static void st_collections_group_parts_part_box_items_item_max(void);
158static void st_collections_group_parts_part_box_items_item_padding(void);
159static void st_collections_group_parts_part_box_items_item_align(void);
160static void st_collections_group_parts_part_box_items_item_weight(void);
161static void st_collections_group_parts_part_box_items_item_aspect(void);
162static void st_collections_group_parts_part_box_items_item_aspect_mode(void);
163static void st_collections_group_parts_part_box_items_item_options(void);
164/* but these are only for table */
165static void st_collections_group_parts_part_table_items_item_position(void);
166static void st_collections_group_parts_part_table_items_item_span(void);
167
168static void ob_collections_group_parts_part_description(void);
169static void st_collections_group_parts_part_description_inherit(void);
170static void st_collections_group_parts_part_description_source(void);
171static void st_collections_group_parts_part_description_state(void);
172static void st_collections_group_parts_part_description_visible(void);
173static void st_collections_group_parts_part_description_align(void);
174static void st_collections_group_parts_part_description_fixed(void);
175static void st_collections_group_parts_part_description_min(void);
176static void st_collections_group_parts_part_description_minmul(void);
177static void st_collections_group_parts_part_description_max(void);
178static void st_collections_group_parts_part_description_step(void);
179static void st_collections_group_parts_part_description_aspect(void);
180static void st_collections_group_parts_part_description_aspect_preference(void);
181static void st_collections_group_parts_part_description_rel1_relative(void);
182static void st_collections_group_parts_part_description_rel1_offset(void);
183static void st_collections_group_parts_part_description_rel1_to(void);
184static void st_collections_group_parts_part_description_rel1_to_x(void);
185static void st_collections_group_parts_part_description_rel1_to_y(void);
186static void st_collections_group_parts_part_description_rel2_relative(void);
187static void st_collections_group_parts_part_description_rel2_offset(void);
188static void st_collections_group_parts_part_description_rel2_to(void);
189static void st_collections_group_parts_part_description_rel2_to_x(void);
190static void st_collections_group_parts_part_description_rel2_to_y(void);
191static void st_collections_group_parts_part_description_image_normal(void);
192static void st_collections_group_parts_part_description_image_tween(void);
193static void st_collections_group_parts_part_description_image_border(void);
194static void st_collections_group_parts_part_description_image_middle(void);
195static void st_collections_group_parts_part_description_image_border_scale(void);
196static void st_collections_group_parts_part_description_image_border_scale_by(void);
197static void st_collections_group_parts_part_description_image_scale_hint(void);
198static void st_collections_group_parts_part_description_fill_smooth(void);
199static void st_collections_group_parts_part_description_fill_origin_relative(void);
200static void st_collections_group_parts_part_description_fill_origin_offset(void);
201static void st_collections_group_parts_part_description_fill_size_relative(void);
202static void st_collections_group_parts_part_description_fill_size_offset(void);
203static void st_collections_group_parts_part_description_fill_spread(void);
204static void st_collections_group_parts_part_description_fill_type(void);
205static void st_collections_group_parts_part_description_color_class(void);
206static void st_collections_group_parts_part_description_color(void);
207static void st_collections_group_parts_part_description_color2(void);
208static void st_collections_group_parts_part_description_color3(void);
209static void st_collections_group_parts_part_description_text_text(void);
210static void st_collections_group_parts_part_description_text_text_class(void);
211static void st_collections_group_parts_part_description_text_font(void);
212static void st_collections_group_parts_part_description_text_style(void);
213static void st_collections_group_parts_part_description_text_repch(void);
214static void st_collections_group_parts_part_description_text_size(void);
215static void st_collections_group_parts_part_description_text_size_range(void);
216static void st_collections_group_parts_part_description_text_fit(void);
217static void st_collections_group_parts_part_description_text_min(void);
218static void st_collections_group_parts_part_description_text_max(void);
219static void st_collections_group_parts_part_description_text_align(void);
220static void st_collections_group_parts_part_description_text_source(void);
221static void st_collections_group_parts_part_description_text_text_source(void);
222static void st_collections_group_parts_part_description_text_elipsis(void);
223static void st_collections_group_parts_part_description_box_layout(void);
224static void st_collections_group_parts_part_description_box_align(void);
225static void st_collections_group_parts_part_description_box_padding(void);
226static void st_collections_group_parts_part_description_box_min(void);
227static void st_collections_group_parts_part_description_table_homogeneous(void);
228static void st_collections_group_parts_part_description_table_align(void);
229static void st_collections_group_parts_part_description_table_padding(void);
230static void st_collections_group_parts_part_description_table_min(void);
231static void st_collections_group_parts_part_description_map_perspective(void);
232static void st_collections_group_parts_part_description_map_light(void);
233static void st_collections_group_parts_part_description_map_rotation_center(void);
234static void st_collections_group_parts_part_description_map_rotation_x(void);
235static void st_collections_group_parts_part_description_map_rotation_y(void);
236static void st_collections_group_parts_part_description_map_rotation_z(void);
237static void st_collections_group_parts_part_description_map_on(void);
238static void st_collections_group_parts_part_description_map_smooth(void);
239static void st_collections_group_parts_part_description_map_alpha(void);
240static void st_collections_group_parts_part_description_map_backface_cull(void);
241static void st_collections_group_parts_part_description_map_perspective_on(void);
242static void st_collections_group_parts_part_description_perspective_zplane(void);
243static void st_collections_group_parts_part_description_perspective_focal(void);
244static void st_collections_group_parts_part_api(void);
245
246/* external part parameters */
247static void st_collections_group_parts_part_description_params_int(void);
248static void ob_collections_group_programs_program(void);
249static void st_collections_group_parts_part_description_params_double(void);
250
251static void st_collections_group_programs_program_name(void);
252static void st_collections_group_parts_part_description_params_string(void);
253static void st_collections_group_parts_part_description_params_bool(void);
254static void st_collections_group_parts_part_description_params_choice(void);
255static void st_collections_group_programs_program_signal(void);
256static void st_collections_group_programs_program_source(void);
257static void st_collections_group_programs_program_filter(void);
258static void st_collections_group_programs_program_in(void);
259static void st_collections_group_programs_program_action(void);
260static void st_collections_group_programs_program_transition(void);
261static void st_collections_group_programs_program_target(void);
262static void st_collections_group_programs_program_after(void);
263static void st_collections_group_programs_program_api(void);
264
265static void ob_collections_group_programs_program_script(void);
266static void st_collections_group_sound_sample_name(void);
267static void st_collections_group_sound_sample_source(void);
268static void st_collections_group_sound_tone(void);
269
270/*****/
271
272New_Statement_Handler statement_handlers[] =
273{
274 {"externals.external", st_externals_external},
275 {"images.image", st_images_image},
276 {"images.set.name", st_images_set_name},
277 {"images.set.image.image", st_images_set_image_image},
278 {"images.set.image.size", st_images_set_image_size},
279 {"fonts.font", st_fonts_font},
280 {"data.item", st_data_item},
281 {"data.file", st_data_file},
282 {"styles.style.name", st_styles_style_name},
283 {"styles.style.base", st_styles_style_base},
284 {"styles.style.tag", st_styles_style_tag},
285 {"color_classes.color_class.name", st_color_class_name},
286 {"color_classes.color_class.color", st_color_class_color},
287 {"color_classes.color_class.color2", st_color_class_color2},
288 {"color_classes.color_class.color3", st_color_class_color3},
289 {"collections.externals.external", st_externals_external}, /* dup */
290 {"collections.image", st_images_image}, /* dup */
291 {"collections.set.name", st_images_set_name}, /* dup */
292 {"collections.set.image.image", st_images_set_image_image}, /* dup */
293 {"collections.set.image.size", st_images_set_image_size}, /* dup */
294 {"collections.images.image", st_images_image}, /* dup */
295 {"collections.images.set.name", st_images_set_name}, /* dup */
296 {"collections.images.set.image.image", st_images_set_image_image}, /* dup */
297 {"collections.images.set.image.size", st_images_set_image_size}, /* dup */
298 {"collections.font", st_fonts_font}, /* dup */
299 {"collections.fonts.font", st_fonts_font}, /* dup */
300 {"collections.styles.style.name", st_styles_style_name}, /* dup */
301 {"collections.styles.style.base", st_styles_style_base}, /* dup */
302 {"collections.styles.style.tag", st_styles_style_tag}, /* dup */
303 {"collections.color_classes.color_class.name", st_color_class_name}, /* dup */
304 {"collections.color_classes.color_class.color", st_color_class_color}, /* dup */
305 {"collections.color_classes.color_class.color2", st_color_class_color2}, /* dup */
306 {"collections.color_classes.color_class.color3", st_color_class_color3}, /* dup */
307
308 {"collections.sounds.sample.name", st_collections_group_sound_sample_name},
309 {"collections.sounds.sample.source", st_collections_group_sound_sample_source},
310 {"collections.group.sounds.sample.name", st_collections_group_sound_sample_name}, /* dup */
311 {"collections.group.sounds.sample.source", st_collections_group_sound_sample_source}, /* dup */
312 {"collections.sounds.tone", st_collections_group_sound_tone},
313 {"collections.group.sounds.tone", st_collections_group_sound_tone}, /* dup */
314 {"collections.group.name", st_collections_group_name},
315 {"collections.group.inherit", st_collections_group_inherit},
316 {"collections.group.script_only", st_collections_group_script_only},
317 {"collections.group.lua_script_only", st_collections_group_script_only},
318 {"collections.group.alias", st_collections_group_alias},
319 {"collections.group.min", st_collections_group_min},
320 {"collections.group.max", st_collections_group_max},
321 {"collections.group.broadcast_signal", st_collections_group_broadcast_signal},
322 {"collections.group.orientation", st_collections_group_orientation},
323 {"collections.group.data.item", st_collections_group_data_item},
324 {"collections.group.limits.horizontal", st_collections_group_limits_horizontal},
325 {"collections.group.limits.vertical", st_collections_group_limits_vertical},
326 {"collections.group.externals.external", st_externals_external}, /* dup */
327 {"collections.group.image", st_images_image}, /* dup */
328 {"collections.group.set.name", st_images_set_name},
329 {"collections.group.set.image.image", st_images_set_image_image},
330 {"collections.group.set.image.size", st_images_set_image_size},
331 {"collections.group.images.image", st_images_image}, /* dup */
332 {"collections.group.images.set.name", st_images_set_name},
333 {"collections.group.images.set.image.image", st_images_set_image_image},
334 {"collections.group.images.set.image.size", st_images_set_image_size},
335 {"collections.group.font", st_fonts_font}, /* dup */
336 {"collections.group.fonts.font", st_fonts_font}, /* dup */
337 {"collections.group.styles.style.name", st_styles_style_name}, /* dup */
338 {"collections.group.styles.style.base", st_styles_style_base}, /* dup */
339 {"collections.group.styles.style.tag", st_styles_style_tag}, /* dup */
340 {"collections.group.color_classes.color_class.name", st_color_class_name}, /* dup */
341 {"collections.group.color_classes.color_class.color", st_color_class_color}, /* dup */
342 {"collections.group.color_classes.color_class.color2", st_color_class_color2}, /* dup */
343 {"collections.group.color_classes.color_class.color3", st_color_class_color3}, /* dup */
344 {"collections.group.parts.alias", st_collections_group_parts_alias },
345 {"collections.group.parts.image", st_images_image}, /* dup */
346 {"collections.group.parts.set.name", st_images_set_name},
347 {"collections.group.parts.set.image.image", st_images_set_image_image},
348 {"collections.group.parts.set.image.size", st_images_set_image_size},
349 {"collections.group.parts.images.image", st_images_image}, /* dup */
350 {"collections.group.parts.images.set.name", st_images_set_name},
351 {"collections.group.parts.images.set.image.image", st_images_set_image_image},
352 {"collections.group.parts.images.set.image.size", st_images_set_image_size},
353 {"collections.group.parts.font", st_fonts_font}, /* dup */
354 {"collections.group.parts.fonts.font", st_fonts_font}, /* dup */
355 {"collections.group.parts.styles.style.name", st_styles_style_name}, /* dup */
356 {"collections.group.parts.styles.style.base", st_styles_style_base}, /* dup */
357 {"collections.group.parts.styles.style.tag", st_styles_style_tag}, /* dup */
358 {"collections.group.parts.color_classes.color_class.name", st_color_class_name}, /* dup */
359 {"collections.group.parts.color_classes.color_class.color", st_color_class_color}, /* dup */
360 {"collections.group.parts.color_classes.color_class.color2", st_color_class_color2}, /* dup */
361 {"collections.group.parts.color_classes.color_class.color3", st_color_class_color3}, /* dup */
362 {"collections.group.parts.part.name", st_collections_group_parts_part_name},
363 {"collections.group.parts.part.api", st_collections_group_parts_part_api},
364 {"collections.group.parts.part.type", st_collections_group_parts_part_type},
365 {"collections.group.parts.part.insert_before", st_collections_group_parts_part_insert_before},
366 {"collections.group.parts.part.insert_after", st_collections_group_parts_part_insert_after},
367 {"collections.group.parts.part.effect", st_collections_group_parts_part_effect},
368 {"collections.group.parts.part.mouse_events", st_collections_group_parts_part_mouse_events},
369 {"collections.group.parts.part.repeat_events", st_collections_group_parts_part_repeat_events},
370 {"collections.group.parts.part.ignore_flags", st_collections_group_parts_part_ignore_flags},
371 {"collections.group.parts.part.scale", st_collections_group_parts_part_scale},
372 {"collections.group.parts.part.pointer_mode", st_collections_group_parts_part_pointer_mode},
373 {"collections.group.parts.part.precise_is_inside", st_collections_group_parts_part_precise_is_inside},
374 {"collections.group.parts.part.use_alternate_font_metrics", st_collections_group_parts_part_use_alternate_font_metrics},
375 {"collections.group.parts.part.clip_to", st_collections_group_parts_part_clip_to_id},
376 {"collections.group.parts.part.source", st_collections_group_parts_part_source},
377 {"collections.group.parts.part.source2", st_collections_group_parts_part_source2},
378 {"collections.group.parts.part.source3", st_collections_group_parts_part_source3},
379 {"collections.group.parts.part.source4", st_collections_group_parts_part_source4},
380 {"collections.group.parts.part.source5", st_collections_group_parts_part_source5},
381 {"collections.group.parts.part.source6", st_collections_group_parts_part_source6},
382 {"collections.group.parts.part.dragable.x", st_collections_group_parts_part_dragable_x},
383 {"collections.group.parts.part.dragable.y", st_collections_group_parts_part_dragable_y},
384 {"collections.group.parts.part.dragable.confine", st_collections_group_parts_part_dragable_confine},
385 {"collections.group.parts.part.dragable.events", st_collections_group_parts_part_dragable_events},
386 {"collections.group.parts.part.entry_mode", st_collections_group_parts_part_entry_mode},
387 {"collections.group.parts.part.select_mode", st_collections_group_parts_part_select_mode},
388 {"collections.group.parts.part.cursor_mode", st_collections_group_parts_part_cursor_mode},
389 {"collections.group.parts.part.multiline", st_collections_group_parts_part_multiline},
390 {"collections.group.parts.part.image", st_images_image}, /* dup */
391 {"collections.group.parts.part.set.name", st_images_set_name},
392 {"collections.group.parts.part.set.image.image", st_images_set_image_image},
393 {"collections.group.parts.part.set.image.size", st_images_set_image_size},
394 {"collections.group.parts.part.images.image", st_images_image}, /* dup */
395 {"collections.group.parts.part.images.set.name", st_images_set_name},
396 {"collections.group.parts.part.images.set.image.image", st_images_set_image_image},
397 {"collections.group.parts.part.images.set.image.size", st_images_set_image_size},
398 {"collections.group.parts.part.font", st_fonts_font}, /* dup */
399 {"collections.group.parts.part.fonts.font", st_fonts_font}, /* dup */
400 {"collections.group.parts.part.styles.style.name", st_styles_style_name}, /* dup */
401 {"collections.group.parts.part.styles.style.base", st_styles_style_base}, /* dup */
402 {"collections.group.parts.part.styles.style.tag", st_styles_style_tag}, /* dup */
403 {"collections.group.parts.part.color_classes.color_class.name", st_color_class_name}, /* dup */
404 {"collections.group.parts.part.color_classes.color_class.color", st_color_class_color}, /* dup */
405 {"collections.group.parts.part.color_classes.color_class.color2", st_color_class_color2}, /* dup */
406 {"collections.group.parts.part.color_classes.color_class.color3", st_color_class_color3}, /* dup */
407 {"collections.group.parts.part.box.items.item.type", st_collections_group_parts_part_box_items_item_type},
408 {"collections.group.parts.part.box.items.item.name", st_collections_group_parts_part_box_items_item_name},
409 {"collections.group.parts.part.box.items.item.source", st_collections_group_parts_part_box_items_item_source},
410 {"collections.group.parts.part.box.items.item.min", st_collections_group_parts_part_box_items_item_min},
411 {"collections.group.parts.part.box.items.item.prefer", st_collections_group_parts_part_box_items_item_prefer},
412 {"collections.group.parts.part.box.items.item.max", st_collections_group_parts_part_box_items_item_max},
413 {"collections.group.parts.part.box.items.item.padding", st_collections_group_parts_part_box_items_item_padding},
414 {"collections.group.parts.part.box.items.item.align", st_collections_group_parts_part_box_items_item_align},
415 {"collections.group.parts.part.box.items.item.weight", st_collections_group_parts_part_box_items_item_weight},
416 {"collections.group.parts.part.box.items.item.aspect", st_collections_group_parts_part_box_items_item_aspect},
417 {"collections.group.parts.part.box.items.item.aspect_mode", st_collections_group_parts_part_box_items_item_aspect_mode},
418 {"collections.group.parts.part.box.items.item.options", st_collections_group_parts_part_box_items_item_options},
419 {"collections.group.parts.part.table.items.item.type", st_collections_group_parts_part_box_items_item_type}, /* dup */
420 {"collections.group.parts.part.table.items.item.name", st_collections_group_parts_part_box_items_item_name}, /* dup */
421 {"collections.group.parts.part.table.items.item.source", st_collections_group_parts_part_box_items_item_source}, /* dup */
422 {"collections.group.parts.part.table.items.item.min", st_collections_group_parts_part_box_items_item_min}, /* dup */
423 {"collections.group.parts.part.table.items.item.prefer", st_collections_group_parts_part_box_items_item_prefer}, /* dup */
424 {"collections.group.parts.part.table.items.item.max", st_collections_group_parts_part_box_items_item_max}, /* dup */
425 {"collections.group.parts.part.table.items.item.padding", st_collections_group_parts_part_box_items_item_padding}, /* dup */
426 {"collections.group.parts.part.table.items.item.align", st_collections_group_parts_part_box_items_item_align}, /* dup */
427 {"collections.group.parts.part.table.items.item.weight", st_collections_group_parts_part_box_items_item_weight}, /* dup */
428 {"collections.group.parts.part.table.items.item.aspect", st_collections_group_parts_part_box_items_item_aspect}, /* dup */
429 {"collections.group.parts.part.table.items.item.aspect_mode", st_collections_group_parts_part_box_items_item_aspect_mode}, /* dup */
430 {"collections.group.parts.part.table.items.item.options", st_collections_group_parts_part_box_items_item_options}, /* dup */
431 {"collections.group.parts.part.table.items.item.position", st_collections_group_parts_part_table_items_item_position},
432 {"collections.group.parts.part.table.items.item.span", st_collections_group_parts_part_table_items_item_span},
433 {"collections.group.parts.part.description.inherit", st_collections_group_parts_part_description_inherit},
434 {"collections.group.parts.part.description.source", st_collections_group_parts_part_description_source},
435 {"collections.group.parts.part.description.state", st_collections_group_parts_part_description_state},
436 {"collections.group.parts.part.description.visible", st_collections_group_parts_part_description_visible},
437 {"collections.group.parts.part.description.align", st_collections_group_parts_part_description_align},
438 {"collections.group.parts.part.description.fixed", st_collections_group_parts_part_description_fixed},
439 {"collections.group.parts.part.description.min", st_collections_group_parts_part_description_min},
440 {"collections.group.parts.part.description.minmul", st_collections_group_parts_part_description_minmul},
441 {"collections.group.parts.part.description.max", st_collections_group_parts_part_description_max},
442 {"collections.group.parts.part.description.step", st_collections_group_parts_part_description_step},
443 {"collections.group.parts.part.description.aspect", st_collections_group_parts_part_description_aspect},
444 {"collections.group.parts.part.description.aspect_preference", st_collections_group_parts_part_description_aspect_preference},
445 {"collections.group.parts.part.description.rel1.relative", st_collections_group_parts_part_description_rel1_relative},
446 {"collections.group.parts.part.description.rel1.offset", st_collections_group_parts_part_description_rel1_offset},
447 {"collections.group.parts.part.description.rel1.to", st_collections_group_parts_part_description_rel1_to},
448 {"collections.group.parts.part.description.rel1.to_x", st_collections_group_parts_part_description_rel1_to_x},
449 {"collections.group.parts.part.description.rel1.to_y", st_collections_group_parts_part_description_rel1_to_y},
450 {"collections.group.parts.part.description.rel2.relative", st_collections_group_parts_part_description_rel2_relative},
451 {"collections.group.parts.part.description.rel2.offset", st_collections_group_parts_part_description_rel2_offset},
452 {"collections.group.parts.part.description.rel2.to", st_collections_group_parts_part_description_rel2_to},
453 {"collections.group.parts.part.description.rel2.to_x", st_collections_group_parts_part_description_rel2_to_x},
454 {"collections.group.parts.part.description.rel2.to_y", st_collections_group_parts_part_description_rel2_to_y},
455 {"collections.group.parts.part.description.image.normal", st_collections_group_parts_part_description_image_normal},
456 {"collections.group.parts.part.description.image.tween", st_collections_group_parts_part_description_image_tween},
457 {"collections.group.parts.part.description.image.image", st_images_image}, /* dup */
458 {"collections.group.parts.part.description.image.set.name", st_images_set_name},
459 {"collections.group.parts.part.description.image.set.image.image", st_images_set_image_image},
460 {"collections.group.parts.part.description.image.set.image.size", st_images_set_image_size},
461 {"collections.group.parts.part.description.image.images.image", st_images_image}, /* dup */
462 {"collections.group.parts.part.description.image.images.set.name", st_images_set_name},
463 {"collections.group.parts.part.description.image.images.set.image.image", st_images_set_image_image},
464 {"collections.group.parts.part.description.image.images.set.image.size", st_images_set_image_size},
465 {"collections.group.parts.part.description.image.border", st_collections_group_parts_part_description_image_border},
466 {"collections.group.parts.part.description.image.middle", st_collections_group_parts_part_description_image_middle},
467 {"collections.group.parts.part.description.image.border_scale", st_collections_group_parts_part_description_image_border_scale},
468 {"collections.group.parts.part.description.image.border_scale_by", st_collections_group_parts_part_description_image_border_scale_by},
469 {"collections.group.parts.part.description.image.scale_hint", st_collections_group_parts_part_description_image_scale_hint},
470 {"collections.group.parts.part.description.fill.smooth", st_collections_group_parts_part_description_fill_smooth},
471 {"collections.group.parts.part.description.fill.origin.relative", st_collections_group_parts_part_description_fill_origin_relative},
472 {"collections.group.parts.part.description.fill.origin.offset", st_collections_group_parts_part_description_fill_origin_offset},
473 {"collections.group.parts.part.description.fill.size.relative", st_collections_group_parts_part_description_fill_size_relative},
474 {"collections.group.parts.part.description.fill.size.offset", st_collections_group_parts_part_description_fill_size_offset},
475 {"collections.group.parts.part.description.fill.spread", st_collections_group_parts_part_description_fill_spread},
476 {"collections.group.parts.part.description.fill.type", st_collections_group_parts_part_description_fill_type},
477 {"collections.group.parts.part.description.color_class", st_collections_group_parts_part_description_color_class},
478 {"collections.group.parts.part.description.color", st_collections_group_parts_part_description_color},
479 {"collections.group.parts.part.description.color2", st_collections_group_parts_part_description_color2},
480 {"collections.group.parts.part.description.color3", st_collections_group_parts_part_description_color3},
481 {"collections.group.parts.part.description.text.text", st_collections_group_parts_part_description_text_text},
482 {"collections.group.parts.part.description.text.text_class", st_collections_group_parts_part_description_text_text_class},
483 {"collections.group.parts.part.description.text.font", st_collections_group_parts_part_description_text_font},
484 {"collections.group.parts.part.description.text.style", st_collections_group_parts_part_description_text_style},
485 {"collections.group.parts.part.description.text.repch", st_collections_group_parts_part_description_text_repch},
486 {"collections.group.parts.part.description.text.size", st_collections_group_parts_part_description_text_size},
487 {"collections.group.parts.part.description.text.size_range", st_collections_group_parts_part_description_text_size_range},
488 {"collections.group.parts.part.description.text.fit", st_collections_group_parts_part_description_text_fit},
489 {"collections.group.parts.part.description.text.min", st_collections_group_parts_part_description_text_min},
490 {"collections.group.parts.part.description.text.max", st_collections_group_parts_part_description_text_max},
491 {"collections.group.parts.part.description.text.align", st_collections_group_parts_part_description_text_align},
492 {"collections.group.parts.part.description.text.source", st_collections_group_parts_part_description_text_source},
493 {"collections.group.parts.part.description.text.text_source", st_collections_group_parts_part_description_text_text_source},
494 {"collections.group.parts.part.description.text.font", st_fonts_font}, /* dup */
495 {"collections.group.parts.part.description.text.fonts.font", st_fonts_font}, /* dup */
496 {"collections.group.parts.part.description.text.elipsis", st_collections_group_parts_part_description_text_elipsis},
497 {"collections.group.parts.part.description.text.ellipsis", st_collections_group_parts_part_description_text_elipsis},
498 {"collections.group.parts.part.description.box.layout", st_collections_group_parts_part_description_box_layout},
499 {"collections.group.parts.part.description.box.align", st_collections_group_parts_part_description_box_align},
500 {"collections.group.parts.part.description.box.padding", st_collections_group_parts_part_description_box_padding},
501 {"collections.group.parts.part.description.box.min", st_collections_group_parts_part_description_box_min},
502 {"collections.group.parts.part.description.table.homogeneous", st_collections_group_parts_part_description_table_homogeneous},
503 {"collections.group.parts.part.description.table.align", st_collections_group_parts_part_description_table_align},
504 {"collections.group.parts.part.description.table.padding", st_collections_group_parts_part_description_table_padding},
505 {"collections.group.parts.part.description.table.min", st_collections_group_parts_part_description_table_min},
506 {"collections.group.parts.part.description.map.perspective", st_collections_group_parts_part_description_map_perspective},
507 {"collections.group.parts.part.description.map.light", st_collections_group_parts_part_description_map_light},
508 {"collections.group.parts.part.description.map.rotation.center", st_collections_group_parts_part_description_map_rotation_center},
509 {"collections.group.parts.part.description.map.rotation.x", st_collections_group_parts_part_description_map_rotation_x},
510 {"collections.group.parts.part.description.map.rotation.y", st_collections_group_parts_part_description_map_rotation_y},
511 {"collections.group.parts.part.description.map.rotation.z", st_collections_group_parts_part_description_map_rotation_z},
512 {"collections.group.parts.part.description.map.on", st_collections_group_parts_part_description_map_on},
513 {"collections.group.parts.part.description.map.smooth", st_collections_group_parts_part_description_map_smooth},
514 {"collections.group.parts.part.description.map.alpha", st_collections_group_parts_part_description_map_alpha},
515 {"collections.group.parts.part.description.map.backface_cull", st_collections_group_parts_part_description_map_backface_cull},
516 {"collections.group.parts.part.description.map.perspective_on", st_collections_group_parts_part_description_map_perspective_on},
517 {"collections.group.parts.part.description.perspective.zplane", st_collections_group_parts_part_description_perspective_zplane},
518 {"collections.group.parts.part.description.perspective.focal", st_collections_group_parts_part_description_perspective_focal},
519 {"collections.group.parts.part.description.params.int", st_collections_group_parts_part_description_params_int},
520 {"collections.group.parts.part.description.params.double", st_collections_group_parts_part_description_params_double},
521 {"collections.group.parts.part.description.params.string", st_collections_group_parts_part_description_params_string},
522 {"collections.group.parts.part.description.params.bool", st_collections_group_parts_part_description_params_bool},
523 {"collections.group.parts.part.description.params.choice", st_collections_group_parts_part_description_params_choice},
524 {"collections.group.parts.part.description.images.image", st_images_image}, /* dup */
525 {"collections.group.parts.part.description.images.set.name", st_images_set_name},
526 {"collections.group.parts.part.description.images.set.image.image", st_images_set_image_image},
527 {"collections.group.parts.part.description.images.set.image.size", st_images_set_image_size},
528 {"collections.group.parts.part.description.font", st_fonts_font}, /* dup */
529 {"collections.group.parts.part.description.fonts.font", st_fonts_font}, /* dup */
530 {"collections.group.parts.part.description.styles.style.name", st_styles_style_name}, /* dup */
531 {"collections.group.parts.part.description.styles.style.base", st_styles_style_base}, /* dup */
532 {"collections.group.parts.part.description.styles.style.tag", st_styles_style_tag}, /* dup */
533 {"collections.group.parts.part.description.color_classes.color_class.name", st_color_class_name}, /* dup */
534 {"collections.group.parts.part.description.color_classes.color_class.color", st_color_class_color}, /* dup */
535 {"collections.group.parts.part.description.color_classes.color_class.color2", st_color_class_color2}, /* dup */
536 {"collections.group.parts.part.description.color_classes.color_class.color3", st_color_class_color3}, /* dup */
537 {"collections.group.parts.part.description.programs.image", st_images_image}, /* dup */
538 {"collections.group.parts.part.description.programs.set.name", st_images_set_name},
539 {"collections.group.parts.part.description.programs.set.image.image", st_images_set_image_image},
540 {"collections.group.parts.part.description.programs.set.image.size", st_images_set_image_size},
541 {"collections.group.parts.part.description.programs.images.image", st_images_image}, /* dup */
542 {"collections.group.parts.part.description.programs.images.set.name", st_images_set_name},
543 {"collections.group.parts.part.description.programs.images.set.image.image", st_images_set_image_image},
544 {"collections.group.parts.part.description.programs.images.set.image.size", st_images_set_image_size},
545 {"collections.group.parts.part.description.programs.font", st_fonts_font}, /* dup */
546 {"collections.group.parts.part.description.programs.fonts.font", st_fonts_font}, /* dup */
547 {"collections.group.parts.part.description.programs.program.name", st_collections_group_programs_program_name}, /* dup */
548 {"collections.group.parts.part.description.programs.program.signal", st_collections_group_programs_program_signal}, /* dup */
549 {"collections.group.parts.part.description.programs.program.source", st_collections_group_programs_program_source}, /* dup */
550 {"collections.group.parts.part.description.programs.program.in", st_collections_group_programs_program_in}, /* dup */
551 {"collections.group.parts.part.description.programs.program.action", st_collections_group_programs_program_action}, /* dup */
552 {"collections.group.parts.part.description.programs.program.transition", st_collections_group_programs_program_transition}, /* dup */
553 {"collections.group.parts.part.description.programs.program.target", st_collections_group_programs_program_target}, /* dup */
554 {"collections.group.parts.part.description.programs.program.after", st_collections_group_programs_program_after}, /* dup */
555 {"collections.group.parts.part.description.programs.program.api", st_collections_group_programs_program_api}, /* dup */
556 {"collections.group.parts.part.description.program.name", st_collections_group_programs_program_name}, /* dup */
557 {"collections.group.parts.part.description.program.signal", st_collections_group_programs_program_signal}, /* dup */
558 {"collections.group.parts.part.description.program.source", st_collections_group_programs_program_source}, /* dup */
559 {"collections.group.parts.part.description.program.in", st_collections_group_programs_program_in}, /* dup */
560 {"collections.group.parts.part.description.program.action", st_collections_group_programs_program_action}, /* dup */
561 {"collections.group.parts.part.description.program.transition", st_collections_group_programs_program_transition}, /* dup */
562 {"collections.group.parts.part.description.program.target", st_collections_group_programs_program_target}, /* dup */
563 {"collections.group.parts.part.description.program.after", st_collections_group_programs_program_after}, /* dup */
564 {"collections.group.parts.part.description.program.api", st_collections_group_programs_program_api}, /* dup */
565 {"collections.group.parts.part.programs.image", st_images_image}, /* dup */
566 {"collections.group.parts.part.programs.set.name", st_images_set_name},
567 {"collections.group.parts.part.programs.set.image.image", st_images_set_image_image},
568 {"collections.group.parts.part.programs.set.image.size", st_images_set_image_size},
569 {"collections.group.parts.part.programs.images.image", st_images_image}, /* dup */
570 {"collections.group.parts.part.programs.images.set.name", st_images_set_name},
571 {"collections.group.parts.part.programs.images.set.image.image", st_images_set_image_image},
572 {"collections.group.parts.part.programs.images.set.image.size", st_images_set_image_size},
573 {"collections.group.parts.part.programs.font", st_fonts_font}, /* dup */
574 {"collections.group.parts.part.programs.fonts.font", st_fonts_font}, /* dup */
575 {"collections.group.parts.part.programs.program.name", st_collections_group_programs_program_name}, /* dup */
576 {"collections.group.parts.part.programs.program.signal", st_collections_group_programs_program_signal}, /* dup */
577 {"collections.group.parts.part.programs.program.source", st_collections_group_programs_program_source}, /* dup */
578 {"collections.group.parts.part.programs.program.in", st_collections_group_programs_program_in}, /* dup */
579 {"collections.group.parts.part.programs.program.action", st_collections_group_programs_program_action}, /* dup */
580 {"collections.group.parts.part.programs.program.transition", st_collections_group_programs_program_transition}, /* dup */
581 {"collections.group.parts.part.programs.program.target", st_collections_group_programs_program_target}, /* dup */
582 {"collections.group.parts.part.programs.program.after", st_collections_group_programs_program_after}, /* dup */
583 {"collections.group.parts.part.programs.program.api", st_collections_group_programs_program_api}, /* dup */
584 {"collections.group.parts.part.program.name", st_collections_group_programs_program_name}, /* dup */
585 {"collections.group.parts.part.program.signal", st_collections_group_programs_program_signal}, /* dup */
586 {"collections.group.parts.part.program.source", st_collections_group_programs_program_source}, /* dup */
587 {"collections.group.parts.part.program.in", st_collections_group_programs_program_in}, /* dup */
588 {"collections.group.parts.part.program.action", st_collections_group_programs_program_action}, /* dup */
589 {"collections.group.parts.part.program.transition", st_collections_group_programs_program_transition}, /* dup */
590 {"collections.group.parts.part.program.target", st_collections_group_programs_program_target}, /* dup */
591 {"collections.group.parts.part.program.after", st_collections_group_programs_program_after}, /* dup */
592 {"collections.group.parts.part.program.api", st_collections_group_programs_program_api}, /* dup */
593 {"collections.group.parts.programs.image", st_images_image}, /* dup */
594 {"collections.group.parts.programs.set.name", st_images_set_name},
595 {"collections.group.parts.programs.set.image.image", st_images_set_image_image},
596 {"collections.group.parts.programs.set.image.size", st_images_set_image_size},
597 {"collections.group.parts.programs.images.image", st_images_image}, /* dup */
598 {"collections.group.parts.programs.images.set.name", st_images_set_name},
599 {"collections.group.parts.programs.images.set.image.image", st_images_set_image_image},
600 {"collections.group.parts.programs.images.set.image.size", st_images_set_image_size},
601 {"collections.group.parts.programs.font", st_fonts_font}, /* dup */
602 {"collections.group.parts.programs.fonts.font", st_fonts_font}, /* dup */
603 {"collections.group.parts.programs.program.name", st_collections_group_programs_program_name}, /* dup */
604 {"collections.group.parts.programs.program.signal", st_collections_group_programs_program_signal}, /* dup */
605 {"collections.group.parts.programs.program.source", st_collections_group_programs_program_source}, /* dup */
606 {"collections.group.parts.programs.program.filter", st_collections_group_programs_program_filter}, /* dup */
607 {"collections.group.parts.programs.program.in", st_collections_group_programs_program_in}, /* dup */
608 {"collections.group.parts.programs.program.action", st_collections_group_programs_program_action}, /* dup */
609 {"collections.group.parts.programs.program.transition", st_collections_group_programs_program_transition}, /* dup */
610 {"collections.group.parts.programs.program.target", st_collections_group_programs_program_target}, /* dup */
611 {"collections.group.parts.programs.program.after", st_collections_group_programs_program_after},
612 {"collections.group.parts.programs.program.api", st_collections_group_programs_program_api},
613 {"collections.group.parts.program.name", st_collections_group_programs_program_name}, /* dup */
614 {"collections.group.parts.program.signal", st_collections_group_programs_program_signal}, /* dup */
615 {"collections.group.parts.program.source", st_collections_group_programs_program_source}, /* dup */
616 {"collections.group.parts.program.filter", st_collections_group_programs_program_filter}, /* dup */
617 {"collections.group.parts.program.in", st_collections_group_programs_program_in}, /* dup */
618 {"collections.group.parts.program.action", st_collections_group_programs_program_action}, /* dup */
619 {"collections.group.parts.program.transition", st_collections_group_programs_program_transition}, /* dup */
620 {"collections.group.parts.program.target", st_collections_group_programs_program_target}, /* dup */
621 {"collections.group.parts.program.after", st_collections_group_programs_program_after}, /* dup */
622 {"collections.group.parts.program.api", st_collections_group_programs_program_api}, /* dup */
623 {"collections.group.program.name", st_collections_group_programs_program_name}, /* dup */
624 {"collections.group.program.signal", st_collections_group_programs_program_signal}, /* dup */
625 {"collections.group.program.source", st_collections_group_programs_program_source}, /* dup */
626 {"collections.group.program.filter", st_collections_group_programs_program_filter}, /* dup */
627 {"collections.group.program.in", st_collections_group_programs_program_in}, /* dup */
628 {"collections.group.program.action", st_collections_group_programs_program_action}, /* dup */
629 {"collections.group.program.transition", st_collections_group_programs_program_transition}, /* dup */
630 {"collections.group.program.target", st_collections_group_programs_program_target}, /* dup */
631 {"collections.group.program.after", st_collections_group_programs_program_after}, /* dup */
632 {"collections.group.program.api", st_collections_group_programs_program_api}, /* dup */
633 {"collections.group.programs.program.name", st_collections_group_programs_program_name},
634 {"collections.group.programs.program.signal", st_collections_group_programs_program_signal},
635 {"collections.group.programs.program.source", st_collections_group_programs_program_source},
636 {"collections.group.programs.program.filter", st_collections_group_programs_program_filter}, /* dup */
637 {"collections.group.programs.program.in", st_collections_group_programs_program_in},
638 {"collections.group.programs.program.action", st_collections_group_programs_program_action},
639 {"collections.group.programs.program.transition", st_collections_group_programs_program_transition},
640 {"collections.group.programs.program.target", st_collections_group_programs_program_target},
641 {"collections.group.programs.program.after", st_collections_group_programs_program_after},
642 {"collections.group.programs.program.api", st_collections_group_programs_program_api},
643 {"collections.group.programs.image", st_images_image}, /* dup */
644 {"collections.group.programs.set.name", st_images_set_name},
645 {"collections.group.programs.set.image.image", st_images_set_image_image},
646 {"collections.group.programs.set.image.size", st_images_set_image_size},
647 {"collections.group.programs.images.image", st_images_image}, /* dup */
648 {"collections.group.programs.images.set.name", st_images_set_name},
649 {"collections.group.programs.images.set.image.image", st_images_set_image_image},
650 {"collections.group.programs.images.set.image.size", st_images_set_image_size},
651 {"collections.group.programs.font", st_fonts_font}, /* dup */
652 {"collections.group.programs.fonts.font", st_fonts_font} /* dup */
653};
654
655New_Object_Handler object_handlers[] =
656{
657 {"externals", NULL},
658 {"images", NULL},
659 {"images.set", ob_images_set},
660 {"images.set.image", ob_images_set_image},
661 {"fonts", NULL},
662 {"data", NULL},
663 {"styles", NULL},
664 {"styles.style", ob_styles_style},
665 {"color_classes", NULL},
666 {"color_classes.color_class", ob_color_class},
667 {"spectra", NULL},
668 {"collections", ob_collections},
669 {"collections.externals", NULL}, /* dup */
670 {"collections.set", ob_images_set}, /* dup */
671 {"collections.set.image", ob_images_set_image}, /* dup */
672 {"collections.images", NULL}, /* dup */
673 {"collections.images.set", ob_images_set}, /* dup */
674 {"collections.images.set.image", ob_images_set_image}, /* dup */
675 {"collections.fonts", NULL}, /* dup */
676 {"collections.styles", NULL}, /* dup */
677 {"collections.styles.style", ob_styles_style}, /* dup */
678 {"collections.color_classes", NULL}, /* dup */
679 {"collections.color_classes.color_class", ob_color_class}, /* dup */
680 {"collections.sounds", NULL},
681 {"collections.group.sounds", NULL}, /* dup */
682 {"collections.sounds.sample", NULL},
683 {"collections.group.sounds.sample", NULL}, /* dup */
684 {"collections.group", ob_collections_group},
685 {"collections.group.data", NULL},
686 {"collections.group.limits", NULL},
687 {"collections.group.script", ob_collections_group_script},
688 {"collections.group.lua_script", ob_collections_group_lua_script},
689 {"collections.group.externals", NULL}, /* dup */
690 {"collections.group.set", ob_images_set}, /* dup */
691 {"collections.group.set.image", ob_images_set_image}, /* dup */
692 {"collections.group.images", NULL}, /* dup */
693 {"collections.group.images.set", ob_images_set}, /* dup */
694 {"collections.group.images.set.image", ob_images_set_image}, /* dup */
695 {"collections.group.fonts", NULL}, /* dup */
696 {"collections.group.styles", NULL}, /* dup */
697 {"collections.group.styles.style", ob_styles_style}, /* dup */
698 {"collections.group.color_classes", NULL}, /* dup */
699 {"collections.group.color_classes.color_class", ob_color_class}, /* dup */
700 {"collections.group.parts", NULL},
701 {"collections.group.parts.set", ob_images_set}, /* dup */
702 {"collections.group.parts.set.image", ob_images_set_image}, /* dup */
703 {"collections.group.parts.images", NULL}, /* dup */
704 {"collections.group.parts.images.set", ob_images_set}, /* dup */
705 {"collections.group.parts.images.set.image", ob_images_set_image}, /* dup */
706 {"collections.group.parts.fonts", NULL}, /* dup */
707 {"collections.group.parts.styles", NULL}, /* dup */
708 {"collections.group.parts.styles.style", ob_styles_style}, /* dup */
709 {"collections.group.parts.color_classes", NULL}, /* dup */
710 {"collections.group.parts.color_classes.color_class", ob_color_class}, /* dup */
711 {"collections.group.parts.part", ob_collections_group_parts_part},
712 {"collections.group.parts.part.dragable", NULL},
713 {"collections.group.parts.part.set", ob_images_set}, /* dup */
714 {"collections.group.parts.part.set.image", ob_images_set_image}, /* dup */
715 {"collections.group.parts.part.images", NULL}, /* dup */
716 {"collections.group.parts.part.images.set", ob_images_set}, /* dup */
717 {"collections.group.parts.part.images.set.image", ob_images_set_image}, /* dup */
718 {"collections.group.parts.part.fonts", NULL}, /* dup */
719 {"collections.group.parts.part.styles", NULL}, /* dup */
720 {"collections.group.parts.part.styles.style", ob_styles_style}, /* dup */
721 {"collections.group.parts.part.color_classes", NULL}, /* dup */
722 {"collections.group.parts.part.color_classes.color_class", ob_color_class}, /* dup */
723 {"collections.group.parts.part.box", NULL},
724 {"collections.group.parts.part.box.items", NULL},
725 {"collections.group.parts.part.box.items.item", ob_collections_group_parts_part_box_items_item},
726 {"collections.group.parts.part.table", NULL},
727 {"collections.group.parts.part.table.items", NULL},
728 {"collections.group.parts.part.table.items.item", ob_collections_group_parts_part_box_items_item}, /* dup */
729 {"collections.group.parts.part.description", ob_collections_group_parts_part_description},
730 {"collections.group.parts.part.description.rel1", NULL},
731 {"collections.group.parts.part.description.rel2", NULL},
732 {"collections.group.parts.part.description.image", NULL}, /* dup */
733 {"collections.group.parts.part.description.image.set", ob_images_set}, /* dup */
734 {"collections.group.parts.part.description.image.set.image", ob_images_set_image}, /* dup */
735 {"collections.group.parts.part.description.image.images", NULL}, /* dup */
736 {"collections.group.parts.part.description.image.images.set", ob_images_set}, /* dup */
737 {"collections.group.parts.part.description.image.images.set.image", ob_images_set_image}, /* dup */
738 {"collections.group.parts.part.description.fill", NULL},
739 {"collections.group.parts.part.description.fill.origin", NULL},
740 {"collections.group.parts.part.description.fill.size", NULL},
741 {"collections.group.parts.part.description.text", NULL},
742 {"collections.group.parts.part.description.text.fonts", NULL}, /* dup */
743 {"collections.group.parts.part.description.images", NULL}, /* dup */
744 {"collections.group.parts.part.description.images.set", ob_images_set}, /* dup */
745 {"collections.group.parts.part.description.images.set.image", ob_images_set_image}, /* dup */
746 {"collections.group.parts.part.description.fonts", NULL}, /* dup */
747 {"collections.group.parts.part.description.styles", NULL}, /* dup */
748 {"collections.group.parts.part.description.styles.style", ob_styles_style}, /* dup */
749 {"collections.group.parts.part.description.box", NULL},
750 {"collections.group.parts.part.description.table", NULL},
751 {"collections.group.parts.part.description.map", NULL},
752 {"collections.group.parts.part.description.map.rotation", NULL},
753 {"collections.group.parts.part.description.perspective", NULL},
754 {"collections.group.parts.part.description.params", NULL},
755 {"collections.group.parts.part.description.color_classes", NULL}, /* dup */
756 {"collections.group.parts.part.description.color_classes.color_class", ob_color_class}, /* dup */
757 {"collections.group.parts.part.description.program", ob_collections_group_programs_program}, /* dup */
758 {"collections.group.parts.part.description.program.script", ob_collections_group_programs_program_script}, /* dup */
759 {"collections.group.parts.part.description.programs", NULL}, /* dup */
760 {"collections.group.parts.part.description.programs.set", ob_images_set}, /* dup */
761 {"collections.group.parts.part.description.programs.set.image", ob_images_set_image}, /* dup */
762 {"collections.group.parts.part.description.programs.images", NULL}, /* dup */
763 {"collections.group.parts.part.description.programs.images.set", ob_images_set},
764 {"collections.group.parts.part.description.programs.images.set.image", ob_images_set_image}, /* dup */
765 {"collections.group.parts.part.description.programs.fonts", NULL}, /* dup */
766 {"collections.group.parts.part.description.programs.program", ob_collections_group_programs_program}, /* dup */
767 {"collections.group.parts.part.description.programs.program.script", ob_collections_group_programs_program_script}, /* dup */
768 {"collections.group.parts.part.description.script", ob_collections_group_script}, /* dup */
769 {"collections.group.parts.part.program", ob_collections_group_programs_program}, /* dup */
770 {"collections.group.parts.part.program.script", ob_collections_group_programs_program_script}, /* dup */
771 {"collections.group.parts.part.programs", NULL}, /* dup */
772 {"collections.group.parts.part.programs.set", ob_images_set}, /* dup */
773 {"collections.group.parts.part.programs.set.image", ob_images_set_image}, /* dup */
774 {"collections.group.parts.part.programs.images", NULL}, /* dup */
775 {"collections.group.parts.part.programs.images.set", ob_images_set}, /* dup */
776 {"collections.group.parts.part.programs.images.set.image", ob_images_set_image}, /* dup */
777 {"collections.group.parts.part.programs.fonts", NULL}, /* dup */
778 {"collections.group.parts.part.programs.program", ob_collections_group_programs_program}, /* dup */
779 {"collections.group.parts.part.programs.program.script", ob_collections_group_programs_program_script}, /* dup */
780 {"collections.group.parts.part.script", ob_collections_group_script}, /* dup */
781 {"collections.group.parts.program", ob_collections_group_programs_program}, /* dup */
782 {"collections.group.parts.program.script", ob_collections_group_programs_program_script}, /* dup */
783 {"collections.group.parts.programs", NULL}, /* dup */
784 {"collections.group.parts.programs.set", ob_images_set}, /* dup */
785 {"collections.group.parts.programs.set.image", ob_images_set_image}, /* dup */
786 {"collections.group.parts.programs.images", NULL}, /* dup */
787 {"collections.group.parts.programs.images.set", ob_images_set}, /* dup */
788 {"collections.group.parts.programs.images.set.image", ob_images_set_image}, /* dup */
789 {"collections.group.parts.programs.fonts", NULL}, /* dup */
790 {"collections.group.parts.programs.program", ob_collections_group_programs_program}, /* dup */
791 {"collections.group.parts.programs.program.script", ob_collections_group_programs_program_script}, /* dup */
792 {"collections.group.parts.script", ob_collections_group_script}, /* dup */
793 {"collections.group.program", ob_collections_group_programs_program}, /* dup */
794 {"collections.group.program.script", ob_collections_group_programs_program_script}, /* dup */
795 {"collections.group.programs", NULL},
796 {"collections.group.programs.set", ob_images_set}, /* dup */
797 {"collections.group.programs.set.image", ob_images_set_image}, /* dup */
798 {"collections.group.programs.images", NULL}, /* dup */
799 {"collections.group.programs.images.set", ob_images_set}, /* dup */
800 {"collections.group.programs.images.set.image", ob_images_set_image}, /* dup */
801 {"collections.group.programs.fonts", NULL}, /* dup */
802 {"collections.group.programs.program", ob_collections_group_programs_program},
803 {"collections.group.programs.program.script", ob_collections_group_programs_program_script},
804 {"collections.group.programs.script", ob_collections_group_script} /* dup */
805};
806
807/*****/
808
809int
810object_handler_num(void)
811{
812 return sizeof(object_handlers) / sizeof (New_Object_Handler);
813}
814
815int
816statement_handler_num(void)
817{
818 return sizeof(statement_handlers) / sizeof (New_Object_Handler);
819}
820
821static void
822_edje_part_description_fill(Edje_Part_Description_Spec_Fill *fill)
823{
824 fill->smooth = 1;
825 fill->pos_rel_x = FROM_DOUBLE(0.0);
826 fill->pos_abs_x = 0;
827 fill->rel_x = FROM_DOUBLE(1.0);
828 fill->abs_x = 0;
829 fill->pos_rel_y = FROM_DOUBLE(0.0);
830 fill->pos_abs_y = 0;
831 fill->rel_y = FROM_DOUBLE(1.0);
832 fill->abs_y = 0;
833 fill->angle = 0;
834 fill->spread = 0;
835 fill->type = EDJE_FILL_TYPE_SCALE;
836}
837
838static void
839_edje_part_description_image_remove(Edje_Part_Description_Image *ed)
840{
841 unsigned int j;
842
843 if (!ed) return;
844
845 data_queue_image_remove(&(ed->image.id), &(ed->image.set));
846
847 for (j = 0; j < ed->image.tweens_count; ++j)
848 data_queue_image_remove(&(ed->image.tweens[j]->id),
849 &(ed->image.tweens[j]->set));
850}
851
852void
853part_description_image_cleanup(Edje_Part *ep)
854{
855 Edje_Part_Description_Image *ed;
856 unsigned int j;
857
858 if (ep->type != EDJE_PART_TYPE_IMAGE)
859 return ;
860
861 ed = (Edje_Part_Description_Image*) ep->default_desc;
862 _edje_part_description_image_remove(ed);
863
864 for (j = 0; j < ep->other.desc_count; j++)
865 {
866 ed = (Edje_Part_Description_Image*) ep->other.desc[j];
867 _edje_part_description_image_remove(ed);
868 }
869}
870
871static Edje_Part_Description_Common *
872_edje_part_description_alloc(unsigned char type, const char *collection, const char *part)
873{
874 Edje_Part_Description_Common *result = NULL;
875
876 switch (type)
877 {
878 case EDJE_PART_TYPE_RECTANGLE:
879 case EDJE_PART_TYPE_SWALLOW:
880 case EDJE_PART_TYPE_GROUP:
881 result = mem_alloc(SZ(Edje_Part_Description_Common));
882 break;
883 case EDJE_PART_TYPE_TEXT:
884 case EDJE_PART_TYPE_TEXTBLOCK:
885 {
886 Edje_Part_Description_Text *ed;
887
888 ed = mem_alloc(SZ(Edje_Part_Description_Text));
889
890 ed->text.color3.r = 0;
891 ed->text.color3.g = 0;
892 ed->text.color3.b = 0;
893 ed->text.color3.a = 128;
894 ed->text.align.x = FROM_DOUBLE(0.5);
895 ed->text.align.y = FROM_DOUBLE(0.5);
896 ed->text.id_source = -1;
897 ed->text.id_text_source = -1;
898
899 result = &ed->common;
900 break;
901 }
902 case EDJE_PART_TYPE_IMAGE:
903 {
904 Edje_Part_Description_Image *ed;
905
906 ed = mem_alloc(SZ(Edje_Part_Description_Image));
907
908 ed->image.id = -1;
909
910 _edje_part_description_fill(&ed->image.fill);
911
912 result = &ed->common;
913 break;
914 }
915 case EDJE_PART_TYPE_PROXY:
916 {
917 Edje_Part_Description_Proxy *ed;
918
919 ed = mem_alloc(SZ(Edje_Part_Description_Proxy));
920
921 ed->proxy.id = -1;
922
923 _edje_part_description_fill(&ed->proxy.fill);
924
925 result = &ed->common;
926 break;
927 }
928 case EDJE_PART_TYPE_BOX:
929 {
930 Edje_Part_Description_Box *ed;
931
932 ed = mem_alloc(SZ(Edje_Part_Description_Box));
933
934 ed->box.layout = NULL;
935 ed->box.alt_layout = NULL;
936 ed->box.align.x = FROM_DOUBLE(0.5);
937 ed->box.align.y = FROM_DOUBLE(0.5);
938 ed->box.padding.x = 0;
939 ed->box.padding.y = 0;
940
941 result = &ed->common;
942 break;
943 }
944 case EDJE_PART_TYPE_TABLE:
945 {
946 Edje_Part_Description_Table *ed;
947
948 ed = mem_alloc(SZ(Edje_Part_Description_Table));
949
950 ed->table.homogeneous = EDJE_OBJECT_TABLE_HOMOGENEOUS_NONE;
951 ed->table.align.x = FROM_DOUBLE(0.5);
952 ed->table.align.y = FROM_DOUBLE(0.5);
953 ed->table.padding.x = 0;
954 ed->table.padding.y = 0;
955
956 result = &ed->common;
957 break;
958 }
959 case EDJE_PART_TYPE_EXTERNAL:
960 {
961 Edje_Part_Description_External *ed;
962
963 ed = mem_alloc(SZ(Edje_Part_Description_External));
964
965 ed->external_params = NULL;
966
967 result = &ed->common;
968 break;
969 }
970 }
971
972 if (!result)
973 {
974 ERR("%s: Error. Unknown type %i of part %s in collection %s.", progname, type, part, collection);
975 exit(-1);
976 }
977
978 return result;
979}
980
981static void
982_edje_program_check(const char *name, Edje_Program *me, Edje_Program **pgrms, unsigned int count)
983{
984 Edje_Part_Collection *pc;
985 unsigned int i;
986 Edje_Program_Parser *epp;
987
988 pc = eina_list_data_get(eina_list_last(edje_collections));
989
990 for (i = 0; i < count; ++i)
991 if (pgrms[i]->name)
992 if (pgrms[i] != me && (!strcmp(name, pgrms[i]->name)))
993 {
994 epp = (Edje_Program_Parser *)pgrms[i];
995 if (!epp->can_override)
996 {
997 ERR("%s: Error. parse error %s:%i. There is already a program of the name %s\n",
998 progname, file_in, line - 1, name);
999 exit(-1);
1000 }
1001 else
1002 {
1003 _edje_program_remove(pc, me);
1004 current_program = pgrms[i];
1005 epp->can_override = EINA_FALSE;
1006 return;
1007 }
1008 }
1009}
1010
1011static void
1012_edje_program_copy(Edje_Program *ep, Edje_Program *ep2)
1013{
1014 Edje_Part_Collection *pc;
1015 Edje_Program_Target *et, *et2;
1016 Edje_Program_After *pa, *pa2;
1017 Edje_Program_Parser *epp;
1018 Eina_List *l;
1019 char *name;
1020 char *copy;
1021
1022 pc = eina_list_data_get(eina_list_last(edje_collections));
1023
1024 #define STRDUP(x) x ? strdup(x) : NULL
1025 ep->name = STRDUP(ep2->name);
1026
1027 _edje_program_remove(pc, current_program);
1028 ep->signal = STRDUP(ep2->signal);
1029 ep->source = STRDUP(ep2->source);
1030 _edje_program_insert(pc, current_program);
1031
1032 ep->filter.part = STRDUP(ep2->filter.part);
1033 ep->filter.state = STRDUP(ep2->filter.state);
1034 ep->in.from = ep2->in.from;
1035 ep->in.range = ep2->in.range;
1036 ep->action = ep2->action;
1037 ep->state = STRDUP(ep2->state);
1038 ep->state2 = STRDUP(ep2->state2);
1039 ep->value = ep2->value;
1040 ep->value2 = ep2->value2;
1041 ep->tween.mode = ep2->tween.mode;
1042 ep->tween.time = ep2->tween.time;
1043 ep->tween.v1 = ep2->tween.v1;
1044 ep->tween.v2 = ep2->tween.v2;
1045
1046 EINA_LIST_FOREACH(ep2->targets, l, et2)
1047 {
1048 name = (char*) (et2 + 1);
1049 et = mem_alloc(SZ(Edje_Program_Target) + strlen(name) + 1);
1050 ep->targets = eina_list_append(ep->targets, et);
1051 copy = (char*) (et + 1);
1052
1053 memcpy(copy, name, strlen(name) + 1);
1054
1055 if (ep2->action == EDJE_ACTION_TYPE_STATE_SET)
1056 data_queue_copied_part_lookup(pc, &(et2->id), &(et->id));
1057 else if (ep2->action == EDJE_ACTION_TYPE_ACTION_STOP)
1058 data_queue_copied_program_lookup(pc, &(et2->id), &(et->id));
1059 else if (ep2->action == EDJE_ACTION_TYPE_DRAG_VAL_SET)
1060 data_queue_copied_part_lookup(pc, &(et2->id), &(et->id));
1061 else if (ep2->action == EDJE_ACTION_TYPE_DRAG_VAL_STEP)
1062 data_queue_copied_part_lookup(pc, &(et2->id), &(et->id));
1063 else if (ep2->action == EDJE_ACTION_TYPE_DRAG_VAL_PAGE)
1064 data_queue_copied_part_lookup(pc, &(et2->id), &(et->id));
1065 else if (ep2->action == EDJE_ACTION_TYPE_FOCUS_SET)
1066
1067 data_queue_copied_part_lookup(pc, &(et2->id), &(et->id));
1068 else if (ep2->action == EDJE_ACTION_TYPE_FOCUS_OBJECT)
1069 data_queue_copied_part_lookup(pc, &(et2->id), &(et->id));
1070 else
1071 {
1072 ERR("%s: Error. parse error %s:%i. "
1073 "target may only be used after action",
1074 progname, file_in, line - 1);
1075 exit(-1);
1076 }
1077 }
1078
1079 EINA_LIST_FOREACH(ep2->after, l, pa2)
1080 {
1081 pa = mem_alloc(SZ(Edje_Program_After));
1082 ep->after = eina_list_append(ep->after, pa);
1083
1084 data_queue_copied_program_lookup(pc, &(pa2->id), &(pa->id));
1085 }
1086
1087 ep->api.name = STRDUP(ep2->api.name);
1088 ep->api.description = STRDUP(ep2->api.description);
1089 data_queue_copied_part_lookup(pc, &(ep2->param.src), &(ep->param.src));
1090 data_queue_copied_part_lookup(pc, &(ep2->param.dst), &(ep->param.dst));
1091
1092 epp = (Edje_Program_Parser *)ep;
1093 epp->can_override = EINA_TRUE;
1094
1095 #undef STRDUP
1096}
1097
1098/*****/
1099
1100/**
1101 @edcsection{toplevel,Top-Level blocks}
1102 */
1103
1104/**
1105 @page edcref
1106
1107 @block
1108 externals
1109 @context
1110 externals {
1111 external: "name";
1112 }
1113 @description
1114 The "externals" block is used to list each external module file that will be used in others
1115 programs.
1116 @endblock
1117
1118 @property
1119 external
1120 @parameters
1121 [external filename]
1122 @effect
1123 Used to add a file to the externals list.
1124 @endproperty
1125 */
1126static void
1127st_externals_external(void)
1128{
1129 External *ex;
1130
1131 check_arg_count(1);
1132
1133 if (!edje_file->external_dir)
1134 edje_file->external_dir = mem_alloc(SZ(Edje_External_Directory));
1135
1136 ex = mem_alloc(SZ(External));
1137 ex->name = parse_str(0);
1138 {
1139 Eina_List *l;
1140 External *lex;
1141
1142 EINA_LIST_FOREACH(externals, l, lex)
1143 {
1144 if (!strcmp(lex->name, ex->name))
1145 {
1146 free(ex->name);
1147 free(ex);
1148 return;
1149 }
1150 }
1151 }
1152 externals = eina_list_append(externals, ex);
1153
1154 if (edje_file->external_dir)
1155 {
1156 edje_file->external_dir->entries_count++;
1157 edje_file->external_dir->entries = realloc(edje_file->external_dir->entries,
1158 sizeof (Edje_External_Directory) * edje_file->external_dir->entries_count);
1159 memset(edje_file->external_dir->entries + edje_file->external_dir->entries_count - 1,
1160 0, sizeof (Edje_External_Directory));
1161 if (!edje_file->external_dir->entries)
1162 {
1163 ERR("%s: Error. not enough memory", progname);
1164 exit(-1);
1165 }
1166
1167 edje_file->external_dir->entries[edje_file->external_dir->entries_count - 1].entry = mem_strdup(ex->name);
1168 }
1169}
1170
1171/**
1172 @page edcref
1173
1174 @block
1175 images
1176 @context
1177 images {
1178 image: "filename1.ext" COMP;
1179 image: "filename2.ext" LOSSY 99;
1180 set {
1181 name: "image_name_used";
1182 image {
1183 image: "filename3.ext" LOSSY 90;
1184 size: 201 201 500 500;
1185 }
1186 image {
1187 image: "filename4.ext" COMP;
1188 size: 51 51 200 200;
1189 }
1190 image {
1191 image: "filename5.ext" COMP;
1192 size: 11 11 50 50;
1193 }
1194 image {
1195 image: "filename6.ext" RAW;
1196 size: 0 0 10 10;
1197 }
1198 }
1199 ..
1200 }
1201 @description
1202 The "images" block is used to list each image file that will be used in
1203 the theme along with its compression method (if any).
1204 Besides the document's root, additional "images" blocks can be
1205 included inside other blocks, normally "collections", "group" and
1206 "part", easing maintenance of the file list when the theme is split
1207 among multiple files.
1208 @endblock
1209
1210 @property
1211 image
1212 @parameters
1213 [image file] [compression method] (compression level)
1214 @effect
1215 Used to include each image file. The full path to the directory holding
1216 the images can be defined later with edje_cc's "-id" option.
1217 Compression methods:
1218 @li RAW: Uncompressed.
1219 @li COMP: Lossless compression.
1220 @li LOSSY [0-100]: Lossy comression with quality from 0 to 100.
1221 @li USER: Do not embed the file, refer to the external file instead.
1222 @endproperty
1223 */
1224static void
1225st_images_image(void)
1226{
1227 Edje_Image_Directory_Entry *img;
1228 const char *tmp;
1229 unsigned int i;
1230 int v;
1231
1232 if (!edje_file->image_dir)
1233 edje_file->image_dir = mem_alloc(SZ(Edje_Image_Directory));
1234
1235 tmp = parse_str(0);
1236
1237 for (i = 0; i < edje_file->image_dir->entries_count; ++i)
1238 if (!strcmp(edje_file->image_dir->entries[i].entry, tmp))
1239 {
1240 free((char*) tmp);
1241 return;
1242 }
1243
1244 edje_file->image_dir->entries_count++;
1245 edje_file->image_dir->entries = realloc(edje_file->image_dir->entries,
1246 sizeof (Edje_Image_Directory_Entry) * edje_file->image_dir->entries_count);
1247 memset(edje_file->image_dir->entries + edje_file->image_dir->entries_count - 1,
1248 0, sizeof (Edje_Image_Directory_Entry));
1249 if (!edje_file->image_dir->entries)
1250 {
1251 ERR("%s: Error. No enough memory.", progname);
1252 exit(-1);
1253 }
1254
1255 img = edje_file->image_dir->entries + edje_file->image_dir->entries_count - 1;
1256
1257 img->entry = tmp;
1258 img->id = edje_file->image_dir->entries_count - 1;
1259 v = parse_enum(1,
1260 "RAW", 0,
1261 "COMP", 1,
1262 "LOSSY", 2,
1263 "USER", 3,
1264 NULL);
1265 if (v == 0)
1266 {
1267 img->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT;
1268 img->source_param = 0;
1269 }
1270 else if (v == 1)
1271 {
1272 img->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT;
1273 img->source_param = 1;
1274 }
1275 else if (v == 2)
1276 {
1277 img->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY;
1278 img->source_param = 0;
1279 }
1280 else if (v == 3)
1281 {
1282 img->source_type = EDJE_IMAGE_SOURCE_TYPE_EXTERNAL;
1283 img->source_param = 0;
1284 }
1285 if (img->source_type != EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY)
1286 check_arg_count(2);
1287 else
1288 {
1289 img->source_param = parse_int_range(2, 0, 100);
1290 check_arg_count(3);
1291 }
1292}
1293
1294/**
1295 @page edcref
1296
1297 @block
1298 set
1299 @context
1300 set {
1301 name: "image_name_used";
1302 image {
1303 image: "filename3.ext" LOSSY 90;
1304 size: 201 201 500 500;
1305 }
1306 image {
1307 image: "filename4.ext" COMP;
1308 size: 51 51 200 200;
1309 }
1310 image {
1311 image: "filename5.ext" COMP;
1312 size: 11 11 50 50;
1313 }
1314 image {
1315 image: "filename6.ext" RAW;
1316 size: 0 0 10 10;
1317 }
1318 }
1319 @description
1320 The "set" block is used to define an image with different content depending on their size.
1321 Besides the document's root, additional "set" blocks can be
1322 included inside other blocks, normally "collections", "group" and
1323 "part", easing maintenance of the file list when the theme is split
1324 among multiple files.
1325 @endblock
1326 */
1327static void
1328ob_images_set(void)
1329{
1330 if (!edje_file->image_dir)
1331 edje_file->image_dir = mem_alloc(SZ(Edje_Image_Directory));
1332
1333 edje_file->image_dir->sets_count++;
1334 edje_file->image_dir->sets = realloc(edje_file->image_dir->sets,
1335 sizeof (Edje_Image_Directory_Set) * edje_file->image_dir->sets_count);
1336 memset(edje_file->image_dir->sets + edje_file->image_dir->sets_count - 1,
1337 0, sizeof (Edje_Image_Directory_Set));
1338 if (!edje_file->image_dir->sets)
1339 {
1340 ERR("%s: Error. Not enough memory.", progname);
1341 exit(-1);
1342 }
1343 edje_file->image_dir->sets[edje_file->image_dir->sets_count - 1].id = edje_file->image_dir->sets_count - 1;
1344}
1345
1346/**
1347 @page edcref
1348
1349 @property
1350 name
1351 @parameters
1352 [image name]
1353 @effect
1354 Define the name that refer to this image description.
1355 @endproperty
1356*/
1357static void
1358st_images_set_name(void)
1359{
1360 check_arg_count(1);
1361
1362 edje_file->image_dir->sets[edje_file->image_dir->sets_count - 1].name = parse_str(0);
1363}
1364
1365static void
1366ob_images_set_image(void)
1367{
1368 Edje_Image_Directory_Set_Entry *entry;
1369 Edje_Image_Directory_Set *set;
1370
1371 set = edje_file->image_dir->sets + edje_file->image_dir->sets_count - 1;
1372
1373 entry = mem_alloc(SZ(Edje_Image_Directory_Set_Entry));
1374
1375 set->entries = eina_list_append(set->entries, entry);
1376}
1377
1378static void
1379st_images_set_image_image(void)
1380{
1381 Edje_Image_Directory_Set_Entry *entry;
1382 Edje_Image_Directory_Set *set;
1383 unsigned int i;
1384
1385 set = edje_file->image_dir->sets + edje_file->image_dir->sets_count - 1;
1386 entry = eina_list_data_get(eina_list_last(set->entries));
1387
1388 /* Add the image to the global pool with the same syntax. */
1389 st_images_image();
1390
1391 entry->name = parse_str(0);
1392
1393 for (i = 0; i < edje_file->image_dir->entries_count; ++i)
1394 if (!strcmp(edje_file->image_dir->entries[i].entry, entry->name))
1395 {
1396 entry->id = i;
1397 return;
1398 }
1399}
1400
1401/**
1402 @page edcref
1403
1404 @property
1405 size
1406 @parameters
1407 [minw minh maxw mawh]
1408 @effect
1409 Define the minimal and maximal size that will select the specified image.
1410 @endproperty
1411*/
1412static void
1413st_images_set_image_size(void)
1414{
1415 Edje_Image_Directory_Set_Entry *entry;
1416 Edje_Image_Directory_Set *set;
1417
1418 set = edje_file->image_dir->sets + edje_file->image_dir->sets_count - 1;
1419 entry = eina_list_data_get(eina_list_last(set->entries));
1420
1421 entry->size.min.w = parse_int(0);
1422 entry->size.min.h = parse_int(1);
1423 entry->size.max.w = parse_int(2);
1424 entry->size.max.h = parse_int(3);
1425
1426 if (entry->size.min.w > entry->size.max.w
1427 || entry->size.min.h > entry->size.max.h)
1428 {
1429 ERR("%s: Error. parse error %s:%i. Image min and max size are not in the right order ([%i, %i] < [%i, %i])",
1430 progname, file_in, line - 1,
1431 entry->size.min.w, entry->size.min.h,
1432 entry->size.max.w, entry->size.max.h);
1433 exit(-1);
1434 }
1435}
1436
1437/**
1438 @page edcref
1439
1440 @block
1441 fonts
1442 @context
1443 fonts {
1444 font: "filename1.ext" "fontname";
1445 font: "filename2.ext" "otherfontname";
1446 ..
1447 }
1448 @description
1449 The "fonts" block is used to list each font file with an alias used later
1450 in the theme. As with the "images" block, additional "fonts" blocks can
1451 be included inside other blocks.
1452 @endblock
1453
1454 @property
1455 font
1456 @parameters
1457 [font filename] [font alias]
1458 @effect
1459 Defines each font "file" and "alias", the full path to the directory
1460 holding the font files can be defined with edje_cc's "-fd" option.
1461 @endproperty
1462 */
1463static void
1464st_fonts_font(void)
1465{
1466 Font *fn;
1467
1468 check_arg_count(2);
1469
1470 if (!edje_file->fonts)
1471 edje_file->fonts = eina_hash_string_small_new(free);
1472
1473 fn = mem_alloc(SZ(Font));
1474 fn->file = parse_str(0);
1475 fn->name = parse_str(1);
1476
1477 if (eina_hash_find(edje_file->fonts, fn->name))
1478 {
1479 free(fn->file);
1480 free(fn->name);
1481 free(fn);
1482 return;
1483 }
1484
1485 eina_hash_direct_add(edje_file->fonts, fn->name, fn);
1486}
1487
1488/**
1489 @page edcref
1490 @block
1491 data
1492 @context
1493 data {
1494 item: "key" "value";
1495 file: "otherkey" "filename.ext";
1496 ..
1497 }
1498 @description
1499 The "data" block is used to pass arbitrary parameters from the theme to
1500 the application. Unlike the "images" and "fonts" blocks, additional
1501 "data" blocks can only be included inside the "group" block.
1502 @endblock
1503
1504 @property
1505 item
1506 @parameters
1507 [parameter name] [parameter value]
1508 @effect
1509 Defines a new parameter, the value will be the string specified next to
1510 it.
1511 @endproperty
1512 */
1513static void
1514st_data_item(void)
1515{
1516 Edje_String *es;
1517 char *key;
1518
1519 check_arg_count(2);
1520
1521 key = parse_str(0);
1522
1523 es = mem_alloc(SZ(Edje_String));
1524 es->str = parse_str(1);
1525
1526 if (!edje_file->data)
1527 edje_file->data = eina_hash_string_small_new(free);
1528
1529 /* FIXME: check if data already exist */
1530 eina_hash_direct_add(edje_file->data, key, es);
1531}
1532
1533/**
1534 @page edcref
1535 @property
1536 file
1537 @parameters
1538 [parameter name] [parameter filename]
1539 @effect
1540 Defines a new parameter , the value will be the contents of the
1541 specified file formated as a single string of text. This property only
1542 works with plain text files.
1543 @endproperty
1544 */
1545static void
1546st_data_file(void)
1547{
1548 const char *data;
1549 const char *over;
1550 Edje_String *es;
1551 char *filename;
1552 char *value;
1553 char *key;
1554 int fd;
1555 int i;
1556 struct stat buf;
1557
1558 check_arg_count(2);
1559
1560 key = parse_str(0);
1561
1562 es = mem_alloc(SZ(Edje_String));
1563 filename = parse_str(1);
1564
1565 fd = open(filename, O_RDONLY | O_BINARY, S_IRUSR | S_IWUSR);
1566 if (fd < 0)
1567 {
1568 ERR("%s: Error. %s:%i when opening file \"%s\": \"%s\"",
1569 progname, file_in, line, filename, strerror(errno));
1570 exit(-1);
1571 }
1572
1573 if (fstat(fd, &buf))
1574 {
1575 ERR("%s: Error. %s:%i when stating file \"%s\": \"%s\"",
1576 progname, file_in, line, filename, strerror(errno));
1577 exit(-1);
1578 }
1579
1580 data = mmap(NULL, buf.st_size, PROT_READ, MAP_SHARED, fd, 0);
1581 if (data == MAP_FAILED)
1582 {
1583 ERR("%s: Error. %s:%i when mapping file \"%s\": \"%s\"",
1584 progname, file_in, line, filename, strerror(errno));
1585 exit(-1);
1586 }
1587
1588 over = data;
1589 for (i = 0; i < buf.st_size; ++i, ++over)
1590 if (*over == '\0')
1591 {
1592 ERR("%s: Error. %s:%i file \"%s\" is a binary file.",
1593 progname, file_in, line, filename);
1594 exit(-1);
1595 }
1596
1597 value = malloc(sizeof (char) * buf.st_size + 1);
1598 snprintf(value, buf.st_size + 1, "%s", data);
1599
1600 munmap((void*)data, buf.st_size);
1601 close(fd);
1602
1603 es->str = value;
1604
1605 eina_hash_direct_add(edje_file->data, key, es);
1606
1607 free(filename);
1608}
1609
1610/**
1611 @page edcref
1612 @block
1613 color_classes
1614 @context
1615 color_classes {
1616 color_class {
1617 name: "colorclassname";
1618 color: [0-255] [0-255] [0-255] [0-255];
1619 color2: [0-255] [0-255] [0-255] [0-255];
1620 color3: [0-255] [0-255] [0-255] [0-255]
1621 }
1622 ..
1623 }
1624 @description
1625 The "color_classes" block contains a list of one or more "color_class"
1626 blocks. Each "color_class" allows the designer to name an arbitrary
1627 group of colors to be used in the theme, the application can use that
1628 name to alter the color values at runtime.
1629 @endblock
1630*/
1631static void
1632ob_color_class(void)
1633{
1634 Edje_Color_Class *cc;
1635
1636 cc = mem_alloc(SZ(Edje_Color_Class));
1637 edje_file->color_classes = eina_list_append(edje_file->color_classes, cc);
1638
1639 cc->r = 0;
1640 cc->g = 0;
1641 cc->b = 0;
1642 cc->a = 0;
1643 cc->r2 = 0;
1644 cc->g2 = 0;
1645 cc->b2 = 0;
1646 cc->a2 = 0;
1647 cc->r3 = 0;
1648 cc->g3 = 0;
1649 cc->b3 = 0;
1650 cc->a3 = 0;
1651}
1652
1653/**
1654 @page edcref
1655
1656 @property
1657 name
1658 @parameters
1659 [color class name]
1660 @effect
1661 Sets the name for the color class, used as reference by both the theme
1662 and the application.
1663 @endproperty
1664*/
1665static void
1666st_color_class_name(void)
1667{
1668 Edje_Color_Class *cc, *tcc;
1669 Eina_List *l;
1670
1671 cc = eina_list_data_get(eina_list_last(edje_file->color_classes));
1672 cc->name = parse_str(0);
1673 EINA_LIST_FOREACH(edje_file->color_classes, l, tcc)
1674 {
1675 if ((cc != tcc) && (!strcmp(cc->name, tcc->name)))
1676 {
1677 fprintf(stderr, "%s: Error. parse error %s:%i. There is already a color class named \"%s\"\n",
1678 progname, file_in, line - 1, cc->name);
1679 exit(-1);
1680 }
1681 }
1682}
1683
1684/**
1685 @page edcref
1686 @property
1687 color
1688 @parameters
1689 [red] [green] [blue] [alpha]
1690 @effect
1691 The main color.
1692 @endproperty
1693*/
1694static void
1695st_color_class_color(void)
1696{
1697 Edje_Color_Class *cc;
1698
1699 check_arg_count(4);
1700
1701 cc = eina_list_data_get(eina_list_last(edje_file->color_classes));
1702 cc->r = parse_int_range(0, 0, 255);
1703 cc->g = parse_int_range(1, 0, 255);
1704 cc->b = parse_int_range(2, 0, 255);
1705 cc->a = parse_int_range(3, 0, 255);
1706}
1707
1708/**
1709 @page edcref
1710 @property
1711 color2
1712 @parameters
1713 [red] [green] [blue] [alpha]
1714 @effect
1715 Used as shadow in text and textblock parts.
1716 @endproperty
1717*/
1718static void
1719st_color_class_color2(void)
1720{
1721 Edje_Color_Class *cc;
1722
1723 check_arg_count(4);
1724
1725 cc = eina_list_data_get(eina_list_last(edje_file->color_classes));
1726 cc->r2 = parse_int_range(0, 0, 255);
1727 cc->g2 = parse_int_range(1, 0, 255);
1728 cc->b2 = parse_int_range(2, 0, 255);
1729 cc->a2 = parse_int_range(3, 0, 255);
1730}
1731
1732/**
1733 @page edcref
1734 @property
1735 color3
1736 @parameters
1737 [red] [green] [blue] [alpha]
1738 @effect
1739 Used as outline in text and textblock parts.
1740 @endproperty
1741*/
1742static void
1743st_color_class_color3(void)
1744{
1745 Edje_Color_Class *cc;
1746
1747 check_arg_count(4);
1748
1749 cc = eina_list_data_get(eina_list_last(edje_file->color_classes));
1750 cc->r3 = parse_int_range(0, 0, 255);
1751 cc->g3 = parse_int_range(1, 0, 255);
1752 cc->b3 = parse_int_range(2, 0, 255);
1753 cc->a3 = parse_int_range(3, 0, 255);
1754}
1755
1756/**
1757 @page edcref
1758 @block
1759 styles
1760 @context
1761 styles {
1762 style {
1763 name: "stylename";
1764 base: "..default style properties..";
1765
1766 tag: "tagname" "..style properties..";
1767 ..
1768 }
1769 ..
1770 }
1771 @description
1772 The "styles" block contains a list of one or more "style" blocks. A
1773 "style" block is used to create style \<tags\> for advanced TEXTBLOCK
1774 formatting.
1775 @endblock
1776*/
1777static void
1778ob_styles_style(void)
1779{
1780 Edje_Style *stl;
1781
1782 stl = mem_alloc(SZ(Edje_Style));
1783 edje_file->styles = eina_list_append(edje_file->styles, stl);
1784}
1785
1786/**
1787 @page edcref
1788 @property
1789 name
1790 @parameters
1791 [style name]
1792 @effect
1793 The name of the style to be used as reference later in the theme.
1794 @endproperty
1795*/
1796static void
1797st_styles_style_name(void)
1798{
1799 Edje_Style *stl, *tstl;
1800 Eina_List *l;
1801
1802 stl = eina_list_data_get(eina_list_last(edje_file->styles));
1803 stl->name = parse_str(0);
1804 EINA_LIST_FOREACH(edje_file->styles, l, tstl)
1805 {
1806 if (stl->name && tstl->name && (stl != tstl) && (!strcmp(stl->name, tstl->name)))
1807 {
1808 ERR("%s: Error. parse error %s:%i. There is already a style named \"%s\"",
1809 progname, file_in, line - 1, stl->name);
1810 exit(-1);
1811 }
1812 }
1813}
1814
1815/**
1816 @page edcref
1817 @property
1818 base
1819 @parameters
1820 [style properties string]
1821 @effect
1822 The default style properties that will be applied to the complete
1823 text.
1824 @endproperty
1825*/
1826static void
1827st_styles_style_base(void)
1828{
1829 Edje_Style *stl;
1830 Edje_Style_Tag *tag;
1831
1832 stl = eina_list_data_get(eina_list_last(edje_file->styles));
1833 if (stl->tags)
1834 {
1835 ERR("%s: Error. parse error %s:%i. There is already a basic format for the style",
1836 progname, file_in, line - 1);
1837 exit(-1);
1838 }
1839 tag = mem_alloc(SZ(Edje_Style_Tag));
1840 tag->key = mem_strdup("DEFAULT");
1841 tag->value = parse_str(0);
1842 stl->tags = eina_list_append(stl->tags, tag);
1843}
1844
1845/**
1846 @page edcref
1847 @property
1848 tag
1849 @parameters
1850 [tag name] [style properties string]
1851 @effect
1852 Style to be applied only to text between style \<tags\>..\</tags\>.
1853 When creating "paired" tags, like \<bold\>\</bold\>, A '+' should be added at the start of the style properties of the first part (\<bold\>).
1854 If the second part (\</bold\>) is also defined, a '-' should be prepended to it's style properties.
1855 This only applies to paired tags; Single tags, like \<tab\>, must not include a starting '+'.
1856 @endproperty
1857*/
1858static void
1859st_styles_style_tag(void)
1860{
1861 Edje_Style *stl;
1862 Edje_Style_Tag *tag;
1863
1864 stl = eina_list_data_get(eina_list_last(edje_file->styles));
1865 tag = mem_alloc(SZ(Edje_Style_Tag));
1866 tag->key = parse_str(0);
1867 tag->value = parse_str(1);
1868 stl->tags = eina_list_append(stl->tags, tag);
1869}
1870
1871/**
1872 @page edcref
1873 @block
1874 collections
1875 @context
1876 collections {
1877 ..
1878 group { }
1879 group { }
1880 sounds { }
1881 ..
1882 }
1883 @description
1884 The "collections" block is used to list the groups that compose the
1885 theme. Additional "collections" blocks do not prevent overriding group
1886 names. The "sounds" block comprises of all sound definitions.
1887 @endblock
1888*/
1889static void
1890ob_collections(void)
1891{
1892 if (!edje_file->collection)
1893 edje_file->collection = eina_hash_string_small_new(NULL);
1894}
1895
1896/**
1897 @page edcref
1898 @block
1899 sounds
1900 @context
1901 sounds {
1902 sample {
1903 name: "sound_file1" COMP;
1904 source: "sound_file1.wav";
1905 }
1906 sample {
1907 name: "sound_file2" LOSSY 0.4;
1908 source: "sound_file2.wav";
1909 }
1910 tone: "tone-1" 2300;
1911 }
1912
1913 @description
1914 The "sounds" block contains a list of one or more sound sample and tones items.
1915 @endblock
1916 @block
1917 sample
1918 @context
1919 sample {
1920 name: "sound_file1" RAW;
1921 source: "sound_file1.wav";
1922 }
1923 sample {
1924 name: "sound_file2" LOSSY 0.5;
1925 source: "sound_file2.wav";
1926 }
1927 sample {
1928 name: "sound_file3" COMP;
1929 source: "sound_file3.wav";
1930 }
1931 sample {
1932 name: "sound_file4" AS-IS;
1933 source: "sound_file1.wav";
1934 }
1935 @description
1936 The sample block defines the sound sample.
1937 @endblock
1938 @property
1939 name
1940 @parameters
1941 [sample name] [compression type] [if lossy, then quality]
1942 @effect
1943 Used to include each sound file. The full path to the directory holding
1944 the sounds can be defined later with edje_cc's "-sd" option.
1945 @li RAW: Uncompressed.
1946 @li COMP: Lossless compression.
1947 @li LOSSY [-0.1 - 1.0]: Lossy comression with quality from 0 to 1.0.
1948 @li AS_IS: Check for re-encoding, no compression/encoding, just write the file information as it is.
1949 @endproperty
1950 @since 1.1.0
1951 */
1952static void
1953st_collections_group_sound_sample_name(void)
1954{
1955 Edje_Sound_Sample *sample;
1956 const char *tmp;
1957 unsigned int i;
1958
1959 if (!edje_file->sound_dir)
1960 edje_file->sound_dir = mem_alloc(SZ(Edje_Sound_Directory));
1961
1962 tmp = parse_str(0);
1963
1964 for (i = 0; i < edje_file->sound_dir->samples_count; i++)
1965 {
1966 if (!strcmp(edje_file->sound_dir->samples[i].name, tmp))
1967 {
1968 free((char *)tmp);
1969 return;
1970 }
1971 }
1972
1973 edje_file->sound_dir->samples_count++;
1974 edje_file->sound_dir->samples =
1975 realloc(edje_file->sound_dir->samples,
1976 sizeof(Edje_Sound_Sample) *
1977 edje_file->sound_dir->samples_count);
1978
1979 if (!edje_file->sound_dir->samples)
1980 {
1981 ERR("%s: Error. No enough memory.", progname);
1982 exit(-1);
1983 }
1984
1985 sample =
1986 edje_file->sound_dir->samples +
1987 edje_file->sound_dir->samples_count - 1;
1988 memset(sample, 0, sizeof (Edje_Sound_Sample));
1989
1990 sample->name = tmp;
1991 sample->id = edje_file->sound_dir->samples_count - 1;
1992 sample->compression = parse_enum(1,
1993 "RAW", EDJE_SOUND_SOURCE_TYPE_INLINE_RAW,
1994 "COMP", EDJE_SOUND_SOURCE_TYPE_INLINE_COMP,
1995 "LOSSY", EDJE_SOUND_SOURCE_TYPE_INLINE_LOSSY,
1996 "AS_IS", EDJE_SOUND_SOURCE_TYPE_INLINE_AS_IS,
1997 NULL);
1998
1999 if (sample->compression == EDJE_SOUND_SOURCE_TYPE_INLINE_LOSSY)
2000 {
2001 sample->quality = parse_float_range(2, 45.0, 1000.0);
2002 check_arg_count(3);
2003 }
2004 else
2005 check_arg_count(2);
2006
2007}
2008
2009/**
2010 @page edcref
2011 @property
2012 source
2013 @parameters
2014 [sound file name]
2015 @effect
2016 The Sound source file name (Source can be mono/stereo WAV file.
2017 Only files with 44.1 KHz sample rate supported now)
2018 @endproperty
2019 @since 1.1.0
2020 */
2021static void
2022st_collections_group_sound_sample_source(void)
2023{
2024 Edje_Sound_Sample *sample;
2025
2026 if (!edje_file->sound_dir->samples)
2027 {
2028 ERR("%s: Error. Invalid sound sample source definition.", progname);
2029 exit(-1);
2030 }
2031
2032 sample =
2033 edje_file->sound_dir->samples +
2034 edje_file->sound_dir->samples_count - 1;
2035
2036 if (!sample)
2037 {
2038 ERR("%s: Error. Invalid sound sample source definition.", progname);
2039 exit(-1);
2040 }
2041 sample->snd_src = parse_str(0);
2042 check_arg_count(1);
2043}
2044
2045/**
2046 @page edcref
2047 @property
2048 tone
2049 @parameters
2050 [tone name] [frequency]
2051 @effect
2052 sound of specific frequency
2053 @endproperty
2054 @since 1.1.0
2055 */
2056static void
2057st_collections_group_sound_tone(void)
2058{
2059 Edje_Sound_Tone *tone;
2060 const char *tmp;
2061 unsigned int i;
2062 int value;
2063
2064 check_arg_count(2);
2065
2066 if (!edje_file->sound_dir)
2067 edje_file->sound_dir = mem_alloc(SZ(Edje_Sound_Directory));
2068
2069 tmp = parse_str(0);
2070 /* Audible range 20 to 20KHz */
2071 value = parse_int_range(1, 20, 20000);
2072
2073 /* Check for Tone duplication */
2074 for (i = 0; i < edje_file->sound_dir->tones_count; i++)
2075 {
2076 if (!strcmp(edje_file->sound_dir->tones[i].name, tmp))
2077 {
2078 ERR("%s: Error. Tone name: %s already exist.", progname, tmp);
2079 free((char *)tmp);
2080 exit(-1);
2081 }
2082 if (edje_file->sound_dir->tones[i].value == value)
2083 {
2084 ERR("%s: Error. Tone name %s with same frequency %d exist.",
2085 progname, edje_file->sound_dir->tones[i].name, value);
2086 exit(-1);
2087 }
2088 }
2089 edje_file->sound_dir->tones_count++;
2090 edje_file->sound_dir->tones =
2091 realloc(edje_file->sound_dir->tones,
2092 sizeof (Edje_Sound_Tone) *
2093 edje_file->sound_dir->tones_count);
2094
2095 if (!edje_file->sound_dir->tones)
2096 {
2097 ERR("%s: Error. No enough memory.", progname);
2098 exit(-1);
2099 }
2100
2101 tone = edje_file->sound_dir->tones + edje_file->sound_dir->tones_count - 1;
2102 memset(tone, 0, sizeof (Edje_Sound_Tone));
2103
2104 tone->name = tmp;
2105 tone->value = value;
2106 tone->id = edje_file->sound_dir->tones_count - 1;
2107}
2108
2109/**
2110 @edcsection{group,Group sub blocks}
2111 */
2112
2113/**
2114 @page edcref
2115 @block
2116 group
2117 @context
2118 collections {
2119 ..
2120 group {
2121 name: "nameusedbytheapplication";
2122 alias: "anothername";
2123 min: width height;
2124 max: width height;
2125
2126 data { }
2127 script { }
2128 parts { }
2129 programs { }
2130 }
2131 ..
2132 }
2133 @description
2134 A "group" block contains the list of parts and programs that compose a
2135 given Edje Object.
2136 @endblock
2137*/
2138static void
2139ob_collections_group(void)
2140{
2141 Edje_Part_Collection *pc;
2142 Code *cd;
2143
2144 if (current_de && !current_de->entry)
2145 {
2146 ERR("%p: Error. A collection without a name was detected, that's not allowed.", progname);
2147 exit(-1);
2148 }
2149
2150 current_de = mem_alloc(SZ(Edje_Part_Collection_Directory_Entry));
2151 current_de->id = eina_list_count(edje_collections);
2152
2153 pc = mem_alloc(SZ(Edje_Part_Collection));
2154 edje_collections = eina_list_append(edje_collections, pc);
2155 pc->id = current_de->id;
2156 pc->broadcast_signal = EINA_TRUE; /* This was the behaviour by default in Edje 1.1 */
2157
2158 cd = mem_alloc(SZ(Code));
2159 codes = eina_list_append(codes, cd);
2160}
2161
2162/**
2163 @page edcref
2164 @property
2165 name
2166 @parameters
2167 [group name]
2168 @effect
2169 The name that will be used by the application to load the resulting
2170 Edje object and to identify the group to swallow in a GROUP part. If a
2171 group with the same name exists already it will be completely overriden
2172 by the new group.
2173 @endproperty
2174*/
2175static void
2176st_collections_group_name(void)
2177{
2178 Edje_Part_Collection_Directory_Entry *alias;
2179 Edje_Part_Collection_Directory_Entry *older;
2180 Edje_Part_Collection *current_pc;
2181 Eina_List *l = NULL;
2182
2183 check_arg_count(1);
2184
2185 current_pc = eina_list_data_get(eina_list_last(edje_collections));
2186
2187 current_de->entry = parse_str(0);
2188 current_pc->part = current_de->entry;
2189
2190 older = eina_hash_find(edje_file->collection, current_de->entry);
2191 if (older) eina_hash_del(edje_file->collection, current_de->entry, older);
2192 eina_hash_direct_add(edje_file->collection, current_de->entry, current_de);
2193 if (!older) return;
2194
2195 EINA_LIST_FOREACH(aliases, l, alias)
2196 if (strcmp(alias->entry, current_de->entry) == 0)
2197 {
2198 Edje_Part_Collection *pc;
2199
2200 pc = eina_list_nth(edje_collections, older->id);
2201 INF("overriding alias ('%s' => '%s') by group '%s'",
2202 alias->entry, pc->part,
2203 current_de->entry);
2204 aliases = eina_list_remove_list(aliases, l);
2205 free(alias);
2206 break;
2207 }
2208
2209}
2210
2211typedef struct _Edje_List_Foreach_Data Edje_List_Foreach_Data;
2212struct _Edje_List_Foreach_Data
2213{
2214 Eina_List *list;
2215};
2216
2217static Eina_Bool
2218_edje_data_item_list_foreach(const Eina_Hash *hash __UNUSED__, const void *key, void *data __UNUSED__, void *fdata)
2219{
2220 Edje_List_Foreach_Data *fd;
2221
2222 fd = fdata;
2223 fd->list = eina_list_append(fd->list, strdup(key));
2224
2225 return EINA_TRUE;
2226}
2227
2228/**
2229 @page edcref
2230 @property
2231 inherit
2232 @parameters
2233 [parent group name]
2234 @effect
2235 Parent group name for inheritance.
2236 Group "inherit" is used to inherit any predefined group and change
2237 some property which belongs to "part", "description", "items" or "program".
2238 The child group has the same property as parent group. If you specify the
2239 type again in an inherited part, it will cause an error (unless you plan
2240 to fix that).
2241 @endproperty
2242 @since 1.1.0
2243*/
2244static void
2245st_collections_group_inherit(void)
2246{
2247 Edje_Part_Collection *pc, *pc2;
2248 Edje_Part *ep, *ep2;
2249 Edje_Part_Parser *epp, *epp2;
2250 Edje_Pack_Element *item, *item2;
2251 Edje_Pack_Element_Parser *pitem;
2252 Edje_Part_Description_Common *ed, *ed2;
2253 Edje_List_Foreach_Data fdata;
2254 Edje_String *es;
2255 Eina_List *l;
2256 char *parent_name;
2257 unsigned int i, j;
2258
2259 check_arg_count(1);
2260
2261 pc = eina_list_data_get(eina_list_last(edje_collections));
2262
2263 parent_name = parse_str(0);
2264
2265 EINA_LIST_FOREACH(edje_collections, l, pc2)
2266 {
2267 if (!strcmp(parent_name, pc2->part))
2268 break;
2269 }
2270 if (!pc2)
2271 {
2272 ERR("%s: Error. parse error %s:%i. There isn't a group with the name %s",
2273 progname, file_in, line - 1, parent_name);
2274 exit(-1);
2275 }
2276 if (pc2 == pc)
2277 {
2278 ERR("%s: Error. parse error %s:%i. You are trying to inherit '%s' from itself. That's not possible."
2279 "If there is another group of the same name, you want to inherit from that group and have the"
2280 "same name as that group, there is a trick ! Just put the inherit before the directive that set"
2281 "the name !", progname, file_in, line - 1, parent_name);
2282 exit(-1);
2283 }
2284
2285 if (pc2->data)
2286 {
2287 char *key;
2288
2289 memset(&fdata, 0, sizeof(Edje_List_Foreach_Data));
2290 eina_hash_foreach(pc2->data,
2291 _edje_data_item_list_foreach, &fdata);
2292
2293 if (!pc->data)
2294 pc->data = eina_hash_string_small_new(free);
2295
2296
2297 EINA_LIST_FREE(fdata.list, key)
2298 {
2299 es = mem_alloc(SZ(Edje_String));
2300 es = (Edje_String *)eina_hash_find(pc2->data, key);
2301 eina_hash_direct_add(pc->data, key, es);
2302 }
2303 }
2304
2305 pc->prop.min.w = pc2->prop.min.w;
2306 pc->prop.min.h = pc2->prop.min.h;
2307 pc->prop.orientation = pc2->prop.orientation;
2308
2309 pc->lua_script_only = pc2->lua_script_only;
2310
2311 #define STRDUP(x) x ? strdup(x) : NULL
2312 for (i = 0 ; i < pc2->parts_count ; i++)
2313 {
2314 // copy the part
2315 ob_collections_group_parts_part();
2316 ep = pc->parts[i];
2317 ep2 = pc2->parts[i];
2318 ep->name = STRDUP(ep2->name);
2319 ep->source = STRDUP(ep2->source);
2320 ep->source2 = STRDUP(ep2->source2);
2321 ep->source3 = STRDUP(ep2->source3);
2322 ep->source4 = STRDUP(ep2->source4);
2323 ep->source5 = STRDUP(ep2->source5);
2324 ep->source6 = STRDUP(ep2->source6);
2325
2326 data_queue_copied_part_lookup(pc, &(ep2->clip_to_id), &(ep->clip_to_id));
2327
2328 ep->type = ep2->type;
2329 ep->mouse_events = ep2->mouse_events;
2330 ep->repeat_events = ep2->repeat_events;
2331 ep->ignore_flags = ep2->ignore_flags;
2332 ep->scale = ep2->scale;
2333 ep->pointer_mode = ep2->pointer_mode;
2334 ep->precise_is_inside = ep2->precise_is_inside;
2335 ep->use_alternate_font_metrics = ep2->use_alternate_font_metrics;
2336 ep->effect = ep2->effect;
2337 ep->entry_mode = ep2->entry_mode;
2338 ep->select_mode = ep2->select_mode;
2339 ep->cursor_mode = ep2->cursor_mode;
2340 ep->multiline = ep2->multiline;
2341 ep->dragable.x = ep2->dragable.x;
2342 ep->dragable.step_x = ep2->dragable.step_x;
2343 ep->dragable.count_x = ep2->dragable.count_x;
2344 ep->dragable.y = ep2->dragable.y;
2345 ep->dragable.step_y = ep2->dragable.step_y;
2346 ep->dragable.count_y = ep2->dragable.count_y;
2347
2348 data_queue_copied_part_lookup(pc, &(ep2->dragable.confine_id), &(ep->dragable.confine_id));
2349 data_queue_copied_part_lookup(pc, &(ep2->dragable.event_id), &(ep->dragable.event_id));
2350
2351 epp = (Edje_Part_Parser *)ep;
2352 epp2 = (Edje_Part_Parser *)ep2;
2353 epp->reorder.insert_before = STRDUP(epp2->reorder.insert_before);
2354 epp->reorder.insert_after = STRDUP(epp2->reorder.insert_after);
2355 epp->can_override = EINA_TRUE;
2356
2357 for (j = 0 ; j < ep2->items_count ; j++)
2358 {
2359 ob_collections_group_parts_part_box_items_item();
2360 item = ep->items[j];
2361 item2 = ep2->items[j];
2362 item->type = item2->type;
2363 item->name = STRDUP(item2->name);
2364 item->source = STRDUP(item2->source);
2365 item->min.w = item2->min.w;
2366 item->min.h = item2->min.h;
2367 item->prefer.w = item2->prefer.w;
2368 item->prefer.h = item2->prefer.h;
2369 item->max.w = item2->max.w;
2370 item->max.h = item2->max.h;
2371 item->padding.l = item2->padding.l;
2372 item->padding.r = item2->padding.r;
2373 item->padding.t = item2->padding.t;
2374 item->padding.b = item2->padding.b;
2375 item->align.x = item2->align.x;
2376 item->align.y = item2->align.y;
2377 item->weight.x = item2->weight.x;
2378 item->weight.y = item2->weight.y;
2379 item->aspect.w = item2->aspect.w;
2380 item->aspect.h = item2->aspect.h;
2381 item->aspect.mode = item2->aspect.mode;
2382 item->options = STRDUP(item2->options);
2383 item->col = item2->col;
2384 item->row = item2->row;
2385 item->colspan = item2->colspan;
2386 item->rowspan = item2->rowspan;
2387
2388 pitem = (Edje_Pack_Element_Parser *)item;
2389 pitem->can_override = EINA_TRUE;
2390 }
2391
2392 ep->api.name = STRDUP(ep2->api.name);
2393 if (ep2->api.description) ep->api.description = STRDUP(ep2->api.description);
2394
2395 // copy default description
2396 ob_collections_group_parts_part_description();
2397 ed = ep->default_desc;
2398 parent_desc = ed2 = ep2->default_desc;
2399 ed->state.name = STRDUP(ed2->state.name);
2400 ed->state.value = ed2->state.value;
2401 st_collections_group_parts_part_description_inherit();
2402 parent_desc = NULL;
2403
2404 // copy other description
2405 for (j = 0 ; j < ep2->other.desc_count ; j++)
2406 {
2407 ob_collections_group_parts_part_description();
2408 ed = ep->other.desc[j];
2409 parent_desc = ed2 = ep2->other.desc[j];
2410 ed->state.name = STRDUP(ed2->state.name);
2411 ed->state.value = ed2->state.value;
2412 st_collections_group_parts_part_description_inherit();
2413 parent_desc = NULL;
2414 }
2415 }
2416
2417 //copy programs
2418 for (j = 0 ; j < pc2->programs.fnmatch_count ; j++)
2419 {
2420 ob_collections_group_programs_program();
2421 _edje_program_copy(current_program, pc2->programs.fnmatch[j]);
2422 }
2423 for (j = 0 ; j < pc2->programs.strcmp_count ; j++)
2424 {
2425 ob_collections_group_programs_program();
2426 _edje_program_copy(current_program, pc2->programs.strcmp[j]);
2427 }
2428 for (j = 0 ; j < pc2->programs.strncmp_count ; j++)
2429 {
2430 ob_collections_group_programs_program();
2431 _edje_program_copy(current_program, pc2->programs.strncmp[j]);
2432 }
2433 for (j = 0 ; j < pc2->programs.strrncmp_count ; j++)
2434 {
2435 ob_collections_group_programs_program();
2436 _edje_program_copy(current_program, pc2->programs.strrncmp[j]);
2437 }
2438 for (j = 0 ; j < pc2->programs.nocmp_count ; j++)
2439 {
2440 ob_collections_group_programs_program();
2441 _edje_program_copy(current_program, pc2->programs.nocmp[j]);
2442 }
2443
2444 Code *cd, *cd2;
2445 Code_Program *cp, *cp2;
2446 Edje_Part_Collection_Directory_Entry *de;
2447
2448 de = eina_hash_find(edje_file->collection, pc2->part);
2449 cd2 = eina_list_nth(codes, de->id);
2450 cd = eina_list_data_get(eina_list_last(codes));
2451
2452 EINA_LIST_FOREACH(cd2->programs, l, cp2)
2453 {
2454 cp = mem_alloc(SZ(Code_Program));
2455
2456 cp->l1 = cp2->l1;
2457 cp->l2 = cp2->l2;
2458 cp->script = STRDUP(cp2->script);
2459 cd->is_lua = cd2->is_lua;
2460 cd->programs = eina_list_append(cd->programs, cp);
2461 data_queue_copied_anonymous_lookup(pc, &(cp2->id), &(cp->id));
2462 }
2463
2464 free(parent_name);
2465 #undef STRDUP
2466}
2467
2468/**
2469 @page edcref
2470 @property
2471 script_only
2472 @parameters
2473 [on/off]
2474 @effect
2475 The flag (on/off) as to if this group is defined ONLY by script
2476 callbacks such as init(), resize() and shutdown()
2477 @endproperty
2478*/
2479static void
2480st_collections_group_script_only(void)
2481{
2482 Edje_Part_Collection *pc;
2483
2484 check_arg_count(1);
2485
2486 pc = eina_list_data_get(eina_list_last(edje_collections));
2487 pc->lua_script_only = parse_bool(0);
2488}
2489
2490/**
2491 @page edcref
2492 @property
2493 alias
2494 @parameters
2495 [aditional group name]
2496 @effect
2497 Additional name to serve as identifier. Defining multiple aliases is
2498 supported.
2499 @endproperty
2500*/
2501static void
2502st_collections_group_alias(void)
2503{
2504 Edje_Part_Collection_Directory_Entry *alias;
2505 Edje_Part_Collection_Directory_Entry *tmp;
2506 Eina_List *l;
2507
2508 check_arg_count(1);
2509
2510 alias = mem_alloc(SZ(Edje_Part_Collection_Directory_Entry));
2511 alias->id = current_de->id;
2512 alias->entry = parse_str(0);
2513
2514 EINA_LIST_FOREACH(aliases, l, tmp)
2515 if (strcmp(alias->entry, tmp->entry) == 0)
2516 {
2517 Edje_Part_Collection *pc;
2518
2519 pc = eina_list_nth(edje_collections, tmp->id);
2520 INF("overriding alias ('%s' => '%s') to ('%s' => '%s')",
2521 tmp->entry, pc->part,
2522 alias->entry, current_de->entry);
2523 aliases = eina_list_remove_list(aliases, l);
2524 free(tmp);
2525 break;
2526 }
2527
2528 aliases = eina_list_append(aliases, alias);
2529}
2530
2531/**
2532 @page edcref
2533 @property
2534 min
2535 @parameters
2536 [width] [height]
2537 @effect
2538 The minimum size for the container defined by the composition of the
2539 parts. It is not enforced.
2540 @endproperty
2541*/
2542static void
2543st_collections_group_min(void)
2544{
2545 Edje_Part_Collection *pc;
2546
2547 check_arg_count(2);
2548
2549 pc = eina_list_data_get(eina_list_last(edje_collections));
2550 pc->prop.min.w = parse_int_range(0, 0, 0x7fffffff);
2551 pc->prop.min.h = parse_int_range(1, 0, 0x7fffffff);
2552}
2553
2554/**
2555 @page edcref
2556 @property
2557 max
2558 @parameters
2559 [width] [height]
2560 @effect
2561 The maximum size for the container defined by the totality of the
2562 parts. It is not enforced.
2563 @endproperty
2564*/
2565static void
2566st_collections_group_max(void)
2567{
2568 Edje_Part_Collection *pc;
2569
2570 check_arg_count(2);
2571
2572 pc = eina_list_data_get(eina_list_last(edje_collections));
2573 pc->prop.max.w = parse_int_range(0, 0, 0x7fffffff);
2574 pc->prop.max.h = parse_int_range(1, 0, 0x7fffffff);
2575}
2576
2577/**
2578 @page edcref
2579 @property
2580 broadcast_signal
2581 @parameters
2582 [broadcast]
2583 @effect
2584 Signal got automatically broadcasted to all sub group part. Default to
2585 true since 1.1.
2586 @endproperty
2587*/
2588static void
2589st_collections_group_broadcast_signal(void)
2590{
2591 Edje_Part_Collection *pc;
2592
2593 check_arg_count(1);
2594
2595 pc = eina_list_data_get(eina_list_last(edje_collections));
2596 pc->broadcast_signal = parse_bool(0);
2597}
2598
2599/**
2600 @page edcref
2601 @block
2602 script
2603 @context
2604 ..
2605 group {
2606 script {
2607 //embryo script
2608 }
2609 ..
2610 program {
2611 script {
2612 //embryo script
2613 }
2614 }
2615 ..
2616 }
2617 ..
2618 @description
2619 This block is used to "inject" embryo scripts to a given Edje theme and
2620 it functions in two modalities. When it's included inside a "program"
2621 block, the script will be executed every time the program is run, on
2622 the other hand, when included directly into a "group", "part" or
2623 "description" block, it will be executed once at load time, in the
2624 load order.
2625 @endblock
2626*/
2627static void
2628ob_collections_group_script(void)
2629{
2630 Code *cd;
2631
2632 cd = eina_list_data_get(eina_list_last(codes));
2633
2634 if (!is_verbatim()) track_verbatim(1);
2635 else
2636 {
2637 char *s;
2638
2639 s = get_verbatim();
2640 if (s)
2641 {
2642 cd->l1 = get_verbatim_line1();
2643 cd->l2 = get_verbatim_line2();
2644 if (cd->shared)
2645 {
2646 ERR("%s: Error. parse error %s:%i. There is already an existing script section for the group",
2647 progname, file_in, line - 1);
2648 exit(-1);
2649 }
2650 cd->shared = s;
2651 cd->original = strdup(s);
2652 cd->is_lua = 0;
2653 set_verbatim(NULL, 0, 0);
2654 }
2655 }
2656}
2657
2658static void
2659ob_collections_group_lua_script(void)
2660{
2661 Code *cd;
2662
2663 cd = eina_list_data_get(eina_list_last(codes));
2664
2665 if (!is_verbatim()) track_verbatim(1);
2666 else
2667 {
2668 char *s;
2669
2670 s = get_verbatim();
2671 if (s)
2672 {
2673 cd->l1 = get_verbatim_line1();
2674 cd->l2 = get_verbatim_line2();
2675 if (cd->shared)
2676 {
2677 ERR("%s: Error. parse error %s:%i. There is already an existing script section for the group",
2678 progname, file_in, line - 1);
2679 exit(-1);
2680 }
2681 cd->shared = s;
2682 cd->is_lua = 1;
2683 set_verbatim(NULL, 0, 0);
2684 }
2685 }
2686}
2687
2688static void
2689st_collections_group_data_item(void)
2690{
2691 Edje_Part_Collection *pc;
2692 Edje_String *es;
2693 char *key;
2694
2695 check_arg_count(2);
2696
2697 pc = eina_list_data_get(eina_list_last(edje_collections));
2698
2699 if (!pc->data)
2700 pc->data = eina_hash_string_small_new(free);
2701
2702 key = parse_str(0);
2703
2704 es = mem_alloc(SZ(Edje_String));
2705 es->str = parse_str(1);
2706
2707 if (eina_hash_find(pc->data, key))
2708 eina_hash_modify(pc->data, key, es);
2709 else
2710 eina_hash_direct_add(pc->data, key, es);
2711}
2712
2713/**
2714 @page edcref
2715 @property
2716 orientation
2717 @parameters
2718 enum AUTO, LTR, RTL
2719 @effect
2720 This defines GROUP orientation.
2721 This is useful if you want match interface orientation with language.
2722 AUTO - Follow system defs.
2723 LTR - suitable for Left To Right Languages (latin)
2724 RTL - suitable for Right To Left Languages (Hebrew, Arabic interface)
2725 @endproperty
2726*/
2727static void
2728st_collections_group_orientation(void)
2729{
2730 Edje_Part_Collection *pc;
2731
2732 check_arg_count(1);
2733
2734 pc = eina_list_data_get(eina_list_last(edje_collections));
2735 pc->prop.orientation = parse_enum(0,
2736 "AUTO", EDJE_ORIENTATION_AUTO,
2737 "LTR", EDJE_ORIENTATION_LTR,
2738 "RTL", EDJE_ORIENTATION_RTL,
2739 NULL);
2740}
2741
2742/**
2743 @page edcref
2744 @block
2745 limits
2746 @context
2747 group {
2748 limits {
2749 vertical: "limit_name" height_barrier;
2750 horizontal: "limit_name" width_barrier;
2751 ..
2752 }
2753 ..
2754 }
2755 ..
2756 @description
2757 This block is used to trigger some signal when the Edje object is resized.
2758 @endblock
2759
2760 @edcref
2761 @property
2762 vertical
2763 @parameters
2764 [name] [height barrier]
2765 @effect
2766 It will send a signal: "limit,name,over" when the object is resized and pass
2767 the limit by growing over it. And it will send: "limit,name,below" when
2768 it pass below that limit.
2769 This limit will be applied on the y absis and is expressed in pixels.
2770 @endproperty
2771*/
2772static void
2773st_collections_group_limits_vertical(void)
2774{
2775 Edje_Part_Collection *pc;
2776 Edje_Limit *el;
2777
2778 check_arg_count(2);
2779
2780 el = mem_alloc(SZ(Edje_Limit));
2781
2782 pc = eina_list_data_get(eina_list_last(edje_collections));
2783 pc->limits.vertical_count++;
2784 pc->limits.vertical = realloc(pc->limits.vertical, pc->limits.vertical_count * sizeof (Edje_Limit *));
2785 if (!pc->limits.vertical || !el)
2786 {
2787 ERR("%s: Error. Not enough memory.", progname);
2788 exit(-1);
2789 }
2790
2791 pc->limits.vertical[pc->limits.vertical_count - 1] = el;
2792
2793 el->name = parse_str(0);
2794 el->value = parse_int_range(1, 1, 0xffff);
2795}
2796
2797/**
2798 @page edcref
2799 @property
2800 horizontal
2801 @parameters
2802 [name] [width barrier]
2803 @effect
2804 It will send a signal: "limit,name,over" when the object is resized and pass
2805 the limit by growing over it. And it will send: "limit,name,below" when
2806 it pass below that limit.
2807 This limit will be applied on the x absis and is expressed in pixels.
2808 @endproperty
2809*/
2810static void
2811st_collections_group_limits_horizontal(void)
2812{
2813 Edje_Part_Collection *pc;
2814 Edje_Limit *el;
2815
2816 check_arg_count(2);
2817
2818 el = mem_alloc(SZ(Edje_Limit));
2819
2820 pc = eina_list_data_get(eina_list_last(edje_collections));
2821 pc->limits.horizontal_count++;
2822 pc->limits.horizontal = realloc(pc->limits.horizontal, pc->limits.horizontal_count * sizeof (Edje_Limit *));
2823 if (!pc->limits.horizontal || !el)
2824 {
2825 ERR("%s: Error. Not enough memory.", progname);
2826 exit(-1);
2827 }
2828
2829 pc->limits.horizontal[pc->limits.horizontal_count - 1] = el;
2830
2831 el->name = parse_str(0);
2832 el->value = parse_int_range(1, 1, 0xffff);
2833}
2834
2835/**
2836 @page edcref
2837 @block
2838 parts
2839 @context
2840 group {
2841 parts {
2842 alias: "theme_part_path" "real_part_path";
2843 ..
2844 }
2845 }
2846 @description
2847 Alias of part give a chance to let the designer put the real one
2848 in a box or reuse one from a GROUP or inside a BOX.
2849 @endblock
2850*/
2851static void
2852st_collections_group_parts_alias(void)
2853{
2854 Edje_Part_Collection *pc;
2855 const char *alias;
2856 const char *aliased;
2857
2858 check_arg_count(2);
2859
2860 pc = eina_list_data_get(eina_list_last(edje_collections));
2861
2862 alias = parse_str(0);
2863 aliased = parse_str(1);
2864
2865 if (!pc->alias) pc->alias = eina_hash_string_small_new(NULL);
2866 eina_hash_add(pc->alias, alias, aliased);
2867
2868 if (!pc->aliased) pc->aliased = eina_hash_string_small_new(NULL);
2869 eina_hash_add(pc->aliased, aliased, alias);
2870}
2871
2872
2873/**
2874 @page edcref
2875 @block
2876 part
2877 @context
2878 group {
2879 parts {
2880 ..
2881 part {
2882 name: "partname";
2883 type: IMAGE;
2884 mouse_events: 1;
2885 repeat_events: 0;
2886 ignore_flags: NONE;
2887 clip_to: "anotherpart";
2888 source: "groupname";
2889 pointer_mode: AUTOGRAB;
2890 use_alternate_font_metrics: 0;
2891
2892 description { }
2893 dragable { }
2894 items { }
2895 }
2896 ..
2897 }
2898 }
2899 @description
2900 Parts are used to represent the most basic design elements of the
2901 theme, for example, a part can represent a line in a border or a label
2902 on a button.
2903 @endblock
2904*/
2905static void
2906ob_collections_group_parts_part(void)
2907{
2908 Edje_Part_Collection *pc;
2909 Edje_Part *ep;
2910 Edje_Part_Parser *epp;
2911
2912 ep = mem_alloc(SZ(Edje_Part_Parser));
2913
2914 pc = eina_list_data_get(eina_list_last(edje_collections));
2915 pc->parts_count++;
2916 pc->parts = realloc(pc->parts, pc->parts_count * sizeof (Edje_Part *));
2917 if (!pc->parts)
2918 {
2919 ERR("%s: Error. Not enough memory.", progname);
2920 exit(-1);
2921 }
2922 current_part = pc->parts[pc->parts_count - 1] = ep;
2923
2924 ep->id = pc->parts_count - 1;
2925 ep->type = EDJE_PART_TYPE_IMAGE;
2926 ep->mouse_events = 1;
2927 ep->repeat_events = 0;
2928 ep->ignore_flags = EVAS_EVENT_FLAG_NONE;
2929 ep->scale = 0;
2930 ep->pointer_mode = EVAS_OBJECT_POINTER_MODE_AUTOGRAB;
2931 ep->precise_is_inside = 0;
2932 ep->use_alternate_font_metrics = 0;
2933 ep->clip_to_id = -1;
2934 ep->dragable.confine_id = -1;
2935 ep->dragable.event_id = -1;
2936 ep->items = NULL;
2937
2938 epp = (Edje_Part_Parser *)ep;
2939 epp->reorder.insert_before = NULL;
2940 epp->reorder.insert_after = NULL;
2941 epp->reorder.before = NULL;
2942 epp->reorder.after = NULL;
2943 epp->reorder.linked_prev = 0;
2944 epp->reorder.linked_next = 0;
2945 epp->reorder.done = EINA_FALSE;
2946 epp->can_override = EINA_FALSE;
2947}
2948
2949/**
2950 @page edcref
2951 @property
2952 name
2953 @parameters
2954 [part name]
2955 @effect
2956 The part's name will be used as reference in the theme's relative
2957 positioning system, by programs and in some cases by the application.
2958 It must be unique within the group.
2959 @endproperty
2960*/
2961static void
2962st_collections_group_parts_part_name(void)
2963{
2964 Edje_Part_Collection *pc;
2965 Edje_Part *ep;
2966 Edje_Part_Parser *epp;
2967
2968 check_arg_count(1);
2969
2970 pc = eina_list_data_get(eina_list_last(edje_collections));
2971 ep = current_part;
2972 ep->name = parse_str(0);
2973
2974 if (ep->name)
2975 {
2976 unsigned int i;
2977
2978 for (i = 0; i < (pc->parts_count - 1); i++)
2979 {
2980 if (pc->parts[i]->name && (!strcmp(pc->parts[i]->name, ep->name)))
2981 {
2982 epp = (Edje_Part_Parser *)pc->parts[i];
2983 if (!epp->can_override)
2984 {
2985 ERR("%s: Error. parse error %s:%i. There is already a part of the name %s",
2986 progname, file_in, line - 1, ep->name);
2987 exit(-1);
2988 }
2989 else
2990 {
2991 free(ep);
2992 pc->parts_count--;
2993 pc->parts = realloc(pc->parts, pc->parts_count * sizeof (Edje_Part *));
2994 ep = current_part = pc->parts[i];
2995 epp->can_override = EINA_FALSE;
2996 break;
2997 }
2998 }
2999 }
3000 }
3001}
3002
3003/**
3004 @page edcref
3005 @property
3006 type
3007 @parameters
3008 [TYPE]
3009 @effect
3010 Set the type (all caps) from among the available types, it's set to
3011 IMAGE by default. Valid types:
3012 @li RECT
3013 @li TEXT
3014 @li IMAGE
3015 @li SWALLOW
3016 @li TEXTBLOCK
3017 @li GROUP
3018 @li BOX
3019 @li TABLE
3020 @li EXTERNAL
3021 @li PROXY
3022 @endproperty
3023*/
3024static void
3025st_collections_group_parts_part_type(void)
3026{
3027 unsigned int type;
3028
3029 check_arg_count(1);
3030
3031 type = parse_enum(0,
3032 "NONE", EDJE_PART_TYPE_NONE,
3033 "RECT", EDJE_PART_TYPE_RECTANGLE,
3034 "TEXT", EDJE_PART_TYPE_TEXT,
3035 "IMAGE", EDJE_PART_TYPE_IMAGE,
3036 "SWALLOW", EDJE_PART_TYPE_SWALLOW,
3037 "TEXTBLOCK", EDJE_PART_TYPE_TEXTBLOCK,
3038 "GROUP", EDJE_PART_TYPE_GROUP,
3039 "BOX", EDJE_PART_TYPE_BOX,
3040 "TABLE", EDJE_PART_TYPE_TABLE,
3041 "EXTERNAL", EDJE_PART_TYPE_EXTERNAL,
3042 "PROXY", EDJE_PART_TYPE_PROXY,
3043 NULL);
3044
3045 /* handle type change of inherited part */
3046 if (type != current_part->type)
3047 {
3048 Edje_Part_Description_Common *new, *previous;
3049 Edje_Part_Collection *pc;
3050 Edje_Part *ep;
3051 unsigned int i;
3052
3053 /* we don't free old part as we don't remove all reference to them */
3054 part_description_image_cleanup(current_part);
3055
3056 pc = eina_list_data_get(eina_list_last(edje_collections));
3057 ep = current_part;
3058
3059 previous = ep->default_desc;
3060 if (previous)
3061 {
3062 new = _edje_part_description_alloc(type, pc->part, ep->name);
3063 memcpy(new, previous, sizeof (Edje_Part_Description_Common));
3064
3065 ep->default_desc = new;
3066 }
3067
3068 for (i = 0; i < ep->other.desc_count; i++)
3069 {
3070 previous = ep->other.desc[i];
3071 new = _edje_part_description_alloc(type, pc->part, ep->name);
3072 memcpy(new, previous, sizeof (Edje_Part_Description_Common));
3073 ep->other.desc[i] = new;
3074 }
3075 }
3076
3077 current_part->type = type;
3078}
3079
3080/**
3081 @page edcref
3082 @property
3083 insert_before
3084 @parameters
3085 [another part's name]
3086 @effect
3087 The part's name which this part is inserted before. One part cannot
3088 have both insert_before and insert_after. One part cannot refer
3089 more than one by insert_before.
3090 @endproperty
3091 @since 1.1.0
3092*/
3093static void
3094st_collections_group_parts_part_insert_before(void)
3095{
3096 Edje_Part_Parser *epp;
3097 check_arg_count(1);
3098
3099 epp = (Edje_Part_Parser *)current_part;
3100 epp->reorder.insert_before = parse_str(0);
3101}
3102
3103/**
3104 @page edcref
3105 @property
3106 insert_after
3107 @parameters
3108 [another part's name]
3109 @effect
3110 The part's name which this part is inserted after. One part cannot
3111 have both insert_before and insert_after. One part cannot refer
3112 more than one by insert_after.
3113 @endproperty
3114 @since 1.1.0
3115*/
3116static void
3117st_collections_group_parts_part_insert_after(void)
3118{
3119 Edje_Part_Parser *epp;
3120 check_arg_count(1);
3121
3122 epp = (Edje_Part_Parser *)current_part;
3123 epp->reorder.insert_after = parse_str(0);
3124}
3125
3126/**
3127 @page edcref
3128 @property
3129 mouse_events
3130 @parameters
3131 [1 or 0]
3132 @effect
3133 Specifies whether the part will emit signals, although it is named
3134 "mouse_events", disabling it (0) will prevent the part from emitting
3135 any type of signal at all. It's set to 1 by default.
3136 @endproperty
3137*/
3138static void
3139st_collections_group_parts_part_mouse_events(void)
3140{
3141 check_arg_count(1);
3142
3143 current_part->mouse_events = parse_bool(0);
3144}
3145
3146/**
3147 @page edcref
3148 @property
3149 repeat_events
3150 @parameters
3151 [1 or 0]
3152 @effect
3153 Specifies whether a part echoes a mouse event to other parts below the
3154 pointer (1), or not (0). It's set to 0 by default.
3155 @endproperty
3156*/
3157static void
3158st_collections_group_parts_part_repeat_events(void)
3159{
3160 check_arg_count(1);
3161
3162 current_part->repeat_events = parse_bool(0);
3163}
3164
3165/**
3166 @page edcref
3167 @property
3168 ignore_flags
3169 @parameters
3170 [FLAG] ...
3171 @effect
3172 Specifies whether events with the given flags should be ignored,
3173 i.e., will not have the signals emitted to the parts. Multiple flags
3174 must be separated by spaces, the effect will be ignoring all events
3175 with one of the flags specified. Possible flags:
3176 @li NONE (default value, no event will be ignored)
3177 @li ON_HOLD
3178 @endproperty
3179*/
3180static void
3181st_collections_group_parts_part_ignore_flags(void)
3182{
3183 check_min_arg_count(1);
3184
3185 current_part->ignore_flags = parse_flags(0,
3186 "NONE", EVAS_EVENT_FLAG_NONE,
3187 "ON_HOLD", EVAS_EVENT_FLAG_ON_HOLD,
3188 NULL);
3189}
3190
3191/**
3192 @page edcref
3193 @property
3194 scale
3195 @parameters
3196 [1 or 0]
3197 @effect
3198 Specifies whether the part will scale its size with an edje scaling
3199 factor. By default scale is off (0) and the default scale factor is
3200 1.0 - that means no scaling. This would be used to scale properties
3201 such as font size, min/max size of the part, and possibly can be used
3202 to scale based on DPI of the target device. The reason to be selective
3203 is that some things work well being scaled, others do not, so the
3204 designer gets to choose what works best.
3205 @endproperty
3206*/
3207static void
3208st_collections_group_parts_part_scale(void)
3209{
3210 check_arg_count(1);
3211
3212 current_part->scale = parse_bool(0);
3213}
3214
3215/**
3216 @page edcref
3217 @property
3218 pointer_mode
3219 @parameters
3220 [MODE]
3221 @effect
3222 Sets the mouse pointer behavior for a given part. The default value is
3223 AUTOGRAB. Aviable modes:
3224 @li AUTOGRAB, when the part is clicked and the button remains
3225 pressed, the part will be the source of all future mouse
3226 signals emitted, even outside the object, until the button is
3227 released.
3228 @li NOGRAB, the effect will be limited to the part's container.
3229 @endproperty
3230*/
3231static void
3232st_collections_group_parts_part_pointer_mode(void)
3233{
3234 check_arg_count(1);
3235
3236 current_part->pointer_mode = parse_enum(0,
3237 "AUTOGRAB", EVAS_OBJECT_POINTER_MODE_AUTOGRAB,
3238 "NOGRAB", EVAS_OBJECT_POINTER_MODE_NOGRAB,
3239 NULL);
3240}
3241
3242/**
3243 @page edcref
3244 @property
3245 precise_is_inside
3246 @parameters
3247 [1 or 0]
3248 @effect
3249 Enables precise point collision detection for the part, which is more
3250 resource intensive. Disabled by default.
3251 @endproperty
3252*/
3253static void
3254st_collections_group_parts_part_precise_is_inside(void)
3255{
3256 check_arg_count(1);
3257
3258 current_part->precise_is_inside = parse_bool(0);
3259}
3260
3261/**
3262 @page edcref
3263 @property
3264 use_alternate_font_metrics
3265 @parameters
3266 [1 or 0]
3267 @effect
3268 Only affects text and textblock parts, when enabled Edje will use
3269 different size measurement functions. Disabled by default. (note from
3270 the author: I don't know what this is exactlu useful for?)
3271 @endproperty
3272*/
3273static void
3274st_collections_group_parts_part_use_alternate_font_metrics(void)
3275{
3276 check_arg_count(1);
3277
3278 current_part->use_alternate_font_metrics = parse_bool(0);
3279}
3280
3281/**
3282 @page edcref
3283 @property
3284 clip_to
3285 @parameters
3286 [another part's name]
3287 @effect
3288 Only renders the area of part that coincides with another part's
3289 container. Overflowing content will not be displayed.
3290 @endproperty
3291*/
3292static void
3293st_collections_group_parts_part_clip_to_id(void)
3294{
3295 Edje_Part_Collection *pc;
3296
3297 check_arg_count(1);
3298
3299 pc = eina_list_data_get(eina_list_last(edje_collections));
3300 {
3301 char *name;
3302
3303 name = parse_str(0);
3304 data_queue_part_lookup(pc, name, &(current_part->clip_to_id));
3305 free(name);
3306 }
3307}
3308
3309/**
3310 @page edcref
3311 @property
3312 source
3313 @parameters
3314 [another group's name]
3315 @effect
3316 Only available to GROUP or TEXTBLOCK parts. Swallows the specified
3317 group into the part's container if a GROUP. If TEXTBLOCK it is used
3318 for the group to be loaded and used for selection display UNDER the
3319 selected text. source2 is used for on top of the selected text, if
3320 source2 is specified.
3321 @endproperty
3322*/
3323static void
3324st_collections_group_parts_part_source(void)
3325{
3326 check_arg_count(1);
3327
3328 //FIXME: validate this somehow (need to decide on the format also)
3329 current_part->source = parse_str(0);
3330 data_queue_group_lookup(current_part->source, current_part);
3331}
3332
3333/**
3334 @page edcref
3335 @property
3336 source2
3337 @parameters
3338 [another group's name]
3339 @effect
3340 Only available to TEXTBLOCK parts. It is used for the group to be
3341 loaded and used for selection display OVER the selected text. source
3342 is used for under of the selected text, if source is specified.
3343 @endproperty
3344*/
3345static void
3346st_collections_group_parts_part_source2(void)
3347{
3348 check_arg_count(1);
3349
3350 //FIXME: validate this somehow (need to decide on the format also)
3351 current_part->source2 = parse_str(0);
3352 data_queue_group_lookup(current_part->source2, current_part);
3353}
3354
3355/**
3356 @page edcref
3357 @property
3358 source3
3359 @parameters
3360 [another group's name]
3361 @effect
3362 Only available to TEXTBLOCK parts. It is used for the group to be
3363 loaded and used for cursor display UNDER the cursor position. source4
3364 is used for over the cursor text, if source4 is specified.
3365 @endproperty
3366*/
3367static void
3368st_collections_group_parts_part_source3(void)
3369{
3370 check_arg_count(1);
3371
3372 //FIXME: validate this somehow (need to decide on the format also)
3373 current_part->source3 = parse_str(0);
3374 data_queue_group_lookup(current_part->source3, current_part);
3375}
3376
3377/**
3378 @page edcref
3379 @property
3380 source4
3381 @parameters
3382 [another group's name]
3383 @effect
3384 Only available to TEXTBLOCK parts. It is used for the group to be
3385 loaded and used for cursor display OVER the cursor position. source3
3386 is used for under the cursor text, if source4 is specified.
3387 @endproperty
3388*/
3389static void
3390st_collections_group_parts_part_source4(void)
3391{
3392 check_arg_count(1);
3393
3394 //FIXME: validate this somehow (need to decide on the format also)
3395 current_part->source4 = parse_str(0);
3396 data_queue_group_lookup(current_part->source4, current_part);
3397}
3398
3399/**
3400 @page edcref
3401 @property
3402 source5
3403 @parameters
3404 [another group's name]
3405 @effect
3406 Only available to TEXTBLOCK parts. It is used for the group to be
3407 loaded and used for anchors display UNDER the anchor position. source6
3408 is used for over the anchors text, if source6 is specified.
3409 @endproperty
3410*/
3411static void
3412st_collections_group_parts_part_source5(void)
3413{
3414 check_arg_count(1);
3415
3416 //FIXME: validate this somehow (need to decide on the format also)
3417 current_part->source5 = parse_str(0);
3418 data_queue_group_lookup(current_part->source5, current_part);
3419}
3420
3421/**
3422 @page edcref
3423 @property
3424 source6
3425 @parameters
3426 [another group's name]
3427 @effect
3428 Only available to TEXTBLOCK parts. It is used for the group to be
3429 loaded and used for anchor display OVER the anchor position. source5
3430 is used for under the anchor text, if source6 is specified.
3431 @endproperty
3432*/
3433static void
3434st_collections_group_parts_part_source6(void)
3435{
3436 check_arg_count(1);
3437
3438 //FIXME: validate this somehow (need to decide on the format also)
3439 current_part->source6 = parse_str(0);
3440 data_queue_group_lookup(current_part->source6, current_part);
3441}
3442
3443/**
3444 @page edcref
3445
3446 @property
3447 effect
3448 @parameters
3449 [EFFECT]
3450 (optional) [SHADOW DIRECTION]
3451 @effect
3452 Causes Edje to draw the selected effect among:
3453 @li PLAIN
3454 @li OUTLINE
3455 @li SOFT_OUTLINE
3456 @li SHADOW
3457 @li SOFT_SHADOW
3458 @li OUTLINE_SHADOW
3459 @li OUTLINE_SOFT_SHADOW
3460 @li FAR_SHADOW
3461 @li FAR_SOFT_SHADOW
3462 @li GLOW
3463
3464 Shadow directions (default if not given is BOTTOM_RIGHT):
3465 @li BOTTOM_RIGHT
3466 @li BOTTOM
3467 @li BOTTOM_LEFT
3468 @li LEFT
3469 @li TOP_LEFT
3470 @li TOP
3471 @li TOP_RIGHT
3472 @li RIGHT
3473 @endproperty
3474*/
3475static void
3476st_collections_group_parts_part_effect(void)
3477{
3478 check_min_arg_count(1);
3479
3480 current_part->effect = parse_enum(0,
3481 "NONE", EDJE_TEXT_EFFECT_NONE,
3482 "PLAIN", EDJE_TEXT_EFFECT_PLAIN,
3483 "OUTLINE", EDJE_TEXT_EFFECT_OUTLINE,
3484 "SOFT_OUTLINE", EDJE_TEXT_EFFECT_SOFT_OUTLINE,
3485 "SHADOW", EDJE_TEXT_EFFECT_SHADOW,
3486 "SOFT_SHADOW", EDJE_TEXT_EFFECT_SOFT_SHADOW,
3487 "OUTLINE_SHADOW", EDJE_TEXT_EFFECT_OUTLINE_SHADOW,
3488 "OUTLINE_SOFT_SHADOW", EDJE_TEXT_EFFECT_OUTLINE_SOFT_SHADOW,
3489 "FAR_SHADOW", EDJE_TEXT_EFFECT_FAR_SHADOW,
3490 "FAR_SOFT_SHADOW", EDJE_TEXT_EFFECT_FAR_SOFT_SHADOW,
3491 "GLOW", EDJE_TEXT_EFFECT_GLOW,
3492 NULL);
3493 if (get_arg_count() >= 2)
3494 {
3495 unsigned char shadow;
3496
3497 shadow = parse_enum(1,
3498 "BOTTOM_RIGHT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_RIGHT,
3499 "BOTTOM", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM,
3500 "BOTTOM_LEFT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_BOTTOM_LEFT,
3501 "LEFT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_LEFT,
3502 "TOP_LEFT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_LEFT,
3503 "TOP", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP,
3504 "TOP_RIGHT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_TOP_RIGHT,
3505 "RIGHT", EDJE_TEXT_EFFECT_SHADOW_DIRECTION_RIGHT,
3506 NULL);
3507 EDJE_TEXT_EFFECT_SHADOW_DIRECTION_SET(current_part->effect, shadow);
3508 }
3509}
3510
3511/**
3512 @page edcref
3513 @property
3514 entry_mode
3515 @parameters
3516 [MODE]
3517 @effect
3518 Sets the edit mode for a textblock part to one of:
3519 @li NONE
3520 @li PLAIN
3521 @li EDITABLE
3522 @li PASSWORD
3523 It causes the part be editable if the edje object has the keyboard
3524 focus AND the part has the edje focus (or selectable always
3525 regardless of focus) and in the event of password mode, not
3526 selectable and all text chars replaced with *'s but editable and
3527 pastable.
3528 @endproperty
3529*/
3530static void
3531st_collections_group_parts_part_entry_mode(void)
3532{
3533 check_arg_count(1);
3534
3535 current_part->entry_mode = parse_enum(0,
3536 "NONE", EDJE_ENTRY_EDIT_MODE_NONE,
3537 "PLAIN", EDJE_ENTRY_EDIT_MODE_SELECTABLE,
3538 "EDITABLE", EDJE_ENTRY_EDIT_MODE_EDITABLE,
3539 "PASSWORD", EDJE_ENTRY_EDIT_MODE_PASSWORD,
3540 NULL);
3541}
3542
3543/**
3544 @page edcref
3545 @property
3546 select_mode
3547 @parameters
3548 [MODE]
3549 @effect
3550 Sets the selection mode for a textblock part to one of:
3551 @li DEFAULT selection mode is what you would expect on any desktop. Press
3552 mouse, drag and release to end.
3553 @li EXPLICITmode requires the application
3554 controlling the edje object has to explicitly begin and end selection
3555 modes, and the selection itself is dragable at both ends.
3556 @endproperty
3557*/
3558static void
3559st_collections_group_parts_part_select_mode(void)
3560{
3561 check_arg_count(1);
3562
3563 current_part->select_mode = parse_enum(0,
3564 "DEFAULT", EDJE_ENTRY_SELECTION_MODE_DEFAULT,
3565 "EXPLICIT", EDJE_ENTRY_SELECTION_MODE_EXPLICIT,
3566 NULL);
3567}
3568
3569/**
3570 @page edcref
3571 @property
3572 cursor_mode
3573 @parameters
3574 [MODE]
3575 @effect
3576 Sets the cursor mode for a textblock part to one of:
3577 @li UNDER cursor mode means the cursor will draw below the character pointed
3578 at. That's the default.
3579 @li BEFORE cursor mode means the cursor is drawn as a vertical line before
3580 the current character, just like many other GUI toolkits handle it.
3581 @endproperty
3582*/
3583static void
3584st_collections_group_parts_part_cursor_mode(void)
3585{
3586 check_arg_count(1);
3587
3588 current_part->cursor_mode = parse_enum(0,
3589 "UNDER", EDJE_ENTRY_CURSOR_MODE_UNDER,
3590 "BEFORE", EDJE_ENTRY_CURSOR_MODE_BEFORE,
3591 NULL);
3592}
3593
3594/**
3595 @page edcref
3596 @property
3597 multiline
3598 @parameters
3599 [1 or 0]
3600 @effect
3601 It causes a textblock that is editable to allow multiple lines for
3602 editing.
3603 @endproperty
3604*/
3605static void
3606st_collections_group_parts_part_multiline(void)
3607{
3608 check_arg_count(1);
3609
3610 current_part->multiline = parse_bool(0);
3611}
3612
3613/**
3614 @page edcref
3615 @block
3616 dragable
3617 @context
3618 part {
3619 ..
3620 dragable {
3621 confine: "another part";
3622 events: "another dragable part";
3623 x: 0 0 0;
3624 y: 0 0 0;
3625 }
3626 ..
3627 }
3628 @description
3629 When this block is used the resulting part can be dragged around the
3630 interface, do not confuse with external drag & drop. By default Edje
3631 (and most applications) will attempt to use the minimal size possible
3632 for a dragable part. If the min property is not set in the description
3633 the part will be (most likely) set to 0px width and 0px height, thus
3634 invisible.
3635 @endblock
3636
3637 @property
3638 x
3639 @parameters
3640 [enable/disable] [step] [count]
3641 @effect
3642 Used to setup dragging events for the X axis. The first parameter is
3643 used to enable (1 or -1) and disable (0) dragging along the axis. When
3644 enabled, 1 will set the starting point at 0.0 and -1 at 1.0. The second
3645 parameter takes any integer and will limit movement to values
3646 divisible by it, causing the part to jump from position to position.
3647 The third parameter, (question from the author: What is count for?).
3648 @endproperty
3649*/
3650static void
3651st_collections_group_parts_part_dragable_x(void)
3652{
3653 check_arg_count(3);
3654
3655 current_part->dragable.x = parse_int_range(0, -1, 1);
3656 current_part->dragable.step_x = parse_int_range(1, 0, 0x7fffffff);
3657 current_part->dragable.count_x = parse_int_range(2, 0, 0x7fffffff);
3658}
3659
3660/**
3661 @page edcref
3662 @property
3663 y
3664 @parameters
3665 [enable/disable] [step] [count]
3666 @effect
3667 Used to setup dragging events for the Y axis. The first parameter is
3668 used to enable (1 or -1) and disable (0) dragging along the axis. When
3669 enabled, 1 will set the starting point at 0.0 and -1 at 1.0. The second
3670 parameter takes any integer and will limit movement to values
3671 divisibles by it, causing the part to jump from position to position.
3672 The third parameter, (question from the author: What is count for?).
3673 @endproperty
3674*/
3675static void
3676st_collections_group_parts_part_dragable_y(void)
3677{
3678 check_arg_count(3);
3679
3680 current_part->dragable.y = parse_int_range(0, -1, 1);
3681 current_part->dragable.step_y = parse_int_range(1, 0, 0x7fffffff);
3682 current_part->dragable.count_y = parse_int_range(2, 0, 0x7fffffff);
3683}
3684
3685/**
3686 @page edcref
3687 @property
3688 confine
3689 @parameters
3690 [another part's name]
3691 @effect
3692 When set, limits the movement of the dragged part to another part's
3693 container. When you use confine don't forget to set a min size for the
3694 part, or the draggie will not show up.
3695 @endproperty
3696*/
3697static void
3698st_collections_group_parts_part_dragable_confine(void)
3699{
3700 Edje_Part_Collection *pc;
3701
3702 check_arg_count(1);
3703
3704 pc = eina_list_data_get(eina_list_last(edje_collections));
3705 {
3706 char *name;
3707
3708 name = parse_str(0);
3709 data_queue_part_lookup(pc, name, &(current_part->dragable.confine_id));
3710 free(name);
3711 }
3712}
3713
3714/**
3715 @page edcref
3716 @property
3717 events
3718 @parameters
3719 [another dragable part's name]
3720 @effect
3721 It causes the part to forward the drag events to another part, thus
3722 ignoring them for itself.
3723 @endproperty
3724*/
3725static void
3726st_collections_group_parts_part_dragable_events(void)
3727{
3728 Edje_Part_Collection *pc;
3729
3730 check_arg_count(1);
3731
3732 pc = eina_list_data_get(eina_list_last(edje_collections));
3733 {
3734 char *name;
3735
3736 name = parse_str(0);
3737 data_queue_part_lookup(pc, name, &(current_part->dragable.event_id));
3738 free(name);
3739 }
3740}
3741
3742/**
3743 @page edcref
3744 @block
3745 items
3746 @context
3747 part {
3748 ..
3749 box {
3750 items {
3751 item {
3752 type: TYPE;
3753 source: "some source";
3754 min: 1 1;
3755 max: 100 100;
3756 padding: 1 1 2 2;
3757 }
3758 item {
3759 type: TYPE;
3760 source: "some other source";
3761 name: "some name";
3762 align: 1.0 0.5;
3763 }
3764 ..
3765 }
3766 }
3767 ..
3768 }
3769 @description
3770 On a part of type BOX, this block can be used to set other groups
3771 as elements of the box. These can be mixed with external objects set
3772 by the application through the edje_object_part_box_* API.
3773 @endblock
3774*/
3775static void ob_collections_group_parts_part_box_items_item(void)
3776{
3777 Edje_Part *ep;
3778 Edje_Pack_Element *item;
3779 Edje_Pack_Element_Parser *pitem;
3780
3781 ep = current_part;
3782
3783 if ((ep->type != EDJE_PART_TYPE_BOX) && (ep->type != EDJE_PART_TYPE_TABLE))
3784 {
3785 ERR("%s: Error. parse error %s:%i. "
3786 "box attributes in non-BOX or TABLE part.",
3787 progname, file_in, line - 1);
3788 exit(-1);
3789 }
3790
3791 ep->items_count++;
3792 ep->items = realloc(ep->items, sizeof (Edje_Pack_Element*) * ep->items_count);
3793 if (!ep->items)
3794 {
3795 ERR("%s: Error. Not enough memory.", progname);
3796 exit(-1);
3797 }
3798
3799 item = mem_alloc(SZ(Edje_Pack_Element_Parser));
3800 current_item = ep->items[ep->items_count - 1] = item;
3801 item->type = EDJE_PART_TYPE_GROUP;
3802 item->name = NULL;
3803 item->source = NULL;
3804 item->min.w = 0;
3805 item->min.h = 0;
3806 item->prefer.w = 0;
3807 item->prefer.h = 0;
3808 item->max.w = -1;
3809 item->max.h = -1;
3810 item->padding.l = 0;
3811 item->padding.r = 0;
3812 item->padding.t = 0;
3813 item->padding.b = 0;
3814 item->align.x = FROM_DOUBLE(0.5);
3815 item->align.y = FROM_DOUBLE(0.5);
3816 item->weight.x = FROM_DOUBLE(0.0);
3817 item->weight.y = FROM_DOUBLE(0.0);
3818 item->aspect.w = 0;
3819 item->aspect.h = 0;
3820 item->aspect.mode = EDJE_ASPECT_CONTROL_NONE;
3821 item->options = NULL;
3822 item->col = -1;
3823 item->row = -1;
3824 item->colspan = 1;
3825 item->rowspan = 1;
3826 pitem = (Edje_Pack_Element_Parser *)item;
3827 pitem->can_override = EINA_FALSE;
3828}
3829
3830/**
3831 @page edcref
3832 @property
3833 type
3834 @parameters
3835 Only GROUP for now (defaults to it)
3836 @effect
3837 Sets the type of the object this item will hold.
3838 @endproperty
3839*/
3840static void st_collections_group_parts_part_box_items_item_type(void)
3841{
3842 check_arg_count(1);
3843
3844 {
3845 char *s;
3846
3847 s = parse_str(0);
3848 if (strcmp(s, "GROUP"))
3849 {
3850 ERR("%s: Error. parse error %s:%i. "
3851 "token %s not one of: GROUP.",
3852 progname, file_in, line - 1, s);
3853 exit(-1);
3854 }
3855 /* FIXME: handle the enum, once everything else is supported */
3856 current_item->type = EDJE_PART_TYPE_GROUP;
3857 }
3858}
3859
3860/**
3861 @page edcref
3862 @property
3863 name
3864 @parameters
3865 [name for the object]
3866 @effect
3867 Sets the name of the object via evas_object_name_set().
3868 @endproperty
3869*/
3870static void st_collections_group_parts_part_box_items_item_name(void)
3871{
3872 Edje_Part *ep;
3873 Edje_Pack_Element *item;
3874 Edje_Pack_Element_Parser *pitem;
3875
3876 check_arg_count(1);
3877
3878 ep = current_part;
3879 item = ep->items[ep->items_count - 1];
3880
3881 item->name = parse_str(0);
3882
3883 {
3884 unsigned int i;
3885
3886 for (i = 0; i < ep->items_count - 1; ++i)
3887 {
3888 if (ep->items[i]->name && (!strcmp(ep->items[i]->name, item->name)))
3889 {
3890 pitem = (Edje_Pack_Element_Parser *)ep->items[i];
3891 if (!pitem->can_override)
3892 {
3893 ERR("%s: Error. parse error %s:%i. There is already a item of the name %s",
3894 progname, file_in, line - 1, item->name);
3895 exit(-1);
3896 }
3897 else
3898 {
3899 free(item);
3900 ep->items_count--;
3901 ep->items = realloc(ep->items, ep->items_count * sizeof (Edje_Pack_Element *));
3902 current_item = ep->items[i];
3903 pitem->can_override = EINA_FALSE;
3904 }
3905 }
3906 }
3907 }
3908}
3909
3910/**
3911 @page edcref
3912 @property
3913 source
3914 @parameters
3915 [another group's name]
3916 @effect
3917 Sets the group this object will be made from.
3918 @endproperty
3919*/
3920static void st_collections_group_parts_part_box_items_item_source(void)
3921{
3922 check_arg_count(1);
3923
3924 current_item->source = parse_str(0);
3925 data_queue_group_lookup(current_item->source, current_part);
3926}
3927
3928/**
3929 @page edcref
3930 @property
3931 min
3932 @parameters
3933 [width] [height]
3934 @effect
3935 Sets the minimum size hints for this object.
3936 @endproperty
3937*/
3938static void st_collections_group_parts_part_box_items_item_min(void)
3939{
3940 check_arg_count(2);
3941
3942 current_item->min.w = parse_int_range(0, 0, 0x7ffffff);
3943 current_item->min.h = parse_int_range(1, 0, 0x7ffffff);
3944}
3945
3946/**
3947 @page edcref
3948 @property
3949 prefer
3950 @parameters
3951 [width] [height]
3952 @effect
3953 Sets the preferred size hints for this object.
3954 @endproperty
3955*/
3956static void st_collections_group_parts_part_box_items_item_prefer(void)
3957{
3958 check_arg_count(2);
3959
3960 current_item->prefer.w = parse_int_range(0, 0, 0x7ffffff);
3961 current_item->prefer.h = parse_int_range(1, 0, 0x7ffffff);
3962}
3963/**
3964 @page edcref
3965 @property
3966 max
3967 @parameters
3968 [width] [height]
3969 @effect
3970 Sets the maximum size hints for this object.
3971 @endproperty
3972*/
3973static void st_collections_group_parts_part_box_items_item_max(void)
3974{
3975 check_arg_count(2);
3976
3977 current_item->max.w = parse_int_range(0, 0, 0x7ffffff);
3978 current_item->max.h = parse_int_range(1, 0, 0x7ffffff);
3979}
3980
3981/**
3982 @page edcref
3983 @property
3984 padding
3985 @parameters
3986 [left] [right] [top] [bottom]
3987 @effect
3988 Sets the padding hints for this object.
3989 @endproperty
3990*/
3991static void st_collections_group_parts_part_box_items_item_padding(void)
3992{
3993 check_arg_count(4);
3994
3995 current_item->padding.l = parse_int_range(0, 0, 0x7ffffff);
3996 current_item->padding.r = parse_int_range(1, 0, 0x7ffffff);
3997 current_item->padding.t = parse_int_range(2, 0, 0x7ffffff);
3998 current_item->padding.b = parse_int_range(3, 0, 0x7ffffff);
3999}
4000
4001/**
4002 @page edcref
4003 @property
4004 align
4005 @parameters
4006 [x] [y]
4007 @effect
4008 Sets the alignment hints for this object.
4009 @endproperty
4010*/
4011static void st_collections_group_parts_part_box_items_item_align(void)
4012{
4013 check_arg_count(2);
4014
4015 current_item->align.x = FROM_DOUBLE(parse_float_range(0, -1.0, 1.0));
4016 current_item->align.y = FROM_DOUBLE(parse_float_range(1, -1.0, 1.0));
4017}
4018
4019/**
4020 @page edcref
4021 @property
4022 weight
4023 @parameters
4024 [x] [y]
4025 @effect
4026 Sets the weight hints for this object.
4027 @endproperty
4028*/
4029static void st_collections_group_parts_part_box_items_item_weight(void)
4030{
4031 check_arg_count(2);
4032
4033 current_item->weight.x = FROM_DOUBLE(parse_float_range(0, 0.0, 99999.99));
4034 current_item->weight.y = FROM_DOUBLE(parse_float_range(1, 0.0, 99999.99));
4035}
4036
4037/**
4038 @page edcref
4039 @property
4040 aspect
4041 @parameters
4042 [w] [h]
4043 @effect
4044 Sets the aspect width and height hints for this object.
4045 @endproperty
4046*/
4047static void st_collections_group_parts_part_box_items_item_aspect(void)
4048{
4049 check_arg_count(2);
4050
4051 current_item->aspect.w = parse_int_range(0, 0, 0x7fffffff);
4052 current_item->aspect.h = parse_int_range(1, 0, 0x7fffffff);
4053}
4054
4055/**
4056 @page edcref
4057 @property
4058 aspect_mode
4059 @parameters
4060 NONE, NEITHER, HORIZONTAL, VERTICAL, BOTH
4061 @effect
4062 Sets the aspect control hints for this object.
4063 @endproperty
4064*/
4065static void st_collections_group_parts_part_box_items_item_aspect_mode(void)
4066{
4067 check_arg_count(1);
4068
4069 current_item->aspect.mode = parse_enum(0,
4070 "NONE", EDJE_ASPECT_CONTROL_NONE,
4071 "NEITHER", EDJE_ASPECT_CONTROL_NEITHER,
4072 "HORIZONTAL", EDJE_ASPECT_CONTROL_HORIZONTAL,
4073 "VERTICAL", EDJE_ASPECT_CONTROL_VERTICAL,
4074 "BOTH", EDJE_ASPECT_CONTROL_BOTH,
4075 NULL);
4076}
4077
4078/**
4079 @page edcref
4080 @property
4081 options
4082 @parameters
4083 [extra options]
4084 @effect
4085 Sets extra options for the object. Unused for now.
4086 @endproperty
4087*/
4088static void st_collections_group_parts_part_box_items_item_options(void)
4089{
4090 check_arg_count(1);
4091
4092 current_item->options = parse_str(0);
4093}
4094
4095/**
4096 @page edcref
4097 @property
4098 position
4099 @parameters
4100 [col] [row]
4101 @effect
4102 Sets the position this item will have in the table.
4103 This is required for parts of type TABLE.
4104 @endproperty
4105*/
4106static void st_collections_group_parts_part_table_items_item_position(void)
4107{
4108 check_arg_count(2);
4109
4110 if (current_part->type != EDJE_PART_TYPE_TABLE)
4111 {
4112 ERR("%s: Error. parse error %s:%i. "
4113 "table attributes in non-TABLE part.",
4114 progname, file_in, line - 1);
4115 exit(-1);
4116 }
4117
4118 current_item->col = parse_int_range(0, 0, 0xffff);
4119 current_item->row = parse_int_range(1, 0, 0xffff);
4120}
4121
4122/**
4123 @page edcref
4124 @property
4125 span
4126 @parameters
4127 [col] [row]
4128 @effect
4129 Sets how many columns/rows this item will use.
4130 Defaults to 1 1.
4131 @endproperty
4132*/
4133static void st_collections_group_parts_part_table_items_item_span(void)
4134{
4135 check_arg_count(2);
4136
4137 if (current_part->type != EDJE_PART_TYPE_TABLE)
4138 {
4139 ERR("%s: Error. parse error %s:%i. "
4140 "table attributes in non-TABLE part.",
4141 progname, file_in, line - 1);
4142 exit(-1);
4143 }
4144
4145 current_item->colspan = parse_int_range(0, 1, 0xffff);
4146 current_item->rowspan = parse_int_range(1, 1, 0xffff);
4147}
4148
4149/**
4150 @edcsection{description,State description sub blocks}
4151 */
4152
4153/**
4154 @page edcref
4155 @block
4156 description
4157 @context
4158 description {
4159 inherit: "another_description" INDEX;
4160 state: "description_name" INDEX;
4161 visible: 1;
4162 min: 0 0;
4163 max: -1 -1;
4164 align: 0.5 0.5;
4165 fixed: 0 0;
4166 step: 0 0;
4167 aspect: 1 1;
4168
4169 rel1 {
4170 ..
4171 }
4172
4173 rel2 {
4174 ..
4175 }
4176 }
4177 @description
4178 Every part can have one or more description blocks. Each description is
4179 used to define style and layout properties of a part in a given
4180 "state".
4181 @endblock
4182*/
4183static void
4184ob_collections_group_parts_part_description(void)
4185{
4186 Edje_Part_Collection *pc;
4187 Edje_Part *ep;
4188 Edje_Part_Description_Common *ed;
4189
4190 pc = eina_list_data_get(eina_list_last(edje_collections));
4191 ep = current_part;
4192
4193 ed = _edje_part_description_alloc(ep->type, pc->part, ep->name);
4194
4195 if (!ep->default_desc)
4196 {
4197 current_desc = ep->default_desc = ed;
4198 }
4199 else
4200 {
4201 ep->other.desc_count++;
4202 ep->other.desc = realloc(ep->other.desc,
4203 sizeof (Edje_Part_Description_Common*) * ep->other.desc_count);
4204 current_desc = ep->other.desc[ep->other.desc_count - 1] = ed;
4205 }
4206
4207 ed->visible = 1;
4208 ed->align.x = FROM_DOUBLE(0.5);
4209 ed->align.y = FROM_DOUBLE(0.5);
4210 ed->min.w = 0;
4211 ed->min.h = 0;
4212 ed->fixed.w = 0;
4213 ed->fixed.h = 0;
4214 ed->max.w = -1;
4215 ed->max.h = -1;
4216 ed->rel1.relative_x = FROM_DOUBLE(0.0);
4217 ed->rel1.relative_y = FROM_DOUBLE(0.0);
4218 ed->rel1.offset_x = 0;
4219 ed->rel1.offset_y = 0;
4220 ed->rel1.id_x = -1;
4221 ed->rel1.id_y = -1;
4222 ed->rel2.relative_x = FROM_DOUBLE(1.0);
4223 ed->rel2.relative_y = FROM_DOUBLE(1.0);
4224 ed->rel2.offset_x = -1;
4225 ed->rel2.offset_y = -1;
4226 ed->rel2.id_x = -1;
4227 ed->rel2.id_y = -1;
4228 ed->color_class = NULL;
4229 ed->color.r = 255;
4230 ed->color.g = 255;
4231 ed->color.b = 255;
4232 ed->color.a = 255;
4233 ed->color2.r = 0;
4234 ed->color2.g = 0;
4235 ed->color2.b = 0;
4236 ed->color2.a = 255;
4237 ed->map.id_persp = -1;
4238 ed->map.id_light = -1;
4239 ed->map.rot.id_center = -1;
4240 ed->map.rot.x = FROM_DOUBLE(0.0);
4241 ed->map.rot.y = FROM_DOUBLE(0.0);
4242 ed->map.rot.z = FROM_DOUBLE(0.0);
4243 ed->map.on = 0;
4244 ed->map.smooth = 1;
4245 ed->map.alpha = 1;
4246 ed->map.backcull = 0;
4247 ed->map.persp_on = 0;
4248 ed->persp.zplane = 0;
4249 ed->persp.focal = 1000;
4250 ed->minmul.have = 1;
4251 ed->minmul.w = FROM_INT(1);
4252 ed->minmul.h = FROM_INT(1);
4253}
4254
4255/**
4256 @page edcref
4257 @property
4258 inherit
4259 @parameters
4260 [another description's name] [another description's index]
4261 @effect
4262 When set, the description will inherit all the properties from the
4263 named description. The properties defined in this part will override
4264 the inherited properties, reducing the amount of necessary code for
4265 simple state changes. Note: inheritance in Edje is single level only.
4266 @endproperty
4267*/
4268static void
4269st_collections_group_parts_part_description_inherit(void)
4270{
4271 Edje_Part_Collection *pc;
4272 Edje_Part *ep;
4273 Edje_Part_Description_Common *ed, *parent = NULL;
4274 Edje_Part_Image_Id *iid;
4275 char *parent_name;
4276 const char *state_name;
4277 double parent_val, state_val;
4278
4279 pc = eina_list_data_get(eina_list_last(edje_collections));
4280 ep = current_part;
4281 ed = current_desc;
4282
4283 if (!ed->state.name)
4284 {
4285 ERR("%s: Error. parse error %s:%i. "
4286 "inherit may only be used after state",
4287 progname, file_in, line - 1);
4288 exit(-1);
4289 }
4290
4291 parent = parent_desc;
4292 if (!parent)
4293 {
4294 check_arg_count(2);
4295
4296 /* inherit may not be used in the default description */
4297 if (!ep->other.desc_count)
4298 {
4299 ERR("%s: Error. parse error %s:%i. "
4300 "inherit may not be used in the default description",
4301 progname, file_in, line - 1);
4302 exit(-1);
4303 }
4304
4305 /* find the description that we inherit from */
4306 parent_name = parse_str(0);
4307 parent_val = parse_float_range(1, 0.0, 1.0);
4308
4309 if (!strcmp (parent_name, "default") && parent_val == 0.0)
4310 parent = ep->default_desc;
4311 else
4312 {
4313 Edje_Part_Description_Common *d;
4314 double min_dst = 999.0;
4315 unsigned int i;
4316
4317 if (!strcmp(parent_name, "default"))
4318 {
4319 parent = ep->default_desc;
4320 min_dst = ABS(ep->default_desc->state.value - parent_val);
4321 }
4322
4323 for (i = 0; i < ep->other.desc_count; ++i)
4324 {
4325 d = ep->other.desc[i];
4326
4327 if (!strcmp (d->state.name, parent_name))
4328 {
4329
4330 double dst;
4331
4332 dst = ABS(d->state.value - parent_val);
4333 if (dst < min_dst)
4334 {
4335 parent = d;
4336 min_dst = dst;
4337 }
4338 }
4339 }
4340 }
4341
4342 if (!parent)
4343 {
4344 ERR("%s: Error. parse error %s:%i. "
4345 "cannot find referenced part state %s %lf",
4346 ep->name, file_in, line - 1, parent_name, parent_val);
4347 exit(-1);
4348 }
4349
4350 free(parent_name);
4351 }
4352 /* now do a full copy, only state info will be kept */
4353 state_name = ed->state.name;
4354 state_val = ed->state.value;
4355
4356 *ed = *parent;
4357
4358 ed->state.name = state_name;
4359 ed->state.value = state_val;
4360
4361 data_queue_copied_part_lookup(pc, &parent->rel1.id_x, &ed->rel1.id_x);
4362 data_queue_copied_part_lookup(pc, &parent->rel1.id_y, &ed->rel1.id_y);
4363 data_queue_copied_part_lookup(pc, &parent->rel2.id_x, &ed->rel2.id_x);
4364 data_queue_copied_part_lookup(pc, &parent->rel2.id_y, &ed->rel2.id_y);
4365
4366 data_queue_copied_part_lookup(pc, &parent->map.id_persp, &ed->map.id_persp);
4367 data_queue_copied_part_lookup(pc, &parent->map.id_light, &ed->map.id_light);
4368 data_queue_copied_part_lookup(pc, &parent->map.rot.id_center, &ed->map.rot.id_center);
4369
4370 /* make sure all the allocated memory is getting copied, not just
4371 * referenced
4372 */
4373#define STRDUP(x) x ? strdup(x) : NULL
4374
4375 ed->color_class = STRDUP(ed->color_class);
4376 switch (ep->type)
4377 {
4378 case EDJE_PART_TYPE_RECTANGLE:
4379 case EDJE_PART_TYPE_SWALLOW:
4380 case EDJE_PART_TYPE_GROUP:
4381 /* Nothing todo, this part only have a common description. */
4382 break;
4383 case EDJE_PART_TYPE_TEXT:
4384 case EDJE_PART_TYPE_TEXTBLOCK:
4385 {
4386 Edje_Part_Description_Text *ted = (Edje_Part_Description_Text*) ed;
4387 Edje_Part_Description_Text *tparent = (Edje_Part_Description_Text*) parent;
4388
4389 ted->text = tparent->text;
4390
4391 ted->text.text.str = STRDUP(ted->text.text.str);
4392 ted->text.text_class = STRDUP(ted->text.text_class);
4393 ted->text.font.str = STRDUP(ted->text.font.str);
4394
4395 data_queue_copied_part_lookup(pc, &(tparent->text.id_source), &(ted->text.id_source));
4396 data_queue_copied_part_lookup(pc, &(tparent->text.id_text_source), &(ted->text.id_text_source));
4397
4398 break;
4399 }
4400 case EDJE_PART_TYPE_IMAGE:
4401 {
4402 Edje_Part_Description_Image *ied = (Edje_Part_Description_Image *) ed;
4403 Edje_Part_Description_Image *iparent = (Edje_Part_Description_Image *) parent;
4404 unsigned int i;
4405
4406 ied->image = iparent->image;
4407
4408 data_queue_image_remove(&ied->image.id, &ied->image.set);
4409 data_queue_copied_image_lookup(&iparent->image.id, &ied->image.id, &ied->image.set);
4410
4411 ied->image.tweens = calloc(iparent->image.tweens_count,
4412 sizeof (Edje_Part_Image_Id*));
4413 for (i = 0; i < iparent->image.tweens_count; i++)
4414 {
4415 Edje_Part_Image_Id *iid_new;
4416
4417 iid = iparent->image.tweens[i];
4418
4419 iid_new = mem_alloc(SZ(Edje_Part_Image_Id));
4420 data_queue_image_remove(&ied->image.id, &ied->image.set);
4421 data_queue_copied_image_lookup(&(iid->id), &(iid_new->id), &(iid_new->set));
4422 ied->image.tweens[i] = iid_new;
4423 }
4424
4425 break;
4426 }
4427 case EDJE_PART_TYPE_PROXY:
4428 {
4429 Edje_Part_Description_Proxy *ped = (Edje_Part_Description_Proxy*) ed;
4430 Edje_Part_Description_Proxy *pparent = (Edje_Part_Description_Proxy*) parent;
4431
4432 data_queue_copied_part_lookup(pc, &(pparent->proxy.id), &(ped->proxy.id));
4433
4434 break;
4435 }
4436 case EDJE_PART_TYPE_BOX:
4437 {
4438 Edje_Part_Description_Box *bed = (Edje_Part_Description_Box *) ed;
4439 Edje_Part_Description_Box *bparent = (Edje_Part_Description_Box *) parent;
4440
4441 bed->box = bparent->box;
4442
4443 break;
4444 }
4445 case EDJE_PART_TYPE_TABLE:
4446 {
4447 Edje_Part_Description_Table *ted = (Edje_Part_Description_Table *) ed;
4448 Edje_Part_Description_Table *tparent = (Edje_Part_Description_Table *) parent;
4449
4450 ted->table = tparent->table;
4451
4452 break;
4453 }
4454 case EDJE_PART_TYPE_EXTERNAL:
4455 {
4456 Edje_Part_Description_External *eed = (Edje_Part_Description_External *) ed;
4457 Edje_Part_Description_External *eparent = (Edje_Part_Description_External *) parent;
4458
4459 if (eparent->external_params)
4460 {
4461 Eina_List *l;
4462 Edje_External_Param *param, *new_param;
4463
4464 eed->external_params = NULL;
4465 EINA_LIST_FOREACH(eparent->external_params, l, param)
4466 {
4467 new_param = mem_alloc(SZ(Edje_External_Param));
4468 *new_param = *param;
4469 eed->external_params = eina_list_append(eed->external_params, new_param);
4470 }
4471 }
4472 break;
4473 }
4474 }
4475
4476#undef STRDUP
4477}
4478
4479/**
4480 @page edcref
4481
4482 @property
4483 source
4484 @parameters
4485 [another part's name]
4486 @effect
4487 Causes the part to use another part content as the content of this part.
4488 Only work with PROXY part.
4489 @endproperty
4490*/
4491static void
4492st_collections_group_parts_part_description_source(void)
4493{
4494 Edje_Part_Collection *pc;
4495 Edje_Part_Description_Proxy *ed;
4496 char *name;
4497
4498 check_arg_count(1);
4499
4500 pc = eina_list_data_get(eina_list_last(edje_collections));
4501
4502 if (current_part->type != EDJE_PART_TYPE_PROXY)
4503 {
4504 ERR("%s: Error. parse error %s:%i. "
4505 "source attributes in non-PROXY part.",
4506 progname, file_in, line - 1);
4507 exit(-1);
4508 }
4509
4510 ed = (Edje_Part_Description_Proxy*) current_desc;
4511
4512 name = parse_str(0);
4513
4514 data_queue_part_lookup(pc, name, &(ed->proxy.id));
4515 free(name);
4516}
4517
4518/**
4519 @page edcref
4520 @property
4521 state
4522 @parameters
4523 [a name for the description] [an index]
4524 @effect
4525 Sets a name used to identify a description inside a given part.
4526 Multiple descriptions are used to declare different states of the same
4527 part, like "clicked" or "invisible". All states declarations are also
4528 coupled with an index number between 0.0 and 1.0. All parts must have
4529 at least one description named "default 0.0".
4530 @endproperty
4531*/
4532static void
4533st_collections_group_parts_part_description_state(void)
4534{
4535 Edje_Part *ep;
4536 Edje_Part_Description_Common *ed;
4537 char *s;
4538
4539 check_arg_count(2);
4540
4541 ep = current_part;
4542
4543 ed = ep->default_desc;
4544 if (ep->other.desc_count) ed = ep->other.desc[ep->other.desc_count - 1];
4545
4546 s = parse_str(0);
4547 if (!strcmp (s, "custom"))
4548 {
4549 ERR("%s: Error. parse error %s:%i. "
4550 "invalid state name: '%s'.",
4551 progname, file_in, line - 1, s);
4552 exit(-1);
4553 }
4554
4555 ed->state.name = s;
4556 ed->state.value = parse_float_range(1, 0.0, 1.0);
4557
4558 if (ed != ep->default_desc)
4559 {
4560 if ((ep->default_desc->state.name && !strcmp(s, ep->default_desc->state.name) && ed->state.value == ep->default_desc->state.value) ||
4561 (!ep->default_desc->state.name && !strcmp(s, "default") && ed->state.value == ep->default_desc->state.value))
4562 {
4563 if (ep->type == EDJE_PART_TYPE_IMAGE)
4564 _edje_part_description_image_remove((Edje_Part_Description_Image*) ed);
4565
4566 free(ed);
4567 ep->other.desc_count--;
4568 ep->other.desc = realloc(ep->other.desc,
4569 sizeof (Edje_Part_Description_Common*) * ep->other.desc_count);
4570 current_desc = ep->default_desc;
4571 }
4572 else if (ep->other.desc_count)
4573 {
4574 unsigned int i;
4575 for (i = 0; i < ep->other.desc_count - 1; ++i)
4576 {
4577 if (!strcmp(s, ep->other.desc[i]->state.name) && ed->state.value == ep->other.desc[i]->state.value)
4578 {
4579 if (ep->type == EDJE_PART_TYPE_IMAGE)
4580 _edje_part_description_image_remove((Edje_Part_Description_Image*) ed);
4581
4582 free(ed);
4583 ep->other.desc_count--;
4584 ep->other.desc = realloc(ep->other.desc,
4585 sizeof (Edje_Part_Description_Common*) * ep->other.desc_count);
4586 current_desc = ep->other.desc[i];
4587 break;
4588 }
4589 }
4590 }
4591 }
4592}
4593
4594/**
4595 @page edcref
4596 @property
4597 visible
4598 @parameters
4599 [0 or 1]
4600 @effect
4601 Takes a boolean value specifying whether part is visible (1) or not
4602 (0). Non-visible parts do not emit signals. The default value is 1.
4603 @endproperty
4604*/
4605static void
4606st_collections_group_parts_part_description_visible(void)
4607{
4608 check_arg_count(1);
4609
4610 current_desc->visible = parse_bool(0);
4611}
4612
4613/**
4614 @page edcref
4615 @property
4616 align
4617 @parameters
4618 [X axis] [Y axis]
4619 @effect
4620 When the displayed object's size is smaller than its container, this
4621 property moves it relatively along both axis inside its container. The
4622 default value is "0.5 0.5".
4623 @endproperty
4624*/
4625static void
4626st_collections_group_parts_part_description_align(void)
4627{
4628 check_arg_count(2);
4629
4630 current_desc->align.x = FROM_DOUBLE(parse_float_range(0, 0.0, 1.0));
4631 current_desc->align.y = FROM_DOUBLE(parse_float_range(1, 0.0, 1.0));
4632}
4633
4634/**
4635 @page edcref
4636 @property
4637 fixed
4638 @parameters
4639 [width, 0 or 1] [height, 0 or 1]
4640 @effect
4641 This affects the minimum size calculation. See
4642 edje_object_size_min_calc() and edje_object_size_min_restricted_calc().
4643 This tells the min size calculation routine that this part does not
4644 change size in width or height (1 for it doesn't, 0 for it does), so
4645 the routine should not try and expand or contract the part.
4646 @endproperty
4647*/
4648static void
4649st_collections_group_parts_part_description_fixed(void)
4650{
4651 check_arg_count(2);
4652
4653 current_desc->fixed.w = parse_float_range(0, 0, 1);
4654 current_desc->fixed.h = parse_float_range(1, 0, 1);
4655}
4656
4657/**
4658 @page edcref
4659 @property
4660 min
4661 @parameters
4662 [width] [height] or SOURCE
4663 @effect
4664 The minimum size of the state.
4665
4666 When min is defined to SOURCE, it will look at the original
4667 image size and enforce it minimal size to match at least the
4668 original one. The part must be an IMAGE or a GROUP part.
4669 @endproperty
4670*/
4671static void
4672st_collections_group_parts_part_description_min(void)
4673{
4674 check_min_arg_count(1);
4675
4676 if (is_param(1)) {
4677 current_desc->min.w = parse_float_range(0, 0, 0x7fffffff);
4678 current_desc->min.h = parse_float_range(1, 0, 0x7fffffff);
4679 } else {
4680 char *tmp;
4681
4682 tmp = parse_str(0);
4683 if ((current_part->type != EDJE_PART_TYPE_IMAGE && current_part->type != EDJE_PART_TYPE_GROUP) ||
4684 !tmp || strcmp(tmp, "SOURCE") != 0)
4685 {
4686 ERR("%s: Error. parse error %s:%i. "
4687 "Only IMAGE and GROUP part can have a min: SOURCE; defined",
4688 progname, file_in, line - 1);
4689 exit(-1);
4690 }
4691
4692 current_desc->min.limit = EINA_TRUE;
4693 }
4694}
4695
4696/**
4697 @page edcref
4698 @property
4699 minmul
4700 @parameters
4701 [width multipler] [height multiplier]
4702 @effect
4703 A multiplier FORCIBLY applied to whatever minimum size is only during
4704 minimum size calculation.
4705 @endproperty
4706 @since 1.2
4707*/
4708static void
4709st_collections_group_parts_part_description_minmul(void)
4710{
4711 check_arg_count(2);
4712
4713 current_desc->minmul.w = FROM_DOUBLE(parse_float_range(0, 0, 999999));
4714 current_desc->minmul.h = FROM_DOUBLE(parse_float_range(1, 0, 999999));
4715}
4716
4717/**
4718 @page edcref
4719 @property
4720 max
4721 @parameters
4722 [width] [height] or SOURCE
4723 @effect
4724 The maximum size of the state. A size of -1.0 means that it will be ignored in one direction.
4725
4726 When max is set to SOURCE, edje will enforce the part to be
4727 not more than the original image size. The part must be an
4728 IMAGE part.
4729 @endproperty
4730*/
4731static void
4732st_collections_group_parts_part_description_max(void)
4733{
4734 check_min_arg_count(1);
4735
4736 if (is_param(1)) {
4737 current_desc->max.w = parse_float_range(0, -1.0, 0x7fffffff);
4738 current_desc->max.h = parse_float_range(1, -1.0, 0x7fffffff);
4739 } else {
4740 char *tmp;
4741
4742 tmp = parse_str(0);
4743 if (current_part->type != EDJE_PART_TYPE_IMAGE ||
4744 !tmp || strcmp(tmp, "SOURCE") != 0)
4745 {
4746 ERR("%s: Error. parse error %s:%i. "
4747 "Only IMAGE part can have a max: SOURCE; defined",
4748 progname, file_in, line - 1);
4749 exit(-1);
4750 }
4751
4752 current_desc->max.limit = EINA_TRUE;
4753 }
4754}
4755
4756/**
4757 @page edcref
4758 @property
4759 step
4760 @parameters
4761 [width] [height]
4762 @effect
4763 Restricts resizing of each dimension to values divisibles by its value.
4764 This causes the part to jump from value to value while resizing. The
4765 default value is "0 0" disabling stepping.
4766 @endproperty
4767*/
4768static void
4769st_collections_group_parts_part_description_step(void)
4770{
4771 check_arg_count(2);
4772
4773 current_desc->step.x = parse_float_range(0, 0, 0x7fffffff);
4774 current_desc->step.y = parse_float_range(1, 0, 0x7fffffff);
4775}
4776
4777/**
4778 @page edcref
4779 @property
4780 aspect
4781 @parameters
4782 [min] [max]
4783 @effect
4784 Normally width and height can be resized to any values independently.
4785 The aspect property forces the width to height ratio to be kept between
4786 the minimum and maximum set. For example, "1.0 1.0" will increase the
4787 width a pixel for every pixel added to height. The default value is
4788 "0.0 0.0" disabling aspect.
4789 @endproperty
4790*/
4791static void
4792st_collections_group_parts_part_description_aspect(void)
4793{
4794 check_arg_count(2);
4795
4796 current_desc->aspect.min = FROM_DOUBLE(parse_float_range(0, 0.0, 999999999.0));
4797 current_desc->aspect.max = FROM_DOUBLE(parse_float_range(1, 0.0, 999999999.0));
4798}
4799
4800/**
4801 @page edcref
4802 @property
4803 aspect_preference
4804 @parameters
4805 [DIMENSION]
4806 @effect
4807 Sets the scope of the "aspect" property to a given dimension. Available
4808 options are BOTH, VERTICAL, HORIZONTAL, SOURCE and NONE
4809 @endproperty
4810*/
4811static void
4812st_collections_group_parts_part_description_aspect_preference(void)
4813{
4814 check_arg_count(1);
4815
4816 current_desc->aspect.prefer = parse_enum(0,
4817 "NONE", EDJE_ASPECT_PREFER_NONE,
4818 "VERTICAL", EDJE_ASPECT_PREFER_VERTICAL,
4819 "HORIZONTAL", EDJE_ASPECT_PREFER_HORIZONTAL,
4820 "BOTH", EDJE_ASPECT_PREFER_BOTH,
4821 "SOURCE", EDJE_ASPECT_PREFER_SOURCE,
4822 NULL);
4823}
4824
4825/**
4826 @page edcref
4827 @property
4828 color_class
4829 @parameters
4830 [color class name]
4831 @effect
4832 The part will use the color values of the named color_class, these
4833 values can be overrided by the "color", "color2" and "color3"
4834 properties set below.
4835 @endproperty
4836*/
4837static void
4838st_collections_group_parts_part_description_color_class(void)
4839{
4840 check_arg_count(1);
4841
4842 current_desc->color_class = parse_str(0);
4843}
4844
4845/**
4846 @page edcref
4847 @property
4848 color
4849 @parameters
4850 [red] [green] [blue] [alpha]
4851 @effect
4852 Sets the main color to the specified values (between 0 and 255).
4853 @endproperty
4854*/
4855static void
4856st_collections_group_parts_part_description_color(void)
4857{
4858 check_arg_count(4);
4859
4860 current_desc->color.r = parse_int_range(0, 0, 255);
4861 current_desc->color.g = parse_int_range(1, 0, 255);
4862 current_desc->color.b = parse_int_range(2, 0, 255);
4863 current_desc->color.a = parse_int_range(3, 0, 255);
4864}
4865
4866/**
4867 @page edcref
4868 @property
4869 color2
4870 @parameters
4871 [red] [green] [blue] [alpha]
4872 @effect
4873 Sets the text shadow color to the specified values (0 to 255).
4874 @endproperty
4875*/
4876static void
4877st_collections_group_parts_part_description_color2(void)
4878{
4879 check_arg_count(4);
4880
4881 current_desc->color2.r = parse_int_range(0, 0, 255);
4882 current_desc->color2.g = parse_int_range(1, 0, 255);
4883 current_desc->color2.b = parse_int_range(2, 0, 255);
4884 current_desc->color2.a = parse_int_range(3, 0, 255);
4885}
4886
4887/**
4888 @page edcref
4889 @property
4890 color3
4891 @parameters
4892 [red] [green] [blue] [alpha]
4893 @effect
4894 Sets the text outline color to the specified values (0 to 255).
4895 @endproperty
4896*/
4897static void
4898st_collections_group_parts_part_description_color3(void)
4899{
4900 Edje_Part_Collection *pc;
4901 Edje_Part_Description_Text *ed;
4902
4903 check_arg_count(4);
4904
4905 pc = eina_list_data_get(eina_list_last(edje_collections));
4906
4907 if (current_part->type != EDJE_PART_TYPE_TEXT
4908 && current_part->type != EDJE_PART_TYPE_TEXTBLOCK)
4909 {
4910 ERR("%s: Error. Setting color3 in part %s from %s not of type TEXT or TEXTBLOCK.", progname, current_part->name, pc->part);
4911 exit(-1);
4912 }
4913
4914 ed = (Edje_Part_Description_Text*)current_desc;
4915
4916 ed->text.color3.r = parse_int_range(0, 0, 255);
4917 ed->text.color3.g = parse_int_range(1, 0, 255);
4918 ed->text.color3.b = parse_int_range(2, 0, 255);
4919 ed->text.color3.a = parse_int_range(3, 0, 255);
4920}
4921
4922/**
4923 @page edcref
4924 @block
4925 rel1/rel2
4926 @context
4927 description {
4928 ..
4929 rel1 {
4930 relative: 0.0 0.0;
4931 offset: 0 0;
4932 }
4933 ..
4934 rel2 {
4935 relative: 1.0 1.0;
4936 offset: -1 -1;
4937 }
4938 ..
4939 }
4940 @description
4941 The rel1 and rel2 blocks are used to define the position of each corner
4942 of the part's container. With rel1 being the left-up corner and rel2
4943 being the right-down corner.
4944 @endblock
4945
4946 @property
4947 relative
4948 @parameters
4949 [X axis] [Y axis]
4950 @effect
4951 Moves a corner to a relative position inside the container of the
4952 relative "to" part. Values from 0.0 (0%, beginning) to 1.0 (100%, end)
4953 of each axis.
4954 @endproperty
4955*/
4956static void
4957st_collections_group_parts_part_description_rel1_relative(void)
4958{
4959 check_arg_count(2);
4960
4961 current_desc->rel1.relative_x = FROM_DOUBLE(parse_float(0));
4962 current_desc->rel1.relative_y = FROM_DOUBLE(parse_float(1));
4963}
4964
4965/**
4966 @page edcref
4967 @property
4968 offset
4969 @parameters
4970 [X axis] [Y axis]
4971 @effect
4972 Affects the corner position a fixed number of pixels along each axis.
4973 @endproperty
4974*/
4975static void
4976st_collections_group_parts_part_description_rel1_offset(void)
4977{
4978 check_arg_count(2);
4979
4980 current_desc->rel1.offset_x = parse_int(0);
4981 current_desc->rel1.offset_y = parse_int(1);
4982}
4983
4984/**
4985 @page edcref
4986 @property
4987 to
4988 @parameters
4989 [another part's name]
4990 @effect
4991 Causes a corner to be positioned relatively to another part's
4992 container. Setting to "" will un-set this value for inherited
4993 parts.
4994 @endproperty
4995*/
4996static void
4997st_collections_group_parts_part_description_rel1_to(void)
4998{
4999 Edje_Part_Collection *pc;
5000
5001 check_arg_count(1);
5002
5003 pc = eina_list_data_get(eina_list_last(edje_collections));
5004
5005 {
5006 char *name;
5007
5008 name = parse_str(0);
5009 data_queue_part_lookup(pc, name, &(current_desc->rel1.id_x));
5010 data_queue_part_lookup(pc, name, &(current_desc->rel1.id_y));
5011 free(name);
5012 }
5013}
5014
5015/**
5016 @page edcref
5017 @property
5018 to_x
5019 @parameters
5020 [another part's name]
5021 @effect
5022 Causes a corner to be positioned relatively to the X axis of another
5023 part's container. Simply put affects the first parameter of "relative".
5024 Setting to "" will un-set this value for inherited parts.
5025 @endproperty
5026*/
5027static void
5028st_collections_group_parts_part_description_rel1_to_x(void)
5029{
5030 Edje_Part_Collection *pc;
5031
5032 check_arg_count(1);
5033
5034 pc = eina_list_data_get(eina_list_last(edje_collections));
5035
5036 {
5037 char *name;
5038
5039 name = parse_str(0);
5040 data_queue_part_lookup(pc, name, &(current_desc->rel1.id_x));
5041 free(name);
5042 }
5043}
5044
5045/**
5046 @page edcref
5047 @property
5048 to_y
5049 @parameters
5050 [another part's name]
5051 @effect
5052 Causes a corner to be positioned relatively to the Y axis of another
5053 part's container. Simply put, affects the second parameter of
5054 "relative". Setting to "" will un-set this value for inherited parts.
5055 @endproperty
5056*/
5057static void
5058st_collections_group_parts_part_description_rel1_to_y(void)
5059{
5060 Edje_Part_Collection *pc;
5061
5062 check_arg_count(1);
5063
5064 pc = eina_list_data_get(eina_list_last(edje_collections));
5065
5066 {
5067 char *name;
5068
5069 name = parse_str(0);
5070 data_queue_part_lookup(pc, name, &(current_desc->rel1.id_y));
5071 free(name);
5072 }
5073}
5074
5075static void
5076st_collections_group_parts_part_description_rel2_relative(void)
5077{
5078 check_arg_count(2);
5079
5080 current_desc->rel2.relative_x = FROM_DOUBLE(parse_float(0));
5081 current_desc->rel2.relative_y = FROM_DOUBLE(parse_float(1));
5082}
5083
5084static void
5085st_collections_group_parts_part_description_rel2_offset(void)
5086{
5087 check_arg_count(2);
5088
5089 current_desc->rel2.offset_x = parse_int(0);
5090 current_desc->rel2.offset_y = parse_int(1);
5091}
5092
5093static void
5094st_collections_group_parts_part_description_rel2_to(void)
5095{
5096 Edje_Part_Collection *pc;
5097
5098 check_arg_count(1);
5099
5100 pc = eina_list_data_get(eina_list_last(edje_collections));
5101
5102 {
5103 char *name;
5104
5105 name = parse_str(0);
5106 data_queue_part_lookup(pc, name, &(current_desc->rel2.id_x));
5107 data_queue_part_lookup(pc, name, &(current_desc->rel2.id_y));
5108 free(name);
5109 }
5110}
5111
5112static void
5113st_collections_group_parts_part_description_rel2_to_x(void)
5114{
5115 Edje_Part_Collection *pc;
5116
5117 check_arg_count(1);
5118
5119 pc = eina_list_data_get(eina_list_last(edje_collections));
5120
5121 {
5122 char *name;
5123
5124 name = parse_str(0);
5125 data_queue_part_lookup(pc, name, &(current_desc->rel2.id_x));
5126 free(name);
5127 }
5128}
5129
5130static void
5131st_collections_group_parts_part_description_rel2_to_y(void)
5132{
5133 Edje_Part_Collection *pc;
5134
5135 check_arg_count(1);
5136
5137 pc = eina_list_data_get(eina_list_last(edje_collections));
5138
5139 {
5140 char *name;
5141
5142 name = parse_str(0);
5143 data_queue_part_lookup(pc, name, &(current_desc->rel2.id_y));
5144 free(name);
5145 }
5146}
5147
5148/**
5149 @edcsection{description_image,Image state description sub blocks}
5150 */
5151
5152/**
5153 @page edcref
5154 @block
5155 image
5156 @context
5157 description {
5158 ..
5159 image {
5160 normal: "filename.ext";
5161 tween: "filename2.ext";
5162 ..
5163 tween: "filenameN.ext";
5164 border: left right top bottom;
5165 middle: 0/1/NONE/DEFAULT/SOLID;
5166 }
5167 ..
5168 }
5169 @description
5170 @endblock
5171
5172 @property
5173 normal
5174 @parameters
5175 [image's filename]
5176 @effect
5177 Name of image to be used as previously declared in the images block.
5178 In an animation, this is the first and last image displayed. It's
5179 required in any image part
5180 @endproperty
5181*/
5182static void
5183st_collections_group_parts_part_description_image_normal(void)
5184{
5185 Edje_Part_Description_Image *ed;
5186
5187 check_arg_count(1);
5188
5189 if (current_part->type != EDJE_PART_TYPE_IMAGE)
5190 {
5191 ERR("%s: Error. parse error %s:%i. "
5192 "image attributes in non-IMAGE part.",
5193 progname, file_in, line - 1);
5194 exit(-1);
5195 }
5196
5197 ed = (Edje_Part_Description_Image*) current_desc;
5198
5199 {
5200 char *name;
5201
5202 name = parse_str(0);
5203 data_queue_image_remove(&(ed->image.id), &(ed->image.set));
5204 data_queue_image_lookup(name, &(ed->image.id), &(ed->image.set));
5205 free(name);
5206 }
5207}
5208
5209/**
5210 @page edcref
5211 @property
5212 tween
5213 @parameters
5214 [image's filename]
5215 @effect
5216 Name of an image to be used in an animation loop, an image block can
5217 have none, one or multiple tween declarations. Images are displayed in
5218 the order they are listed.
5219 @endproperty
5220*/
5221static void
5222st_collections_group_parts_part_description_image_tween(void)
5223{
5224 Edje_Part_Description_Image *ed;
5225
5226 check_arg_count(1);
5227
5228 if (current_part->type != EDJE_PART_TYPE_IMAGE)
5229 {
5230 ERR("%s: Error. parse error %s:%i. "
5231 "image attributes in non-IMAGE part.",
5232 progname, file_in, line - 1);
5233 exit(-1);
5234 }
5235
5236 ed = (Edje_Part_Description_Image*) current_desc;
5237
5238 {
5239 char *name;
5240 Edje_Part_Image_Id *iid;
5241
5242 iid = mem_alloc(SZ(Edje_Part_Image_Id));
5243 ed->image.tweens_count++;
5244 ed->image.tweens = realloc(ed->image.tweens,
5245 sizeof (Edje_Part_Image_Id*) * ed->image.tweens_count);
5246 ed->image.tweens[ed->image.tweens_count - 1] = iid;
5247 name = parse_str(0);
5248 data_queue_image_remove(&(iid->id), &(iid->set));
5249 data_queue_image_lookup(name, &(iid->id), &(iid->set));
5250 free(name);
5251 }
5252}
5253
5254/**
5255 @page edcref
5256 @property
5257 border
5258 @parameters
5259 [left] [right] [top] [bottom]
5260 @effect
5261 If set, the area (in pixels) of each side of the image will be
5262 displayed as a fixed size border, from the side -> inwards, preventing
5263 the corners from being changed on a resize.
5264 @endproperty
5265*/
5266static void
5267st_collections_group_parts_part_description_image_border(void)
5268{
5269 Edje_Part_Description_Image *ed;
5270
5271 check_arg_count(4);
5272
5273 if (current_part->type != EDJE_PART_TYPE_IMAGE)
5274 {
5275 ERR("%s: Error. parse error %s:%i. "
5276 "image attributes in non-IMAGE part.",
5277 progname, file_in, line - 1);
5278 exit(-1);
5279 }
5280
5281 ed = (Edje_Part_Description_Image*) current_desc;
5282
5283 ed->image.border.l = parse_int_range(0, 0, 0x7fffffff);
5284 ed->image.border.r = parse_int_range(1, 0, 0x7fffffff);
5285 ed->image.border.t = parse_int_range(2, 0, 0x7fffffff);
5286 ed->image.border.b = parse_int_range(3, 0, 0x7fffffff);
5287}
5288
5289/**
5290 @page edcref
5291 @property
5292 middle
5293 @parameters
5294 0, 1, NONE, DEFAULT, SOLID
5295 @effect
5296 If border is set, this value tells Edje if the rest of the
5297 image (not covered by the defined border) will be displayed or not
5298 or be assumed to be solid (without alpha). The default is 1/DEFAULT.
5299 @endproperty
5300*/
5301static void
5302st_collections_group_parts_part_description_image_middle(void)
5303{
5304 Edje_Part_Description_Image *ed;
5305
5306 check_arg_count(1);
5307
5308 if (current_part->type != EDJE_PART_TYPE_IMAGE)
5309 {
5310 ERR("%s: Error. parse error %s:%i. "
5311 "image attributes in non-IMAGE part.",
5312 progname, file_in, line - 1);
5313 exit(-1);
5314 }
5315
5316 ed = (Edje_Part_Description_Image*) current_desc;
5317
5318 ed->image.border.no_fill = parse_enum(0,
5319 "1", 0,
5320 "DEFAULT", 0,
5321 "0", 1,
5322 "NONE", 1,
5323 "SOLID", 2,
5324 NULL);
5325}
5326
5327/**
5328 @page edcref
5329 @property
5330 border_scale_by
5331 @parameters
5332 0.0 or bigger (0.0 or 1.0 to turn it off)
5333 @effect
5334 If border scaling is enabled then normally the OUTPUT border sizes
5335 (e.g. if 3 pixels on the left edge are set as a border, then normally
5336 at scale 1.0, those 3 columns will always be the exact 3 columns of
5337 output, or at scale 2.0 they will be 6 columns, or 0.33 they will merge
5338 into a single column). This property multiplies the input scale
5339 factor by this multiplier, allowing the creation of "supersampled"
5340 borders to make much higher resolution outputs possible by always using
5341 the highest resolution artwork and then runtime scaling it down.
5342 @endproperty
5343*/
5344static void
5345st_collections_group_parts_part_description_image_border_scale_by(void)
5346{
5347 Edje_Part_Description_Image *ed;
5348
5349 check_arg_count(1);
5350
5351 if (current_part->type != EDJE_PART_TYPE_IMAGE)
5352 {
5353 ERR("%s: Error. parse error %s:%i. "
5354 "image attributes in non-IMAGE part.",
5355 progname, file_in, line - 1);
5356 exit(-1);
5357 }
5358
5359 ed = (Edje_Part_Description_Image*) current_desc;
5360
5361 ed->image.border.scale_by = FROM_DOUBLE(parse_float_range(0, 0.0, 999999999.0));
5362}
5363
5364/**
5365 @page edcref
5366 @property
5367 border_scale
5368 @parameters
5369 0, 1
5370 @effect
5371 If border is set, this value tells Edje if the border should be scaled
5372 by the object/global edje scale factors
5373 @endproperty
5374*/
5375static void
5376st_collections_group_parts_part_description_image_border_scale(void)
5377{
5378 Edje_Part_Description_Image *ed;
5379
5380 check_arg_count(1);
5381
5382 if (current_part->type != EDJE_PART_TYPE_IMAGE)
5383 {
5384 ERR("%s: Error. parse error %s:%i. "
5385 "image attributes in non-IMAGE part.",
5386 progname, file_in, line - 1);
5387 exit(-1);
5388 }
5389
5390 ed = (Edje_Part_Description_Image*) current_desc;
5391
5392 ed->image.border.scale = parse_enum(0,
5393 "0", 0,
5394 "1", 1,
5395 NULL);
5396}
5397
5398/**
5399 @page edcref
5400 @property
5401 scale_hint
5402 @parameters
5403 0, NONE, DYNAMIC, STATIC
5404 @effect
5405 Sets the evas image scale hint letting the engine more effectively save
5406 cached copies of the scaled image if it makes sense
5407 @endproperty
5408*/
5409static void
5410st_collections_group_parts_part_description_image_scale_hint(void)
5411{
5412 Edje_Part_Description_Image *ed;
5413
5414 check_arg_count(1);
5415
5416 if (current_part->type != EDJE_PART_TYPE_IMAGE)
5417 {
5418 ERR("%s: Error. parse error %s:%i. "
5419 "image attributes in non-IMAGE part.",
5420 progname, file_in, line - 1);
5421 exit(-1);
5422 }
5423
5424 ed = (Edje_Part_Description_Image*) current_desc;
5425
5426 ed->image.scale_hint = parse_enum(0,
5427 "NONE", EVAS_IMAGE_SCALE_HINT_NONE,
5428 "DYNAMIC", EVAS_IMAGE_SCALE_HINT_DYNAMIC,
5429 "STATIC", EVAS_IMAGE_SCALE_HINT_STATIC,
5430 "0", EVAS_IMAGE_SCALE_HINT_NONE,
5431 NULL);
5432}
5433
5434/**
5435 @page edcref
5436 @block
5437 fill
5438 @context
5439 description {
5440 ..
5441 fill {
5442 smooth: 0-1;
5443 origin {
5444 relative: X-axis Y-axis;
5445 offset: X-axis Y-axis;
5446 }
5447 size {
5448 relative: width height;
5449 offset: width height;
5450 }
5451 }
5452 ..
5453 }
5454 @description
5455 The fill method is an optional block that defines the way an IMAGE part
5456 is going to be displayed inside its container.
5457 @endblock
5458
5459 @property
5460 smooth
5461 @parameters
5462 [0 or 1]
5463 @effect
5464 The smooth property takes a boolean value to decide if the image will
5465 be smoothed on scaling (1) or not (0). The default value is 1.
5466 @endproperty
5467*/
5468static void
5469st_collections_group_parts_part_description_fill_smooth(void)
5470{
5471 Edje_Part_Description_Spec_Fill *fill;
5472
5473 check_arg_count(1);
5474
5475 switch (current_part->type)
5476 {
5477 case EDJE_PART_TYPE_IMAGE:
5478 {
5479 Edje_Part_Description_Image *ed;
5480
5481 ed = (Edje_Part_Description_Image*) current_desc;
5482
5483 fill = &ed->image.fill;
5484 break;
5485 }
5486 case EDJE_PART_TYPE_PROXY:
5487 {
5488 Edje_Part_Description_Proxy *ed;
5489
5490 ed = (Edje_Part_Description_Proxy*) current_desc;
5491
5492 fill = &ed->proxy.fill;
5493 break;
5494 }
5495 default:
5496 {
5497 ERR("%s: Error. parse error %s:%i. "
5498 "image and proxy attributes in non-IMAGE, non-PROXY `%s` part (%i).",
5499 progname, file_in, line - 1, current_part->name, current_part->type);
5500 exit(-1);
5501 }
5502 }
5503
5504 fill->smooth = parse_bool(0);
5505}
5506
5507/**
5508 @page edcref
5509
5510 @property
5511 spread
5512 @parameters
5513 TODO
5514 @effect
5515 TODO
5516 @endproperty
5517*/
5518static void
5519st_collections_group_parts_part_description_fill_spread(void)
5520{
5521#if 0
5522 Edje_Part_Collection *pc;
5523 Edje_Part *ep;
5524 Edje_Part_Description_Image *ed;
5525#endif
5526
5527 check_arg_count(1);
5528
5529 /* XXX this will need to include IMAGES when spread support is added to evas images */
5530 {
5531 ERR("%s: Error. parse error %s:%i. "
5532 "fill.spread not supported yet.",
5533 progname, file_in, line - 1);
5534 exit(-1);
5535 }
5536
5537#if 0
5538 pc = eina_list_data_get(eina_list_last(edje_collections));
5539
5540 ep = pc->parts[pc->parts_count - 1];
5541
5542 if (ep->type != EDJE_PART_TYPE_IMAGE)
5543 {
5544 ERR("%s: Error. parse error %s:%i. "
5545 "image attributes in non-IMAGE part.",
5546 progname, file_in, line - 1);
5547 exit(-1);
5548 }
5549
5550 ed = (Edje_Part_Description_Image*) ep->default_desc;
5551 if (ep->other.desc_count) ed = (Edje_Part_Description_Image*) ep->other.desc[ep->other.desc_count - 1];
5552
5553 ed->image.fill.spread = parse_int_range(0, 0, 1);
5554#endif
5555}
5556
5557/**
5558 @page edcref
5559
5560 @property
5561 type
5562 @parameters
5563 TODO
5564 @effect
5565 TODO
5566 @endproperty
5567*/
5568static void
5569st_collections_group_parts_part_description_fill_type(void)
5570{
5571 Edje_Part_Description_Spec_Fill *fill;
5572
5573 check_arg_count(1);
5574
5575 switch (current_part->type)
5576 {
5577 case EDJE_PART_TYPE_IMAGE:
5578 {
5579 Edje_Part_Description_Image *ed;
5580
5581 ed = (Edje_Part_Description_Image*) current_desc;
5582
5583 fill = &ed->image.fill;
5584 break;
5585 }
5586 case EDJE_PART_TYPE_PROXY:
5587 {
5588 Edje_Part_Description_Proxy *ed;
5589
5590 ed = (Edje_Part_Description_Proxy*) current_desc;
5591
5592 fill = &ed->proxy.fill;
5593 break;
5594 }
5595 default:
5596 {
5597 ERR("%s: Error. parse error %s:%i. "
5598 "image and proxy attributes in non-IMAGE, non-PROXY part.",
5599 progname, file_in, line - 1);
5600 exit(-1);
5601 }
5602 }
5603
5604 fill->type = parse_enum(0,
5605 "SCALE", EDJE_FILL_TYPE_SCALE,
5606 "TILE", EDJE_FILL_TYPE_TILE,
5607 NULL);
5608}
5609
5610/**
5611 @page edcref
5612 @block
5613 origin
5614 @context
5615 description {
5616 ..
5617 fill {
5618 ..
5619 origin {
5620 relative: 0.0 0.0;
5621 offset: 0 0;
5622 }
5623 ..
5624 }
5625 ..
5626 }
5627 @description
5628 The origin block is used to place the starting point, inside the
5629 displayed element, that will be used to render the tile. By default,
5630 the origin is set at the element's left-up corner.
5631 @endblock
5632
5633 @property
5634 relative
5635 @parameters
5636 [X axis] [Y axis]
5637 @effect
5638 Sets the starting point relatively to displayed element's content.
5639 @endproperty
5640*/
5641static void
5642st_collections_group_parts_part_description_fill_origin_relative(void)
5643{
5644 Edje_Part_Description_Spec_Fill *fill;
5645
5646 check_arg_count(2);
5647
5648 switch (current_part->type)
5649 {
5650 case EDJE_PART_TYPE_IMAGE:
5651 {
5652 Edje_Part_Description_Image *ed;
5653
5654 ed = (Edje_Part_Description_Image*) current_desc;
5655
5656 fill = &ed->image.fill;
5657 break;
5658 }
5659 case EDJE_PART_TYPE_PROXY:
5660 {
5661 Edje_Part_Description_Proxy *ed;
5662
5663 ed = (Edje_Part_Description_Proxy*) current_desc;
5664
5665 fill = &ed->proxy.fill;
5666 break;
5667 }
5668 default:
5669 {
5670 ERR("%s: Error. parse error %s:%i. "
5671 "image and proxy attributes in non-IMAGE, non-PROXY part.",
5672 progname, file_in, line - 1);
5673 exit(-1);
5674 }
5675 }
5676
5677 fill->pos_rel_x = FROM_DOUBLE(parse_float_range(0, -999999999.0, 999999999.0));
5678 fill->pos_rel_y = FROM_DOUBLE(parse_float_range(1, -999999999.0, 999999999.0));
5679}
5680
5681/**
5682 @page edcref
5683 @property
5684 offset
5685 @parameters
5686 [X axis] [Y axis]
5687 @effect
5688 Affects the starting point a fixed number of pixels along each axis.
5689 @endproperty
5690*/
5691static void
5692st_collections_group_parts_part_description_fill_origin_offset(void)
5693{
5694 Edje_Part_Description_Spec_Fill *fill;
5695
5696 check_arg_count(2);
5697
5698 switch (current_part->type)
5699 {
5700 case EDJE_PART_TYPE_IMAGE:
5701 {
5702 Edje_Part_Description_Image *ed;
5703
5704 ed = (Edje_Part_Description_Image*) current_desc;
5705
5706 fill = &ed->image.fill;
5707 break;
5708 }
5709 case EDJE_PART_TYPE_PROXY:
5710 {
5711 Edje_Part_Description_Proxy *ed;
5712
5713 ed = (Edje_Part_Description_Proxy*) current_desc;
5714
5715 fill = &ed->proxy.fill;
5716 break;
5717 }
5718 default:
5719 {
5720 ERR("%s: Error. parse error %s:%i. "
5721 "image and proxy attributes in non-IMAGE, non-PROXY part.",
5722 progname, file_in, line - 1);
5723 exit(-1);
5724 }
5725 }
5726
5727 fill->pos_abs_x = parse_int(0);
5728 fill->pos_abs_y = parse_int(1);
5729}
5730
5731/**
5732 @page edcref
5733 @block
5734 size
5735 @context
5736 description {
5737 ..
5738 fill {
5739 ..
5740 size {
5741 relative: 1.0 1.0;
5742 offset: -1 -1;
5743 }
5744 ..
5745 }
5746 ..
5747 }
5748 @description
5749 The size block defines the tile size of the content that will be
5750 displayed.
5751 @endblock
5752
5753 @property
5754 relative
5755 @parameters
5756 [width] [height]
5757 @effect
5758 Takes a pair of decimal values that represent the a percentual value
5759 of the original size of the element. For example, "0.5 0.5" represents
5760 half the size, while "2.0 2.0" represents the double. The default
5761 value is "1.0 1.0".
5762 @endproperty
5763*/
5764static void
5765st_collections_group_parts_part_description_fill_size_relative(void)
5766{
5767 Edje_Part_Description_Spec_Fill *fill;
5768
5769 check_arg_count(2);
5770
5771 switch (current_part->type)
5772 {
5773 case EDJE_PART_TYPE_IMAGE:
5774 {
5775 Edje_Part_Description_Image *ed;
5776
5777 ed = (Edje_Part_Description_Image*) current_desc;
5778
5779 fill = &ed->image.fill;
5780 break;
5781 }
5782 case EDJE_PART_TYPE_PROXY:
5783 {
5784 Edje_Part_Description_Proxy *ed;
5785
5786 ed = (Edje_Part_Description_Proxy*) current_desc;
5787
5788 fill = &ed->proxy.fill;
5789 break;
5790 }
5791 default:
5792 {
5793 ERR("%s: Error. parse error %s:%i. "
5794 "image and proxy attributes in non-IMAGE, non-PROXY part.",
5795 progname, file_in, line - 1);
5796 exit(-1);
5797 }
5798 }
5799
5800 fill->rel_x = FROM_DOUBLE(parse_float_range(0, 0.0, 999999999.0));
5801 fill->rel_y = FROM_DOUBLE(parse_float_range(1, 0.0, 999999999.0));
5802}
5803
5804/**
5805 @page edcref
5806 @property
5807 offset
5808 @parameters
5809 [X axis] [Y axis]
5810 @effect
5811 Affects the size of the tile a fixed number of pixels along each axis.
5812 @endproperty
5813*/
5814static void
5815st_collections_group_parts_part_description_fill_size_offset(void)
5816{
5817 Edje_Part_Description_Spec_Fill *fill;
5818
5819 check_arg_count(2);
5820
5821 switch (current_part->type)
5822 {
5823 case EDJE_PART_TYPE_IMAGE:
5824 {
5825 Edje_Part_Description_Image *ed;
5826
5827 ed = (Edje_Part_Description_Image*) current_desc;
5828
5829 fill = &ed->image.fill;
5830 break;
5831 }
5832 case EDJE_PART_TYPE_PROXY:
5833 {
5834 Edje_Part_Description_Proxy *ed;
5835
5836 ed = (Edje_Part_Description_Proxy*) current_desc;
5837
5838 fill = &ed->proxy.fill;
5839 break;
5840 }
5841 default:
5842 {
5843 ERR("%s: Error. parse error %s:%i. "
5844 "image and proxy attributes in non-IMAGE, non-PROXY part.",
5845 progname, file_in, line - 1);
5846 exit(-1);
5847 }
5848 }
5849
5850 fill->abs_x = parse_int(0);
5851 fill->abs_y = parse_int(1);
5852}
5853
5854
5855/**
5856 @edcsection{description_text,Text state description sub blocks}
5857 */
5858
5859/**
5860 @page edcref
5861
5862 @block
5863 text
5864 @context
5865 part {
5866 description {
5867 ..
5868 text {
5869 text: "some string of text to display";
5870 font: "font_name";
5871 size: SIZE;
5872 text_class: "class_name";
5873 fit: horizontal vertical;
5874 min: horizontal vertical;
5875 max: horizontal vertical;
5876 align: X-axis Y-axis;
5877 source: "part_name";
5878 text_source: "text_part_name";
5879 ellipsis: 0.0-1.0;
5880 style: "stylename";
5881 }
5882 ..
5883 }
5884 }
5885 @description
5886 @endblock
5887
5888 @property
5889 text
5890 @parameters
5891 [a string of text, or nothing]
5892 @effect
5893 Sets the default content of a text part, normally the application is
5894 the one changing its value.
5895 @endproperty
5896*/
5897static void
5898st_collections_group_parts_part_description_text_text(void)
5899{
5900 Edje_Part_Description_Text *ed;
5901 char *str = NULL;
5902 int i;
5903
5904 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
5905 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
5906 {
5907 ERR("%s: Error. parse error %s:%i. "
5908 "text attributes in non-TEXT part.",
5909 progname, file_in, line - 1);
5910 exit(-1);
5911 }
5912
5913 ed = (Edje_Part_Description_Text*) current_desc;
5914
5915 for (i = 0; ;i++)
5916 {
5917 char *s;
5918
5919 if (!is_param(i)) break;
5920 s = parse_str(i);
5921 if (!str) str = s;
5922 else
5923 {
5924 str = realloc(str, strlen(str) + strlen(s) + 1);
5925 strcat(str, s);
5926 free(s);
5927 }
5928 }
5929 ed->text.text.str = str;
5930}
5931
5932/**
5933 @page edcref
5934
5935 @property
5936 text_class
5937 @parameters
5938 [text class name]
5939 @effect
5940 Similar to color_class, this is the name used by the application
5941 to alter the font family and size at runtime.
5942 @endproperty
5943*/
5944static void
5945st_collections_group_parts_part_description_text_text_class(void)
5946{
5947 Edje_Part_Description_Text *ed;
5948
5949 check_arg_count(1);
5950
5951 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
5952 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
5953 {
5954 ERR("%s: Error. parse error %s:%i. "
5955 "text attributes in non-TEXT part.",
5956 progname, file_in, line - 1);
5957 exit(-1);
5958 }
5959
5960 ed = (Edje_Part_Description_Text*) current_desc;
5961
5962 ed->text.text_class = parse_str(0);
5963}
5964
5965/**
5966 @page edcref
5967
5968 @property
5969 font
5970 @parameters
5971 [font alias]
5972 @effect
5973 This sets the font family to one of the aliases set up in the "fonts"
5974 block. Can be overrided by the application.
5975 @endproperty
5976*/
5977static void
5978st_collections_group_parts_part_description_text_font(void)
5979{
5980 Edje_Part_Description_Text *ed;
5981
5982 check_arg_count(1);
5983
5984 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
5985 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
5986 {
5987 ERR("%s: Error. parse error %s:%i. "
5988 "text attributes in non-TEXT part.",
5989 progname, file_in, line - 1);
5990 exit(-1);
5991 }
5992
5993 ed = (Edje_Part_Description_Text*) current_desc;
5994
5995 ed->text.font.str = parse_str(0);
5996}
5997
5998/**
5999 @page edcref
6000
6001 @property
6002 style
6003 @parameters
6004 [the style name]
6005 @effect
6006 Causes the part to use the default style and tags defined in the
6007 "style" block with the specified name.
6008 @endproperty
6009*/
6010static void
6011st_collections_group_parts_part_description_text_style(void)
6012{
6013 Edje_Part_Description_Text *ed;
6014
6015 check_arg_count(1);
6016
6017 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
6018 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
6019 {
6020 ERR("%s: Error. parse error %s:%i. "
6021 "text attributes in non-TEXT part.",
6022 progname, file_in, line - 1);
6023 exit(-1);
6024 }
6025
6026 ed = (Edje_Part_Description_Text*) current_desc;
6027
6028 ed->text.style.str = parse_str(0);
6029}
6030
6031/**
6032 @page edcref
6033
6034 @property
6035 repch
6036 @parameters
6037 [the replacement character string]
6038 @effect
6039 If this is a textblock and is in PASSWORD mode this string is used
6040 to replace every character to hide the details of the entry. Normally
6041 you would use a "*", but you can use anything you like.
6042 @endproperty
6043*/
6044static void
6045st_collections_group_parts_part_description_text_repch(void)
6046{
6047 Edje_Part_Description_Text *ed;
6048
6049 check_arg_count(1);
6050
6051 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
6052 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
6053 {
6054 ERR("%s: Error. parse error %s:%i. "
6055 "text attributes in non-TEXT part.",
6056 progname, file_in, line - 1);
6057 exit(-1);
6058 }
6059
6060 ed = (Edje_Part_Description_Text*) current_desc;
6061
6062 ed->text.repch.str = parse_str(0);
6063}
6064
6065/**
6066 @page edcref
6067
6068 @property
6069 size
6070 @parameters
6071 [font size in points (pt)]
6072 @effect
6073 Sets the default font size for the text part. Can be overrided by the
6074 application.
6075 @endproperty
6076*/
6077static void
6078st_collections_group_parts_part_description_text_size(void)
6079{
6080 Edje_Part_Description_Text *ed;
6081
6082 check_arg_count(1);
6083
6084 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
6085 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
6086 {
6087 ERR("%s: Error. parse error %s:%i. "
6088 "text attributes in non-TEXT part.",
6089 progname, file_in, line - 1);
6090 exit(-1);
6091 }
6092
6093 ed = (Edje_Part_Description_Text*)current_desc;
6094
6095 ed->text.size = parse_int_range(0, 0, 255);
6096}
6097
6098/**
6099 @page edcref
6100
6101 @property
6102 size_range
6103 @parameters
6104 [font min size in points (pt)] [font max size in points (pt)]
6105 @effect
6106 Sets the allowed font size for the text part. Setting min and max to 0
6107 means we won't restrict the sizing (default).
6108 @endproperty
6109 @since 1.1.0
6110*/
6111static void
6112st_collections_group_parts_part_description_text_size_range(void)
6113{
6114 Edje_Part_Description_Text *ed;
6115
6116 check_arg_count(2);
6117
6118 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
6119 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
6120 {
6121 ERR("%s: Error. parse error %s:%i. "
6122 "text attributes in non-TEXT part.",
6123 progname, file_in, line - 1);
6124 exit(-1);
6125 }
6126
6127 ed = (Edje_Part_Description_Text*) current_desc;
6128
6129 ed->text.size_range_min = parse_int_range(0, 0, 255);
6130 ed->text.size_range_max = parse_int_range(1, 0, 255);
6131 if (ed->text.size_range_min > ed->text.size_range_max)
6132 {
6133 ERR("%s: Error. parse error %s:%i. "
6134 "min size is bigger than max size.",
6135 progname, file_in, line - 1);
6136 exit(-1);
6137 }
6138}
6139
6140/**
6141 @page edcref
6142
6143 @property
6144 fit
6145 @parameters
6146 [horizontal] [vertical]
6147 @effect
6148 When any of the parameters is set to 1 edje will resize the text for it
6149 to fit in it's container. Both are disabled by default.
6150 @endproperty
6151*/
6152static void
6153st_collections_group_parts_part_description_text_fit(void)
6154{
6155 Edje_Part_Description_Text *ed;
6156
6157 check_arg_count(2);
6158
6159 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
6160 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
6161 {
6162 ERR("%s: Error. parse error %s:%i. "
6163 "text attributes in non-TEXT part.",
6164 progname, file_in, line - 1);
6165 exit(-1);
6166 }
6167
6168 ed = (Edje_Part_Description_Text*) current_desc;
6169
6170 ed->text.fit_x = parse_bool(0);
6171 ed->text.fit_y = parse_bool(1);
6172}
6173
6174/**
6175 @page edcref
6176
6177 @property
6178 min
6179 @parameters
6180 [horizontal] [vertical]
6181 @effect
6182 When any of the parameters is enabled (1) it forces the minimum size of
6183 the container to be equal to the minimum size of the text. The default
6184 value is "0 0".
6185 @endproperty
6186*/
6187static void
6188st_collections_group_parts_part_description_text_min(void)
6189{
6190 Edje_Part_Description_Text *ed;
6191
6192 check_arg_count(2);
6193
6194 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
6195 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
6196 {
6197 ERR("%s: Error. parse error %s:%i. "
6198 "text attributes in non-TEXT part.",
6199 progname, file_in, line - 1);
6200 exit(-1);
6201 }
6202
6203 ed = (Edje_Part_Description_Text*)current_desc;
6204
6205 ed->text.min_x = parse_bool(0);
6206 ed->text.min_y = parse_bool(1);
6207}
6208
6209/**
6210 @page edcref
6211
6212 @property
6213 max
6214 @parameters
6215 [horizontal] [vertical]
6216 @effect
6217 When any of the parameters is enabled (1) it forces the maximum size of
6218 the container to be equal to the maximum size of the text. The default
6219 value is "0 0".
6220 @endproperty
6221*/
6222static void
6223st_collections_group_parts_part_description_text_max(void)
6224{
6225 Edje_Part_Description_Text *ed;
6226
6227 check_arg_count(2);
6228
6229 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
6230 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
6231 {
6232 ERR("%s: Error. parse error %s:%i. "
6233 "text attributes in non-TEXT part.",
6234 progname, file_in, line - 1);
6235 exit(-1);
6236 }
6237
6238 ed = (Edje_Part_Description_Text*) current_desc;
6239
6240 ed->text.max_x = parse_bool(0);
6241 ed->text.max_y = parse_bool(1);
6242}
6243
6244/**
6245 @page edcref
6246
6247 @property
6248 align
6249 @parameters
6250 [horizontal] [vertical]
6251 @effect
6252 Change the position of the point of balance inside the container. The
6253 default value is 0.5 0.5.
6254 @endproperty
6255*/
6256static void
6257st_collections_group_parts_part_description_text_align(void)
6258{
6259 Edje_Part_Description_Text *ed;
6260
6261 check_arg_count(2);
6262
6263 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
6264 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
6265 {
6266 ERR("%s: Error. parse error %s:%i. "
6267 "text attributes in non-TEXT part.",
6268 progname, file_in, line - 1);
6269 exit(-1);
6270 }
6271
6272 ed = (Edje_Part_Description_Text*) current_desc;
6273
6274 ed->text.align.x = FROM_DOUBLE(parse_float_range(0, -1.0, 1.0));
6275 ed->text.align.y = FROM_DOUBLE(parse_float_range(1, 0.0, 1.0));
6276}
6277
6278/**
6279 @page edcref
6280
6281 @property
6282 source
6283 @parameters
6284 [another TEXT part's name]
6285 @effect
6286 Causes the part to use the text properties (like font and size) of
6287 another part and update them as they change.
6288 @endproperty
6289*/
6290static void
6291st_collections_group_parts_part_description_text_source(void)
6292{
6293 Edje_Part_Collection *pc;
6294 Edje_Part_Description_Text *ed;
6295
6296 check_arg_count(1);
6297
6298 pc = eina_list_data_get(eina_list_last(edje_collections));
6299
6300 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
6301 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
6302 {
6303 ERR("%s: Error. parse error %s:%i. "
6304 "text attributes in non-TEXT part.",
6305 progname, file_in, line - 1);
6306 exit(-1);
6307 }
6308
6309 ed = (Edje_Part_Description_Text*) current_desc;
6310
6311 {
6312 char *name;
6313
6314 name = parse_str(0);
6315 data_queue_part_lookup(pc, name, &(ed->text.id_source));
6316 free(name);
6317 }
6318}
6319
6320/**
6321 @page edcref
6322
6323 @property
6324 text_source
6325 @parameters
6326 [another TEXT part's name]
6327 @effect
6328 Causes the part to display the text content of another part and update
6329 them as they change.
6330 @endproperty
6331*/
6332static void
6333st_collections_group_parts_part_description_text_text_source(void)
6334{
6335 Edje_Part_Collection *pc;
6336 Edje_Part_Description_Text *ed;
6337
6338 check_arg_count(1);
6339
6340 pc = eina_list_data_get(eina_list_last(edje_collections));
6341
6342 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
6343 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
6344 {
6345 ERR("%s: Error. parse error %s:%i. "
6346 "text attributes in non-TEXT part.",
6347 progname, file_in, line - 1);
6348 exit(-1);
6349 }
6350
6351 ed = (Edje_Part_Description_Text*) current_desc;
6352
6353 {
6354 char *name;
6355
6356 name = parse_str(0);
6357 data_queue_part_lookup(pc, name, &(ed->text.id_text_source));
6358 free(name);
6359 }
6360}
6361
6362/**
6363 @page edcref
6364
6365 @property
6366 ellipsis
6367 @parameters
6368 [point of balance]
6369 @effect
6370 Used to balance the text in a relative point from 0.0 to 1.0, this
6371 point is the last section of the string to be cut out in case of a
6372 resize that is smaller than the text itself. The default value is 0.0.
6373 @endproperty
6374*/
6375static void
6376st_collections_group_parts_part_description_text_elipsis(void)
6377{
6378 Edje_Part_Description_Text *ed;
6379
6380 check_arg_count(1);
6381
6382 if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
6383 (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
6384 {
6385 ERR("%s: Error. parse error %s:%i. "
6386 "text attributes in non-TEXT part.",
6387 progname, file_in, line - 1);
6388 exit(-1);
6389 }
6390
6391 ed = (Edje_Part_Description_Text*) current_desc;
6392
6393 ed->text.elipsis = parse_float_range(0, 0.0, 1.0);
6394}
6395
6396
6397/**
6398 @edcsection{description_box,Box state description sub blocks}
6399 */
6400
6401/**
6402 @page edcref
6403
6404 @block
6405 box
6406 @context
6407 part {
6408 description {
6409 ..
6410 box {
6411 layout: "vertical";
6412 padding: 0 2;
6413 align: 0.5 0.5;
6414 min: 0 0;
6415 }
6416 ..
6417 }
6418 }
6419 @description
6420 A box block can contain other objects and display them in different
6421 layouts, any of the predefined set, or a custom one, set by the
6422 application.
6423 @endblock
6424
6425 @property
6426 layout
6427 @parameters
6428 [primary layout] [fallback layout]
6429 @effect
6430 Sets the layout for the box:
6431 @li horizontal (default)
6432 @li vertical
6433 @li horizontal_homogeneous
6434 @li vertical_homogeneous
6435 @li horizontal_max (homogeneous to the max sized child)
6436 @li vertical_max
6437 @li horizontal_flow
6438 @li vertical_flow
6439 @li stack
6440 @li some_other_custom_layout_set_by_the_application
6441 You could set a custom layout as fallback, it makes very
6442 very little sense though, and if that one fails, it will
6443 default to horizontal.
6444 @endproperty
6445
6446 @property
6447 align
6448 @parameters
6449 [horizontal] [vertical]
6450 @effect
6451 Change the position of the point of balance inside the container. The
6452 default value is 0.5 0.5.
6453 @endproperty
6454
6455 @property
6456 padding
6457 @parameters
6458 [horizontal] [vertical]
6459 @effect
6460 Sets the space between cells in pixels. Defaults to 0 0.
6461 @endproperty
6462
6463 @property
6464 min
6465 @parameters
6466 [horizontal] [vertical]
6467 @effect
6468 When any of the parameters is enabled (1) it forces the minimum size of
6469 the box to be equal to the minimum size of the items. The default
6470 value is "0 0".
6471 @endproperty
6472*/
6473static void st_collections_group_parts_part_description_box_layout(void)
6474{
6475 Edje_Part_Description_Box *ed;
6476
6477 check_min_arg_count(1);
6478
6479 if (current_part->type != EDJE_PART_TYPE_BOX)
6480 {
6481 ERR("%s: Error. parse error %s:%i. "
6482 "box attributes in non-BOX part.",
6483 progname, file_in, line - 1);
6484 exit(-1);
6485 }
6486
6487 ed = (Edje_Part_Description_Box*) current_desc;
6488
6489 ed->box.layout = parse_str(0);
6490 if (is_param(1))
6491 ed->box.alt_layout = parse_str(1);
6492}
6493
6494static void st_collections_group_parts_part_description_box_align(void)
6495{
6496 Edje_Part_Description_Box *ed;
6497
6498 check_arg_count(2);
6499
6500 if (current_part->type != EDJE_PART_TYPE_BOX)
6501 {
6502 ERR("%s: Error. parse error %s:%i. "
6503 "box attributes in non-BOX part.",
6504 progname, file_in, line - 1);
6505 exit(-1);
6506 }
6507
6508 ed = (Edje_Part_Description_Box*) current_desc;
6509
6510 ed->box.align.x = FROM_DOUBLE(parse_float_range(0, -1.0, 1.0));
6511 ed->box.align.y = FROM_DOUBLE(parse_float_range(1, -1.0, 1.0));
6512}
6513
6514static void st_collections_group_parts_part_description_box_padding(void)
6515{
6516 Edje_Part_Description_Box *ed;
6517
6518 check_arg_count(2);
6519
6520 if (current_part->type != EDJE_PART_TYPE_BOX)
6521 {
6522 ERR("%s: Error. parse error %s:%i. "
6523 "box attributes in non-BOX part.",
6524 progname, file_in, line - 1);
6525 exit(-1);
6526 }
6527
6528 ed = (Edje_Part_Description_Box*) current_desc;
6529
6530 ed->box.padding.x = parse_int_range(0, 0, 0x7fffffff);
6531 ed->box.padding.y = parse_int_range(1, 0, 0x7fffffff);
6532}
6533
6534static void
6535st_collections_group_parts_part_description_box_min(void)
6536{
6537 Edje_Part_Description_Box *ed;
6538
6539 check_arg_count(2);
6540
6541 if (current_part->type != EDJE_PART_TYPE_BOX)
6542 {
6543 ERR("%s: Error. parse error %s:%i. "
6544 "box attributes in non-BOX part.",
6545 progname, file_in, line - 1);
6546 exit(-1);
6547 }
6548
6549 ed = (Edje_Part_Description_Box*) current_desc;
6550
6551 ed->box.min.h = parse_bool(0);
6552 ed->box.min.v = parse_bool(1);
6553}
6554
6555
6556/**
6557 @edcsection{description_table,Table state description sub blocks}
6558 */
6559
6560/**
6561 @page edcref
6562
6563 @block
6564 table
6565 @context
6566 part {
6567 description {
6568 ..
6569 table {
6570 homogeneous: TABLE;
6571 padding: 0 2;
6572 align: 0.5 0.5;
6573 min: 0 0;
6574 }
6575 ..
6576 }
6577 }
6578 @description
6579 A table block can contain other objects packed in multiple columns
6580 and rows, and each item can span across more than one column and/or
6581 row.
6582 @endblock
6583
6584 @property
6585 homogeneous
6586 @parameters
6587 [homogeneous mode]
6588 @effect
6589 Sets the homogeneous mode for the table:
6590 @li NONE (default)
6591 @li TABLE
6592 @li ITEM
6593 @endproperty
6594
6595 @property
6596 align
6597 @parameters
6598 [horizontal] [vertical]
6599 @effect
6600 Change the position of the point of balance inside the container. The
6601 default value is 0.5 0.5.
6602 @endproperty
6603
6604 @property
6605 padding
6606 @parameters
6607 [horizontal] [vertical]
6608 @effect
6609 Sets the space between cells in pixels. Defaults to 0 0.
6610 @endproperty
6611
6612 @property
6613 min
6614 @parameters
6615 [horizontal] [vertical]
6616 @effect
6617 When any of the parameters is enabled (1) it forces the minimum size of
6618 the table to be equal to the minimum size of the items. The default
6619 value is "0 0".
6620 @endproperty
6621*/
6622static void st_collections_group_parts_part_description_table_homogeneous(void)
6623{
6624 Edje_Part_Description_Table *ed;
6625
6626 check_min_arg_count(1);
6627
6628 if (current_part->type != EDJE_PART_TYPE_TABLE)
6629 {
6630 ERR("%s: Error. parse error %s:%i. "
6631 "table attributes in non-TABLE part.",
6632 progname, file_in, line - 1);
6633 exit(-1);
6634 }
6635
6636 ed = (Edje_Part_Description_Table*) current_desc;
6637
6638 ed->table.homogeneous = parse_enum(0,
6639 "NONE", EDJE_OBJECT_TABLE_HOMOGENEOUS_NONE,
6640 "TABLE", EDJE_OBJECT_TABLE_HOMOGENEOUS_TABLE,
6641 "ITEM", EDJE_OBJECT_TABLE_HOMOGENEOUS_ITEM,
6642 NULL);
6643}
6644
6645static void st_collections_group_parts_part_description_table_align(void)
6646{
6647 Edje_Part_Description_Table *ed;
6648
6649 check_arg_count(2);
6650
6651 if (current_part->type != EDJE_PART_TYPE_TABLE)
6652 {
6653 ERR("%s: Error. parse error %s:%i. "
6654 "table attributes in non-TABLE part.",
6655 progname, file_in, line - 1);
6656 exit(-1);
6657 }
6658
6659 ed = (Edje_Part_Description_Table*) current_desc;
6660
6661 ed->table.align.x = FROM_DOUBLE(parse_float_range(0, -1.0, 1.0));
6662 ed->table.align.y = FROM_DOUBLE(parse_float_range(1, -1.0, 1.0));
6663}
6664
6665static void st_collections_group_parts_part_description_table_padding(void)
6666{
6667 Edje_Part_Description_Table *ed;
6668
6669 check_arg_count(2);
6670
6671 if (current_part->type != EDJE_PART_TYPE_TABLE)
6672 {
6673 ERR("%s: Error. parse error %s:%i. "
6674 "table attributes in non-TABLE part.",
6675 progname, file_in, line - 1);
6676 exit(-1);
6677 }
6678
6679 ed = (Edje_Part_Description_Table*) current_desc;
6680
6681 ed->table.padding.x = parse_int_range(0, 0, 0x7fffffff);
6682 ed->table.padding.y = parse_int_range(1, 0, 0x7fffffff);
6683}
6684
6685static void
6686st_collections_group_parts_part_description_table_min(void)
6687{
6688 Edje_Part_Description_Table *ed;
6689
6690 check_arg_count(2);
6691
6692 if (current_part->type != EDJE_PART_TYPE_TABLE)
6693 {
6694 ERR("%s: Error. parse error %s:%i. "
6695 "box attributes in non-TABLE part.",
6696 progname, file_in, line - 1);
6697 exit(-1);
6698 }
6699
6700 ed = (Edje_Part_Description_Table*) current_desc;
6701
6702 ed->table.min.h = parse_bool(0);
6703 ed->table.min.v = parse_bool(1);
6704}
6705
6706/**
6707 @edcsection{description_map,Map state description sub blocks}
6708 */
6709
6710/**
6711 @page edcref
6712 @block
6713 map
6714 @context
6715 description {
6716 ..
6717 map {
6718 perspective: "name";
6719 light: "name";
6720 on: 1;
6721 smooth: 1;
6722 perspective_on: 1;
6723 backface_cull: 1;
6724 alpha: 1;
6725
6726 rotation {
6727 ..
6728 }
6729 }
6730 ..
6731 }
6732
6733 @description
6734 @endblock
6735
6736 @property
6737 perspective
6738 @parameters
6739 [another part's name]
6740 @effect
6741 This sets the part that is used as the "perspective point" for giving
6742 a part a "3d look". The perspective point should have a perspective
6743 section that provides zplane and focal properties. The center of this
6744 part will be used as the focal point, so size, color and visibility
6745 etc. are not relevant just center point, zplane and focal are used.
6746 This also implicitly enables perspective transforms (see the on
6747 parameter for the map section).
6748 @endproperty
6749*/
6750static void
6751st_collections_group_parts_part_description_map_perspective(void)
6752{
6753 Edje_Part_Collection *pc;
6754
6755 check_arg_count(1);
6756
6757 pc = eina_list_data_get(eina_list_last(edje_collections));
6758
6759 {
6760 char *name;
6761
6762 name = parse_str(0);
6763 data_queue_part_lookup(pc, name, &(current_desc->map.id_persp));
6764 free(name);
6765 }
6766
6767 current_desc->map.persp_on = 1;
6768}
6769
6770/**
6771 @page edcref
6772 @property
6773 light
6774 @parameters
6775 [another part's name]
6776 @effect
6777 This sets the part that is used as the "light" for calculating the
6778 brightness (based on how directly the part's surface is facing the
6779 light source point). Like the perspective point part, the center point
6780 is used and zplane is used for the z position (0 being the zero-plane
6781 where all 2D objects normally live) and positive values being further
6782 away into the distance. The light part color is used as the light
6783 color (alpha not used for light color). The color2 color is used for
6784 the ambient lighting when calculating brightness (alpha also not
6785 used).
6786 @endproperty
6787*/
6788static void
6789st_collections_group_parts_part_description_map_light(void)
6790{
6791 Edje_Part_Collection *pc;
6792
6793 check_arg_count(1);
6794
6795 pc = eina_list_data_get(eina_list_last(edje_collections));
6796
6797 {
6798 char *name;
6799
6800 name = parse_str(0);
6801 data_queue_part_lookup(pc, name, &(current_desc->map.id_light));
6802 free(name);
6803 }
6804}
6805
6806/**
6807 @page edcref
6808 @property
6809 on
6810 @parameters
6811 [1 or 0]
6812 @effect
6813 This enables mapping for the part. Default is 0.
6814 @endproperty
6815*/
6816static void
6817st_collections_group_parts_part_description_map_on(void)
6818{
6819 check_arg_count(1);
6820
6821 current_desc->map.on = parse_bool(0);
6822}
6823
6824/**
6825 @page edcref
6826 @property
6827 smooth
6828 @parameters
6829 [1 or 0]
6830 @effect
6831 This enable smooth map rendering. This may be linear interpolation,
6832 anisotropic filtering or anything the engine decides is "smooth".
6833 This is a best-effort hint and may not produce precisely the same
6834 results in all engines and situations. Default is 1
6835 @endproperty
6836*/
6837static void
6838st_collections_group_parts_part_description_map_smooth(void)
6839{
6840 check_arg_count(1);
6841
6842 current_desc->map.smooth = parse_bool(0);
6843}
6844
6845/**
6846 @page edcref
6847 @property
6848 alpha
6849 @parameters
6850 [1 or 0]
6851 @effect
6852 This enable alpha channel when map rendering. Default is 1.
6853 @endproperty
6854*/
6855static void
6856st_collections_group_parts_part_description_map_alpha(void)
6857{
6858 check_arg_count(1);
6859
6860 current_desc->map.alpha = parse_bool(0);
6861}
6862
6863/**
6864 @page edcref
6865 @property
6866 backface_cull
6867 @parameters
6868 [1 or 0]
6869 @effect
6870 This enables backface culling (when the rotated part that normally
6871 faces the camera is facing away after being rotated etc.). This means
6872 that the object will be hidden when "backface culled".
6873 @endproperty
6874*/
6875static void
6876st_collections_group_parts_part_description_map_backface_cull(void)
6877{
6878 check_arg_count(1);
6879
6880 current_desc->map.backcull = parse_bool(0);
6881}
6882
6883/**
6884 @page edcref
6885 @property
6886 perspective_on
6887 @parameters
6888 [1 or 0]
6889 @effect
6890 Enable perspective when rotating even without a perspective point object.
6891 This would use perspective set for the object itself or for the
6892 canvas as a whole as the global perspective with
6893 edje_perspective_set() and edje_perspective_global_set().
6894 @endproperty
6895*/
6896static void
6897st_collections_group_parts_part_description_map_perspective_on(void)
6898{
6899 check_arg_count(1);
6900
6901 current_desc->map.persp_on = parse_bool(0);
6902}
6903/**
6904 @page edcref
6905 @block
6906 rotation
6907 @context
6908 map {
6909 ..
6910 rotation {
6911 center: "name";
6912 x: 45.0;
6913 y: 45.0;
6914 z: 45.0;
6915 }
6916 ..
6917 }
6918 @description
6919 Rotates the part, optionally with the center on another part.
6920 @endblock
6921
6922 @property
6923 center
6924 @parameters
6925 [another part's name]
6926 @effect
6927 This sets the part that is used as the center of rotation when
6928 rotating the part with this description. The part's center point
6929 is used as the rotation center when applying rotation around the
6930 x, y and z axes. If no center is given, the parts original center
6931 itself is used for the rotation center.
6932 @endproperty
6933*/
6934static void
6935st_collections_group_parts_part_description_map_rotation_center(void)
6936{
6937 Edje_Part_Collection *pc;
6938
6939 check_arg_count(1);
6940
6941 pc = eina_list_data_get(eina_list_last(edje_collections));
6942
6943 {
6944 char *name;
6945
6946 name = parse_str(0);
6947 data_queue_part_lookup(pc, name, &(current_desc->map.rot.id_center));
6948 free(name);
6949 }
6950}
6951
6952/**
6953 @page edcref
6954 @property
6955 x
6956 @parameters
6957 [X degrees]
6958 @effect
6959 This sets the rotation around the x axis of the part considering
6960 the center set. In degrees.
6961 @endproperty
6962*/
6963static void
6964st_collections_group_parts_part_description_map_rotation_x(void)
6965{
6966 check_arg_count(1);
6967
6968 current_desc->map.rot.x = FROM_DOUBLE(parse_float(0));
6969}
6970
6971/**
6972 @page edcref
6973 @property
6974 y
6975 @parameters
6976 [Y degrees]
6977 @effect
6978 This sets the rotation around the u axis of the part considering
6979 the center set. In degrees.
6980 @endproperty
6981*/
6982static void
6983st_collections_group_parts_part_description_map_rotation_y(void)
6984{
6985 check_arg_count(1);
6986
6987 current_desc->map.rot.y = FROM_DOUBLE(parse_float(0));
6988}
6989
6990/**
6991 @page edcref
6992 @property
6993 z
6994 @parameters
6995 [Z degrees]
6996 @effect
6997 This sets the rotation around the z axis of the part considering
6998 the center set. In degrees.
6999 @endproperty
7000*/
7001static void
7002st_collections_group_parts_part_description_map_rotation_z(void)
7003{
7004 check_arg_count(1);
7005
7006 current_desc->map.rot.z = FROM_DOUBLE(parse_float(0));
7007}
7008
7009/**
7010 @page edcref
7011 @block
7012 perspective
7013 @context
7014 description {
7015 ..
7016 perspective {
7017 zplane: 0;
7018 focal: 1000;
7019 }
7020 ..
7021 }
7022 @description
7023 Adds focal and plane perspective to the part. Active if perspective_on is true.
7024 Must be provided if the part is being used by other part as it's perspective target.
7025 @endblock
7026
7027 @property
7028 zplane
7029 @parameters
7030 [unscaled Z value]
7031 @effect
7032 This sets the z value that will not be scaled. Normally this is 0 as
7033 that is the z distance that all objects are at normally.
7034 @endproperty
7035*/
7036static void
7037st_collections_group_parts_part_description_perspective_zplane(void)
7038{
7039 check_arg_count(1);
7040
7041 current_desc->persp.zplane = parse_int(0);
7042}
7043
7044
7045/**
7046 @page edcref
7047 @property
7048 focal
7049 @parameters
7050 [distance]
7051 @effect
7052 This sets the distance from the focal z plane (zplane) and the
7053 camera - i.e. very much equating to focal length of the camera
7054 @endproperty
7055*/
7056static void
7057st_collections_group_parts_part_description_perspective_focal(void)
7058{
7059 check_arg_count(1);
7060
7061 current_desc->persp.focal = parse_int_range(0, 1, 0x7fffffff);
7062}
7063
7064
7065/**
7066 @edcsection{description_params,Params state description sub blocks}
7067 */
7068
7069/**
7070 @page edcref
7071 @block
7072 params
7073 @context
7074 description {
7075 ..
7076 params {
7077 int: "name" 0;
7078 double: "other_name" 0.0;
7079 string: "another_name" "some text";
7080 bool: "name" 1;
7081 choice: "some_name" "value";
7082 }
7083 ..
7084 }
7085 @description
7086 Set parameters for EXTERNAL parts. The value overwrites previous
7087 definitions with the same name.
7088 @endblock
7089*/
7090static void
7091_st_collections_group_parts_part_description_params(Edje_External_Param_Type type)
7092{
7093 Edje_Part_Description_External *ed;
7094 Edje_External_Param *param;
7095 Eina_List *l;
7096 const char *name;
7097 int found = 0;
7098
7099 check_arg_count(2);
7100
7101 if (current_part->type != EDJE_PART_TYPE_EXTERNAL)
7102 {
7103 ERR("%s: Error. parse error %s:%i. "
7104 "params in non-EXTERNAL part.",
7105 progname, file_in, line - 1);
7106 exit(-1);
7107 }
7108
7109 ed = (Edje_Part_Description_External*) current_desc;
7110
7111 name = parse_str(0);
7112
7113 /* if a param with this name already exists, overwrite it */
7114 EINA_LIST_FOREACH(ed->external_params, l, param)
7115 {
7116 if (!strcmp(param->name, name))
7117 {
7118 found = 1;
7119 break;
7120 }
7121 }
7122
7123 if (!found)
7124 {
7125 param = mem_alloc(SZ(Edje_External_Param));
7126 param->name = name;
7127 }
7128
7129 param->type = type;
7130 param->i = 0;
7131 param->d = 0;
7132 param->s = NULL;
7133
7134 switch (type)
7135 {
7136 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
7137 case EDJE_EXTERNAL_PARAM_TYPE_INT:
7138 param->i = parse_int(1);
7139 break;
7140 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
7141 param->d = parse_float(1);
7142 break;
7143 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
7144 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
7145 param->s = parse_str(1);
7146 break;
7147 default:
7148 ERR("%s: Error. parse error %s:%i. Invalid param type.\n",
7149 progname, file_in, line - 1);
7150 break;
7151 }
7152
7153 if (!found)
7154 ed->external_params = eina_list_append(ed->external_params, param);
7155}
7156
7157/**
7158 @page edcref
7159 @property
7160 int
7161 @parameters
7162 [param_name] [int_value]
7163 @effect
7164 Adds an integer parameter for an external object
7165 @endproperty
7166*/
7167static void
7168st_collections_group_parts_part_description_params_int(void)
7169{
7170 _st_collections_group_parts_part_description_params(EDJE_EXTERNAL_PARAM_TYPE_INT);
7171}
7172
7173/**
7174 @page edcref
7175 @property
7176 double
7177 @parameters
7178 [param_name] [double_value]
7179 @effect
7180 Adds a double parameter for an external object
7181 @endproperty
7182*/
7183static void
7184st_collections_group_parts_part_description_params_double(void)
7185{
7186 _st_collections_group_parts_part_description_params(EDJE_EXTERNAL_PARAM_TYPE_DOUBLE);
7187}
7188
7189/**
7190 @page edcref
7191 @property
7192 string
7193 @parameters
7194 [param_name] [string_value]
7195 @effect
7196 Adds a string parameter for an external object
7197 @endproperty
7198*/
7199static void
7200st_collections_group_parts_part_description_params_string(void)
7201{
7202 _st_collections_group_parts_part_description_params(EDJE_EXTERNAL_PARAM_TYPE_STRING);
7203}
7204
7205/**
7206 @page edcref
7207 @property
7208 bool
7209 @parameters
7210 [param_name] [bool_value]
7211 @effect
7212 Adds an boolean parameter for an external object. Value must be 0 or 1.
7213 @endproperty
7214*/
7215static void
7216st_collections_group_parts_part_description_params_bool(void)
7217{
7218 _st_collections_group_parts_part_description_params(EDJE_EXTERNAL_PARAM_TYPE_BOOL);
7219}
7220
7221/**
7222 @page edcref
7223 @property
7224 choice
7225 @parameters
7226 [param_name] [choice_string]
7227 @effect
7228 Adds a choice parameter for an external object. The possible
7229 choice values are defined by external type at their register time
7230 and will be validated at runtime.
7231 @endproperty
7232*/
7233static void
7234st_collections_group_parts_part_description_params_choice(void)
7235{
7236 _st_collections_group_parts_part_description_params(EDJE_EXTERNAL_PARAM_TYPE_CHOICE);
7237}
7238
7239
7240/**
7241 @edcsection{program, Program block}
7242 */
7243
7244/**
7245 @page edcref
7246 @block
7247 program
7248 @context
7249 group {
7250 programs {
7251 ..
7252 program {
7253 name: "programname";
7254 signal: "signalname";
7255 source: "partname";
7256 filter: "partname" "statename";
7257 in: 0.3 0.0;
7258 action: STATE_SET "statename" state_value;
7259 transition: LINEAR 0.5;
7260 target: "partname";
7261 target: "anotherpart";
7262 after: "programname";
7263 after: "anotherprogram";
7264 }
7265 ..
7266 }
7267 }
7268 @description
7269 Programs define how your interface reacts to events.
7270 Programs can change the state of parts, react to events or trigger
7271 other events.
7272 @endblock
7273*/
7274static void
7275ob_collections_group_programs_program(void)
7276{
7277 Edje_Part_Collection *pc;
7278 Edje_Program *ep;
7279 Edje_Program_Parser *epp;
7280
7281 pc = eina_list_data_get(eina_list_last(edje_collections));
7282
7283 ep = mem_alloc(SZ(Edje_Program_Parser));
7284 ep->id = -1;
7285 ep->tween.mode = EDJE_TWEEN_MODE_LINEAR;
7286 ep->after = NULL;
7287 epp = (Edje_Program_Parser *)ep;
7288 epp->can_override = EINA_FALSE;
7289
7290 _edje_program_insert(pc, ep);
7291
7292 current_program = ep;
7293}
7294
7295/**
7296 @page edcref
7297 @property
7298 name
7299 @parameters
7300 [program name]
7301 @effect
7302 Symbolic name of program as a unique identifier.
7303 @endproperty
7304*/
7305static void
7306st_collections_group_programs_program_name(void)
7307{
7308 Edje_Part_Collection *pc;
7309
7310 check_arg_count(1);
7311
7312 pc = eina_list_data_get(eina_list_last(edje_collections));
7313 current_program->name = parse_str(0);
7314
7315 _edje_program_check(current_program->name, current_program, pc->programs.fnmatch, pc->programs.fnmatch_count);
7316 _edje_program_check(current_program->name, current_program, pc->programs.strcmp, pc->programs.strcmp_count);
7317 _edje_program_check(current_program->name, current_program, pc->programs.strncmp, pc->programs.strncmp_count);
7318 _edje_program_check(current_program->name, current_program, pc->programs.strrncmp, pc->programs.strrncmp_count);
7319 _edje_program_check(current_program->name, current_program, pc->programs.nocmp, pc->programs.nocmp_count);
7320}
7321
7322/**
7323 @page edcref
7324 @property
7325 signal
7326 @parameters
7327 [signal name]
7328 @effect
7329 Specifies signal(s) that should cause the program to run. The signal
7330 received must match the specified source to run.
7331 Signals may be globbed, but only one signal keyword per program
7332 may be used. ex: signal: "mouse,clicked,*"; (clicking any mouse button
7333 that matches source starts program).
7334 @endproperty
7335*/
7336static void
7337st_collections_group_programs_program_signal(void)
7338{
7339 Edje_Part_Collection *pc;
7340
7341 check_arg_count(1);
7342
7343 pc = eina_list_data_get(eina_list_last(edje_collections));
7344
7345 _edje_program_remove(pc, current_program);
7346 current_program->signal = parse_str(0);
7347 _edje_program_insert(pc, current_program);
7348}
7349
7350/**
7351 @page edcref
7352 @property
7353 source
7354 @parameters
7355 [source name]
7356 @effect
7357 Source of accepted signal. Sources may be globbed, but only one source
7358 keyword per program may be used. ex:source: "button-*"; (Signals from
7359 any part or program named "button-*" are accepted).
7360 @endproperty
7361*/
7362static void
7363st_collections_group_programs_program_source(void)
7364{
7365 Edje_Part_Collection *pc;
7366
7367 check_arg_count(1);
7368
7369 pc = eina_list_data_get(eina_list_last(edje_collections));
7370
7371 _edje_program_remove(pc, current_program);
7372 current_program->source = parse_str(0);
7373 _edje_program_insert(pc, current_program);
7374}
7375
7376/**
7377 @page edcref
7378 @property
7379 filter
7380 @parameters
7381 [part] [state]
7382 @effect
7383 Filter signals to be only accepted if the part [part] is in state named [state].
7384 Only one filter per program can be used. If [state] is not given, the source of
7385 the event will be used instead.
7386 @endproperty
7387*/
7388static void
7389st_collections_group_programs_program_filter(void)
7390{
7391 check_min_arg_count(1);
7392
7393 if(is_param(1)) {
7394 current_program->filter.part = parse_str(0);
7395 current_program->filter.state = parse_str(1);
7396 } else {
7397 current_program->filter.state = parse_str(0);
7398 }
7399}
7400
7401/**
7402 @page edcref
7403 @property
7404 in
7405 @parameters
7406 [from] [range]
7407 @effect
7408 Wait 'from' seconds before executing the program. And add a random
7409 number of seconds (from 0 to 'range') to the total waiting time.
7410 @endproperty
7411*/
7412static void
7413st_collections_group_programs_program_in(void)
7414{
7415 check_arg_count(2);
7416
7417 current_program->in.from = parse_float_range(0, 0.0, 999999999.0);
7418 current_program->in.range = parse_float_range(1, 0.0, 999999999.0);
7419}
7420
7421/**
7422 @page edcref
7423 @property
7424 action
7425 @parameters
7426 [type] [param1] [param2]
7427 @effect
7428 Action to be performed by the program. Valid actions are: STATE_SET,
7429 ACTION_STOP, SIGNAL_EMIT, DRAG_VAL_SET, DRAG_VAL_STEP, DRAG_VAL_PAGE,
7430 FOCUS_SET, PARAM_COPY, PARAM_SET, PLAY_SAMPLE, PLAY_TONE
7431 Only one action can be specified per program. Examples:\n
7432 action: STATE_SET "statename" 0.5;\n
7433 action: ACTION_STOP;\n
7434 action: SIGNAL_EMIT "signalname" "emitter";\n
7435 action: DRAG_VAL_SET 0.5 0.0;\n
7436 action: DRAG_VAL_STEP 1.0 0.0;\n
7437 action: DRAG_VAL_PAGE 0.0 0.0;\n
7438 action: FOCUS_SET;\n
7439 action: FOCUS_OBJECT;\n
7440 action: PARAM_COPY "src_part" "src_param" "dst_part" "dst_param";\n
7441 action: PARAM_SET "part" "param" "value";\n
7442 action: PLAY_SAMPLE "sample name";\n
7443 action: PLAY_TONE "tone name" duration in seconds ( Range 0.1 to 10.0 );\n
7444 @endproperty
7445*/
7446static void
7447st_collections_group_programs_program_action(void)
7448{
7449 Edje_Part_Collection *pc;
7450 Edje_Program *ep;
7451 int i;
7452
7453 pc = eina_list_data_get(eina_list_last(edje_collections));
7454 ep = current_program;
7455 ep->action = parse_enum(0,
7456 "STATE_SET", EDJE_ACTION_TYPE_STATE_SET,
7457 "ACTION_STOP", EDJE_ACTION_TYPE_ACTION_STOP,
7458 "SIGNAL_EMIT", EDJE_ACTION_TYPE_SIGNAL_EMIT,
7459 "DRAG_VAL_SET", EDJE_ACTION_TYPE_DRAG_VAL_SET,
7460 "DRAG_VAL_STEP", EDJE_ACTION_TYPE_DRAG_VAL_STEP,
7461 "DRAG_VAL_PAGE", EDJE_ACTION_TYPE_DRAG_VAL_PAGE,
7462 "SCRIPT", EDJE_ACTION_TYPE_SCRIPT,
7463 "FOCUS_SET", EDJE_ACTION_TYPE_FOCUS_SET,
7464 "FOCUS_OBJECT", EDJE_ACTION_TYPE_FOCUS_OBJECT,
7465 "PARAM_COPY", EDJE_ACTION_TYPE_PARAM_COPY,
7466 "PARAM_SET", EDJE_ACTION_TYPE_PARAM_SET,
7467 "PLAY_SAMPLE", EDJE_ACTION_TYPE_SOUND_SAMPLE,
7468 "PLAY_TONE", EDJE_ACTION_TYPE_SOUND_TONE,
7469 NULL);
7470 if (ep->action == EDJE_ACTION_TYPE_STATE_SET)
7471 {
7472 ep->state = parse_str(1);
7473 ep->value = parse_float_range(2, 0.0, 1.0);
7474 }
7475 else if (ep->action == EDJE_ACTION_TYPE_SIGNAL_EMIT)
7476 {
7477 ep->state = parse_str(1);
7478 ep->state2 = parse_str(2);
7479 }
7480 else if (ep->action == EDJE_ACTION_TYPE_SOUND_SAMPLE)
7481 {
7482 ep->sample_name = parse_str(1);
7483 for (i = 0; i < (int)edje_file->sound_dir->samples_count; i++)
7484 {
7485 if (!strcmp(edje_file->sound_dir->samples[i].name, ep->sample_name))
7486 break;
7487 if (i == (int)(edje_file->sound_dir->samples_count - 1))
7488 {
7489 ERR("%s: Error. No Sample name %s exist.", progname,
7490 ep->sample_name);
7491 exit(-1);
7492 }
7493 }
7494 ep->speed = parse_float_range(2, 0.0, 10.0);
7495 }
7496 else if (ep->action == EDJE_ACTION_TYPE_SOUND_TONE)
7497 {
7498 ep->tone_name = parse_str(1);
7499 for (i = 0; i < (int)edje_file->sound_dir->tones_count; i++)
7500 {
7501 if (!strcmp(edje_file->sound_dir->tones[i].name, ep->tone_name))
7502 break;
7503 if (i == (int)(edje_file->sound_dir->tones_count - 1))
7504 {
7505 ERR("%s: Error. No Tone name %s exist.", progname,
7506 ep->tone_name);
7507 exit(-1);
7508 }
7509 }
7510 ep->duration = parse_float_range(2, 0.1, 10.0);
7511 }
7512 else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_SET)
7513 {
7514 ep->value = parse_float(1);
7515 ep->value2 = parse_float(2);
7516 }
7517 else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_STEP)
7518 {
7519 ep->value = parse_float(1);
7520 ep->value2 = parse_float(2);
7521 }
7522 else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_PAGE)
7523 {
7524 ep->value = parse_float(1);
7525 ep->value2 = parse_float(2);
7526 }
7527 else if (ep->action == EDJE_ACTION_TYPE_PARAM_COPY)
7528 {
7529 char *src_part, *dst_part;
7530
7531 src_part = parse_str(1);
7532 ep->state = parse_str(2);
7533 dst_part = parse_str(3);
7534 ep->state2 = parse_str(4);
7535
7536 data_queue_part_lookup(pc, src_part, &(ep->param.src));
7537 data_queue_part_lookup(pc, dst_part, &(ep->param.dst));
7538
7539 free(src_part);
7540 free(dst_part);
7541 }
7542 else if (ep->action == EDJE_ACTION_TYPE_PARAM_SET)
7543 {
7544 char *part;
7545
7546 part = parse_str(1);
7547 ep->state = parse_str(2);
7548 ep->state2 = parse_str(3);
7549
7550 data_queue_part_lookup(pc, part, &(ep->param.dst));
7551 free(part);
7552 }
7553
7554 switch (ep->action)
7555 {
7556 case EDJE_ACTION_TYPE_ACTION_STOP:
7557 check_arg_count(1);
7558 break;
7559 case EDJE_ACTION_TYPE_SCRIPT:
7560 /* this is implicitly set by script {} so this is here just for
7561 * completeness */
7562 break;
7563 case EDJE_ACTION_TYPE_FOCUS_OBJECT:
7564 case EDJE_ACTION_TYPE_FOCUS_SET:
7565 check_arg_count(1);
7566 break;
7567 case EDJE_ACTION_TYPE_PARAM_COPY:
7568 check_arg_count(5);
7569 break;
7570 case EDJE_ACTION_TYPE_PARAM_SET:
7571 check_arg_count(4);
7572 break;
7573 case EDJE_ACTION_TYPE_SOUND_SAMPLE:
7574 check_arg_count(3);
7575 break;
7576 case EDJE_ACTION_TYPE_SOUND_TONE:
7577 check_arg_count(3);
7578 break;
7579 default:
7580 check_arg_count(3);
7581 }
7582}
7583
7584/**
7585 @page edcref
7586 @property
7587 transition
7588 @parameters
7589 [type] [length] [[interp val 1]] [[interp val 2]] [[option]]
7590 @effect
7591 Defines how transitions occur using STATE_SET action.\n
7592 Where 'type' is the style of the transition and 'length' is a double
7593 specifying the number of seconds in which to preform the transition.\n
7594 Valid types are: LIN or LINEAR, SIN or SINUSOIDAL,
7595 ACCEL or ACCELERATE, DECEL or DECELERATE,
7596 ACCEL_FAC or ACCELERATE_FACTOR, DECEL_FAC or DECELERATE_FACTOR,
7597 SIN_FAC or SINUSOIDAL_FACTOR, DIVIS or DIVISOR_INTERP,
7598 BOUNCE, SPRING.
7599
7600 ACCEL_FAC, DECEL_FAC and SIN_FAC need the extra optional
7601 "interp val 1" to determine the "factor" of curviness. 1.0 is the same
7602 as their non-factor counterparts, where 0.0 is equal to linear.
7603 numbers higher than one make the curve angles steeper with a more
7604 prnounced curve point.
7605
7606 DIVIS, BOUNCE and SPRING also require "interp val 2" in addition
7607 to "interp val 1".
7608
7609 DIVIS uses val 1 as the initial graident start
7610 (0.0 is horizontal, 1.0 is diagonal (linear), 2.0 is twice the
7611 gradient of linear etc.). val 2 is interpreted as an integer factor
7612 defining how much the value swings "outside" the gradient only to come
7613 back to the final resting spot at the end. 0.0 for val 2 is equivalent
7614 to linear interpolation. Note that DIVIS can exceed 1.0
7615
7616 BOUNCE uses val 2 as the number of bounces (so its rounded down to
7617 the nearest integer value), with val 2 determining how much the
7618 bounce decays, with 0.0 giving linear decay per bounce, and higher
7619 values giving much more decay.
7620
7621 SPRING is similar to bounce, where val 2 specifies the number of
7622 spring "swings" and val 1 specifies the decay, but it can exceed 1.0
7623 on the outer swings.
7624
7625 Valid option is CURRENT.
7626
7627 CURRENT is the option which causes the edje object to move from its current position.
7628 It can be used as the last parameter of any transition type. (@since 1.1.0)
7629
7630 @endproperty
7631*/
7632static void
7633st_collections_group_programs_program_transition(void)
7634{
7635 check_min_arg_count(2);
7636
7637 current_program->tween.mode = parse_enum(0,
7638 // short names
7639 "LIN", EDJE_TWEEN_MODE_LINEAR,
7640 "SIN", EDJE_TWEEN_MODE_SINUSOIDAL,
7641 "ACCEL", EDJE_TWEEN_MODE_ACCELERATE,
7642 "DECEL", EDJE_TWEEN_MODE_DECELERATE,
7643 "ACCEL_FAC", EDJE_TWEEN_MODE_ACCELERATE_FACTOR,
7644 "DECEL_FAC", EDJE_TWEEN_MODE_DECELERATE_FACTOR,
7645 "SIN_FAC", EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR,
7646 "DIVIS", EDJE_TWEEN_MODE_DIVISOR_INTERP,
7647
7648 // long/full names
7649 "LINEAR", EDJE_TWEEN_MODE_LINEAR,
7650 "SINUSOIDAL", EDJE_TWEEN_MODE_SINUSOIDAL,
7651 "ACCELERATE", EDJE_TWEEN_MODE_ACCELERATE,
7652 "DECELERATE", EDJE_TWEEN_MODE_DECELERATE,
7653 "ACCELERATE_FACTOR", EDJE_TWEEN_MODE_ACCELERATE_FACTOR,
7654 "DECELERATE_FACTOR", EDJE_TWEEN_MODE_DECELERATE_FACTOR,
7655 "SINUSOIDAL_FACTOR", EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR,
7656 "DIVISOR_INTERP", EDJE_TWEEN_MODE_DIVISOR_INTERP,
7657
7658 // long/full is short enough
7659 "BOUNCE", EDJE_TWEEN_MODE_BOUNCE,
7660 "SPRING", EDJE_TWEEN_MODE_SPRING,
7661 NULL);
7662 current_program->tween.time = FROM_DOUBLE(parse_float_range(1, 0.0, 999999999.0));
7663 if ((current_program->tween.mode >= EDJE_TWEEN_MODE_LINEAR) &&
7664 (current_program->tween.mode <= EDJE_TWEEN_MODE_DECELERATE))
7665 {
7666 if ((get_arg_count() == 3) && (!strcmp(parse_str(2), "CURRENT")))
7667 current_program->tween.mode |= EDJE_TWEEN_MODE_OPT_FROM_CURRENT;
7668 else if (get_arg_count() != 2)
7669 {
7670 ERR("%s: Error. parse error %s:%i. "
7671 "Need 2rd parameter to set time",
7672 progname, file_in, line - 1);
7673 exit(-1);
7674 }
7675 }
7676 // the following need v1
7677 // EDJE_TWEEN_MODE_ACCELERATE_FACTOR
7678 // EDJE_TWEEN_MODE_DECELERATE_FACTOR
7679 // EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR
7680 // current_program->tween.v1
7681 else if ((current_program->tween.mode >= EDJE_TWEEN_MODE_ACCELERATE_FACTOR) &&
7682 (current_program->tween.mode <= EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR))
7683 {
7684 if ((get_arg_count() == 4) && (!strcmp(parse_str(3), "CURRENT")))
7685 current_program->tween.mode |= EDJE_TWEEN_MODE_OPT_FROM_CURRENT;
7686 else if (get_arg_count() != 3)
7687 {
7688 ERR("%s: Error. parse error %s:%i. "
7689 "Need 3rd parameter to set factor",
7690 progname, file_in, line - 1);
7691 exit(-1);
7692 }
7693 current_program->tween.v1 = FROM_DOUBLE(parse_float_range(2, 0.0, 999999999.0));
7694 }
7695 // the followjng also need v2
7696 // EDJE_TWEEN_MODE_DIVISOR_INTERP
7697 // EDJE_TWEEN_MODE_BOUNCE
7698 // EDJE_TWEEN_MODE_SPRING
7699 // current_program->tween.v2
7700 else if ((current_program->tween.mode >= EDJE_TWEEN_MODE_DIVISOR_INTERP) &&
7701 (current_program->tween.mode <= EDJE_TWEEN_MODE_SPRING))
7702 {
7703 if ((get_arg_count() == 5) && (!strcmp(parse_str(4), "CURRENT")))
7704 current_program->tween.mode |= EDJE_TWEEN_MODE_OPT_FROM_CURRENT;
7705 else if (get_arg_count() != 4)
7706 {
7707 ERR("%s: Error. parse error %s:%i. "
7708 "Need 3rd and 4th parameters to set factor and counts",
7709 progname, file_in, line - 1);
7710 exit(-1);
7711 }
7712 current_program->tween.v1 = FROM_DOUBLE(parse_float_range(2, 0.0, 999999999.0));
7713 current_program->tween.v2 = FROM_DOUBLE(parse_float_range(3, 0.0, 999999999.0));
7714 }
7715}
7716
7717/**
7718 @page edcref
7719 @property
7720 target
7721 @parameters
7722 [target]
7723 @effect
7724 Program or part on which the specified action acts. Multiple target
7725 keywords may be specified, one per target. SIGNAL_EMITs do not have
7726 targets.
7727 @endproperty
7728*/
7729static void
7730st_collections_group_programs_program_target(void)
7731{
7732 Edje_Part_Collection *pc;
7733 Edje_Program *ep;
7734
7735 check_arg_count(1);
7736
7737 pc = eina_list_data_get(eina_list_last(edje_collections));
7738 ep = current_program;
7739 {
7740 Edje_Program_Target *et;
7741 Edje_Program_Target *etw;
7742 Eina_List *l;
7743 char *name;
7744 char *copy;
7745
7746 name = parse_str(0);
7747
7748 EINA_LIST_FOREACH(ep->targets, l, etw)
7749 {
7750 if (!strcmp(name, (char*) (etw + 1)))
7751 {
7752 free(name);
7753 return;
7754 }
7755 }
7756
7757 et = mem_alloc(SZ(Edje_Program_Target) + strlen(name) + 1);
7758 ep->targets = eina_list_append(ep->targets, et);
7759 copy = (char*) (et + 1);
7760
7761 memcpy(copy, name, strlen(name) + 1);
7762
7763 if (ep->action == EDJE_ACTION_TYPE_STATE_SET)
7764 data_queue_part_lookup(pc, name, &(et->id));
7765 else if (ep->action == EDJE_ACTION_TYPE_ACTION_STOP)
7766 data_queue_program_lookup(pc, name, &(et->id));
7767 else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_SET)
7768 data_queue_part_lookup(pc, name, &(et->id));
7769 else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_STEP)
7770 data_queue_part_lookup(pc, name, &(et->id));
7771 else if (ep->action == EDJE_ACTION_TYPE_DRAG_VAL_PAGE)
7772 data_queue_part_lookup(pc, name, &(et->id));
7773 else if (ep->action == EDJE_ACTION_TYPE_FOCUS_SET)
7774 data_queue_part_lookup(pc, name, &(et->id));
7775 else if (ep->action == EDJE_ACTION_TYPE_FOCUS_OBJECT)
7776 data_queue_part_lookup(pc, name, &(et->id));
7777 else
7778 {
7779 ERR("%s: Error. parse error %s:%i. "
7780 "target may only be used after action",
7781 progname, file_in, line - 1);
7782 exit(-1);
7783 }
7784 free(name);
7785 }
7786}
7787
7788/**
7789 @page edcref
7790 @property
7791 after
7792 @parameters
7793 [after]
7794 @effect
7795 Specifies a program to run after the current program completes. The
7796 source and signal parameters of a program run as an "after" are ignored.
7797 Multiple "after" statements can be specified per program.
7798 @endproperty
7799*/
7800static void
7801st_collections_group_programs_program_after(void)
7802{
7803 Edje_Part_Collection *pc;
7804 Edje_Program *ep;
7805
7806 check_arg_count(1);
7807
7808 pc = eina_list_data_get(eina_list_last(edje_collections));
7809 ep = current_program;
7810 {
7811 Edje_Program_After *pa;
7812 char *name;
7813
7814 name = parse_str(0);
7815
7816 pa = mem_alloc(SZ(Edje_Program_After));
7817 pa->id = -1;
7818 ep->after = eina_list_append(ep->after, pa);
7819
7820 data_queue_program_lookup(pc, name, &(pa->id));
7821 free(name);
7822 }
7823}
7824
7825/**
7826 @page edcref
7827 @property
7828 api
7829 @parameters
7830 [name] [description]
7831 @effect
7832 Specifies a hint to let applications (or IDE's) know how to bind
7833 things. The parameter name should contain the name of the function that
7834 the application should use, and description describes how it should
7835 be used.
7836 @endproperty
7837*/
7838static void
7839st_collections_group_programs_program_api(void)
7840{
7841 check_min_arg_count(1);
7842
7843 current_program->api.name = parse_str(0);
7844
7845 if (is_param(1))
7846 {
7847 check_arg_count(2);
7848 current_program->api.description = parse_str(1);
7849 }
7850}
7851
7852static void
7853st_collections_group_parts_part_api(void)
7854{
7855 check_min_arg_count(1);
7856
7857 current_part->api.name = parse_str(0);
7858 if (is_param(1))
7859 {
7860 check_arg_count(2);
7861 current_part->api.description = parse_str(1);
7862 }
7863}
7864
7865static void
7866ob_collections_group_programs_program_script(void)
7867{
7868 Edje_Part_Collection *pc;
7869 Code *cd;
7870
7871 pc = eina_list_data_get(eina_list_last(edje_collections));
7872 cd = eina_list_data_get(eina_list_last(codes));
7873
7874 if (!is_verbatim()) track_verbatim(1);
7875 else
7876 {
7877 Eina_Bool empty = EINA_TRUE;
7878 char *s;
7879 int i, len;
7880
7881 s = get_verbatim();
7882 if (s)
7883 {
7884 Code_Program *cp;
7885
7886 /* FIXME: Need to store the script somewhere to be restored when using edje_edit API */
7887 cp = mem_alloc(SZ(Code_Program));
7888 cp->l1 = get_verbatim_line1();
7889 cp->l2 = get_verbatim_line2();
7890 cp->script = s;
7891 cp->original = strdup(s);
7892 if (cd->shared && cd->is_lua)
7893 {
7894 ERR("%s: Error. parse error %s:%i. You're trying to mix Embryo and Lua scripting in the same group",
7895 progname, file_in, line - 1);
7896 exit(-1);
7897 }
7898 cd->is_lua = 0;
7899
7900 len = strlen(cp->script);
7901 for (i = 0; i < len; i++)
7902 {
7903 if (((cp->script[i] > 'a') && (cp->script[i] < 'z')) ||
7904 ((cp->script[i] > 'A') && (cp->script[i] < 'Z')) ||
7905 ((cp->script[i] > '0') && (cp->script[i] < '9')))
7906 empty = EINA_FALSE;
7907 }
7908
7909 if (!empty)
7910 {
7911 cd->programs = eina_list_append(cd->programs, cp);
7912 data_queue_anonymous_lookup(pc, current_program, &(cp->id));
7913 current_program->action = EDJE_ACTION_TYPE_SCRIPT;
7914 }
7915 else
7916 {
7917 data_queue_anonymous_lookup(pc, current_program, NULL);
7918 free(cp);
7919 cp = NULL;
7920 }
7921
7922 set_verbatim(NULL, 0, 0);
7923 }
7924 }
7925}
7926/**
7927 @page edcref
7928 </table>
7929*/
diff --git a/libraries/edje/src/bin/edje_cc_mem.c b/libraries/edje/src/bin/edje_cc_mem.c
deleted file mode 100644
index d2d4ae0..0000000
--- a/libraries/edje/src/bin/edje_cc_mem.c
+++ /dev/null
@@ -1,34 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <string.h>
6#include <errno.h>
7
8#include "edje_cc.h"
9
10void *
11mem_alloc(size_t size)
12{
13 void *mem;
14
15 mem = calloc(1, size);
16 if (mem) return mem;
17 ERR("%s: Error. %s:%i memory allocation of %zu bytes failed. %s",
18 progname, file_in, line, size, strerror(errno));
19 exit(-1);
20 return NULL;
21}
22
23char *
24mem_strdup(const char *s)
25{
26 void *str;
27
28 str = strdup(s);
29 if (str) return str;
30 ERR("%s: Error. %s:%i memory allocation of %zu bytes failed. %s. string being duplicated: \"%s\"",
31 progname, file_in, line, strlen(s) + 1, strerror(errno), s);
32 exit(-1);
33 return NULL;
34}
diff --git a/libraries/edje/src/bin/edje_cc_out.c b/libraries/edje/src/bin/edje_cc_out.c
deleted file mode 100644
index b4c541c..0000000
--- a/libraries/edje/src/bin/edje_cc_out.c
+++ /dev/null
@@ -1,2162 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#ifdef STDC_HEADERS
6# include <stdlib.h>
7# include <stddef.h>
8#else
9# ifdef HAVE_STDLIB_H
10# include <stdlib.h>
11# endif
12#endif
13#ifdef HAVE_ALLOCA_H
14# include <alloca.h>
15#elif !defined alloca
16# ifdef __GNUC__
17# define alloca __builtin_alloca
18# elif defined _AIX
19# define alloca __alloca
20# elif defined _MSC_VER
21# include <malloc.h>
22# define alloca _alloca
23# elif !defined HAVE_ALLOCA
24# ifdef __cplusplus
25extern "C"
26# endif
27void *alloca (size_t);
28# endif
29#endif
30
31#include <string.h>
32#include <limits.h>
33#include <unistd.h>
34#include <sys/stat.h>
35
36#include <Ecore_Evas.h>
37
38#include "edje_cc.h"
39#include "edje_convert.h"
40#include "edje_multisense_convert.h"
41
42#include <lua.h>
43#include <lauxlib.h>
44
45typedef struct _External_Lookup External_Lookup;
46typedef struct _Part_Lookup Part_Lookup;
47typedef struct _Program_Lookup Program_Lookup;
48typedef struct _Group_Lookup Group_Lookup;
49typedef struct _Image_Lookup Image_Lookup;
50typedef struct _Slave_Lookup Slave_Lookup;
51typedef struct _Code_Lookup Code_Lookup;
52
53
54struct _External_Lookup
55{
56 char *name;
57};
58
59struct _Part_Lookup
60{
61 Edje_Part_Collection *pc;
62 char *name;
63 int *dest;
64};
65
66struct _Program_Lookup
67{
68 Edje_Part_Collection *pc;
69
70 union
71 {
72 char *name;
73 Edje_Program *ep;
74 } u;
75
76 int *dest;
77
78 Eina_Bool anonymous : 1;
79};
80
81struct _Group_Lookup
82{
83 char *name;
84 Edje_Part *part;
85};
86
87struct _String_Lookup
88{
89 char *name;
90 int *dest;
91};
92
93struct _Image_Lookup
94{
95 char *name;
96 int *dest;
97 Eina_Bool *set;
98};
99
100struct _Slave_Lookup
101{
102 int *master;
103 int *slave;
104};
105
106struct _Code_Lookup
107{
108 char *ptr;
109 int len;
110 int val;
111 Eina_Bool set;
112};
113
114static void data_process_string(Edje_Part_Collection *pc, const char *prefix, char *s, void (*func)(Edje_Part_Collection *pc, char *name, char* ptr, int len));
115
116Edje_File *edje_file = NULL;
117Eina_List *edje_collections = NULL;
118Eina_List *externals = NULL;
119Eina_List *fonts = NULL;
120Eina_List *codes = NULL;
121Eina_List *code_lookups = NULL;
122Eina_List *aliases = NULL;
123
124static Eet_Data_Descriptor *edd_edje_file = NULL;
125static Eet_Data_Descriptor *edd_edje_part_collection = NULL;
126
127static Eina_List *part_lookups = NULL;
128static Eina_List *program_lookups = NULL;
129static Eina_List *group_lookups = NULL;
130static Eina_List *image_lookups = NULL;
131static Eina_List *part_slave_lookups = NULL;
132static Eina_List *image_slave_lookups= NULL;
133
134#define ABORT_WRITE(eet_file, file) \
135 eet_close(eet_file); \
136 unlink(file); \
137 exit(-1);
138
139void
140error_and_abort(Eet_File *ef, const char *fmt, ...)
141{
142 va_list ap;
143
144 fprintf(stderr, "%s: Error. ", progname);
145
146 va_start(ap, fmt);
147 vfprintf(stderr, fmt, ap);
148 va_end(ap);
149 ABORT_WRITE(ef, file_out);
150}
151
152void
153data_setup(void)
154{
155 edd_edje_file = _edje_edd_edje_file;
156 edd_edje_part_collection = _edje_edd_edje_part_collection;
157}
158
159static void
160check_image_part_desc (Edje_Part_Collection *pc, Edje_Part *ep,
161 Edje_Part_Description_Image *epd, Eet_File *ef)
162{
163 unsigned int i;
164
165#if 0 /* FIXME: This check sounds like not a useful one */
166 if (epd->image.id == -1)
167 ERR(ef, "Collection %s(%i): image attributes missing for "
168 "part \"%s\", description \"%s\" %f\n",
169 pc->part, pc->id, ep->name, epd->common.state.name, epd->common.state.value);
170#endif
171
172 for (i = 0; i < epd->image.tweens_count; ++i)
173 {
174 if (epd->image.tweens[i]->id == -1)
175 error_and_abort(ef, "Collection %i: tween image id missing for "
176 "part \"%s\", description \"%s\" %f\n",
177 pc->id, ep->name, epd->common.state.name, epd->common.state.value);
178 }
179}
180
181static void
182check_packed_items(Edje_Part_Collection *pc, Edje_Part *ep, Eet_File *ef)
183{
184 unsigned int i;
185
186 for (i = 0; i < ep->items_count; ++i)
187 {
188 if (ep->items[i]->type == EDJE_PART_TYPE_GROUP && !ep->items[i]->source)
189 error_and_abort(ef, "Collection %i: missing source on packed item "
190 "of type GROUP in part \"%s\"\n",
191 pc->id, ep->name);
192 if (ep->type == EDJE_PART_TYPE_TABLE && (ep->items[i]->col < 0 || ep->items[i]->row < 0))
193 error_and_abort(ef, "Collection %i: missing col/row on packed item "
194 "for part \"%s\" of type TABLE\n",
195 pc->id, ep->name);
196 }
197}
198
199static void
200check_nameless_state(Edje_Part_Collection *pc, Edje_Part *ep, Edje_Part_Description_Common *ed, Eet_File *ef)
201{
202 if (!ed->state.name)
203 error_and_abort(ef, "Collection %i: description with state missing on part \"%s\"\n",
204 pc->id, ep->name);
205}
206
207static void
208check_part (Edje_Part_Collection *pc, Edje_Part *ep, Eet_File *ef)
209{
210 unsigned int i;
211 /* FIXME: check image set and sort them. */
212 if (!ep->default_desc)
213 error_and_abort(ef, "Collection %i: default description missing "
214 "for part \"%s\"\n", pc->id, ep->name);
215
216 for (i = 0; i < ep->other.desc_count; ++i)
217 check_nameless_state(pc, ep, ep->other.desc[i], ef);
218
219 if (ep->type == EDJE_PART_TYPE_IMAGE)
220 {
221 check_image_part_desc(pc, ep, (Edje_Part_Description_Image*) ep->default_desc, ef);
222
223 for (i = 0; i < ep->other.desc_count; ++i)
224 check_image_part_desc (pc, ep, (Edje_Part_Description_Image*) ep->other.desc[i], ef);
225 }
226 else if ((ep->type == EDJE_PART_TYPE_BOX) ||
227 (ep->type == EDJE_PART_TYPE_TABLE))
228 check_packed_items(pc, ep, ef);
229}
230
231static void
232check_program (Edje_Part_Collection *pc, Edje_Program *ep, Eet_File *ef)
233{
234 switch (ep->action)
235 {
236 case EDJE_ACTION_TYPE_STATE_SET:
237 case EDJE_ACTION_TYPE_ACTION_STOP:
238 case EDJE_ACTION_TYPE_DRAG_VAL_SET:
239 case EDJE_ACTION_TYPE_DRAG_VAL_STEP:
240 case EDJE_ACTION_TYPE_DRAG_VAL_PAGE:
241 if (!ep->targets)
242 error_and_abort(ef, "Collection %i: target missing in program "
243 "\"%s\"\n", pc->id, ep->name);
244 break;
245 default:
246 break;
247 }
248}
249
250static int
251data_write_header(Eet_File *ef)
252{
253 int bytes = 0;
254
255 if (edje_file)
256 {
257 if (edje_file->collection)
258 {
259 Edje_Part_Collection_Directory_Entry *ce;
260
261 /* copy aliases into collection directory */
262 EINA_LIST_FREE(aliases, ce)
263 {
264 Edje_Part_Collection_Directory_Entry *sce;
265 Eina_Iterator *it;
266
267 if (!ce->entry)
268 error_and_abort(ef, "Collection %i: name missing.\n", ce->id);
269
270 it = eina_hash_iterator_data_new(edje_file->collection);
271
272 EINA_ITERATOR_FOREACH(it, sce)
273 if (ce->id == sce->id)
274 {
275 memcpy(&ce->count, &sce->count, sizeof (ce->count));
276 break;
277 }
278
279 if (!sce)
280 error_and_abort(ef, "Collection %s (%i) can't find an correct alias.\n", ce->entry, ce->id);
281
282 eina_iterator_free(it);
283
284 eina_hash_direct_add(edje_file->collection, ce->entry, ce);
285 }
286 }
287 bytes = eet_data_write(ef, edd_edje_file, "edje/file", edje_file, 1);
288 if (bytes <= 0)
289 error_and_abort(ef, "Unable to write \"edje_file\" entry to \"%s\" \n",
290 file_out);
291 }
292
293 if (verbose)
294 {
295 printf("%s: Wrote %9i bytes (%4iKb) for \"edje_file\" header\n",
296 progname, bytes, (bytes + 512) / 1024);
297 }
298
299 return bytes;
300}
301
302static int
303data_write_fonts(Eet_File *ef, int *font_num, int *input_bytes, int *input_raw_bytes)
304{
305 Eina_Iterator *it;
306 int bytes = 0;
307 int total_bytes = 0;
308 Font *fn;
309
310 if (!edje_file->fonts)
311 return 0;
312
313 it = eina_hash_iterator_data_new(edje_file->fonts);
314 EINA_ITERATOR_FOREACH(it, fn)
315 {
316 void *fdata = NULL;
317 int fsize = 0;
318 Eina_List *ll;
319 FILE *f;
320
321 f = fopen(fn->file, "rb");
322 if (f)
323 {
324 long pos;
325
326 fseek(f, 0, SEEK_END);
327 pos = ftell(f);
328 rewind(f);
329 fdata = malloc(pos);
330 if (fdata)
331 {
332 if (fread(fdata, pos, 1, f) != 1)
333 error_and_abort(ef, "Unable to read all of font "
334 "file \"%s\"\n", fn->file);
335 fsize = pos;
336 }
337 fclose(f);
338 }
339 else
340 {
341 char *data;
342
343 EINA_LIST_FOREACH(fnt_dirs, ll, data)
344 {
345 char buf[4096];
346
347 snprintf(buf, sizeof(buf), "%s/%s", data, fn->file);
348 f = fopen(buf, "rb");
349 if (f)
350 {
351 long pos;
352
353 fseek(f, 0, SEEK_END);
354 pos = ftell(f);
355 rewind(f);
356 fdata = malloc(pos);
357 if (fdata)
358 {
359 if (fread(fdata, pos, 1, f) != 1)
360 error_and_abort(ef, "Unable to read all of font "
361 "file \"%s\"\n", buf);
362 fsize = pos;
363 }
364 fclose(f);
365 if (fdata) break;
366 }
367 }
368 }
369 if (!fdata)
370 {
371 error_and_abort(ef, "Unable to load font part \"%s\" entry "
372 "to %s \n", fn->file, file_out);
373 }
374 else
375 {
376 char buf[4096];
377
378 snprintf(buf, sizeof(buf), "edje/fonts/%s", fn->name);
379 bytes = eet_write(ef, buf, fdata, fsize, 1);
380 if (bytes <= 0)
381 error_and_abort(ef, "Unable to write font part \"%s\" as \"%s\" "
382 "part entry to %s \n", fn->file, buf, file_out);
383
384 *font_num += 1;
385 total_bytes += bytes;
386 *input_bytes += fsize;
387 *input_raw_bytes += fsize;
388
389 if (verbose)
390 {
391 printf("%s: Wrote %9i bytes (%4iKb) for \"%s\" font entry \"%s\" compress: [real: %2.1f%%]\n",
392 progname, bytes, (bytes + 512) / 1024, buf, fn->file,
393 100 - (100 * (double)bytes) / ((double)(fsize))
394 );
395 }
396 free(fdata);
397 }
398 }
399 eina_iterator_free(it);
400
401 return total_bytes;
402}
403
404static void
405error_and_abort_image_load_error(Eet_File *ef, const char *file, int error)
406{
407 const char *errmsg = evas_load_error_str(error);
408 char hint[1024] = "";
409
410 if (error == EVAS_LOAD_ERROR_DOES_NOT_EXIST)
411 {
412 snprintf
413 (hint, sizeof(hint),
414 " Check if path to file \"%s\" is correct "
415 "(both directory and file name).",
416 file);
417 }
418 else if (error == EVAS_LOAD_ERROR_CORRUPT_FILE)
419 {
420 snprintf
421 (hint, sizeof(hint),
422 " Check if file \"%s\" is consistent.",
423 file);
424 }
425 else if (error == EVAS_LOAD_ERROR_UNKNOWN_FORMAT)
426 {
427 const char *ext = strrchr(file, '.');
428 const char **itr, *known_loaders[] = {
429 /* list from evas_image_load.c */
430 "png",
431 "jpg",
432 "jpeg",
433 "jfif",
434 "eet",
435 "edj",
436 "eap",
437 "edb",
438 "xpm",
439 "tiff",
440 "tif",
441 "svg",
442 "svgz",
443 "gif",
444 "pbm",
445 "pgm",
446 "ppm",
447 "pnm",
448 NULL
449 };
450
451 if (!ext)
452 {
453 snprintf
454 (hint, sizeof(hint),
455 " File \"%s\" does not have an extension, "
456 "maybe it should?",
457 file);
458 goto show_err;
459 }
460
461 ext++;
462 for (itr = known_loaders; *itr; itr++)
463 {
464 if (strcasecmp(ext, *itr) == 0)
465 {
466 snprintf
467 (hint, sizeof(hint),
468 " Check if Evas was compiled with %s module enabled and "
469 "all required dependencies exist.",
470 ext);
471 goto show_err;
472 }
473 }
474
475 snprintf(hint, sizeof(hint),
476 " Check if Evas supports loading files of type \"%s\" (%s) "
477 "and this module was compiled and all its dependencies exist.",
478 ext, file);
479 }
480 show_err:
481 error_and_abort
482 (ef, "Unable to load image \"%s\" used by file \"%s\": %s.%s\n",
483 file, file_out, errmsg, hint);
484}
485
486static int
487data_write_images(Eet_File *ef, int *image_num, int *input_bytes, int *input_raw_bytes)
488{
489 unsigned int i;
490 int bytes = 0;
491 int total_bytes = 0;
492
493 if ((edje_file) && (edje_file->image_dir))
494 {
495 Ecore_Evas *ee;
496 Evas *evas;
497 Edje_Image_Directory_Entry *img;
498
499 ecore_init();
500 ecore_evas_init();
501
502 ee = ecore_evas_buffer_new(1, 1);
503 if (!ee)
504 error_and_abort(ef, "Cannot create buffer engine canvas for image "
505 "load.\n");
506
507 evas = ecore_evas_get(ee);
508 for (i = 0; i < edje_file->image_dir->entries_count; i++)
509 {
510 img = &edje_file->image_dir->entries[i];
511
512 if (img->source_type == EDJE_IMAGE_SOURCE_TYPE_EXTERNAL
513 || img->entry == NULL)
514 {
515 }
516 else
517 {
518 Evas_Object *im;
519 Eina_List *ll;
520 char *data;
521 int load_err = EVAS_LOAD_ERROR_NONE;
522
523 im = NULL;
524 EINA_LIST_FOREACH(img_dirs, ll, data)
525 {
526 char buf[4096];
527
528 snprintf(buf, sizeof(buf), "%s/%s",
529 data, img->entry);
530 im = evas_object_image_add(evas);
531 if (im)
532 {
533 evas_object_image_file_set(im, buf, NULL);
534 load_err = evas_object_image_load_error_get(im);
535 if (load_err == EVAS_LOAD_ERROR_NONE)
536 break;
537 evas_object_del(im);
538 im = NULL;
539 if (load_err != EVAS_LOAD_ERROR_DOES_NOT_EXIST)
540 break;
541 }
542 }
543 if ((!im) && (load_err == EVAS_LOAD_ERROR_DOES_NOT_EXIST))
544 {
545 im = evas_object_image_add(evas);
546 if (im)
547 {
548 evas_object_image_file_set(im, img->entry, NULL);
549 load_err = evas_object_image_load_error_get(im);
550 if (load_err != EVAS_LOAD_ERROR_NONE)
551 {
552 evas_object_del(im);
553 im = NULL;
554 }
555 }
556 }
557 if (im)
558 {
559 void *im_data;
560 int im_w, im_h;
561 int im_alpha;
562 char buf[256];
563
564 evas_object_image_size_get(im, &im_w, &im_h);
565 im_alpha = evas_object_image_alpha_get(im);
566 im_data = evas_object_image_data_get(im, 0);
567 if ((im_data) && (im_w > 0) && (im_h > 0))
568 {
569 int mode, qual;
570
571 snprintf(buf, sizeof(buf), "edje/images/%i", img->id);
572 qual = 80;
573 if ((img->source_type == EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT) &&
574 (img->source_param == 0))
575 mode = 0; /* RAW */
576 else if ((img->source_type == EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT) &&
577 (img->source_param == 1))
578 mode = 1; /* COMPRESS */
579 else
580 mode = 2; /* LOSSY */
581 if ((mode == 0) && (no_raw))
582 {
583 mode = 1; /* promote compression */
584 img->source_param = 95;
585 }
586 if ((mode == 2) && (no_lossy)) mode = 1; /* demote compression */
587 if ((mode == 1) && (no_comp))
588 {
589 if (no_lossy) mode = 0; /* demote compression */
590 else if (no_raw)
591 {
592 img->source_param = 90;
593 mode = 2; /* no choice. lossy */
594 }
595 }
596 if (mode == 2)
597 {
598 qual = img->source_param;
599 if (qual < min_quality) qual = min_quality;
600 if (qual > max_quality) qual = max_quality;
601 }
602 if (mode == 0)
603 bytes = eet_data_image_write(ef, buf,
604 im_data, im_w, im_h,
605 im_alpha,
606 0, 0, 0);
607 else if (mode == 1)
608 bytes = eet_data_image_write(ef, buf,
609 im_data, im_w, im_h,
610 im_alpha,
611 1, 0, 0);
612 else if (mode == 2)
613 bytes = eet_data_image_write(ef, buf,
614 im_data, im_w, im_h,
615 im_alpha,
616 0, qual, 1);
617 if (bytes <= 0)
618 error_and_abort(ef, "Unable to write image part "
619 "\"%s\" as \"%s\" part entry to "
620 "%s\n", img->entry, buf,
621 file_out);
622
623 *image_num += 1;
624 total_bytes += bytes;
625 }
626 else
627 {
628 error_and_abort_image_load_error
629 (ef, img->entry, load_err);
630 }
631
632 if (verbose)
633 {
634 struct stat st;
635 const char *file = NULL;
636
637 evas_object_image_file_get(im, &file, NULL);
638 if (!file || (stat(file, &st) != 0))
639 st.st_size = 0;
640 *input_bytes += st.st_size;
641 *input_raw_bytes += im_w * im_h * 4;
642 printf("%s: Wrote %9i bytes (%4iKb) for \"%s\" image entry \"%s\" compress: [raw: %2.1f%%] [real: %2.1f%%]\n",
643 progname, bytes, (bytes + 512) / 1024, buf, img->entry,
644 100 - (100 * (double)bytes) / ((double)(im_w * im_h * 4)),
645 100 - (100 * (double)bytes) / ((double)(st.st_size))
646 );
647 }
648 evas_object_del(im);
649 }
650 else
651 {
652 error_and_abort_image_load_error
653 (ef, img->entry, load_err);
654 }
655 }
656 }
657 ecore_evas_free(ee);
658 ecore_evas_shutdown();
659 ecore_shutdown();
660 }
661
662 return total_bytes;
663}
664
665static int
666data_write_sounds(Eet_File * ef, int *sound_num, int *input_bytes, int *input_raw_bytes)
667{
668 int bytes = 0;
669 int total_bytes = 0;
670
671 if ((edje_file) && (edje_file->sound_dir))
672 {
673 Eina_List *ll;
674 Edje_Sound_Sample *sample;
675#ifdef HAVE_LIBSNDFILE
676 Edje_Sound_Encode *enc_info;
677#endif
678 char *dir_path = NULL;
679 char snd_path[PATH_MAX];
680 char sndid_str[15];
681 void *fdata;
682 FILE *fp = NULL;
683 struct stat st;
684 int size = 0;
685 int i;
686
687 for (i = 0; i < (int)edje_file->sound_dir->samples_count; i++)
688 {
689 sample = &edje_file->sound_dir->samples[i];
690 memset(&st, 0, sizeof(struct stat));
691
692 // Search the Sound file in all the -sd ( sound directory )
693 EINA_LIST_FOREACH(snd_dirs, ll, dir_path)
694 {
695 snprintf((char *)snd_path, sizeof(snd_path), "%s/%s", dir_path,
696 sample->snd_src);
697 stat(snd_path, &st);
698 if (st.st_size) break;
699 }
700 if (!st.st_size)
701 {
702 snprintf((char *)snd_path, sizeof(snd_path), "%s",
703 sample->snd_src);
704 stat(snd_path, &st);
705 }
706 size = st.st_size;
707 if (!size)
708 {
709 ERR("%s: Error. Unable to load sound source file : %s",
710 progname, sample->snd_src);
711 exit(-1);
712 }
713#ifdef HAVE_LIBSNDFILE
714 enc_info = _edje_multisense_encode(snd_path, sample, sample->quality);
715
716 stat(enc_info->file, &st);
717 size = st.st_size;
718 fp = fopen(enc_info->file, "rb");
719#else
720 fp = fopen(snd_path, "rb");
721#endif
722 if (!fp)
723 {
724 ERR("%s: Error: Unable to load sound data of: %s",
725 progname, sample->name);
726 exit(-1);
727 }
728
729 snprintf(sndid_str, sizeof(sndid_str), "edje/sounds/%i", sample->id);
730 fdata = malloc(size);
731 if (!fdata)
732 {
733 ERR("%s: Error. %s:%i while allocating memory to load file \"%s\"",
734 progname, file_in, line, snd_path);
735 exit(-1);
736 }
737 if (fread(fdata, size, 1, fp))
738 bytes = eet_write(ef, sndid_str, fdata, size, EINA_FALSE);
739 free(fdata);
740 fclose(fp);
741
742#ifdef HAVE_LIBSNDFILE
743 //If encoded temporary file, delete it.
744 if (enc_info->encoded) unlink(enc_info->file);
745#endif
746 *sound_num += 1;
747 total_bytes += bytes;
748 *input_bytes += size;
749 *input_raw_bytes += size;
750
751 if (verbose)
752 {
753#ifdef HAVE_LIBSNDFILE
754 printf ("%s: Wrote %9i bytes (%4iKb) for \"%s\" %s sound entry"
755 "\"%s\" \n", progname, bytes, (bytes + 512) / 1024,
756 sndid_str, enc_info->comp_type, sample->name);
757#else
758 printf ("%s: Wrote %9i bytes (%4iKb) for \"%s\" %s sound entry"
759 "\"%s\" \n", progname, bytes, (bytes + 512) / 1024,
760 sndid_str, "RAW PCM", sample->name);
761#endif
762 }
763#ifdef HAVE_LIBSNDFILE
764 if ((enc_info->file) && (!enc_info->encoded)) eina_stringshare_del(enc_info->file);
765 if (enc_info) free(enc_info);
766 enc_info = NULL;
767#endif
768 }
769 }
770 return total_bytes;
771}
772
773static void
774check_groups(Eet_File *ef)
775{
776 Edje_Part_Collection *pc;
777 Eina_List *l;
778
779 /* sanity checks for parts and programs */
780 EINA_LIST_FOREACH(edje_collections, l, pc)
781 {
782 unsigned int i;
783
784 for (i = 0; i < pc->parts_count; ++i)
785 check_part(pc, pc->parts[i], ef);
786
787#define CHECK_PROGRAM(Type, Pc, It) \
788 for (It = 0; It < Pc->programs.Type ## _count; ++It) \
789 check_program(Pc, Pc->programs.Type[i], ef); \
790
791 CHECK_PROGRAM(fnmatch, pc, i);
792 CHECK_PROGRAM(strcmp, pc, i);
793 CHECK_PROGRAM(strncmp, pc, i);
794 CHECK_PROGRAM(strrncmp, pc, i);
795 CHECK_PROGRAM(nocmp, pc, i);
796 }
797}
798
799static int
800data_write_groups(Eet_File *ef, int *collection_num)
801{
802 Eina_List *l;
803 Edje_Part_Collection *pc;
804 int bytes = 0;
805 int total_bytes = 0;
806
807 EINA_LIST_FOREACH(edje_collections, l, pc)
808 {
809 char buf[4096];
810
811 snprintf(buf, sizeof(buf), "edje/collections/%i", pc->id);
812 bytes = eet_data_write(ef, edd_edje_part_collection, buf, pc, 1);
813 if (bytes <= 0)
814 error_and_abort(ef, "Error. Unable to write \"%s\" part entry "
815 "to %s\n", buf, file_out);
816
817 *collection_num += 1;
818 total_bytes += bytes;
819
820 if (verbose)
821 {
822 printf("%s: Wrote %9i bytes (%4iKb) for \"%s\" aka \"%s\" collection entry\n",
823 progname, bytes, (bytes + 512) / 1024, buf, pc->part);
824 }
825 }
826
827 return total_bytes;
828}
829
830static void
831create_script_file(Eet_File *ef, const char *filename, const Code *cd, int fd)
832{
833 FILE *f = fdopen(fd, "wb");
834 if (!f)
835 error_and_abort(ef, "Unable to open temp file \"%s\" for script "
836 "compilation.\n", filename);
837
838 Eina_List *ll;
839 Code_Program *cp;
840
841 fprintf(f, "#include <edje>\n");
842 int ln = 2;
843
844 if (cd->shared)
845 {
846 while (ln < (cd->l1 - 1))
847 {
848 fprintf(f, " \n");
849 ln++;
850 }
851 {
852 char *sp;
853 int hash = 0;
854 int newlined = 0;
855
856 for (sp = cd->shared; *sp; sp++)
857 {
858 if ((sp[0] == '#') && (newlined))
859 {
860 hash = 1;
861 }
862 newlined = 0;
863 if (sp[0] == '\n') newlined = 1;
864 if (!hash) fputc(sp[0], f);
865 else if (sp[0] == '\n') hash = 0;
866 }
867 fputc('\n', f);
868 }
869 ln += cd->l2 - cd->l1 + 1;
870 }
871 EINA_LIST_FOREACH(cd->programs, ll, cp)
872 {
873 if (cp->script)
874 {
875 while (ln < (cp->l1 - 1))
876 {
877 fprintf(f, " \n");
878 ln++;
879 }
880 /* FIXME: this prototype needs to be */
881 /* formalised and set in stone */
882 fprintf(f, "public _p%i(sig[], src[]) {", cp->id);
883 {
884 char *sp;
885 int hash = 0;
886 int newlined = 0;
887
888 for (sp = cp->script; *sp; sp++)
889 {
890 if ((sp[0] == '#') && (newlined))
891 {
892 hash = 1;
893 }
894 newlined = 0;
895 if (sp[0] == '\n') newlined = 1;
896 if (!hash) fputc(sp[0], f);
897 else if (sp[0] == '\n') hash = 0;
898 }
899 }
900 fprintf(f, "}\n");
901 ln += cp->l2 - cp->l1 + 1;
902 }
903 }
904
905 fclose(f);
906}
907
908static void
909compile_script_file(Eet_File *ef, const char *source, const char *output,
910 int script_num, int fd)
911{
912 FILE *f;
913 char buf[4096];
914 int ret;
915
916 snprintf(buf, sizeof(buf),
917 "embryo_cc -i %s/include -o %s %s",
918 eina_prefix_data_get(pfx), output, source);
919 ret = system(buf);
920
921 /* accept warnings in the embryo code */
922 if (ret < 0 || ret > 1)
923 error_and_abort(ef, "Compiling script code not clean.\n");
924
925 f = fdopen(fd, "rb");
926 if (!f)
927 error_and_abort(ef, "Unable to open script object \"%s\" for reading.\n",
928 output);
929
930 fseek(f, 0, SEEK_END);
931 int size = ftell(f);
932 rewind(f);
933
934 if (size > 0)
935 {
936 void *data = malloc(size);
937
938 if (data)
939 {
940 if (fread(data, size, 1, f) != 1)
941 error_and_abort(ef, "Unable to read all of script object "
942 "\"%s\"\n", output);
943
944 snprintf(buf, sizeof(buf), "edje/scripts/embryo/compiled/%i", script_num);
945 eet_write(ef, buf, data, size, 1);
946 free(data);
947 }
948 }
949
950 fclose(f);
951}
952
953static void
954data_write_scripts(Eet_File *ef)
955{
956 Eina_List *l;
957 int i;
958
959 if (!tmp_dir)
960#ifdef HAVE_EVIL
961 tmp_dir = (char *)evil_tmpdir_get();
962#else
963 tmp_dir = "/tmp";
964#endif
965
966 for (i = 0, l = codes; l; l = eina_list_next(l), i++)
967 {
968 char tmpn[PATH_MAX];
969 char tmpo[PATH_MAX];
970 int fd;
971 Code *cd = eina_list_data_get(l);
972
973 if (cd->is_lua)
974 continue;
975 if ((!cd->shared) && (!cd->programs))
976 continue;
977
978 snprintf(tmpn, PATH_MAX, "%s/edje_cc.sma-tmp-XXXXXX", tmp_dir);
979 fd = mkstemp(tmpn);
980 if (fd < 0)
981 error_and_abort(ef, "Unable to open temp file \"%s\" for script "
982 "compilation.\n", tmpn);
983
984 create_script_file(ef, tmpn, cd, fd);
985
986 snprintf(tmpo, PATH_MAX, "%s/edje_cc.amx-tmp-XXXXXX", tmp_dir);
987 fd = mkstemp(tmpo);
988 if (fd < 0)
989 {
990 unlink(tmpn);
991 error_and_abort(ef, "Unable to open temp file \"%s\" for script "
992 "compilation.\n", tmpn);
993 }
994 compile_script_file(ef, tmpn, tmpo, i, fd);
995
996 unlink(tmpn);
997 unlink(tmpo);
998
999 if (!no_save)
1000 {
1001 char buf[PATH_MAX];
1002 Eina_List *ll;
1003 Code_Program *cp;
1004
1005 if (cd->original)
1006 {
1007 snprintf(buf, PATH_MAX, "edje/scripts/embryo/source/%i", i);
1008 eet_write(ef, buf, cd->original, strlen(cd->original) + 1, 1);
1009 }
1010 EINA_LIST_FOREACH(cd->programs, ll, cp)
1011 {
1012 if (!cp->original)
1013 continue;
1014 snprintf(buf, PATH_MAX, "edje/scripts/embryo/source/%i/%i", i,
1015 cp->id);
1016 eet_write(ef, buf, cp->original, strlen(cp->original) + 1, 1);
1017 }
1018 }
1019 }
1020}
1021
1022typedef struct _Edje_Lua_Script_Writer_Struct Edje_Lua_Script_Writer_Struct;
1023
1024struct _Edje_Lua_Script_Writer_Struct
1025{
1026 char *buf;
1027 int size;
1028};
1029
1030#ifdef LUA_BINARY
1031static int
1032_edje_lua_script_writer(lua_State *L __UNUSED__, const void *chunk_buf, size_t chunk_size, void *_data)
1033{
1034 Edje_Lua_Script_Writer_Struct *data;
1035 void *old;
1036
1037 data = (Edje_Lua_Script_Writer_Struct *)_data;
1038 old = data->buf;
1039 data->buf = malloc (data->size + chunk_size);
1040 memcpy (data->buf, old, data->size);
1041 memcpy (&((data->buf)[data->size]), chunk_buf, chunk_size);
1042 if (old)
1043 free (old);
1044 data->size += chunk_size;
1045
1046 return 0;
1047}
1048#endif
1049
1050void
1051_edje_lua_error_and_abort(lua_State * L, int err_code, Eet_File *ef)
1052{
1053 char *err_type;
1054
1055 switch (err_code)
1056 {
1057 case LUA_ERRRUN:
1058 err_type = "runtime";
1059 break;
1060 case LUA_ERRSYNTAX:
1061 err_type = "syntax";
1062 break;
1063 case LUA_ERRMEM:
1064 err_type = "memory allocation";
1065 break;
1066 case LUA_ERRERR:
1067 err_type = "error handler";
1068 break;
1069 default:
1070 err_type = "unknown";
1071 break;
1072 }
1073 error_and_abort(ef, "Lua %s error: %s\n", err_type, lua_tostring(L, -1));
1074}
1075
1076
1077static void
1078data_write_lua_scripts(Eet_File *ef)
1079{
1080 Eina_List *l;
1081 Eina_List *ll;
1082 Code_Program *cp;
1083 int i;
1084
1085 for (i = 0, l = codes; l; l = eina_list_next(l), i++)
1086 {
1087 char buf[4096];
1088 Code *cd;
1089 lua_State *L;
1090 int ln = 1;
1091 luaL_Buffer b;
1092 Edje_Lua_Script_Writer_Struct data;
1093#ifdef LUA_BINARY
1094 int err_code;
1095#endif
1096
1097 cd = (Code *)eina_list_data_get(l);
1098 if (!cd->is_lua)
1099 continue;
1100 if ((!cd->shared) && (!cd->programs))
1101 continue;
1102
1103 L = luaL_newstate();
1104 if (!L)
1105 error_and_abort(ef, "Lua error: Lua state could not be initialized\n");
1106
1107 luaL_buffinit(L, &b);
1108
1109 data.buf = NULL;
1110 data.size = 0;
1111 if (cd->shared)
1112 {
1113 while (ln < (cd->l1 - 1))
1114 {
1115 luaL_addchar(&b, '\n');
1116 ln++;
1117 }
1118 luaL_addstring(&b, cd->shared);
1119 ln += cd->l2 - cd->l1;
1120 }
1121
1122 EINA_LIST_FOREACH(cd->programs, ll, cp)
1123 {
1124 if (cp->script)
1125 {
1126 while (ln < (cp->l1 - 1))
1127 {
1128 luaL_addchar(&b, '\n');
1129 ln++;
1130 }
1131 luaL_addstring(&b, "_G[");
1132 lua_pushnumber(L, cp->id);
1133 luaL_addvalue(&b);
1134 luaL_addstring(&b, "] = function (ed, signal, source)");
1135 luaL_addstring(&b, cp->script);
1136 luaL_addstring(&b, "end\n");
1137 ln += cp->l2 - cp->l1 + 1;
1138 }
1139 }
1140 luaL_pushresult(&b);
1141#ifdef LUA_BINARY
1142 if (err_code = luaL_loadstring(L, lua_tostring (L, -1)))
1143 _edje_lua_error_and_abort(L, err_code, ef);
1144 lua_dump(L, _edje_lua_script_writer, &data);
1145#else // LUA_PLAIN_TEXT
1146 data.buf = (char *)lua_tostring(L, -1);
1147 data.size = strlen(data.buf);
1148#endif
1149 //printf("lua chunk size: %d\n", data.size);
1150
1151 /*
1152 * TODO load and test Lua chunk
1153 */
1154
1155 /*
1156 if (luaL_loadbuffer(L, globbuf, globbufsize, "edje_lua_script"))
1157 printf("lua load error: %s\n", lua_tostring (L, -1));
1158 if (lua_pcall(L, 0, 0, 0))
1159 printf("lua call error: %s\n", lua_tostring (L, -1));
1160 */
1161
1162 snprintf(buf, sizeof(buf), "edje/scripts/lua/%i", i);
1163 eet_write(ef, buf, data.buf, data.size, 1);
1164#ifdef LUA_BINARY
1165 free(data.buf);
1166#endif
1167 lua_close(L);
1168 }
1169}
1170
1171void
1172data_write(void)
1173{
1174 Eet_File *ef;
1175 int input_bytes = 0;
1176 int total_bytes = 0;
1177 int src_bytes = 0;
1178 int fmap_bytes = 0;
1179 int input_raw_bytes = 0;
1180 int image_num = 0;
1181 int sound_num = 0;
1182 int font_num = 0;
1183 int collection_num = 0;
1184
1185 if (!edje_file)
1186 {
1187 ERR("%s: Error. No data to put in \"%s\"",
1188 progname, file_out);
1189 exit(-1);
1190 }
1191
1192 ef = eet_open(file_out, EET_FILE_MODE_WRITE);
1193 if (!ef)
1194 {
1195 ERR("%s: Error. Unable to open \"%s\" for writing output",
1196 progname, file_out);
1197 exit(-1);
1198 }
1199
1200 check_groups(ef);
1201
1202 total_bytes += data_write_header(ef);
1203 total_bytes += data_write_fonts(ef, &font_num, &input_bytes,
1204 &input_raw_bytes);
1205 total_bytes += data_write_images(ef, &image_num, &input_bytes,
1206 &input_raw_bytes);
1207 total_bytes += data_write_sounds(ef, &sound_num, &input_bytes,
1208 &input_raw_bytes);
1209
1210 total_bytes += data_write_groups(ef, &collection_num);
1211 data_write_scripts(ef);
1212 data_write_lua_scripts(ef);
1213
1214 src_bytes = source_append(ef);
1215 total_bytes += src_bytes;
1216 fmap_bytes = source_fontmap_save(ef, fonts);
1217 total_bytes += fmap_bytes;
1218
1219 eet_close(ef);
1220
1221 if (verbose)
1222 {
1223 struct stat st;
1224
1225 if (stat(file_in, &st) != 0)
1226 st.st_size = 0;
1227 input_bytes += st.st_size;
1228 input_raw_bytes += st.st_size;
1229 printf("Summary:\n"
1230 " Wrote %i collections\n"
1231 " Wrote %i images\n"
1232 " Wrote %i sounds\n"
1233 " Wrote %i fonts\n"
1234 " Wrote %i bytes (%iKb) of original source data\n"
1235 " Wrote %i bytes (%iKb) of original source font map\n"
1236 "Conservative compression summary:\n"
1237 " Wrote total %i bytes (%iKb) from %i (%iKb) input data\n"
1238 " Output file is %3.1f%% the size of the input data\n"
1239 " Saved %i bytes (%iKb)\n"
1240 "Raw compression summary:\n"
1241 " Wrote total %i bytes (%iKb) from %i (%iKb) raw input data\n"
1242 " Output file is %3.1f%% the size of the raw input data\n"
1243 " Saved %i bytes (%iKb)\n"
1244 ,
1245 collection_num,
1246 image_num,
1247 sound_num,
1248 font_num,
1249 src_bytes, (src_bytes + 512) / 1024,
1250 fmap_bytes, (fmap_bytes + 512) / 1024,
1251 total_bytes, (total_bytes + 512) / 1024,
1252 input_bytes, (input_bytes + 512) / 1024,
1253 (100.0 * (double)total_bytes) / (double)input_bytes,
1254 input_bytes - total_bytes,
1255 (input_bytes - total_bytes + 512) / 1024,
1256 total_bytes, (total_bytes + 512) / 1024,
1257 input_raw_bytes, (input_raw_bytes + 512) / 1024,
1258 (100.0 * (double)total_bytes) / (double)input_raw_bytes,
1259 input_raw_bytes - total_bytes,
1260 (input_raw_bytes - total_bytes + 512) / 1024);
1261 }
1262}
1263
1264void
1265reorder_parts(void)
1266{
1267 Edje_Part_Collection *pc;
1268 Edje_Part **parts;
1269 Edje_Part_Parser *ep, *ep2;
1270 Eina_List *l;
1271
1272 /* sanity checks for parts and programs */
1273 EINA_LIST_FOREACH(edje_collections, l, pc)
1274 {
1275 unsigned int i, j, k;
1276 Eina_Bool found = EINA_FALSE;
1277
1278 for (i = 0; i < pc->parts_count; i++)
1279 {
1280 ep = (Edje_Part_Parser *)pc->parts[i];
1281 if (ep->reorder.insert_before && ep->reorder.insert_after)
1282 ERR("%s: Error. Unable to use together insert_before and insert_after in part \"%s\".", progname, pc->parts[i]->name);
1283
1284 if (ep->reorder.done)
1285 {
1286 continue;
1287 }
1288 if (ep->reorder.insert_before || ep->reorder.insert_after)
1289 {
1290 found = EINA_FALSE;
1291 for (j = 0; j < pc->parts_count; j++)
1292 {
1293 if (ep->reorder.insert_before &&
1294 !strcmp(ep->reorder.insert_before, pc->parts[j]->name))
1295 {
1296 ep2 = (Edje_Part_Parser *)pc->parts[j];
1297 if (ep2->reorder.after)
1298 ERR("%s: Error. The part \"%s\" is ambiguous ordered part.", progname, pc->parts[i]->name);
1299 if (ep2->reorder.linked_prev)
1300 ERR("%s: Error. Unable to insert two or more parts in same part \"%s\".", progname, pc->parts[j]->name);
1301 k = j - 1;
1302 found = EINA_TRUE;
1303 ep2->reorder.linked_prev += ep->reorder.linked_prev + 1;
1304 ep->reorder.before = (Edje_Part_Parser *)pc->parts[j];
1305 while (ep2->reorder.before)
1306 {
1307 ep2->reorder.before->reorder.linked_prev = ep2->reorder.linked_prev + 1;
1308 ep2 = ep2->reorder.before;
1309 }
1310 break;
1311 }
1312 else if (ep->reorder.insert_after &&
1313 !strcmp(ep->reorder.insert_after, pc->parts[j]->name))
1314 {
1315 ep2 = (Edje_Part_Parser *)pc->parts[j];
1316 if (ep2->reorder.before)
1317 ERR("%s: Error. The part \"%s\" is ambiguous ordered part.", progname, pc->parts[i]->name);
1318 if (ep2->reorder.linked_next)
1319 ERR("%s: Error. Unable to insert two or more parts in same part \"%s\".", progname, pc->parts[j]->name);
1320 k = j;
1321 found = EINA_TRUE;
1322 ep2->reorder.linked_next += ep->reorder.linked_next + 1;
1323 ep->reorder.after = (Edje_Part_Parser *)pc->parts[j];
1324 while (ep2->reorder.after)
1325 {
1326 ep2->reorder.after->reorder.linked_next = ep2->reorder.linked_next + 1;
1327 ep2 = ep2->reorder.after;
1328 }
1329 break;
1330 }
1331 }
1332 if (found)
1333 {
1334 unsigned int amount, linked;
1335
1336 if (((i > k) && ((i - ep->reorder.linked_prev) <= k))
1337 || ((i < k) && ((i + ep->reorder.linked_next) >= k)))
1338 ERR("%s: Error. The part order is wrong. It has circular dependency.",
1339 progname);
1340
1341 amount = ep->reorder.linked_prev + ep->reorder.linked_next + 1;
1342 linked = i - ep->reorder.linked_prev;
1343 parts = malloc(amount * sizeof(Edje_Part));
1344 for (j = 0 ; j < amount ; j++)
1345 {
1346 parts[j] = pc->parts[linked];
1347 linked++;
1348 }
1349 if (i > k)
1350 {
1351 for (j = i - ep->reorder.linked_prev - 1 ; j >= k ; j--)
1352 {
1353 pc->parts[j + amount] = pc->parts[j];
1354 pc->parts[j + amount]->id = j + amount;
1355 }
1356 for (j = 0 ; j < amount ; j++)
1357 {
1358 pc->parts[j + k] = parts[j];
1359 pc->parts[j + k]->id = j + k;
1360 }
1361 }
1362 else if (i < k)
1363 {
1364 for (j = i + ep->reorder.linked_next + 1 ; j <= k ; j++)
1365 {
1366 pc->parts[j - amount] = pc->parts[j];
1367 pc->parts[j - amount]->id = j - amount;
1368 }
1369 for (j = 0 ; j < amount ; j++)
1370 {
1371 pc->parts[j + k - amount + 1] = parts[j];
1372 pc->parts[j + k - amount + 1]->id = j + k - amount + 1;
1373 }
1374 i -= amount;
1375 }
1376 ep->reorder.done = EINA_TRUE;
1377 free(parts);
1378 }
1379 }
1380 }
1381 }
1382}
1383
1384void
1385data_queue_group_lookup(const char *name, Edje_Part *part)
1386{
1387 Group_Lookup *gl;
1388
1389 if (!name || !name[0]) return;
1390
1391 gl = mem_alloc(SZ(Group_Lookup));
1392 group_lookups = eina_list_append(group_lookups, gl);
1393 gl->name = mem_strdup(name);
1394 gl->part = part;
1395}
1396
1397void
1398data_queue_part_lookup(Edje_Part_Collection *pc, const char *name, int *dest)
1399{
1400 Eina_List *l;
1401 Part_Lookup *pl;
1402
1403 EINA_LIST_FOREACH(part_lookups, l, pl)
1404 {
1405 if ((pl->pc == pc) && (pl->dest == dest))
1406 {
1407 free(pl->name);
1408 if (name[0])
1409 pl->name = mem_strdup(name);
1410 else
1411 {
1412 part_lookups = eina_list_remove(part_lookups, pl);
1413 free(pl);
1414 }
1415 return;
1416 }
1417 }
1418 if (!name[0]) return;
1419
1420 pl = mem_alloc(SZ(Part_Lookup));
1421 part_lookups = eina_list_append(part_lookups, pl);
1422 pl->pc = pc;
1423 pl->name = mem_strdup(name);
1424 pl->dest = dest;
1425}
1426
1427void
1428data_queue_copied_part_lookup(Edje_Part_Collection *pc, int *src, int *dest)
1429{
1430 Eina_List *l;
1431 Part_Lookup *pl;
1432
1433 EINA_LIST_FOREACH(part_lookups, l, pl)
1434 {
1435 if (pl->dest == src)
1436 data_queue_part_lookup(pc, pl->name, dest);
1437 }
1438}
1439
1440void
1441data_queue_anonymous_lookup(Edje_Part_Collection *pc, Edje_Program *ep, int *dest)
1442{
1443 Eina_List *l, *l2;
1444 Program_Lookup *pl;
1445
1446 if (!ep) return ; /* FIXME: should we stop compiling ? */
1447
1448 EINA_LIST_FOREACH(program_lookups, l, pl)
1449 {
1450 if (pl->u.ep == ep)
1451 {
1452 Code *cd;
1453 Code_Program *cp;
1454
1455 cd = eina_list_data_get(eina_list_last(codes));
1456
1457 EINA_LIST_FOREACH(cd->programs, l2, cp)
1458 {
1459 if (&(cp->id) == pl->dest)
1460 {
1461 cd->programs = eina_list_remove(cd->programs, cp);
1462 free(cp);
1463 cp = NULL;
1464 }
1465 }
1466 program_lookups = eina_list_remove(program_lookups, pl);
1467 free(pl);
1468 }
1469 }
1470
1471 if (dest)
1472 {
1473 pl = mem_alloc(SZ(Program_Lookup));
1474 program_lookups = eina_list_append(program_lookups, pl);
1475 pl->pc = pc;
1476 pl->u.ep = ep;
1477 pl->dest = dest;
1478 pl->anonymous = EINA_TRUE;
1479 }
1480}
1481
1482void
1483data_queue_copied_anonymous_lookup(Edje_Part_Collection *pc, int *src, int *dest)
1484{
1485 Eina_List *l;
1486 Program_Lookup *pl;
1487 unsigned int i;
1488
1489 EINA_LIST_FOREACH(program_lookups, l, pl)
1490 {
1491 if (pl->dest == src)
1492 {
1493 for (i = 0 ; i < pc->programs.fnmatch_count ; i++)
1494 {
1495 if (!strcmp(pl->u.ep->name, pc->programs.fnmatch[i]->name))
1496 data_queue_anonymous_lookup(pc, pc->programs.fnmatch[i], dest);
1497 }
1498 for (i = 0 ; i < pc->programs.strcmp_count ; i++)
1499 {
1500 if (!strcmp(pl->u.ep->name, pc->programs.strcmp[i]->name))
1501 data_queue_anonymous_lookup(pc, pc->programs.strcmp[i], dest);
1502 }
1503 for (i = 0 ; i < pc->programs.strncmp_count ; i++)
1504 {
1505 if (!strcmp(pl->u.ep->name, pc->programs.strncmp[i]->name))
1506 data_queue_anonymous_lookup(pc, pc->programs.strncmp[i], dest);
1507 }
1508 for (i = 0 ; i < pc->programs.strrncmp_count ; i++)
1509 {
1510 if (!strcmp(pl->u.ep->name, pc->programs.strrncmp[i]->name))
1511 data_queue_anonymous_lookup(pc, pc->programs.strrncmp[i], dest);
1512 }
1513 for (i = 0 ; i < pc->programs.nocmp_count ; i++)
1514 {
1515 if (!strcmp(pl->u.ep->name, pc->programs.nocmp[i]->name))
1516 data_queue_anonymous_lookup(pc, pc->programs.nocmp[i], dest);
1517 }
1518 }
1519 }
1520}
1521
1522void
1523data_queue_program_lookup(Edje_Part_Collection *pc, const char *name, int *dest)
1524{
1525 Program_Lookup *pl;
1526
1527 if (!name) return ; /* FIXME: should we stop compiling ? */
1528
1529 pl = mem_alloc(SZ(Program_Lookup));
1530 program_lookups = eina_list_append(program_lookups, pl);
1531 pl->pc = pc;
1532 pl->u.name = mem_strdup(name);
1533 pl->dest = dest;
1534 pl->anonymous = EINA_FALSE;
1535}
1536
1537void
1538data_queue_copied_program_lookup(Edje_Part_Collection *pc, int *src, int *dest)
1539{
1540 Eina_List *l;
1541 Program_Lookup *pl;
1542
1543 EINA_LIST_FOREACH(program_lookups, l, pl)
1544 {
1545 if (pl->dest == src)
1546 data_queue_program_lookup(pc, pl->u.name, dest);
1547 }
1548}
1549
1550void
1551data_queue_image_lookup(char *name, int *dest, Eina_Bool *set)
1552{
1553 Image_Lookup *il;
1554
1555 il = mem_alloc(SZ(Image_Lookup));
1556 image_lookups = eina_list_append(image_lookups, il);
1557 il->name = mem_strdup(name);
1558 il->dest = dest;
1559 il->set = set;
1560}
1561
1562void
1563data_queue_image_remove(int *dest, Eina_Bool *set)
1564{
1565 Eina_List *l;
1566 Image_Lookup *il;
1567
1568 EINA_LIST_FOREACH(image_lookups, l, il)
1569 {
1570 if (il->dest == dest && il->set == set)
1571 {
1572 image_lookups = eina_list_remove_list(image_lookups, l);
1573 free(il);
1574 return ;
1575 }
1576 }
1577 }
1578
1579void
1580data_queue_copied_image_lookup(int *src, int *dest, Eina_Bool *set)
1581{
1582 Eina_List *l;
1583 Image_Lookup *il;
1584
1585 EINA_LIST_FOREACH(image_lookups, l, il)
1586 {
1587 if (il->dest == src)
1588 data_queue_image_lookup(il->name, dest, set);
1589 }
1590}
1591void
1592data_queue_part_slave_lookup(int *master, int *slave)
1593{
1594 Slave_Lookup *sl;
1595
1596 sl = mem_alloc(SZ(Slave_Lookup));
1597 part_slave_lookups = eina_list_append(part_slave_lookups, sl);
1598 sl->master = master;
1599 sl->slave = slave;
1600}
1601
1602void
1603data_queue_image_slave_lookup(int *master, int *slave)
1604{
1605 Slave_Lookup *sl;
1606
1607 sl = mem_alloc(SZ(Slave_Lookup));
1608 image_slave_lookups = eina_list_append(image_slave_lookups, sl);
1609 sl->master = master;
1610 sl->slave = slave;
1611}
1612
1613void
1614handle_slave_lookup(Eina_List *list, int *master, int value)
1615{
1616 Eina_List *l;
1617 Slave_Lookup *sl;
1618
1619 EINA_LIST_FOREACH(list, l, sl)
1620 if (sl->master == master)
1621 *sl->slave = value;
1622}
1623
1624void
1625data_process_lookups(void)
1626{
1627 Edje_Part_Collection *pc;
1628 Part_Lookup *part;
1629 Program_Lookup *program;
1630 Group_Lookup *group;
1631 Image_Lookup *image;
1632 Eina_List *l2;
1633 Eina_List *l;
1634 Eina_Hash *images_in_use;
1635 void *data;
1636 Eina_Bool is_lua = EINA_FALSE;
1637
1638 /* remove all unreferenced Edje_Part_Collection */
1639 EINA_LIST_FOREACH_SAFE(edje_collections, l, l2, pc)
1640 {
1641 Edje_Part_Collection_Directory_Entry *alias;
1642 Edje_Part_Collection_Directory_Entry *find;
1643 Eina_List *l3;
1644 unsigned int id = 0;
1645 unsigned int i;
1646
1647 find = eina_hash_find(edje_file->collection, pc->part);
1648 if (find && find->id == pc->id)
1649 continue ;
1650
1651 EINA_LIST_FOREACH(aliases, l3, alias)
1652 if (alias->id == pc->id)
1653 continue ;
1654
1655 /* This Edje_Part_Collection is not used at all */
1656 edje_collections = eina_list_remove_list(edje_collections, l);
1657 l3 = eina_list_nth_list(codes, pc->id);
1658 codes = eina_list_remove_list(codes, l3);
1659
1660 /* Unref all image used by that group */
1661 for (i = 0; i < pc->parts_count; ++i)
1662 part_description_image_cleanup(pc->parts[i]);
1663
1664 /* Correct all id */
1665 EINA_LIST_FOREACH(edje_collections, l3, pc)
1666 {
1667 Eina_List *l4;
1668
1669 /* Some group could be removed from the collection, but still be referenced by alias */
1670 find = eina_hash_find(edje_file->collection, pc->part);
1671 if (pc->id != find->id) find = NULL;
1672
1673 /* Update all matching alias */
1674 EINA_LIST_FOREACH(aliases, l4, alias)
1675 if (pc->id == alias->id)
1676 alias->id = id;
1677
1678 pc->id = id++;
1679 if (find) find->id = pc->id;
1680 }
1681 }
1682
1683 EINA_LIST_FOREACH(edje_collections, l, pc)
1684 {
1685 unsigned int count = 0;
1686 unsigned int i;
1687
1688 if (pc->lua_script_only)
1689 is_lua = EINA_TRUE;
1690#define PROGRAM_ID_SET(Type, Pc, It, Count) \
1691 for (It = 0; It < Pc->programs.Type ## _count; ++It) \
1692 { \
1693 Pc->programs.Type[It]->id = Count++; \
1694 }
1695
1696 PROGRAM_ID_SET(fnmatch, pc, i, count);
1697 PROGRAM_ID_SET(strcmp, pc, i, count);
1698 PROGRAM_ID_SET(strncmp, pc, i, count);
1699 PROGRAM_ID_SET(strrncmp, pc, i, count);
1700 PROGRAM_ID_SET(nocmp, pc, i, count);
1701
1702#undef PROGRAM_ID_SET
1703 }
1704
1705 EINA_LIST_FREE(part_lookups, part)
1706 {
1707 Edje_Part *ep;
1708 unsigned int i;
1709
1710 for (i = 0; i < part->pc->parts_count; ++i)
1711 {
1712 ep = part->pc->parts[i];
1713
1714 if ((ep->name) && (!strcmp(ep->name, part->name)))
1715 {
1716 handle_slave_lookup(part_slave_lookups, part->dest, ep->id);
1717 *(part->dest) = ep->id;
1718 break;
1719 }
1720 }
1721
1722 if (i == part->pc->parts_count)
1723 {
1724 ERR("%s: Error. Unable to find part name \"%s\".",
1725 progname, part->name);
1726 exit(-1);
1727 }
1728
1729 free(part->name);
1730 free(part);
1731 }
1732
1733 EINA_LIST_FREE(program_lookups, program)
1734 {
1735 unsigned int i;
1736 Eina_Bool find = EINA_FALSE;
1737
1738#define PROGRAM_MATCH(Type, Pl, It) \
1739 for (It = 0; It < Pl->pc->programs.Type ## _count; ++It) \
1740 { \
1741 Edje_Program *ep; \
1742 \
1743 ep = Pl->pc->programs.Type[It]; \
1744 \
1745 if ((Pl->anonymous && ep == Pl->u.ep) || \
1746 ((!Pl->anonymous) && (ep->name) && (!strcmp(ep->name, Pl->u.name)))) \
1747 { \
1748 *(Pl->dest) = ep->id; \
1749 find = EINA_TRUE; \
1750 break; \
1751 } \
1752 }
1753
1754 PROGRAM_MATCH(fnmatch, program, i);
1755 PROGRAM_MATCH(strcmp, program, i);
1756 PROGRAM_MATCH(strncmp, program, i);
1757 PROGRAM_MATCH(strrncmp, program, i);
1758 PROGRAM_MATCH(nocmp, program, i);
1759
1760#undef PROGRAM_MATCH
1761
1762 if (!find)
1763 {
1764 if (!program->anonymous)
1765 ERR("%s: Error. Unable to find program name \"%s\".",
1766 progname, program->u.name);
1767 else
1768 ERR("%s: Error. Unable to find anonymous program.",
1769 progname);
1770 exit(-1);
1771 }
1772
1773 if (!program->anonymous)
1774 free(program->u.name);
1775 free(program);
1776 }
1777
1778 EINA_LIST_FREE(group_lookups, group)
1779 {
1780 Edje_Part_Collection_Directory_Entry *de;
1781
1782 if (group->part)
1783 {
1784 if (group->part->type != EDJE_PART_TYPE_GROUP
1785 && group->part->type != EDJE_PART_TYPE_TEXTBLOCK
1786 && group->part->type != EDJE_PART_TYPE_BOX
1787 && group->part->type != EDJE_PART_TYPE_TABLE)
1788 goto free_group;
1789 }
1790
1791 de = eina_hash_find(edje_file->collection, group->name);
1792
1793 if (!de)
1794 {
1795 Eina_Bool found = EINA_FALSE;
1796
1797 EINA_LIST_FOREACH(aliases, l, de)
1798 if (strcmp(de->entry, group->name) == 0)
1799 {
1800 found = EINA_TRUE;
1801 break;
1802 }
1803 if (!found) de = NULL;
1804 }
1805
1806 if (!de)
1807 {
1808 ERR("%s: Error. Unable to find group name \"%s\".",
1809 progname, group->name);
1810 exit(-1);
1811 }
1812
1813 free_group:
1814 free(group->name);
1815 free(group);
1816 }
1817
1818 images_in_use = eina_hash_string_superfast_new(NULL);
1819
1820 EINA_LIST_FREE(image_lookups, image)
1821 {
1822 Eina_Bool find = EINA_FALSE;
1823
1824 if (edje_file->image_dir)
1825 {
1826 Edje_Image_Directory_Entry *de;
1827 unsigned int i;
1828
1829 for (i = 0; i < edje_file->image_dir->entries_count; ++i)
1830 {
1831 de = edje_file->image_dir->entries + i;
1832
1833 if ((de->entry) && (!strcmp(de->entry, image->name)))
1834 {
1835 handle_slave_lookup(image_slave_lookups, image->dest, de->id);
1836 if (de->source_type == EDJE_IMAGE_SOURCE_TYPE_EXTERNAL)
1837 *(image->dest) = -de->id - 1;
1838 else
1839 *(image->dest) = de->id;
1840 *(image->set) = EINA_FALSE;
1841 find = EINA_TRUE;
1842
1843 if (!eina_hash_find(images_in_use, image->name))
1844 eina_hash_direct_add(images_in_use, de->entry, de);
1845 break;
1846 }
1847 }
1848
1849 if (!find)
1850 {
1851 Edje_Image_Directory_Set *set;
1852
1853 for (i = 0; i < edje_file->image_dir->sets_count; ++i)
1854 {
1855 set = edje_file->image_dir->sets + i;
1856
1857 if ((set->name) && (!strcmp(set->name, image->name)))
1858 {
1859 Edje_Image_Directory_Set_Entry *child;
1860 Eina_List *lc;
1861
1862 handle_slave_lookup(image_slave_lookups, image->dest, set->id);
1863 *(image->dest) = set->id;
1864 *(image->set) = EINA_TRUE;
1865 find = EINA_TRUE;
1866
1867 EINA_LIST_FOREACH(set->entries, lc, child)
1868 if (!eina_hash_find(images_in_use, child->name))
1869 eina_hash_direct_add(images_in_use, child->name, child);
1870
1871 if (!eina_hash_find(images_in_use, image->name))
1872 eina_hash_direct_add(images_in_use, set->name, set);
1873 break;
1874 }
1875 }
1876 }
1877 }
1878
1879 if (!find)
1880 {
1881 ERR("%s: Error. Unable to find image name \"%s\".",
1882 progname, image->name);
1883 exit(-1);
1884 }
1885
1886 free(image->name);
1887 free(image);
1888 }
1889
1890 if (edje_file->image_dir && !is_lua)
1891 {
1892 Edje_Image_Directory_Entry *de;
1893 Edje_Image_Directory_Set *set;
1894 unsigned int i;
1895
1896 for (i = 0; i < edje_file->image_dir->entries_count; ++i)
1897 {
1898 de = edje_file->image_dir->entries + i;
1899
1900 if (de->entry && eina_hash_find(images_in_use, de->entry))
1901 continue ;
1902
1903 if (verbose)
1904 {
1905 printf("%s: Image '%s' in ressource 'edje/image/%i' will not be included as it is unused.\n", progname, de->entry, de->id);
1906 }
1907 else
1908 {
1909 INF("Image '%s' in ressource 'edje/image/%i' will not be included as it is unused.", de->entry, de->id);
1910 }
1911
1912 de->entry = NULL;
1913 }
1914
1915 for (i = 0; i < edje_file->image_dir->sets_count; ++i)
1916 {
1917 set = edje_file->image_dir->sets + i;
1918
1919 if (set->name && eina_hash_find(images_in_use, set->name))
1920 continue ;
1921
1922 if (verbose)
1923 {
1924 printf("%s: Set '%s' will not be included as it is unused.\n", progname, set->name);
1925 }
1926 else
1927 {
1928 INF("Set '%s' will not be included as it is unused.", set->name);
1929 }
1930
1931 set->name = NULL;
1932 set->entries = NULL;
1933 }
1934 }
1935
1936 eina_hash_free(images_in_use);
1937
1938 EINA_LIST_FREE(part_slave_lookups, data)
1939 free(data);
1940
1941 EINA_LIST_FREE(image_slave_lookups, data)
1942 free(data);
1943}
1944
1945static void
1946data_process_string(Edje_Part_Collection *pc, const char *prefix, char *s, void (*func)(Edje_Part_Collection *pc, char *name, char* ptr, int len))
1947{
1948 char *p;
1949 char *key;
1950 int keyl;
1951 int quote, escape;
1952
1953 key = alloca(strlen(prefix) + 2 + 1);
1954 if (!key) return;
1955 strcpy(key, prefix);
1956 strcat(key, ":\"");
1957 keyl = strlen(key);
1958 quote = 0;
1959 escape = 0;
1960 for (p = s; (p) && (*p); p++)
1961 {
1962 if (!quote)
1963 {
1964 if (*p == '\"')
1965 {
1966 quote = 1;
1967 p++;
1968 }
1969 }
1970 if (!quote)
1971 {
1972 if (!strncmp(p, key, keyl))
1973 {
1974 char *ptr;
1975 int len;
1976 int inesc = 0;
1977 char *name;
1978
1979 ptr = p;
1980 p += keyl;
1981 while ((*p))
1982 {
1983 if (!inesc)
1984 {
1985 if (*p == '\\') inesc = 1;
1986 else if (*p == '\"')
1987 {
1988 /* string concatenation, see below */
1989 if (*(p + 1) != '\"')
1990 break;
1991 else
1992 p++;
1993 }
1994 }
1995 else
1996 inesc = 0;
1997 p++;
1998 }
1999 len = p - ptr + 1;
2000 name = alloca(len);
2001 if (name)
2002 {
2003 char *pp;
2004 int i;
2005
2006 name[0] = 0;
2007 pp = ptr + keyl;
2008 inesc = 0;
2009 i = 0;
2010 while (*pp)
2011 {
2012 if (!inesc)
2013 {
2014 if (*pp == '\\') inesc = 1;
2015 else if (*pp == '\"')
2016 {
2017 /* concat strings like "foo""bar" to "foobar" */
2018 if (*(pp + 1) == '\"')
2019 pp++;
2020 else
2021 {
2022 name[i] = 0;
2023 break;
2024 }
2025 }
2026 else
2027 {
2028 name[i] = *pp;
2029 name[i + 1] = 0;
2030 i++;
2031 }
2032 }
2033 else
2034 inesc = 0;
2035 pp++;
2036 }
2037 func(pc, name, ptr, len);
2038 }
2039 }
2040 }
2041 else
2042 {
2043 if (!escape)
2044 {
2045 if (*p == '\"') quote = 0;
2046 else if (*p == '\\') escape = 1;
2047 }
2048 else if (escape)
2049 {
2050 escape = 0;
2051 }
2052 }
2053 }
2054}
2055
2056static void
2057_data_queue_part_lookup(Edje_Part_Collection *pc, char *name, char *ptr, int len)
2058{
2059 Code_Lookup *cl;
2060 cl = mem_alloc(SZ(Code_Lookup));
2061 cl->ptr = ptr;
2062 cl->len = len;
2063
2064 data_queue_part_lookup(pc, name, &(cl->val));
2065
2066 code_lookups = eina_list_append(code_lookups, cl);
2067}
2068static void
2069_data_queue_program_lookup(Edje_Part_Collection *pc, char *name, char *ptr, int len)
2070{
2071 Code_Lookup *cl;
2072
2073 cl = mem_alloc(SZ(Code_Lookup));
2074 cl->ptr = ptr;
2075 cl->len = len;
2076
2077 data_queue_program_lookup(pc, name, &(cl->val));
2078
2079 code_lookups = eina_list_append(code_lookups, cl);
2080}
2081static void
2082_data_queue_group_lookup(Edje_Part_Collection *pc __UNUSED__, char *name, char *ptr __UNUSED__, int len __UNUSED__)
2083{
2084 data_queue_group_lookup(name, NULL);
2085}
2086static void
2087_data_queue_image_pc_lookup(Edje_Part_Collection *pc __UNUSED__, char *name, char *ptr, int len)
2088{
2089 Code_Lookup *cl;
2090
2091 cl = mem_alloc(SZ(Code_Lookup));
2092 cl->ptr = ptr;
2093 cl->len = len;
2094
2095 data_queue_image_lookup(name, &(cl->val), &(cl->set));
2096
2097 code_lookups = eina_list_append(code_lookups, cl);
2098}
2099
2100void
2101data_process_scripts(void)
2102{
2103 Eina_List *l, *l2;
2104
2105 for (l = codes, l2 = edje_collections; (l) && (l2); l = eina_list_next(l), l2 = eina_list_next(l2))
2106 {
2107 Edje_Part_Collection *pc;
2108 Code *cd;
2109
2110 cd = eina_list_data_get(l);
2111 pc = eina_list_data_get(l2);
2112
2113 if ((cd->shared) && (!cd->is_lua))
2114 {
2115 data_process_string(pc, "PART", cd->shared, _data_queue_part_lookup);
2116 data_process_string(pc, "PROGRAM", cd->shared, _data_queue_program_lookup);
2117 data_process_string(pc, "IMAGE", cd->shared, _data_queue_image_pc_lookup);
2118 data_process_string(pc, "GROUP", cd->shared, _data_queue_group_lookup);
2119 }
2120
2121 if (cd->programs)
2122 {
2123 Code_Program *cp;
2124 Eina_List *ll;
2125
2126 EINA_LIST_FOREACH(cd->programs, ll, cp)
2127 {
2128 if (cp->script)
2129 {
2130 data_process_string(pc, "PART", cp->script, _data_queue_part_lookup);
2131 data_process_string(pc, "PROGRAM", cp->script, _data_queue_program_lookup);
2132 data_process_string(pc, "IMAGE", cp->script, _data_queue_image_pc_lookup);
2133 data_process_string(pc, "GROUP", cp->script, _data_queue_group_lookup);
2134 }
2135 }
2136 }
2137 }
2138}
2139
2140void
2141data_process_script_lookups(void)
2142{
2143 Eina_List *l;
2144 Code_Lookup *cl;
2145
2146 EINA_LIST_FOREACH(code_lookups, l, cl)
2147 {
2148 char buf[12];
2149 int n;
2150
2151 /* FIXME !! Handle set in program */
2152 n = eina_convert_itoa(cl->val, buf);
2153 if (n > cl->len)
2154 {
2155 ERR("%s: Error. The unexpected happened. A numeric replacement string was larger than the original!",
2156 progname);
2157 exit(-1);
2158 }
2159 memset(cl->ptr, ' ', cl->len);
2160 strncpy(cl->ptr, buf, n);
2161 }
2162}
diff --git a/libraries/edje/src/bin/edje_cc_parse.c b/libraries/edje/src/bin/edje_cc_parse.c
deleted file mode 100644
index adc08d3..0000000
--- a/libraries/edje/src/bin/edje_cc_parse.c
+++ /dev/null
@@ -1,1546 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#ifdef HAVE_ALLOCA_H
6# include <alloca.h>
7#elif defined __GNUC__
8# define alloca __builtin_alloca
9#elif defined _AIX
10# define alloca __alloca
11#elif defined _MSC_VER
12# include <malloc.h>
13# define alloca _alloca
14#else
15# include <stddef.h>
16# ifdef __cplusplus
17extern "C"
18# endif
19void *alloca (size_t);
20#endif
21
22#include <string.h>
23#include <ctype.h>
24#include <limits.h>
25#include <errno.h>
26#include <sys/types.h>
27#include <sys/stat.h>
28#include <unistd.h>
29#include <fcntl.h>
30#include <math.h>
31
32#include "edje_cc.h"
33#include <Ecore.h>
34#include <Ecore_File.h>
35
36#ifdef _WIN32
37# define EPP_EXT ".exe"
38#else
39# define EPP_EXT
40#endif
41
42static void new_object(void);
43static void new_statement(void);
44static char *perform_math (char *input);
45static int isdelim(char c);
46static char *next_token(char *p, char *end, char **new_p, int *delim);
47static char *stack_id(void);
48static void stack_chop_top(void);
49static void parse(char *data, off_t size);
50
51/* simple expression parsing protos */
52static int my_atoi(const char * s);
53static char * _alphai(char *s, int * val);
54static char * _betai(char *s, int * val);
55static char * _gammai(char *s, int * val);
56static char * _deltai(char *s, int * val);
57static char * _get_numi(char *s, int * val);
58static int _is_numi(char c);
59static int _is_op1i(char c);
60static int _is_op2i(char c);
61static int _calci(char op, int a, int b);
62
63static double my_atof(const char * s);
64static char * _alphaf(char *s, double * val);
65static char * _betaf(char *s, double * val);
66static char * _gammaf(char *s, double * val);
67static char * _deltaf(char *s, double * val);
68static char * _get_numf(char *s, double * val);
69static int _is_numf(char c);
70static int _is_op1f(char c);
71static int _is_op2f(char c);
72static double _calcf(char op, double a, double b);
73static int strstrip(const char *in, char *out, size_t size);
74
75
76int line = 0;
77Eina_List *stack = NULL;
78Eina_List *params = NULL;
79
80static char file_buf[4096];
81static int verbatim = 0;
82static int verbatim_line1 = 0;
83static int verbatim_line2 = 0;
84static char *verbatim_str = NULL;
85
86static void
87err_show_stack(void)
88{
89 char *s;
90
91 s = stack_id();
92 if (s)
93 {
94 printf("PARSE STACK:\n%s\n", s);
95 free(s);
96 }
97 else
98 printf("NO PARSE STACK\n");
99}
100
101static void
102err_show_params(void)
103{
104 Eina_List *l;
105 char *p;
106
107 printf("PARAMS:");
108 EINA_LIST_FOREACH(params, l, p)
109 {
110 printf(" %s", p);
111 }
112 printf("\n");
113}
114
115static void
116err_show(void)
117{
118 err_show_stack();
119 err_show_params();
120}
121
122static void
123new_object(void)
124{
125 char *id;
126 int i;
127 int handled = 0;
128
129 id = stack_id();
130 for (i = 0; i < object_handler_num(); i++)
131 {
132 if (!strcmp(object_handlers[i].type, id))
133 {
134 handled = 1;
135 if (object_handlers[i].func)
136 {
137 object_handlers[i].func();
138 }
139 break;
140 }
141 }
142 if (!handled)
143 {
144 for (i = 0; i < statement_handler_num(); i++)
145 {
146 if (!strcmp(statement_handlers[i].type, id))
147 {
148 free(id);
149 return;
150 }
151 }
152 }
153 if (!handled)
154 {
155 ERR("%s: Error. %s:%i unhandled keyword %s",
156 progname, file_in, line - 1,
157 (char *)eina_list_data_get(eina_list_last(stack)));
158 err_show();
159 exit(-1);
160 }
161 free(id);
162}
163
164static void
165new_statement(void)
166{
167 char *id;
168 int i;
169 int handled = 0;
170
171 id = stack_id();
172 for (i = 0; i < statement_handler_num(); i++)
173 {
174 if (!strcmp(statement_handlers[i].type, id))
175 {
176 handled = 1;
177 if (statement_handlers[i].func)
178 {
179 statement_handlers[i].func();
180 }
181 break;
182 }
183 }
184 if (!handled)
185 {
186 ERR("%s: Error. %s:%i unhandled keyword %s",
187 progname, file_in, line - 1,
188 (char *)eina_list_data_get(eina_list_last(stack)));
189 err_show();
190 exit(-1);
191 }
192 free(id);
193}
194
195static char *
196perform_math (char *input)
197{
198 char buf[256];
199 double res;
200
201 /* FIXME
202 * Always apply floating-point arithmetic.
203 * Does this cause problems for integer parameters? (yes it will)
204 *
205 * What we should do is, loop over the string and figure out whether
206 * there are floating point operands, too and then switch to
207 * floating point math.
208 */
209 res = my_atof(input);
210 snprintf(buf, sizeof (buf), "%lf", res);
211 return strdup(buf);
212}
213
214static int
215isdelim(char c)
216{
217 const char *delims = "{},;:";
218 char *d;
219
220 d = (char *)delims;
221 while (*d)
222 {
223 if (c == *d) return 1;
224 d++;
225 }
226 return 0;
227}
228
229static char *
230next_token(char *p, char *end, char **new_p, int *delim)
231{
232 char *tok_start = NULL, *tok_end = NULL, *tok = NULL, *sa_start = NULL;
233 int in_tok = 0;
234 int in_quote = 0;
235 int in_parens = 0;
236 int in_comment_ss = 0;
237 int in_comment_cpp = 0;
238 int in_comment_sa = 0;
239 int had_quote = 0;
240 int is_escaped = 0;
241
242 *delim = 0;
243 if (p >= end) return NULL;
244 while (p < end)
245 {
246 if (*p == '\n')
247 {
248 in_comment_ss = 0;
249 in_comment_cpp = 0;
250 line++;
251 }
252 if ((!in_comment_ss) && (!in_comment_sa))
253 {
254 if ((!in_quote) && (*p == '/') && (p < (end - 1)) && (*(p + 1) == '/'))
255 in_comment_ss = 1;
256 if ((!in_quote) && (*p == '#'))
257 in_comment_cpp = 1;
258 if ((!in_quote) && (*p == '/') && (p < (end - 1)) && (*(p + 1) == '*'))
259 {
260 in_comment_sa = 1;
261 sa_start = p;
262 }
263 }
264 if ((in_comment_cpp) && (*p == '#'))
265 {
266 char *pp, fl[4096];
267 char *tmpstr = NULL;
268 int l, nm;
269
270 /* handle cpp comments */
271 /* their line format is
272 * #line <line no. of next line> <filename from next line on> [??]
273 */
274
275 pp = p;
276 while ((pp < end) && (*pp != '\n'))
277 {
278 pp++;
279 }
280 l = pp - p;
281 tmpstr = alloca(l + 1);
282 if (!tmpstr)
283 {
284 ERR("%s: Error. %s:%i malloc %i bytes failed",
285 progname, file_in, line - 1, l + 1);
286 exit(-1);
287 }
288 strncpy(tmpstr, p, l);
289 tmpstr[l] = 0;
290 l = sscanf(tmpstr, "%*s %i \"%[^\"]\"", &nm, fl);
291 if (l == 2)
292 {
293 strcpy(file_buf, fl);
294 line = nm;
295 file_in = file_buf;
296 }
297 }
298 else if ((!in_comment_ss) && (!in_comment_sa) && (!in_comment_cpp))
299 {
300 if (!in_tok)
301 {
302 if (!in_quote)
303 {
304 if (!isspace(*p))
305 {
306 if (*p == '"')
307 {
308 in_quote = 1;
309 had_quote = 1;
310 }
311 else if (*p == '(')
312 in_parens++;
313
314 in_tok = 1;
315 tok_start = p;
316 if (isdelim(*p)) *delim = 1;
317 }
318 }
319 }
320 else
321 {
322 if (in_quote)
323 {
324 if ((*p) == '\\')
325 is_escaped = !is_escaped;
326 else if (((*p) == '"') && (!is_escaped))
327 {
328 in_quote = 0;
329 had_quote = 1;
330 }
331 else if (is_escaped)
332 is_escaped = 0;
333 }
334 else if (in_parens)
335 {
336 if (((*p) == ')') && (!is_escaped))
337 in_parens--;
338 }
339 else
340 {
341 if (*p == '"')
342 {
343 in_quote = 1;
344 had_quote = 1;
345 }
346 else if (*p == '(')
347 in_parens++;
348
349 /* check for end-of-token */
350 if (
351 (isspace(*p)) ||
352 ((*delim) && (!isdelim(*p))) ||
353 (isdelim(*p))
354 )
355 {/*the line below this is never used because it skips to
356 * the 'done' label which is after the return call for
357 * in_tok being 0. is this intentional?
358 */
359 in_tok = 0;
360
361 tok_end = p - 1;
362 if (*p == '\n') line--;
363 goto done;
364 }
365 }
366 }
367 }
368 if (in_comment_sa)
369 {
370 if ((*p == '/') && (*(p - 1) == '*') && ((p - sa_start) > 2))
371 in_comment_sa = 0;
372 }
373 p++;
374 }
375 if (!in_tok) return NULL;
376 tok_end = p - 1;
377
378 done:
379 *new_p = p;
380
381 tok = mem_alloc(tok_end - tok_start + 2);
382 strncpy(tok, tok_start, tok_end - tok_start + 1);
383 tok[tok_end - tok_start + 1] = 0;
384
385 if (had_quote)
386 {
387 is_escaped = 0;
388 p = tok;
389
390 while (*p)
391 {
392 if ((*p == '\"') && (!is_escaped))
393 {
394 memmove(p, p + 1, strlen(p));
395 }
396 else if ((*p == '\\') && (*(p + 1) == 'n'))
397 {
398 memmove(p, p + 1, strlen(p));
399 *p = '\n';
400 }
401 else if ((*p == '\\') && (*(p + 1) == 't'))
402 {
403 memmove(p, p + 1, strlen(p));
404 *p = '\t';
405 }
406 else if (*p == '\\')
407 {
408 memmove(p, p + 1, strlen(p));
409 if (*p == '\\') p++;
410 else is_escaped = 1;
411 }
412 else
413 {
414 if (is_escaped) is_escaped = 0;
415 p++;
416 }
417 }
418 }
419 else if ((tok) && (*tok == '('))
420 {
421 char *tmp;
422 tmp = tok;
423 tok = perform_math(tok);
424 free(tmp);
425 }
426
427 return tok;
428}
429
430static char *
431stack_id(void)
432{
433 char *id;
434 int len;
435 Eina_List *l;
436 char *data;
437
438 len = 0;
439 EINA_LIST_FOREACH(stack, l, data)
440 len += strlen(data) + 1;
441 id = mem_alloc(len);
442 id[0] = 0;
443 EINA_LIST_FOREACH(stack, l, data)
444 {
445 strcat(id, data);
446 if (eina_list_next(l)) strcat(id, ".");
447 }
448 return id;
449}
450
451static void
452stack_chop_top(void)
453{
454 char *top;
455
456 /* remove top from stack */
457 top = eina_list_data_get(eina_list_last(stack));
458 if (top)
459 {
460 free(top);
461 stack = eina_list_remove(stack, top);
462 }
463 else
464 {
465 ERR("%s: Error. parse error %s:%i. } marker without matching { marker",
466 progname, file_in, line - 1);
467 err_show();
468 exit(-1);
469 }
470}
471
472static void
473parse(char *data, off_t size)
474{
475 char *p, *end, *token;
476 int delim = 0;
477 int do_params = 0;
478
479 if (verbose)
480 {
481 INF("%s: Parsing input file",
482 progname);
483 }
484 p = data;
485 end = data + size;
486 line = 1;
487 while ((token = next_token(p, end, &p, &delim)))
488 {
489 /* if we are in param mode, the only delimiter
490 * we'll accept is the semicolon
491 */
492 if (do_params && delim && *token != ';')
493 {
494 ERR("%s: Error. parse error %s:%i. %c marker before ; marker",
495 progname, file_in, line - 1, *token);
496 err_show();
497 exit(-1);
498 }
499 else if (delim)
500 {
501 if (*token == ',' || *token == ':') do_params = 1;
502 else if (*token == '}')
503 {
504 if (do_params)
505 {
506 ERR("%s: Error. parse error %s:%i. } marker before ; marker",
507 progname, file_in, line - 1);
508 err_show();
509 exit(-1);
510 }
511 else
512 stack_chop_top();
513 }
514 else if (*token == ';')
515 {
516 if (do_params)
517 {
518 do_params = 0;
519 new_statement();
520 /* clear out params */
521 while (params)
522 {
523 free(eina_list_data_get(params));
524 params = eina_list_remove(params, eina_list_data_get(params));
525 }
526 /* remove top from stack */
527 stack_chop_top();
528 }
529 }
530 else if (*token == '{')
531 {
532 if (do_params)
533 {
534 ERR("%s: Error. parse error %s:%i. { marker before ; marker",
535 progname, file_in, line - 1);
536 err_show();
537 exit(-1);
538 }
539 }
540 free(token);
541 }
542 else
543 {
544 if (do_params)
545 params = eina_list_append(params, token);
546 else
547 {
548 stack = eina_list_append(stack, token);
549 new_object();
550 if ((verbatim == 1) && (p < (end - 2)))
551 {
552 int escaped = 0;
553 int inquotes = 0;
554 int insquotes = 0;
555 int squigglie = 1;
556 int l1 = 0, l2 = 0;
557 char *verbatim_1;
558 char *verbatim_2;
559
560 l1 = line;
561 while ((p[0] != '{') && (p < end))
562 {
563 if (*p == '\n') line++;
564 p++;
565 }
566 p++;
567 verbatim_1 = p;
568 verbatim_2 = NULL;
569 for (; p < end; p++)
570 {
571 if (*p == '\n') line++;
572 if (escaped) escaped = 0;
573 if (!escaped)
574 {
575 if (p[0] == '\\') escaped = 1;
576 else if (p[0] == '\"')
577 {
578 if (!insquotes)
579 {
580 if (inquotes) inquotes = 0;
581 else inquotes = 1;
582 }
583 }
584 else if (p[0] == '\'')
585 {
586 if (!inquotes)
587 {
588 if (insquotes) insquotes = 0;
589 else insquotes = 1;
590 }
591 }
592 else if ((!inquotes) && (!insquotes))
593 {
594 if (p[0] == '{') squigglie++;
595 else if (p[0] == '}') squigglie--;
596 if (squigglie == 0)
597 {
598 verbatim_2 = p - 1;
599 l2 = line;
600 break;
601 }
602 }
603 }
604 }
605 if (verbatim_2 > verbatim_1)
606 {
607 int l;
608 char *v;
609
610 l = verbatim_2 - verbatim_1 + 1;
611 v = malloc(l + 1);
612 strncpy(v, verbatim_1, l);
613 v[l] = 0;
614 set_verbatim(v, l1, l2);
615 }
616 else
617 {
618 ERR("%s: Error. parse error %s:%i. { marker does not have matching } marker",
619 progname, file_in, line - 1);
620 err_show();
621 exit(-1);
622 }
623 new_object();
624 verbatim = 0;
625 }
626 }
627 }
628 }
629 if (verbose)
630 {
631 INF("%s: Parsing done",
632 progname);
633 }
634}
635
636static char *clean_file = NULL;
637static void
638clean_tmp_file(void)
639{
640 if (clean_file) unlink(clean_file);
641}
642
643int
644is_verbatim(void)
645{
646 return verbatim;
647}
648
649void
650track_verbatim(int on)
651{
652 verbatim = on;
653}
654
655void
656set_verbatim(char *s, int l1, int l2)
657{
658 verbatim_line1 = l1;
659 verbatim_line2 = l2;
660 verbatim_str = s;
661}
662
663char *
664get_verbatim(void)
665{
666 return verbatim_str;
667}
668
669int
670get_verbatim_line1(void)
671{
672 return verbatim_line1;
673}
674
675int
676get_verbatim_line2(void)
677{
678 return verbatim_line2;
679}
680
681void
682compile(void)
683{
684 char buf[4096], buf2[4096];
685 char inc[4096];
686 static char tmpn[4096];
687 int fd;
688 off_t size;
689 char *data, *p;
690 Eina_List *l;
691 Edje_Style *stl;
692
693 if (!tmp_dir)
694#ifdef HAVE_EVIL
695 tmp_dir = (char *)evil_tmpdir_get();
696#else
697 tmp_dir = "/tmp";
698#endif
699
700 strncpy(inc, file_in, 4000);
701 inc[4001] = 0;
702 p = strrchr(inc, '/');
703 if (!p) strcpy(inc, "./");
704 else *p = 0;
705 snprintf(tmpn, PATH_MAX, "%s/edje_cc.edc-tmp-XXXXXX", tmp_dir);
706 fd = mkstemp(tmpn);
707 if (fd >= 0)
708 {
709 int ret;
710 char *def;
711
712 clean_file = tmpn;
713 close(fd);
714 atexit(clean_tmp_file);
715 if (!defines)
716 def = mem_strdup("");
717 else
718 {
719 int len;
720 char *define;
721
722 len = 0;
723 EINA_LIST_FOREACH(defines, l, define)
724 len += strlen(define) + 1;
725 def = mem_alloc(len + 1);
726 def[0] = 0;
727 EINA_LIST_FOREACH(defines, l, define)
728 {
729 strcat(def, define);
730 strcat(def, " ");
731 }
732 }
733
734 /*
735 * Run the input through the C pre-processor.
736 */
737 ret = -1;
738 snprintf(buf2, sizeof(buf2), "%s/edje/utils/epp" EPP_EXT,
739 eina_prefix_lib_get(pfx));
740 if (ecore_file_exists(buf2))
741 {
742 snprintf(buf, sizeof(buf), "%s %s -I%s %s -o %s",
743 buf2, file_in, inc, def, tmpn);
744 ret = system(buf);
745 }
746 else
747 {
748 ERR("Error. Cannot run epp: %s", buf2);
749 exit(-1);
750 }
751 if (ret == EXIT_SUCCESS)
752 file_in = tmpn;
753 else
754 {
755 ERR("Error. Exit code of epp not clean: %i", ret);
756 exit(-1);
757 }
758 free(def);
759 }
760 fd = open(file_in, O_RDONLY | O_BINARY, S_IRUSR | S_IWUSR);
761 if (fd < 0)
762 {
763 ERR("%s: Error. cannot open file \"%s\" for input. %s",
764 progname, file_in, strerror(errno));
765 exit(-1);
766 }
767 if (verbose)
768 {
769 INF("%s: Opening \"%s\" for input", progname, file_in);
770 }
771
772 size = lseek(fd, 0, SEEK_END);
773 lseek(fd, 0, SEEK_SET);
774 data = malloc(size);
775 if (data && (read(fd, data, size) == size))
776 parse(data, size);
777 else
778 {
779 ERR("%s: Error. cannot read file \"%s\". %s",
780 progname, file_in, strerror(errno));
781 exit(-1);
782 }
783 free(data);
784 close(fd);
785
786 EINA_LIST_FOREACH(edje_file->styles, l, stl)
787 {
788 if (!stl->name)
789 {
790 ERR("%s: Error. style must have a name.", progname);
791 exit(-1);
792 }
793 }
794}
795
796int
797is_param(int n)
798{
799 char *str;
800
801 str = eina_list_nth(params, n);
802 if (str) return 1;
803 return 0;
804}
805
806int
807is_num(int n)
808{
809 char *str;
810 char *end;
811 long int ret;
812
813 str = eina_list_nth(params, n);
814 if (!str)
815 {
816 ERR("%s: Error. %s:%i no parameter supplied as argument %i",
817 progname, file_in, line - 1, n + 1);
818 err_show();
819 exit(-1);
820 }
821 if (str[0] == 0) return 0;
822 end = str;
823 ret = strtol(str, &end, 0);
824 if ((ret == LONG_MIN) || (ret == LONG_MAX))
825 {
826 n = 0; // do nothing. shut gcc warnings up
827 }
828 if ((end != str) && (end[0] == 0)) return 1;
829 return 0;
830}
831
832char *
833parse_str(int n)
834{
835 char *str;
836 char *s;
837
838 str = eina_list_nth(params, n);
839 if (!str)
840 {
841 ERR("%s: Error. %s:%i no parameter supplied as argument %i",
842 progname, file_in, line - 1, n + 1);
843 err_show();
844 exit(-1);
845 }
846 s = mem_strdup(str);
847 return s;
848}
849
850static int
851_parse_enum(char *str, va_list va)
852{
853 va_list va2;
854 va_copy(va2, va); /* iterator for the error message */
855
856 for (;;)
857 {
858 char *s;
859 int v;
860
861 s = va_arg(va, char *);
862
863 /* End of the list, nothing matched. */
864 if (!s)
865 {
866 fprintf(stderr, "%s: Error. %s:%i token %s not one of:",
867 progname, file_in, line - 1, str);
868 s = va_arg(va2, char *);
869 while (s)
870 {
871 va_arg(va2, int);
872 fprintf(stderr, " %s", s);
873 s = va_arg(va2, char *);
874 if (!s) break;
875 }
876 fprintf(stderr, "\n");
877 va_end(va2);
878 va_end(va);
879 err_show();
880 exit(-1);
881 }
882
883 v = va_arg(va, int);
884 if (!strcmp(s, str))
885 {
886 va_end(va2);
887 va_end(va);
888 return v;
889 }
890 }
891 va_end(va2);
892 va_end(va);
893 return 0;
894}
895
896int
897parse_enum(int n, ...)
898{
899 char *str;
900 int result;
901 va_list va;
902
903 str = eina_list_nth(params, n);
904 if (!str)
905 {
906 ERR("%s: Error. %s:%i no parameter supplied as argument %i",
907 progname, file_in, line - 1, n + 1);
908 err_show();
909 exit(-1);
910 }
911
912 va_start(va, n);
913 result = _parse_enum(str, va);
914 va_end(va);
915
916 return result;
917}
918
919int
920parse_flags(int n, ...)
921{
922 Eina_List *lst;
923 int result = 0;
924 va_list va;
925 char *data;
926
927 va_start(va, n);
928 EINA_LIST_FOREACH(eina_list_nth_list(params, n), lst, data)
929 result |= _parse_enum(data, va);
930 va_end(va);
931
932 return result;
933}
934
935int
936parse_int(int n)
937{
938 char *str;
939 int i;
940
941 str = eina_list_nth(params, n);
942 if (!str)
943 {
944 ERR("%s: Error. %s:%i no parameter supplied as argument %i",
945 progname, file_in, line - 1, n + 1);
946 err_show();
947 exit(-1);
948 }
949 i = my_atoi(str);
950 return i;
951}
952
953int
954parse_int_range(int n, int f, int t)
955{
956 char *str;
957 int i;
958
959 str = eina_list_nth(params, n);
960 if (!str)
961 {
962 ERR("%s: Error. %s:%i no parameter supplied as argument %i",
963 progname, file_in, line - 1, n + 1);
964 err_show();
965 exit(-1);
966 }
967 i = my_atoi(str);
968 if ((i < f) || (i > t))
969 {
970 ERR("%s: Error. %s:%i integer %i out of range of %i to %i inclusive",
971 progname, file_in, line - 1, i, f, t);
972 err_show();
973 exit(-1);
974 }
975 return i;
976}
977
978int
979parse_bool(int n)
980{
981 char *str, buf[4096];
982 int i;
983
984 str = eina_list_nth(params, n);
985 if (!str)
986 {
987 ERR("%s: Error. %s:%i no parameter supplied as argument %i",
988 progname, file_in, line - 1, n + 1);
989 err_show();
990 exit(-1);
991 }
992
993 if (!strstrip(str, buf, sizeof (buf)))
994 {
995 ERR("%s: Error. %s:%i expression is too long",
996 progname, file_in, line - 1);
997 return 0;
998 }
999
1000 if (!strcasecmp(buf, "false") || !strcasecmp(buf, "off"))
1001 return 0;
1002 if (!strcasecmp(buf, "true") || !strcasecmp(buf, "on"))
1003 return 1;
1004
1005 i = my_atoi(str);
1006 if ((i < 0) || (i > 1))
1007 {
1008 ERR("%s: Error. %s:%i integer %i out of range of 0 to 1 inclusive",
1009 progname, file_in, line - 1, i);
1010 err_show();
1011 exit(-1);
1012 }
1013 return i;
1014}
1015
1016double
1017parse_float(int n)
1018{
1019 char *str;
1020 double i;
1021
1022 str = eina_list_nth(params, n);
1023 if (!str)
1024 {
1025 ERR("%s: Error. %s:%i no parameter supplied as argument %i",
1026 progname, file_in, line - 1, n + 1);
1027 err_show();
1028 exit(-1);
1029 }
1030 i = my_atof(str);
1031 return i;
1032}
1033
1034double
1035parse_float_range(int n, double f, double t)
1036{
1037 char *str;
1038 double i;
1039
1040 str = eina_list_nth(params, n);
1041 if (!str)
1042 {
1043 ERR("%s: Error. %s:%i no parameter supplied as argument %i",
1044 progname, file_in, line - 1, n + 1);
1045 err_show();
1046 exit(-1);
1047 }
1048 i = my_atof(str);
1049 if ((i < f) || (i > t))
1050 {
1051 ERR("%s: Error. %s:%i float %3.3f out of range of %3.3f to %3.3f inclusive",
1052 progname, file_in, line - 1, i, f, t);
1053 err_show();
1054 exit(-1);
1055 }
1056 return i;
1057}
1058
1059int
1060get_arg_count(void)
1061{
1062 return eina_list_count (params);
1063}
1064
1065void
1066check_arg_count(int required_args)
1067{
1068 int num_args = eina_list_count (params);
1069
1070 if (num_args != required_args)
1071 {
1072 ERR("%s: Error. %s:%i got %i arguments, but expected %i",
1073 progname, file_in, line - 1, num_args, required_args);
1074 err_show();
1075 exit(-1);
1076 }
1077}
1078
1079void
1080check_min_arg_count(int min_required_args)
1081{
1082 int num_args = eina_list_count (params);
1083
1084 if (num_args < min_required_args)
1085 {
1086 ERR("%s: Error. %s:%i got %i arguments, "
1087 "but expected at least %i",
1088 progname, file_in, line - 1, num_args, min_required_args);
1089 err_show();
1090 exit(-1);
1091 }
1092}
1093
1094/* simple expression parsing stuff */
1095
1096/*
1097 * alpha ::= beta + beta || beta
1098 * beta ::= gamma + gamma || gamma
1099 * gamma ::= num || delta
1100 * delta ::= '(' alpha ')'
1101 *
1102 */
1103
1104/* int set of function */
1105
1106static int
1107my_atoi(const char *s)
1108{
1109 int res = 0;
1110 char buf[4096];
1111
1112 if (!s) return 0;
1113 if (!strstrip(s, buf, sizeof(buf)))
1114 {
1115 ERR("%s: Error. %s:%i expression is too long\n",
1116 progname, file_in, line - 1);
1117 return 0;
1118 }
1119 _alphai(buf, &res);
1120 return res;
1121}
1122
1123static char *
1124_deltai(char *s, int *val)
1125{
1126 if (!val) return NULL;
1127 if ('(' != s[0])
1128 {
1129 ERR("%s: Error. %s:%i unexpected character at %s\n",
1130 progname, file_in, line - 1, s);
1131 return s;
1132 }
1133 else
1134 {
1135 s++;
1136 s = _alphai(s, val);
1137 s++;
1138 return s;
1139 }
1140 return s;
1141}
1142
1143static char *
1144_funci(char *s, int *val)
1145{
1146 if (!strncmp(s, "floor(", 6))
1147 {
1148 s += 5;
1149 s = _deltai(s, val);
1150 *val = *val;
1151 }
1152 else if (!strncmp(s, "ceil(", 5))
1153 {
1154 s += 4;
1155 s = _deltai(s, val);
1156 *val = *val;
1157 }
1158 else
1159 {
1160 ERR("%s: Error. %s:%i unexpected character at %s\n",
1161 progname, file_in, line - 1, s);
1162 }
1163 return s;
1164}
1165
1166static char *
1167_gammai(char *s, int *val)
1168{
1169 if (!val) return NULL;
1170 if (_is_numi(s[0]))
1171 {
1172 s = _get_numi(s, val);
1173 return s;
1174 }
1175 else if ('(' == s[0])
1176 {
1177 s = _deltai(s, val);
1178 return s;
1179 }
1180 else
1181 {
1182 s = _funci(s, val);
1183// ERR("%s: Error. %s:%i unexpected character at %s\n",
1184// progname, file_in, line - 1, s);
1185 }
1186 return s;
1187}
1188
1189static char *
1190_betai(char *s, int *val)
1191{
1192 int a1, a2;
1193 char op;
1194
1195 if (!val) return NULL;
1196 s = _gammai(s, &a1);
1197 while (_is_op1i(s[0]))
1198 {
1199 op = s[0];
1200 s++;
1201 s = _gammai(s, &a2);
1202 a1 = _calci(op, a1, a2);
1203 }
1204 (*val) = a1;
1205 return s;
1206}
1207
1208static char *
1209_alphai(char *s, int *val)
1210{
1211 int a1, a2;
1212 char op;
1213
1214 if (!val) return NULL;
1215 s = _betai(s, &a1);
1216 while (_is_op2i(s[0]))
1217 {
1218 op = s[0];
1219 s++;
1220 s = _betai(s, &a2);
1221 a1 = _calci(op, a1, a2);
1222 }
1223 (*val) = a1;
1224 return s;
1225}
1226
1227char *
1228_get_numi(char *s, int *val)
1229{
1230 char buf[4096];
1231 int pos = 0;
1232
1233 if (!val) return s;
1234 while ((('0' <= s[pos]) && ('9' >= s[pos])) ||
1235 ((0 == pos) && ('-' == s[pos])))
1236 {
1237 buf[pos] = s[pos];
1238 pos++;
1239 }
1240 buf[pos] = '\0';
1241 (*val) = atoi(buf);
1242 return (s + pos);
1243}
1244
1245int
1246_is_numi(char c)
1247{
1248 if (((c >= '0') && (c <= '9')) || ('-' == c) || ('+' == c))
1249 return 1;
1250 else
1251 return 0;
1252}
1253
1254int
1255_is_op1i(char c)
1256{
1257 switch (c)
1258 {
1259 case '*':;
1260 case '%':;
1261 case '/': return 1;
1262 default: break;
1263 }
1264 return 0;
1265}
1266
1267int
1268_is_op2i(char c)
1269{
1270 switch (c)
1271 {
1272 case '+':;
1273 case '-': return 1;
1274 default: break;
1275 }
1276 return 0;
1277}
1278
1279int
1280_calci(char op, int a, int b)
1281{
1282 switch(op)
1283 {
1284 case '+':
1285 a += b;
1286 return a;
1287 case '-':
1288 a -= b;
1289 return a;
1290 case '/':
1291 if (0 != b) a /= b;
1292 else
1293 ERR("%s: Error. %s:%i divide by zero\n",
1294 progname, file_in, line - 1);
1295 return a;
1296 case '*':
1297 a *= b;
1298 return a;
1299 case '%':
1300 if (0 != b) a = a % b;
1301 else
1302 ERR("%s: Error. %s:%i modula by zero\n",
1303 progname, file_in, line - 1);
1304 return a;
1305 default:
1306 ERR("%s: Error. %s:%i unexpected character '%c'\n",
1307 progname, file_in, line - 1, op);
1308 }
1309 return a;
1310}
1311
1312/* float set of functoins */
1313
1314double
1315my_atof(const char *s)
1316{
1317 double res = 0;
1318 char buf[4096];
1319
1320 if (!s) return 0;
1321
1322 if (!strstrip(s, buf, sizeof (buf)))
1323 {
1324 ERR("%s: Error. %s:%i expression is too long",
1325 progname, file_in, line - 1);
1326 return 0;
1327 }
1328 _alphaf(buf, &res);
1329 return res;
1330}
1331
1332static char *
1333_deltaf(char *s, double *val)
1334{
1335 if (!val) return NULL;
1336 if ('(' != s[0])
1337 {
1338 ERR("%s: Error. %s:%i unexpected character at %s",
1339 progname, file_in, line - 1, s);
1340 return s;
1341 }
1342 else
1343 {
1344 s++;
1345 s = _alphaf(s, val);
1346 s++;
1347 }
1348 return s;
1349}
1350
1351static char *
1352_funcf(char *s, double *val)
1353{
1354 if (!strncmp(s, "floor(", 6))
1355 {
1356 s += 5;
1357 s = _deltaf(s, val);
1358 *val = floor(*val);
1359 }
1360 else if (!strncmp(s, "ceil(", 5))
1361 {
1362 s += 4;
1363 s = _deltaf(s, val);
1364 *val = ceil(*val);
1365 }
1366 else
1367 {
1368 ERR("%s: Error. %s:%i unexpected character at %s\n",
1369 progname, file_in, line - 1, s);
1370 }
1371 return s;
1372}
1373
1374static char *
1375_gammaf(char *s, double *val)
1376{
1377 if (!val) return NULL;
1378
1379 if (_is_numf(s[0]))
1380 {
1381 s = _get_numf(s, val);
1382 return s;
1383 }
1384 else if ('(' == s[0])
1385 {
1386 s = _deltaf(s, val);
1387 return s;
1388 }
1389 else
1390 {
1391 s = _funcf(s, val);
1392// ERR("%s: Error. %s:%i unexpected character at %s\n",
1393// progname, file_in, line - 1, s);
1394 }
1395 return s;
1396}
1397
1398static char *
1399_betaf(char *s, double *val)
1400{
1401 double a1=0, a2=0;
1402 char op;
1403
1404 if (!val) return NULL;
1405 s = _gammaf(s, &a1);
1406 while (_is_op1f(s[0]))
1407 {
1408 op = s[0];
1409 s++;
1410 s = _gammaf(s, &a2);
1411 a1 = _calcf(op, a1, a2);
1412 }
1413 (*val) = a1;
1414 return s;
1415}
1416
1417static char *
1418_alphaf(char *s, double *val)
1419{
1420 double a1=0, a2=0;
1421 char op;
1422
1423 if (!val) return NULL;
1424 s = _betaf(s, &a1);
1425 while (_is_op2f(s[0]))
1426 {
1427 op = s[0];
1428 s++;
1429 s = _betaf(s, &a2);
1430 a1 = _calcf(op, a1, a2);
1431 }
1432 (*val) = a1;
1433 return s;
1434}
1435
1436static char *
1437_get_numf(char *s, double *val)
1438{
1439 char buf[4096];
1440 int pos = 0;
1441
1442 if (!val) return s;
1443
1444 while ((('0' <= s[pos]) && ('9' >= s[pos])) ||
1445 ('.' == s[pos]) ||
1446 ((0 == pos) && ('-' == s[pos])))
1447 {
1448 buf[pos] = s[pos];
1449 pos++;
1450 }
1451 buf[pos] = '\0';
1452 (*val) = atof(buf);
1453 return (s+pos);
1454}
1455
1456static int
1457_is_numf(char c)
1458{
1459 if (((c >= '0') && (c <= '9'))
1460 || ('-' == c)
1461 || ('.' == c)
1462 || ('+' == c))
1463 return 1;
1464 return 0;
1465}
1466
1467static int
1468_is_op1f(char c)
1469{
1470 switch(c)
1471 {
1472 case '*':;
1473 case '%':;
1474 case '/': return 1;
1475 default: break;
1476 }
1477 return 0;
1478}
1479
1480static int
1481_is_op2f(char c)
1482{
1483 switch(c)
1484 {
1485 case '+':;
1486 case '-': return 1;
1487 default: break;
1488 }
1489 return 0;
1490}
1491
1492static double
1493_calcf(char op, double a, double b)
1494{
1495 switch(op)
1496 {
1497 case '+':
1498 a += b;
1499 return a;
1500 case '-':
1501 a -= b;
1502 return a;
1503 case '/':
1504 if (b != 0) a /= b;
1505 else
1506 ERR("%s: Error. %s:%i divide by zero\n",
1507 progname, file_in, line - 1);
1508 return a;
1509 case '*':
1510 a *= b;
1511 return a;
1512 case '%':
1513 if (0 != b) a = (double)((int)a % (int)b);
1514 else
1515 ERR("%s: Error. %s:%i modula by zero\n",
1516 progname, file_in, line - 1);
1517 return a;
1518 default:
1519 ERR("%s: Error. %s:%i unexpected character '%c'\n",
1520 progname, file_in, line - 1, op);
1521 }
1522 return a;
1523}
1524
1525static int
1526strstrip(const char *in, char *out, size_t size)
1527{
1528 if ((size -1 ) < strlen(in))
1529 {
1530 ERR("%s: Error. %s:%i expression is too long",
1531 progname, file_in, line - 1);
1532 return 0;
1533 }
1534 /* remove spaces and tabs */
1535 while (*in)
1536 {
1537 if ((0x20 != *in) && (0x09 != *in))
1538 {
1539 *out = *in;
1540 out++;
1541 }
1542 in++;
1543 }
1544 *out = '\0';
1545 return 1;
1546}
diff --git a/libraries/edje/src/bin/edje_cc_sources.c b/libraries/edje/src/bin/edje_cc_sources.c
deleted file mode 100644
index d9cd0c1..0000000
--- a/libraries/edje/src/bin/edje_cc_sources.c
+++ /dev/null
@@ -1,259 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <string.h>
6#include <ctype.h>
7#include <limits.h>
8
9#include "edje_cc.h"
10
11static Eet_Data_Descriptor *_srcfile_edd = NULL;
12static Eet_Data_Descriptor *_srcfile_list_edd = NULL;
13
14static Eet_Data_Descriptor *_external_edd = NULL;
15static Eet_Data_Descriptor *_external_list_edd = NULL;
16
17static Eet_Data_Descriptor *_font_edd = NULL;
18static Eet_Data_Descriptor *_font_list_edd = NULL;
19
20static SrcFile_List srcfiles = {NULL};
21
22void
23source_edd(void)
24{
25 Eet_Data_Descriptor_Class eddc;
26
27 eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "srcfile", sizeof (SrcFile));
28 _srcfile_edd = eet_data_descriptor_stream_new(&eddc);
29 EET_DATA_DESCRIPTOR_ADD_BASIC(_srcfile_edd, SrcFile, "name", name, EET_T_INLINED_STRING);
30 EET_DATA_DESCRIPTOR_ADD_BASIC(_srcfile_edd, SrcFile, "file", file, EET_T_INLINED_STRING);
31
32 eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "srcfile_list", sizeof (SrcFile_List));
33 _srcfile_list_edd = eet_data_descriptor_stream_new(&eddc);
34 EET_DATA_DESCRIPTOR_ADD_LIST(_srcfile_list_edd, SrcFile_List, "list", list, _srcfile_edd);
35
36 eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "external", sizeof (External));
37 _external_edd = eet_data_descriptor_stream_new(&eddc);
38 EET_DATA_DESCRIPTOR_ADD_BASIC(_external_edd, External, "name", name, EET_T_INLINED_STRING);
39
40 eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "external_list", sizeof (External_List));
41 _external_list_edd = eet_data_descriptor_stream_new(&eddc);
42 EET_DATA_DESCRIPTOR_ADD_LIST(_external_list_edd, External_List, "list", list, _external_edd);
43
44 eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "font", sizeof (Font));
45 _font_edd = eet_data_descriptor_stream_new(&eddc);
46 EET_DATA_DESCRIPTOR_ADD_BASIC(_font_edd, Font, "file", file, EET_T_INLINED_STRING);
47 EET_DATA_DESCRIPTOR_ADD_BASIC(_font_edd, Font, "name", name, EET_T_INLINED_STRING);
48
49 eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "font_list", sizeof (Font_List));
50 _font_list_edd = eet_data_descriptor_stream_new(&eddc);
51 EET_DATA_DESCRIPTOR_ADD_LIST(_font_list_edd, Font_List, "list", list, _font_edd);
52}
53
54static void source_fetch_file(const char *fil, const char *filname);
55
56static void
57source_fetch_file(const char *fil, const char *filname)
58{
59 FILE *f;
60 char buf[16 * 1024], *dir = NULL;
61 long sz;
62 size_t tmp;
63 ssize_t dir_len = 0;
64 SrcFile *sf;
65
66 f = fopen(fil, "rb");
67 if (!f)
68 {
69 ERR("%s: Warning. Cannot open file '%s'",
70 progname, fil);
71 exit(-1);
72 }
73
74 fseek(f, 0, SEEK_END);
75 sz = ftell(f);
76 fseek(f, 0, SEEK_SET);
77 sf = mem_alloc(SZ(SrcFile));
78 sf->name = mem_strdup(filname);
79 sf->file = mem_alloc(sz + 1);
80 if (sz > 0)
81 {
82 tmp = fread(sf->file, sz, 1, f);
83 if (tmp != 1)
84 {
85 ERR("%s: Warning file length for (%s) doesn't match !",
86 progname, filname);
87 exit(-1);
88 }
89 }
90
91 sf->file[sz] = '\0';
92 fseek(f, 0, SEEK_SET);
93 srcfiles.list = eina_list_append(srcfiles.list, sf);
94
95 while (fgets(buf, sizeof(buf), f))
96 {
97 char *p, *pp;
98 int got_hash = 0;
99 int forgetit = 0;
100 int haveinclude = 0;
101 char *file = NULL, *fname = NULL;
102
103 p = buf;
104 while ((!forgetit) && (*p))
105 {
106 if (!got_hash)
107 {
108 if (!isspace(*p))
109 {
110 if (*p == '#')
111 got_hash = 1;
112 else
113 forgetit = 1;
114 }
115 p++;
116 }
117
118 if (!haveinclude)
119 {
120 if (!isspace(*p))
121 {
122 if (!strncmp(p, "include", 7))
123 {
124 haveinclude = 1;
125 p += 7;
126 }
127 /* HACK! the logic above should be fixed so
128 * preprocessor statements don't have to begin
129 * in column 0.
130 * otoh, edje_cc should print a warning in that case,
131 * since according to the standard, preprocessor
132 * statements need to be put in column 0.
133 */
134 else if (!strncmp(p, "#include", 8))
135 {
136 haveinclude = 1;
137 p += 8;
138 }
139 else
140 forgetit = 1;
141 }
142 }
143 else
144 {
145 if (!isspace(*p))
146 {
147 char end = '\0';
148
149 if (*p == '"') end = '"';
150 else if (*p == '<') end = '>';
151
152 if (end)
153 {
154 pp = strchr(p + 1, end);
155 if (!pp)
156 forgetit = 1;
157 else
158 {
159 char *slash;
160 ssize_t l = 0;
161
162 /* get the directory of the current file
163 * if we haven't already done so
164 */
165 if ((!dir) && (strrchr(fil, '/')))
166 {
167 dir = mem_strdup(fil);
168 slash = strrchr(dir, '/');
169 *slash = '\0';
170 dir_len = strlen(dir);
171 }
172
173 l = pp - p + dir_len + 1;
174 file = mem_alloc(l);
175
176 if (!dir_len)
177 {
178 snprintf(file, l - 1, "%s", p + 1);
179 file[l - 2] = 0;
180 }
181 else
182 {
183 snprintf(file, l, "%s/%s", dir, p + 1);
184 file[l - 1] = 0;
185 }
186
187
188 fname = strdup(p + 1);
189 pp = strrchr(fname, end);
190 if (pp) *pp = 0;
191 forgetit = 1;
192 }
193 }
194 else
195 forgetit = 1;
196 }
197 else
198 p++;
199 }
200
201 got_hash = 0;
202 }
203 if ((file) && (fname))
204 {
205 source_fetch_file(file, fname);
206 free(file);
207 free(fname);
208 }
209 }
210 free(dir);
211 fclose(f);
212}
213
214void
215source_fetch(void)
216{
217 char buf[PATH_MAX] = {0}, *ptr;
218
219 ptr = strrchr(file_in, '/');
220 if (ptr)
221 {
222 snprintf(buf, sizeof (buf), "%s", ptr + 1);
223 }
224
225 source_fetch_file(file_in, buf[0] ? buf : file_in);
226}
227
228int
229source_append(Eet_File *ef)
230{
231 return eet_data_write(ef, _srcfile_list_edd, "edje_sources", &srcfiles, 1);
232}
233
234SrcFile_List *
235source_load(Eet_File *ef)
236{
237 SrcFile_List *s;
238
239 s = eet_data_read(ef, _srcfile_list_edd, "edje_sources");
240 return s;
241}
242
243int
244source_fontmap_save(Eet_File *ef, Eina_List *font_list)
245{
246 Font_List fl;
247
248 fl.list = font_list;
249 return eet_data_write(ef, _font_list_edd, "edje_source_fontmap", &fl, 1);
250}
251
252Font_List *
253source_fontmap_load(Eet_File *ef)
254{
255 Font_List *fl;
256
257 fl = eet_data_read(ef, _font_list_edd, "edje_source_fontmap");
258 return fl;
259}
diff --git a/libraries/edje/src/bin/edje_convert.c b/libraries/edje/src/bin/edje_convert.c
deleted file mode 100644
index 63d11ba..0000000
--- a/libraries/edje/src/bin/edje_convert.c
+++ /dev/null
@@ -1,459 +0,0 @@
1#include "edje_private.h"
2
3#include "edje_cc.h"
4#include "edje_convert.h"
5
6static const Edje_File *_current_edje_file = NULL;
7
8const Edje_File *
9_edje_file_get(void)
10{
11 return _current_edje_file;
12}
13
14void
15_edje_file_set(const Edje_File *edf)
16{
17 _current_edje_file = edf;
18}
19
20static Eina_Bool
21_edje_file_convert_external(Edje_File *edf, Old_Edje_File *oedf)
22{
23 Edje_External_Directory_Entry *ede;
24 unsigned int max;
25 unsigned int i = 0;
26
27 edf->external_dir = calloc(1, sizeof (Edje_External_Directory));
28 if (!edf->external_dir) return EINA_FALSE;
29 if (!oedf->external_dir) return EINA_TRUE;
30
31 max = eina_list_count(oedf->external_dir->entries);
32 edf->external_dir->entries = calloc(1, sizeof (Edje_External_Directory_Entry) * max);
33 edf->external_dir->entries_count = max;
34
35 if (!edf->external_dir->entries && max)
36 return EINA_FALSE;
37
38 EINA_LIST_FREE(oedf->external_dir->entries, ede)
39 {
40 edf->external_dir->entries[i++].entry = ede->entry;
41 free(ede);
42 }
43
44 free(oedf->external_dir);
45 oedf->external_dir = NULL;
46
47 return EINA_TRUE;
48}
49
50static Eina_Bool
51_edje_file_convert_images(Edje_File *edf, Old_Edje_File *oedf)
52{
53 Edje_Image_Directory_Entry *de;
54 Edje_Image_Directory_Set *ds;
55 Eina_List *l;
56 int max;
57
58 edf->image_dir = calloc(1, sizeof (Edje_Image_Directory));
59 if (!edf->image_dir) return EINA_FALSE;
60 if (!oedf->image_dir) return EINA_TRUE;
61
62 max = -1;
63 EINA_LIST_FOREACH(oedf->image_dir->entries, l, de)
64 if (max < de->id)
65 max = de->id;
66
67 edf->image_dir->entries = calloc(1, sizeof (Edje_Image_Directory_Entry) * (max + 1));
68 edf->image_dir->entries_count = max + 1;
69
70 if (!edf->image_dir->entries && edf->image_dir->entries_count)
71 return EINA_FALSE;
72
73 EINA_LIST_FREE(oedf->image_dir->entries, de)
74 {
75 memcpy(edf->image_dir->entries + de->id,
76 de,
77 sizeof (Edje_Image_Directory_Entry));
78 free(de);
79 }
80
81 max = -1;
82 EINA_LIST_FOREACH(oedf->image_dir->sets, l, ds)
83 if (max < ds->id)
84 max = ds->id;
85
86 edf->image_dir->sets = calloc(1, sizeof (Edje_Image_Directory_Set) * (max + 1));
87 edf->image_dir->sets_count = max + 1;
88
89 if (!edf->image_dir->sets && edf->image_dir->sets_count)
90 {
91 free(edf->image_dir->entries);
92 edf->image_dir->entries = NULL;
93 return EINA_FALSE;
94 }
95
96 EINA_LIST_FREE(oedf->image_dir->sets, ds)
97 {
98 memcpy(edf->image_dir->sets + ds->id,
99 ds,
100 sizeof (Edje_Image_Directory_Set));
101 free(ds);
102 }
103
104 return EINA_TRUE;
105}
106
107Edje_File *
108_edje_file_convert(Eet_File *ef, Old_Edje_File *oedf)
109{
110 Edje_Part_Collection_Directory_Entry *ce;
111 Edje_Font_Directory_Entry *fnt;
112 Edje_File *edf;
113 Eina_List *l;
114 Old_Edje_Data *ed;
115
116 if (oedf->version < 2) return NULL;
117
118 edf = calloc(1, sizeof (Edje_File));
119 if (!edf) return NULL;
120
121 edf->free_strings = 0;
122
123 edf->fonts = eina_hash_string_small_new(free);
124 edf->collection = eina_hash_string_small_new(free);
125 edf->data = eina_hash_string_small_new(free);
126
127 if (!edf->fonts || !edf->collection || !edf->data)
128 goto on_error;
129
130 EINA_LIST_FREE(oedf->data, ed)
131 {
132 Edje_String *es;
133
134 es = calloc(1, sizeof (Edje_String));
135 if (!es) continue;
136
137 es->str = ed->value;
138
139 eina_hash_direct_add(edf->data, ed->key, es);
140 free(ed);
141 }
142
143 EINA_LIST_FOREACH(oedf->collection_dir->entries, l, ce)
144 if (ce->entry)
145 eina_hash_direct_add(edf->collection, ce->entry, ce);
146 else
147 error_and_abort(ef, "Collection %i: name missing.\n", ce->id);
148
149 if (oedf->font_dir)
150 EINA_LIST_FOREACH(oedf->font_dir->entries, l, fnt)
151 eina_hash_direct_add(edf->fonts, fnt->entry, fnt);
152
153 if (!_edje_file_convert_images(edf, oedf))
154 goto on_error;
155
156 if (!_edje_file_convert_external(edf, oedf))
157 goto on_error;
158
159 edf->styles = oedf->styles;
160 edf->color_classes = oedf->color_classes;
161 edf->version = EDJE_FILE_VERSION;
162 edf->feature_ver = oedf->feature_ver;
163 edf->compiler = oedf->compiler;
164
165 edf->dangling = EINA_FALSE;
166 edf->warning = EINA_FALSE;
167
168 /* Below you will find all memory structure that could be cleaned when under
169 memory pressure */
170 edf->collection_cache = NULL;
171 edf->collection_patterns = NULL;
172
173 return edf;
174
175 on_error:
176 eina_hash_free(edf->fonts);
177 eina_hash_free(edf->collection);
178 eina_hash_free(edf->data);
179 free(edf->image_dir);
180 free(edf->external_dir);
181 free(edf);
182 return NULL;
183}
184
185static void
186_edje_collection_program_add(Edje_Program ***array,
187 unsigned int *count,
188 Edje_Program *add)
189{
190 Edje_Program **tmp;
191
192 tmp = realloc(*array, sizeof (Edje_Program*) * (*count + 1));
193 if (!tmp) return ;
194
195 tmp[(*count)++] = add;
196 *array = tmp;
197}
198
199Edje_Part_Collection *
200_edje_collection_convert(Eet_File *ef, Edje_Part_Collection_Directory_Entry *ce, Old_Edje_Part_Collection *oedc)
201{
202 Edje_Part_Collection *edc;
203 Old_Edje_Part *part;
204 Edje_Program *pg;
205 Old_Edje_Data *di;
206 Eina_List *l;
207 char *buffer;
208 unsigned int k;
209
210 oedc->part = ce->entry;
211
212 /* Count each type part and their respective state */
213 EINA_LIST_FOREACH(oedc->parts, l, part)
214 {
215 int *count;
216 int dummy = 0;
217
218
219 switch (part->type)
220 {
221#define CSP(Tp, Ce) \
222 case EDJE_PART_TYPE_##Tp : \
223 count = &Ce->count.Tp; \
224 break;
225
226 CSP(RECTANGLE, ce);
227 CSP(TEXT, ce);
228 CSP(IMAGE, ce);
229 CSP(SWALLOW, ce);
230 CSP(TEXTBLOCK, ce);
231 CSP(GROUP, ce);
232 CSP(BOX, ce);
233 CSP(TABLE, ce);
234 CSP(EXTERNAL, ce);
235 default:
236 count = &dummy;
237 break;
238 }
239
240 *count += eina_list_count(part->other_desc) + 1;
241 }
242 ce->count.part = eina_list_count(oedc->parts);
243
244#define CONVERT_EMN(Tp, Sz, Ce) \
245 buffer = alloca(strlen(ce->entry) + strlen(#Tp) + 2); \
246 sprintf(buffer, "%s/%s", ce->entry, #Tp); \
247 Ce->mp.Tp = eina_mempool_add("one_big", buffer, NULL, sizeof (Sz), Ce->count.Tp);
248
249 CONVERT_EMN(RECTANGLE, Edje_Part_Description_Common, ce);
250 CONVERT_EMN(TEXT, Edje_Part_Description_Text, ce);
251 CONVERT_EMN(IMAGE, Edje_Part_Description_Image, ce);
252 CONVERT_EMN(SWALLOW, Edje_Part_Description_Common, ce);
253 CONVERT_EMN(TEXTBLOCK, Edje_Part_Description_Text, ce);
254 CONVERT_EMN(GROUP, Edje_Part_Description_Common, ce);
255 CONVERT_EMN(BOX, Edje_Part_Description_Box, ce);
256 CONVERT_EMN(TABLE, Edje_Part_Description_Table, ce);
257 CONVERT_EMN(EXTERNAL, Edje_Part_Description_External, ce);
258 CONVERT_EMN(part, Edje_Part, ce);
259
260 /* Change structure layout */
261 edc = calloc(1, sizeof (Edje_Part_Collection));
262 if (!edc) error_and_abort(ef, "Not enough memory\n");
263 ce->ref = edc;
264
265 EINA_LIST_FREE(oedc->programs, pg)
266 {
267 if (!pg->signal && !pg->source)
268 _edje_collection_program_add(&edc->programs.nocmp,
269 &edc->programs.nocmp_count,
270 pg);
271 else if (pg->signal && !strpbrk(pg->signal, "*?[\\")
272 && pg->source && !strpbrk(pg->source, "*?[\\"))
273 _edje_collection_program_add(&edc->programs.strcmp,
274 &edc->programs.strcmp_count,
275 pg);
276 else if (pg->signal && edje_program_is_strncmp(pg->signal)
277 && pg->source && edje_program_is_strncmp(pg->source))
278 _edje_collection_program_add(&edc->programs.strncmp,
279 &edc->programs.strncmp_count,
280 pg);
281 else if (pg->signal && edje_program_is_strrncmp(pg->signal)
282 && pg->source && edje_program_is_strrncmp(pg->source))
283 _edje_collection_program_add(&edc->programs.strrncmp,
284 &edc->programs.strrncmp_count,
285 pg);
286 else
287 _edje_collection_program_add(&edc->programs.fnmatch,
288 &edc->programs.fnmatch_count,
289 pg);
290 }
291
292 edc->data = eina_hash_string_small_new(NULL);
293 EINA_LIST_FREE(oedc->data, di)
294 {
295 Edje_String *es;
296
297 es = calloc(1, sizeof (Edje_String));
298 if (!es) continue ;
299
300 es->str = di->value;
301
302 eina_hash_direct_add(edc->data, di->key, es);
303 free(di);
304 }
305
306 edc->parts_count = eina_list_count(oedc->parts);
307 edc->parts = calloc(edc->parts_count, sizeof (Edje_Part *));
308 if (edc->parts_count && !edc->parts)
309 error_and_abort(ef, "Not enough memory\n");
310 k = 0;
311
312 EINA_LIST_FREE(oedc->parts, part)
313 {
314 Old_Edje_Part_Description *oepd;
315 Edje_Pack_Element *elm;
316 Edje_Part *replacement;
317 unsigned int i;
318
319 replacement = eina_mempool_malloc(ce->mp.part, sizeof (Edje_Part));
320 if (!replacement)
321 error_and_abort(ef, "Not enough memory\n");
322
323 replacement->name = part->name;
324 replacement->default_desc = _edje_description_convert(part->type, ce, part->default_desc);
325
326 replacement->other.desc_count = eina_list_count(part->other_desc);
327 replacement->other.desc = calloc(replacement->other.desc_count, sizeof (Edje_Part_Description_Common*));
328
329 i = 0;
330 EINA_LIST_FREE(part->other_desc, oepd)
331 replacement->other.desc[i++] = _edje_description_convert(part->type, ce, oepd);
332
333 replacement->source = part->source;
334 replacement->source2 = part->source2;
335 replacement->source3 = part->source3;
336 replacement->source4 = part->source4;
337 replacement->source5 = part->source5;
338 replacement->source6 = part->source6;
339 replacement->id = part->id;
340 replacement->clip_to_id = part->clip_to_id;
341 replacement->dragable = part->dragable;
342 replacement->items_count = eina_list_count(part->items);
343 replacement->items = calloc(replacement->items_count, sizeof (Edje_Pack_Element*));
344
345 i = 0;
346 EINA_LIST_FREE(part->items, elm)
347 replacement->items[i++] = elm;
348
349 replacement->type = part->type;
350 replacement->effect = part->effect;
351 replacement->mouse_events = part->mouse_events;
352 replacement->repeat_events = part->repeat_events;
353 replacement->ignore_flags = part->ignore_flags;
354 replacement->scale = part->scale;
355 replacement->precise_is_inside = part->precise_is_inside;
356 replacement->use_alternate_font_metrics = part->use_alternate_font_metrics;
357 replacement->pointer_mode = part->pointer_mode;
358 replacement->entry_mode = part->entry_mode;
359 replacement->select_mode = part->select_mode;
360 replacement->multiline = part->multiline;
361 replacement->api = part->api;
362
363 edc->parts[k++] = replacement;
364
365 free(part);
366 }
367
368 edc->id = oedc->id;
369 edc->alias = oedc->alias;
370 edc->prop.min = oedc->prop.min;
371 edc->prop.max = oedc->prop.max;
372 edc->script = oedc->script;
373 edc->part = oedc->part;
374 edc->script_only = oedc->script_only;
375 edc->lua_script_only = oedc->lua_script_only;
376 edc->checked = oedc->checked;
377
378 free(oedc);
379
380 return edc;
381}
382
383Edje_Part_Description_Common*
384_edje_description_convert(int type,
385 Edje_Part_Collection_Directory_Entry *ce,
386 Old_Edje_Part_Description *oed)
387{
388 Edje_Part_Description_Common *result = NULL;
389
390 switch (type)
391 {
392 case EDJE_PART_TYPE_RECTANGLE:
393 result = eina_mempool_malloc(ce->mp.RECTANGLE,
394 sizeof (Edje_Part_Description_Common));
395 break;
396 case EDJE_PART_TYPE_SWALLOW:
397 result = eina_mempool_malloc(ce->mp.SWALLOW,
398 sizeof (Edje_Part_Description_Common));
399 break;
400 case EDJE_PART_TYPE_GROUP:
401 result = eina_mempool_malloc(ce->mp.GROUP,
402 sizeof (Edje_Part_Description_Common));
403 break;
404
405 case EDJE_PART_TYPE_IMAGE:
406 {
407 Edje_Part_Description_Image *img;
408 Edje_Part_Image_Id *id;
409 unsigned int i = 0;
410
411 img = eina_mempool_malloc(ce->mp.IMAGE, sizeof (Edje_Part_Description_Image));
412
413 img->image.tweens_count = eina_list_count(oed->image.tween_list);
414 img->image.tweens = calloc(img->image.tweens_count,
415 sizeof (Edje_Part_Image_Id*));
416 if (img->image.tweens_count > 0 && !img->image.tweens)
417 {
418 eina_mempool_free(ce->mp.IMAGE, img);
419 return NULL;
420 }
421
422 EINA_LIST_FREE(oed->image.tween_list, id)
423 img->image.tweens[i++] = id;
424
425 img->image.id = oed->image.id;
426 img->image.scale_hint = oed->image.scale_hint;
427 img->image.set = oed->image.set;
428
429 img->image.border = oed->image.border;
430 img->image.fill = oed->image.fill;
431
432 result = &img->common;
433 break;
434 }
435
436#define CONVERT_ALLOC_POOL(Short, Type, Name) \
437 case EDJE_PART_TYPE_##Short: \
438 { \
439 Edje_Part_Description_##Type *Name; \
440 \
441 Name = eina_mempool_malloc(ce->mp.Short, sizeof (Edje_Part_Description_##Type)); \
442 Name->Name = oed->Name; \
443 result = &Name->common; \
444 break; \
445 }
446
447 CONVERT_ALLOC_POOL(TEXT, Text, text);
448 CONVERT_ALLOC_POOL(TEXTBLOCK, Text, text);
449 CONVERT_ALLOC_POOL(BOX, Box, box);
450 CONVERT_ALLOC_POOL(TABLE, Table, table);
451 CONVERT_ALLOC_POOL(EXTERNAL, External, external_params);
452 }
453
454 if (result)
455 *result = oed->common;
456
457 free(oed);
458 return result;
459}
diff --git a/libraries/edje/src/bin/edje_convert.h b/libraries/edje/src/bin/edje_convert.h
deleted file mode 100644
index 0bbb38e..0000000
--- a/libraries/edje/src/bin/edje_convert.h
+++ /dev/null
@@ -1,154 +0,0 @@
1#ifndef EDJE_CONVERT_H__
2# define EDJE_CONVERT_H__
3
4
5typedef struct _Old_Edje_File Old_Edje_File;
6typedef struct _Old_Edje_Image_Directory Old_Edje_Image_Directory;
7typedef struct _Old_Edje_Font_Directory Old_Edje_Font_Directory;
8typedef struct _Old_Edje_External_Directory Old_Edje_External_Directory;
9typedef struct _Old_Edje_Part Old_Edje_Part;
10typedef struct _Old_Edje_Part_Collection Old_Edje_Part_Collection;
11typedef struct _Old_Edje_Part_Collection_Directory Old_Edje_Part_Collection_Directory;
12typedef struct _Old_Edje_Part_Description Old_Edje_Part_Description;
13typedef struct _Old_Edje_Part_Description_Spec_Image Old_Edje_Part_Description_Spec_Image;
14typedef struct _Old_Edje_Data Old_Edje_Data;
15
16struct _Old_Edje_Data
17{
18 const char *key;
19 char *value;
20};
21
22/*----------*/
23
24struct _Old_Edje_Font_Directory
25{
26 Eina_List *entries; /* a list of Edje_Font_Directory_Entry */
27};
28
29struct _Old_Edje_Image_Directory
30{
31 Eina_List *entries; /* a list of Edje_Image_Directory_Entry */
32 Eina_List *sets; /* a list of Edje_Image_Directory_Set */
33};
34
35struct _Old_Edje_External_Directory
36{
37 Eina_List *entries; /* a list of Edje_External_Directory_Entry */
38};
39
40struct _Old_Edje_File
41{
42 const char *path;
43 time_t mtime;
44
45 Old_Edje_External_Directory *external_dir;
46 Old_Edje_Font_Directory *font_dir;
47 Old_Edje_Image_Directory *image_dir;
48 Old_Edje_Part_Collection_Directory *collection_dir;
49 Eina_List *data;
50 Eina_List *styles;
51 Eina_List *color_classes;
52
53 const char *compiler;
54 int version;
55 int feature_ver;
56};
57
58struct _Old_Edje_Part_Collection
59{
60 Eina_List *programs; /* a list of Edje_Program */
61 Eina_List *parts; /* a list of Edje_Part */
62 Eina_List *data;
63
64 int id; /* the collection id */
65
66 Eina_Hash *alias; /* aliasing part*/
67
68 struct {
69 Edje_Size min, max;
70 } prop;
71
72 int references;
73#ifdef EDJE_PROGRAM_CACHE
74 struct {
75 Eina_Hash *no_matches;
76 Eina_Hash *matches;
77 } prog_cache;
78#endif
79
80 Embryo_Program *script; /* all the embryo script code for this group */
81 const char *part;
82
83 unsigned char script_only;
84
85 unsigned char lua_script_only;
86
87 unsigned char checked : 1;
88};
89
90struct _Old_Edje_Part
91{
92 const char *name; /* the name if any of the part */
93 Old_Edje_Part_Description *default_desc; /* the part descriptor for default */
94 Eina_List *other_desc; /* other possible descriptors */
95 const char *source, *source2, *source3, *source4, *source5, *source6;
96 int id; /* its id number */
97 int clip_to_id; /* the part id to clip this one to */
98 Edje_Part_Dragable dragable;
99 Eina_List *items; /* packed items for box and table */
100 unsigned char type; /* what type (image, rect, text) */
101 unsigned char effect; /* 0 = plain... */
102 unsigned char mouse_events; /* it will affect/respond to mouse events */
103 unsigned char repeat_events; /* it will repeat events to objects below */
104 Evas_Event_Flags ignore_flags;
105 unsigned char scale; /* should certain properties scale with edje scale factor? */
106 unsigned char precise_is_inside;
107 unsigned char use_alternate_font_metrics;
108 unsigned char pointer_mode;
109 unsigned char entry_mode;
110 unsigned char select_mode;
111 unsigned char multiline;
112 Edje_Part_Api api;
113};
114
115struct _Old_Edje_Part_Description_Spec_Image
116{
117 Eina_List *tween_list; /* list of Edje_Part_Image_Id */
118 int id; /* the image id to use */
119 int scale_hint; /* evas scale hint */
120 Eina_Bool set; /* if image condition it's content */
121
122 Edje_Part_Description_Spec_Border border;
123 Edje_Part_Description_Spec_Fill fill;
124};
125
126struct _Old_Edje_Part_Description
127{
128 Edje_Part_Description_Common common;
129 Old_Edje_Part_Description_Spec_Image image;
130 Edje_Part_Description_Spec_Text text;
131 Edje_Part_Description_Spec_Box box;
132 Edje_Part_Description_Spec_Table table;
133
134 Eina_List *external_params; /* parameters for external objects */
135};
136
137struct _Old_Edje_Part_Collection_Directory
138{
139 Eina_List *entries; /* a list of Edje_Part_Collection_Directory_Entry */
140
141 int references;
142};
143
144Edje_File *_edje_file_convert(Eet_File *ef, Old_Edje_File *oedf);
145Edje_Part_Collection *_edje_collection_convert(Eet_File *ef,
146 Edje_Part_Collection_Directory_Entry *ce,
147 Old_Edje_Part_Collection *oedc);
148Edje_Part_Description_Common *_edje_description_convert(int type,
149 Edje_Part_Collection_Directory_Entry *ce,
150 Old_Edje_Part_Description *oed);
151const Edje_File *_edje_file_get(void);
152void _edje_file_set(const Edje_File *edf);
153
154#endif
diff --git a/libraries/edje/src/bin/edje_data_convert.c b/libraries/edje/src/bin/edje_data_convert.c
deleted file mode 100644
index 5fb129e..0000000
--- a/libraries/edje/src/bin/edje_data_convert.c
+++ /dev/null
@@ -1,451 +0,0 @@
1#include "edje_private.h"
2#include "edje_convert.h"
3
4Eet_Data_Descriptor *_edje_edd_old_edje_file = NULL;
5Eet_Data_Descriptor *_edje_edd_old_edje_style = NULL;
6Eet_Data_Descriptor *_edje_edd_old_edje_style_tag = NULL;
7Eet_Data_Descriptor *_edje_edd_old_edje_color_class = NULL;
8Eet_Data_Descriptor *_edje_edd_old_edje_data = NULL;
9Eet_Data_Descriptor *_edje_edd_old_edje_external_directory = NULL;
10Eet_Data_Descriptor *_edje_edd_old_edje_external_directory_entry = NULL;
11Eet_Data_Descriptor *_edje_edd_old_edje_font_directory = NULL;
12Eet_Data_Descriptor *_edje_edd_old_edje_font_directory_entry = NULL;
13Eet_Data_Descriptor *_edje_edd_old_edje_image_directory = NULL;
14Eet_Data_Descriptor *_edje_edd_old_edje_image_directory_entry = NULL;
15Eet_Data_Descriptor *_edje_edd_old_edje_image_directory_set = NULL;
16Eet_Data_Descriptor *_edje_edd_old_edje_image_directory_set_entry = NULL;
17Eet_Data_Descriptor *_edje_edd_old_edje_program = NULL;
18Eet_Data_Descriptor *_edje_edd_old_edje_program_target = NULL;
19Eet_Data_Descriptor *_edje_edd_old_edje_program_after = NULL;
20Eet_Data_Descriptor *_edje_edd_old_edje_part_collection_directory = NULL;
21Eet_Data_Descriptor *_edje_edd_old_edje_part_collection_directory_entry = NULL;
22Eet_Data_Descriptor *_edje_edd_old_edje_pack_element = NULL;
23Eet_Data_Descriptor *_edje_edd_old_edje_part_collection = NULL;
24Eet_Data_Descriptor *_edje_edd_old_edje_part = NULL;
25Eet_Data_Descriptor *_edje_edd_old_edje_part_description = NULL;
26Eet_Data_Descriptor *_edje_edd_old_edje_part_image_id = NULL;
27Eet_Data_Descriptor *_edje_edd_old_edje_external_param = NULL;
28
29#define FREED(eed) \
30 if (eed) \
31 { \
32 eet_data_descriptor_free((eed)); \
33 (eed) = NULL; \
34 }
35
36void
37_edje_edd_old_shutdown(void)
38{
39 FREED(_edje_edd_old_edje_file);
40 FREED(_edje_edd_old_edje_style);
41 FREED(_edje_edd_old_edje_style_tag);
42 FREED(_edje_edd_old_edje_color_class);
43 FREED(_edje_edd_old_edje_data);
44 FREED(_edje_edd_old_edje_external_directory);
45 FREED(_edje_edd_old_edje_external_directory_entry);
46 FREED(_edje_edd_old_edje_font_directory);
47 FREED(_edje_edd_old_edje_font_directory_entry);
48 FREED(_edje_edd_old_edje_image_directory);
49 FREED(_edje_edd_old_edje_image_directory_entry);
50 FREED(_edje_edd_old_edje_program);
51 FREED(_edje_edd_old_edje_program_target);
52 FREED(_edje_edd_old_edje_program_after);
53 FREED(_edje_edd_old_edje_part_collection_directory);
54 FREED(_edje_edd_old_edje_part_collection_directory_entry);
55 FREED(_edje_edd_old_edje_pack_element);
56 FREED(_edje_edd_old_edje_part_collection);
57 FREED(_edje_edd_old_edje_part);
58 FREED(_edje_edd_old_edje_part_description);
59 FREED(_edje_edd_old_edje_part_image_id);
60 FREED(_edje_edd_old_edje_external_param);
61 FREED(_edje_edd_old_edje_image_directory_set);
62 FREED(_edje_edd_old_edje_image_directory_set_entry);
63}
64
65void
66_edje_edd_old_init(void)
67{
68 Eet_Data_Descriptor_Class eddc;
69
70 /* external directory */
71 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_External_Directory_Entry);
72 _edje_edd_old_edje_external_directory_entry =
73 eet_data_descriptor_file_new(&eddc);
74 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_external_directory_entry, Edje_External_Directory_Entry, "entry", entry, EET_T_STRING);
75
76 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
77 "Edje_External_Directory",
78 sizeof (Old_Edje_External_Directory));
79 _edje_edd_old_edje_external_directory =
80 eet_data_descriptor_file_new(&eddc);
81 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_external_directory, Edje_External_Directory, "entries", entries, _edje_edd_old_edje_external_directory_entry);
82
83 /* font directory */
84 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Font_Directory_Entry);
85 _edje_edd_old_edje_font_directory_entry =
86 eet_data_descriptor_file_new(&eddc);
87 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_font_directory_entry, Edje_Font_Directory_Entry, "entry", entry, EET_T_STRING);
88 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_font_directory_entry, Edje_Font_Directory_Entry, "file", file, EET_T_STRING);
89
90 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
91 "Edje_Font_Directory",
92 sizeof (Old_Edje_Font_Directory));
93 _edje_edd_old_edje_font_directory =
94 eet_data_descriptor_file_new(&eddc);
95 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_font_directory, Old_Edje_Font_Directory, "entries", entries, _edje_edd_old_edje_font_directory_entry);
96
97 /* image directory */
98 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory_Entry);
99 _edje_edd_old_edje_image_directory_entry =
100 eet_data_descriptor_file_new(&eddc);
101 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_entry, Edje_Image_Directory_Entry, "entry", entry, EET_T_STRING);
102 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_entry, Edje_Image_Directory_Entry, "source_type", source_type, EET_T_INT);
103 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_entry, Edje_Image_Directory_Entry, "source_param", source_param, EET_T_INT);
104 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_entry, Edje_Image_Directory_Entry, "id", id, EET_T_INT);
105
106 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory_Set_Entry);
107 _edje_edd_old_edje_image_directory_set_entry =
108 eet_data_descriptor_file_new(&eddc);
109 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "name", name, EET_T_STRING);
110 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "id", id, EET_T_INT);
111 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "min.w", size.min.w, EET_T_INT);
112 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "min.h", size.min.h, EET_T_INT);
113 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "max.w", size.max.w, EET_T_INT);
114 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "max.h", size.max.h, EET_T_INT);
115
116 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory_Set);
117 _edje_edd_old_edje_image_directory_set =
118 eet_data_descriptor_file_new(&eddc);
119 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set, Edje_Image_Directory_Set, "name", name, EET_T_STRING);
120 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set, Edje_Image_Directory_Set, "id", id, EET_T_INT);
121 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_image_directory_set, Edje_Image_Directory_Set, "entries", entries, _edje_edd_old_edje_image_directory_set_entry);
122
123 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
124 "Edje_Image_Directory",
125 sizeof (Old_Edje_Image_Directory));
126 _edje_edd_old_edje_image_directory =
127 eet_data_descriptor_file_new(&eddc);
128 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_image_directory, Old_Edje_Image_Directory, "entries", entries, _edje_edd_old_edje_image_directory_entry);
129 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_image_directory, Old_Edje_Image_Directory, "sets", sets, _edje_edd_old_edje_image_directory_set);
130
131 /* collection directory */
132 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Collection_Directory_Entry);
133 _edje_edd_old_edje_part_collection_directory_entry =
134 eet_data_descriptor_file_new(&eddc);
135 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "entry", entry, EET_T_STRING);
136 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "id", id, EET_T_INT);
137
138 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
139 "Edje_Part_Collection_Directory",
140 sizeof (Old_Edje_Part_Collection_Directory));
141 _edje_edd_old_edje_part_collection_directory =
142 eet_data_descriptor_file_new(&eddc);
143 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_collection_directory, Old_Edje_Part_Collection_Directory, "entries", entries, _edje_edd_old_edje_part_collection_directory_entry);
144
145 /* generic data attachment */
146 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
147 "Edje_Data", sizeof (Old_Edje_Data));
148 _edje_edd_old_edje_data =
149 eet_data_descriptor_file_new(&eddc);
150 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_data, Old_Edje_Data, "key", key, EET_T_STRING);
151 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_data, Old_Edje_Data, "value", value, EET_T_STRING);
152
153 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Style_Tag);
154 _edje_edd_old_edje_style_tag =
155 eet_data_descriptor_file_new(&eddc);
156 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_style_tag, Edje_Style_Tag, "key", key, EET_T_STRING);
157 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_style_tag, Edje_Style_Tag, "value", value, EET_T_STRING);
158
159 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Style);
160 _edje_edd_old_edje_style =
161 eet_data_descriptor_file_new(&eddc);
162 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_style, Edje_Style, "name", name, EET_T_STRING);
163 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_style, Edje_Style, "tags", tags, _edje_edd_old_edje_style_tag);
164
165 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Color_Class);
166 _edje_edd_old_edje_color_class =
167 eet_data_descriptor_file_new(&eddc);
168 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "name", name, EET_T_STRING);
169 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "r", r, EET_T_UCHAR);
170 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "g", g, EET_T_UCHAR);
171 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "b", b, EET_T_UCHAR);
172 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "a", a, EET_T_UCHAR);
173 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "r2", r2, EET_T_UCHAR);
174 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "g2", g2, EET_T_UCHAR);
175 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "b2", b2, EET_T_UCHAR);
176 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "a2", a2, EET_T_UCHAR);
177 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "r3", r3, EET_T_UCHAR);
178 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "g3", g3, EET_T_UCHAR);
179 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "b3", b3, EET_T_UCHAR);
180 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_color_class, Edje_Color_Class, "a3", a3, EET_T_UCHAR);
181
182 /* the main file directory */
183 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
184 "Edje_File", sizeof (Old_Edje_File));
185 _edje_edd_old_edje_file =
186 eet_data_descriptor_file_new(&eddc);
187 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_file, Old_Edje_File, "compiler", compiler, EET_T_STRING);
188 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_file, Old_Edje_File, "version", version, EET_T_INT);
189 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_file, Old_Edje_File, "feature_ver", feature_ver, EET_T_INT);
190 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_old_edje_file, Old_Edje_File, "external_dir", external_dir, _edje_edd_old_edje_external_directory);
191 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_old_edje_file, Old_Edje_File, "font_dir", font_dir, _edje_edd_old_edje_font_directory);
192 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_old_edje_file, Old_Edje_File, "image_dir", image_dir, _edje_edd_old_edje_image_directory);
193 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_old_edje_file, Old_Edje_File, "collection_dir", collection_dir, _edje_edd_old_edje_part_collection_directory);
194 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_file, Old_Edje_File, "data", data, _edje_edd_old_edje_data);
195 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_file, Old_Edje_File, "styles", styles, _edje_edd_old_edje_style);
196 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_file, Old_Edje_File, "color_classes", color_classes, _edje_edd_old_edje_color_class);
197
198 /* parts & programs - loaded induvidually */
199 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Program_Target);
200 _edje_edd_old_edje_program_target =
201 eet_data_descriptor_file_new(&eddc);
202 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program_target, Edje_Program_Target, "id", id, EET_T_INT);
203
204 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Program_After);
205 _edje_edd_old_edje_program_after =
206 eet_data_descriptor_file_new(&eddc);
207 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program_after,
208 Edje_Program_After, "id", id, EET_T_INT);
209
210 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Program);
211 _edje_edd_old_edje_program =
212 eet_data_descriptor_file_new(&eddc);
213 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "id", id, EET_T_INT);
214 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "name", name, EET_T_STRING);
215 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "signal", signal, EET_T_STRING);
216 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "source", source, EET_T_STRING);
217 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "filter_part", filter.part, EET_T_STRING);
218 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "filter_state", filter.state, EET_T_STRING);
219 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "in.from", in.from, EET_T_DOUBLE);
220 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "in.range", in.range, EET_T_DOUBLE);
221 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "action", action, EET_T_INT);
222 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "state", state, EET_T_STRING);
223 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "state2", state2, EET_T_STRING);
224 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "value", value, EET_T_DOUBLE);
225 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "value2", value2, EET_T_DOUBLE);
226 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "tween.mode", tween.mode, EET_T_INT);
227 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "tween.time", tween.time, EDJE_T_FLOAT);
228 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_program, Edje_Program, "targets", targets, _edje_edd_old_edje_program_target);
229 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_program, Edje_Program, "after", after, _edje_edd_old_edje_program_after);
230 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "api.name", api.name, EET_T_STRING);
231 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "api.description", api.description, EET_T_STRING);
232
233 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "param.src", param.src, EET_T_INT);
234 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_program, Edje_Program, "param.dst", param.dst, EET_T_INT);
235
236 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Image_Id);
237 _edje_edd_old_edje_part_image_id =
238 eet_data_descriptor_file_new(&eddc);
239 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_image_id, Edje_Part_Image_Id, "id", id, EET_T_INT);
240 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_image_id, Edje_Part_Image_Id, "set", set, EET_T_UCHAR);
241
242 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_External_Param);
243 _edje_edd_old_edje_external_param =
244 eet_data_descriptor_file_new(&eddc);
245 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_external_param, Edje_External_Param, "name", name, EET_T_STRING);
246 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_external_param, Edje_External_Param, "type", type, EET_T_INT);
247 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_external_param, Edje_External_Param, "i", i, EET_T_INT);
248 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_external_param, Edje_External_Param, "d", d, EET_T_DOUBLE);
249 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_external_param, Edje_External_Param, "s", s, EET_T_STRING);
250
251 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc), "Edje_Part_Description", sizeof (Old_Edje_Part_Description));
252 _edje_edd_old_edje_part_description =
253 eet_data_descriptor_file_new(&eddc);
254 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "state.name", common.state.name, EET_T_STRING);
255 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "state.value", common.state.value, EET_T_DOUBLE);
256 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "visible", common.visible, EET_T_CHAR);
257 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "align.x", common.align.x, EDJE_T_FLOAT);
258 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "align.y", common.align.y, EDJE_T_FLOAT);
259 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fixed.w", common.fixed.w, EET_T_UCHAR);
260 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fixed.h", common.fixed.h, EET_T_UCHAR);
261 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "min.w", common.min.w, EET_T_INT);
262 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "min.h", common.min.h, EET_T_INT);
263 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "max.w", common.max.w, EET_T_INT);
264 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "max.h", common.max.h, EET_T_INT);
265 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "step.x", common.step.x, EET_T_INT);
266 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "step.y", common.step.y, EET_T_INT);
267 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "aspect.min", common.aspect.min, EDJE_T_FLOAT);
268 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "aspect.max", common.aspect.max, EDJE_T_FLOAT);
269 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "aspect.prefer", common.aspect.prefer, EET_T_CHAR);
270 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel1.relative_x", common.rel1.relative_x, EDJE_T_FLOAT);
271 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel1.relative_y", common.rel1.relative_y, EDJE_T_FLOAT);
272 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel1.offset_x", common.rel1.offset_x, EET_T_INT);
273 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel1.offset_y", common.rel1.offset_y, EET_T_INT);
274 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel1.id_x", common.rel1.id_x, EET_T_INT);
275 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel1.id_y", common.rel1.id_y, EET_T_INT);
276 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel2.relative_x", common.rel2.relative_x, EDJE_T_FLOAT);
277 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel2.relative_y", common.rel2.relative_y, EDJE_T_FLOAT);
278 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel2.offset_x", common.rel2.offset_x, EET_T_INT);
279 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel2.offset_y", common.rel2.offset_y, EET_T_INT);
280 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel2.id_x", common.rel2.id_x, EET_T_INT);
281 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "rel2.id_y", common.rel2.id_y, EET_T_INT);
282 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "image.id", image.id, EET_T_INT);
283 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "image.set", image.set, EET_T_UCHAR);
284 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "image.tween_list", image.tween_list, _edje_edd_old_edje_part_image_id);
285
286 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "border.l", image.border.l, EET_T_INT);
287 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "border.r", image.border.r, EET_T_INT);
288 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "border.t", image.border.t, EET_T_INT);
289 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "border.b", image.border.b, EET_T_INT);
290 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "border.no_fill", image.border.no_fill, EET_T_UCHAR);
291 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "border.scale", image.border.scale, EET_T_UCHAR);
292 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.smooth", image.fill.smooth, EET_T_CHAR);
293 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.pos_rel_x", image.fill.pos_rel_x, EDJE_T_FLOAT);
294 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.pos_abs_x", image.fill.pos_abs_x, EET_T_INT);
295 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.rel_x", image.fill.rel_x, EDJE_T_FLOAT);
296 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.abs_x", image.fill.abs_x, EET_T_INT);
297 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.pos_rel_y", image.fill.pos_rel_y, EDJE_T_FLOAT);
298 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.pos_abs_y", image.fill.pos_abs_y, EET_T_INT);
299 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.rel_y", image.fill.rel_y, EDJE_T_FLOAT);
300 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.abs_y", image.fill.abs_y, EET_T_INT);
301 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.angle", image.fill.angle, EET_T_INT);
302 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.spread", image.fill.spread, EET_T_INT);
303 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "fill.type", image.fill.type, EET_T_CHAR);
304 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color_class", common.color_class, EET_T_STRING);
305 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color.r", common.color.r, EET_T_UCHAR);
306 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color.g", common.color.g, EET_T_UCHAR);
307 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color.b", common.color.b, EET_T_UCHAR);
308 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color.a", common.color.a, EET_T_UCHAR);
309 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color2.r", common.color2.r, EET_T_UCHAR);
310 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color2.g", common.color2.g, EET_T_UCHAR);
311 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color2.b", common.color2.b, EET_T_UCHAR);
312 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color2.a", common.color2.a, EET_T_UCHAR);
313 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color3.r", text.color3.r, EET_T_UCHAR);
314 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color3.g", text.color3.g, EET_T_UCHAR);
315 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color3.b", text.color3.b, EET_T_UCHAR);
316 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "color3.a", text.color3.a, EET_T_UCHAR);
317 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.text", text.text.str, EET_T_STRING);
318 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.text_class", text.text_class, EET_T_STRING);
319 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.style", text.style.str, EET_T_STRING);
320 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.font", text.font.str, EET_T_STRING);
321 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.repch", text.repch.str, EET_T_STRING);
322 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.size", text.size, EET_T_INT);
323 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.fit_x", text.fit_x, EET_T_UCHAR);
324 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.fit_y", text.fit_y, EET_T_UCHAR);
325 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.min_x", text.min_x, EET_T_UCHAR);
326 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.min_y", text.min_y, EET_T_UCHAR);
327 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.max_x", text.max_x, EET_T_UCHAR);
328 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.max_y", text.max_y, EET_T_UCHAR);
329 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.align.x", text.align.x, EDJE_T_FLOAT);
330 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.align.y", text.align.y, EDJE_T_FLOAT);
331 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.id_source", text.id_source, EET_T_INT);
332 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.id_text_source", text.id_text_source, EET_T_INT);
333 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "text.elipsis", text.elipsis, EET_T_DOUBLE);
334 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "box.layout", box.layout, EET_T_STRING);
335 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "box.alt_layout", box.alt_layout, EET_T_STRING);
336 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "box.align.x", box.align.x, EDJE_T_FLOAT);
337 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "box.align.y", box.align.y, EDJE_T_FLOAT);
338 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "box.padding.x", box.padding.x, EET_T_INT);
339 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "box.padding.y", box.padding.y, EET_T_INT);
340 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "box.min.h", box.min.h, EET_T_UCHAR);
341 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "box.min.v", box.min.v, EET_T_UCHAR);
342 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "table.homogeneous", table.homogeneous, EET_T_UCHAR);
343 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "table.align.x", table.align.x, EDJE_T_FLOAT);
344 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "table.align.y", table.align.y, EDJE_T_FLOAT);
345 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "table.padding.x", table.padding.x, EET_T_INT);
346 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "table.padding.y", table.padding.y, EET_T_INT);
347 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.id_persp", common.map.id_persp, EET_T_INT);
348 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.id_light", common.map.id_light, EET_T_INT);
349 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.rot.id_center", common.map.rot.id_center, EET_T_INT);
350 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.rot.x", common.map.rot.x, EDJE_T_FLOAT);
351 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.rot.y", common.map.rot.y, EDJE_T_FLOAT);
352 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.rot.z", common.map.rot.z, EDJE_T_FLOAT);
353 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.on", common.map.on, EET_T_UCHAR);
354 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.smooth", common.map.smooth, EET_T_UCHAR);
355 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.alpha", common.map.alpha, EET_T_UCHAR);
356 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.persp_on", common.map.persp_on, EET_T_UCHAR);
357 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "map.backcull", common.map.backcull, EET_T_UCHAR);
358 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "persp.zplane", common.persp.zplane, EET_T_INT);
359 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "persp.focal", common.persp.focal, EET_T_INT);
360 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_description, Old_Edje_Part_Description, "external_params", external_params, _edje_edd_old_edje_external_param);
361
362 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Pack_Element);
363 _edje_edd_old_edje_pack_element =
364 eet_data_descriptor_file_new(&eddc);
365 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "type", type, EET_T_UCHAR);
366 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "name", name, EET_T_STRING);
367 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "source", source, EET_T_STRING);
368 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "min.w", min.w, EET_T_INT);
369 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "min.h", min.h, EET_T_INT);
370 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "prefer.w", prefer.w, EET_T_INT);
371 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "prefer.h", prefer.h, EET_T_INT);
372 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "max.w", max.w, EET_T_INT);
373 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "max.h", max.h, EET_T_INT);
374 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "padding.l", padding.l, EET_T_INT);
375 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "padding.r", padding.r, EET_T_INT);
376 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "padding.t", padding.t, EET_T_INT);
377 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "padding.b", padding.b, EET_T_INT);
378 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "align.x", align.x, EDJE_T_FLOAT);
379 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "align.y", align.y, EDJE_T_FLOAT);
380 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "weight.x", weight.x, EDJE_T_FLOAT);
381 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "weight.y", weight.y, EDJE_T_FLOAT);
382 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "aspect.w", aspect.w, EET_T_INT);
383 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "aspect.h", aspect.h, EET_T_INT);
384 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "aspect.mode", aspect.mode, EET_T_UCHAR);
385 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "options", options, EET_T_STRING);
386 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "col", col, EET_T_INT);
387 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "row", row, EET_T_INT);
388 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "colspan", colspan, EET_T_USHORT);
389 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "rowspan", rowspan, EET_T_USHORT);
390
391 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc), "Edje_Part", sizeof (Old_Edje_Part));
392 _edje_edd_old_edje_part =
393 eet_data_descriptor_file_new(&eddc);
394 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "name", name, EET_T_STRING);
395 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "id", id, EET_T_INT);
396 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "type", type, EET_T_UCHAR);
397 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "effect", effect, EET_T_UCHAR);
398 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "mouse_events", mouse_events, EET_T_UCHAR);
399 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "repeat_events", repeat_events, EET_T_UCHAR);
400 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "ignore_flags", ignore_flags, EET_T_INT);
401 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "scale", scale, EET_T_UCHAR);
402 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "pointer_mode", pointer_mode, EET_T_UCHAR);
403 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "precise_is_inside", precise_is_inside, EET_T_UCHAR);
404 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "clip_to_id", clip_to_id, EET_T_INT);
405 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "use_alternate_font_metrics", use_alternate_font_metrics, EET_T_UCHAR);
406 EET_DATA_DESCRIPTOR_ADD_SUB(_edje_edd_old_edje_part, Old_Edje_Part, "default_desc", default_desc, _edje_edd_old_edje_part_description);
407 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part, Old_Edje_Part, "other_desc", other_desc, _edje_edd_old_edje_part_description);
408 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "dragable.x", dragable.x, EET_T_CHAR);
409 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "dragable.step_x", dragable.step_x, EET_T_INT);
410 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "dragable.count_x", dragable.count_x, EET_T_INT);
411 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "dragable.y", dragable.y, EET_T_CHAR);
412 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "dragable.step_y", dragable.step_y, EET_T_INT);
413 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "dragable.count_y", dragable.count_y, EET_T_INT);
414 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "dragable.counfine_id", dragable.confine_id, EET_T_INT);
415 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "dragable.events_id", dragable.event_id, EET_T_INT);
416 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "entry_mode", entry_mode, EET_T_UCHAR);
417 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "select_mode", select_mode, EET_T_UCHAR);
418 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "multiline", multiline, EET_T_UCHAR);
419 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source", source, EET_T_STRING);
420 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source2", source2, EET_T_STRING);
421 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source3", source3, EET_T_STRING);
422 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source4", source4, EET_T_STRING);
423 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source5", source5, EET_T_STRING);
424 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source6", source6, EET_T_STRING);
425 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part, Old_Edje_Part, "items", items, _edje_edd_old_edje_pack_element);
426 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "api.name", api.name, EET_T_STRING);
427 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "api.description", api.description, EET_T_STRING);
428
429 eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc), "Edje_Part_Collection", sizeof (Old_Edje_Part_Collection));
430 _edje_edd_old_edje_part_collection =
431 eet_data_descriptor_file_new(&eddc);
432 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "programs", programs, _edje_edd_old_edje_program);
433 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "parts", parts, _edje_edd_old_edje_part);
434 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "data", data, _edje_edd_old_edje_data);
435 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "prop.min.w", prop.min.w, EET_T_INT);
436 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "prop.min.h", prop.min.h, EET_T_INT);
437 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "prop.max.w", prop.max.w, EET_T_INT);
438 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "prop.max.h", prop.max.h, EET_T_INT);
439 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "id", id, EET_T_INT);
440 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "script_only", script_only, EET_T_UCHAR);
441 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "lua_script_only", lua_script_only, EET_T_UCHAR);
442
443 {
444 Old_Edje_Part_Collection epc;
445
446 eet_data_descriptor_element_add(_edje_edd_old_edje_part_collection,
447 "alias", EET_T_STRING, EET_G_HASH,
448 (char *)(&(epc.alias)) - (char *)(&(epc)),
449 0, /* 0, */NULL, NULL);
450 }
451}
diff --git a/libraries/edje/src/bin/edje_decc.c b/libraries/edje/src/bin/edje_decc.c
deleted file mode 100644
index ac776e9..0000000
--- a/libraries/edje/src/bin/edje_decc.c
+++ /dev/null
@@ -1,471 +0,0 @@
1/* ugly ugly. avert your eyes. */
2
3#ifdef HAVE_CONFIG_H
4# include <config.h>
5#endif
6
7#include <string.h>
8#include <ctype.h>
9#include <unistd.h>
10#include <locale.h>
11#include <sys/types.h>
12#include <sys/stat.h>
13#include <errno.h>
14
15
16#include <Ecore_File.h>
17#include <Ecore_Evas.h>
18
19#include "edje_decc.h"
20
21int _edje_cc_log_dom = -1;
22char *progname = NULL;
23char *file_in = NULL;
24char *file_out = NULL;
25
26Edje_File *edje_file = NULL;
27SrcFile_List *srcfiles = NULL;
28Font_List *fontlist = NULL;
29
30int line = 0;
31int build_sh = 1;
32int new_dir = 1;
33
34int decomp(void);
35void output(void);
36static int compiler_cmd_is_sane();
37static int root_filename_is_sane();
38
39static void
40main_help(void)
41{
42 printf
43 ("Usage:\n"
44 "\t%s input_file.edj [-main-out file.edc] [-no-build-sh] [-current-dir]\n"
45 "\n"
46 " -main-out\tCreate a symbolic link to the main edc \n"
47 " -no-build-sh\tDon't output build.sh \n"
48 " -current-dir\tOutput to current directory \n"
49 "\n"
50 ,progname);
51}
52
53Eet_File *ef;
54Eet_Dictionary *ed;
55
56int
57main(int argc, char **argv)
58{
59 int i;
60
61 setlocale(LC_NUMERIC, "C");
62 if (!eina_init())
63 exit(-1);
64 _edje_cc_log_dom = eina_log_domain_register
65 ("edje_decc", EDJE_CC_DEFAULT_LOG_COLOR);
66 if (_edje_cc_log_dom < 0)
67 {
68 EINA_LOG_ERR("Impossible to create a log domain.");
69 eina_shutdown();
70 exit(-1);
71 }
72 progname = argv[0];
73 for (i = 1; i < argc; i++)
74 {
75 if (!strcmp(argv[i], "-h"))
76 {
77 main_help();
78 exit(0);
79 }
80 if (!file_in)
81 file_in = argv[i];
82 else if ((!strcmp(argv[i], "-main-out")) && (i < (argc - 1)))
83 {
84 i++;
85 file_out = argv[i];
86 }
87 else if (!strcmp(argv[i], "-no-build-sh"))
88 build_sh = 0;
89 else if (!strcmp(argv[i], "-current-dir"))
90 new_dir = 0;
91 }
92 if (!file_in)
93 {
94 ERR("%s: Error: no input file specified.", progname);
95 main_help();
96 exit(-1);
97 }
98
99 if (!edje_init())
100 exit(-1);
101 source_edd();
102
103 if (!decomp()) return -1;
104 output();
105
106 fprintf(stderr, "WARNING! If any Image or audio data was encoded in a LOSSY way, then\n"
107 "re-encoding will drop quality even more. You need access to the original\n"
108 "data to ensure no loss of quality.\n");
109 eet_close(ef);
110 edje_shutdown();
111 eina_log_domain_unregister(_edje_cc_log_dom);
112 _edje_cc_log_dom = -1;
113 eina_shutdown();
114 return 0;
115}
116
117int
118decomp(void)
119{
120 ef = eet_open(file_in, EET_FILE_MODE_READ);
121 if (!ef)
122 {
123 ERR("ERROR: cannot open %s", file_in);
124 return 0;
125 }
126
127 srcfiles = source_load(ef);
128 if (!srcfiles || !srcfiles->list)
129 {
130 ERR("ERROR: %s has no decompile information", file_in);
131 eet_close(ef);
132 return 0;
133 }
134 if (!eina_list_data_get(srcfiles->list) || !root_filename_is_sane())
135 {
136 ERR("ERROR: Invalid root filename: '%s'", (char *) eina_list_data_get(srcfiles->list));
137 eet_close(ef);
138 return 0;
139 }
140 edje_file = eet_data_read(ef, _edje_edd_edje_file, "edje/file");
141 if (!edje_file)
142 {
143 ERR("ERROR: %s does not appear to be an edje file", file_in);
144 eet_close(ef);
145 return 0;
146 }
147 /* force compiler to be edje_cc */
148 edje_file->compiler = strdup("edje_cc");
149 if (!edje_file->compiler)
150 {
151 edje_file->compiler = strdup("edje_cc");
152 }
153 else if (!compiler_cmd_is_sane())
154 {
155 ERR("ERROR: invalid compiler executable: '%s'", edje_file->compiler);
156 eet_close(ef);
157 return 0;
158 }
159 fontlist = source_fontmap_load(ef);
160 return 1;
161}
162
163void
164output(void)
165{
166 Eina_List *l;
167 Eet_File *tef;
168 SrcFile *sf;
169 char *outdir, *p;
170
171 if (!new_dir)
172 outdir = strdup(".");
173 else
174 {
175 p = strrchr(file_in, '/');
176 if (p)
177 outdir = strdup(p + 1);
178 else
179 outdir = strdup(file_in);
180 p = strrchr(outdir, '.');
181 if (p) *p = 0;
182 ecore_file_mkpath(outdir);
183 }
184
185
186 tef = eet_open(file_in, EET_FILE_MODE_READ);
187
188 if (edje_file->image_dir)
189 {
190 Edje_Image_Directory_Entry *ei;
191 unsigned int i;
192
193 for (i = 0; i < edje_file->image_dir->entries_count; ++i)
194 {
195 ei = &edje_file->image_dir->entries[i];
196
197 if ((ei->source_type > EDJE_IMAGE_SOURCE_TYPE_NONE) &&
198 (ei->source_type < EDJE_IMAGE_SOURCE_TYPE_LAST) &&
199 (ei->source_type != EDJE_IMAGE_SOURCE_TYPE_EXTERNAL) &&
200 (ei->entry))
201 {
202 Ecore_Evas *ee;
203 Evas *evas;
204 Evas_Object *im;
205 char buf[4096];
206 char out[4096];
207 char *pp;
208
209 ecore_init();
210 ecore_evas_init();
211 ee = ecore_evas_buffer_new(1, 1);
212 if (!ee)
213 {
214 ERR("Cannot create buffer engine canvas for image save.");
215 exit(-1);
216 }
217 evas = ecore_evas_get(ee);
218 im = evas_object_image_add(evas);
219 if (!im)
220 {
221 ERR("Cannot create image object for save.");
222 exit(-1);
223 }
224 snprintf(buf, sizeof(buf), "edje/images/%i", ei->id);
225 evas_object_image_file_set(im, file_in, buf);
226 snprintf(out, sizeof(out), "%s/%s", outdir, ei->entry);
227 printf("Output Image: %s\n", out);
228 pp = strdup(out);
229 p = strrchr(pp, '/');
230 *p = 0;
231 if (strstr(pp, "../"))
232 {
233 ERR("Potential security violation. attempt to write in parent dir.");
234 exit(-1);
235 }
236 ecore_file_mkpath(pp);
237 free(pp);
238 if (!evas_object_image_save(im, out, NULL, "quality=100 compress=9"))
239 {
240 ERR("Cannot write file %s. Perhaps missing JPEG or PNG saver modules for Evas.", out);
241 exit(-1);
242 }
243 evas_object_del(im);
244 ecore_evas_free(ee);
245 ecore_evas_shutdown();
246 ecore_shutdown();
247 }
248 }
249 }
250
251 EINA_LIST_FOREACH(srcfiles->list, l, sf)
252 {
253 char out[4096];
254 FILE *f;
255 char *pp;
256
257 snprintf(out, sizeof(out), "%s/%s", outdir, sf->name);
258 INF("Output Source File: %s\n", out);
259 pp = strdup(out);
260 p = strrchr(pp, '/');
261 *p = 0;
262 if (strstr(pp, "../"))
263 {
264 ERR("Potential security violation. attempt to write in parent dir.");
265 exit (-1);
266 }
267 ecore_file_mkpath(pp);
268 free(pp);
269 if (strstr(out, "../"))
270 {
271 ERR("Potential security violation. attempt to write in parent dir.");
272 exit (-1);
273 }
274 f = fopen(out, "wb");
275 if (!f)
276 {
277 ERR("Unable to write file (%s).", out);
278 exit (-1);
279 }
280
281 /* if the file is empty, sf->file will be NULL.
282 * note that that's not an error
283 */
284 if (sf->file) fputs(sf->file, f);
285 fclose(f);
286 }
287 if (edje_file->fonts)
288 {
289 Edje_Font_Directory_Entry *fn;
290 Eina_Iterator *it;
291
292 it = eina_hash_iterator_data_new(edje_file->fonts);
293 EINA_ITERATOR_FOREACH(it, fn)
294 {
295 void *font;
296 int fontsize;
297 char out[4096];
298 /* FIXME!!!! */
299 /* should be fn->entry -v */
300 snprintf(out, sizeof(out), "edje/fonts/%s", fn->file);
301 font = eet_read(tef, out, &fontsize);
302 if (font)
303 {
304 FILE *f;
305 char *pp;
306
307 /* should be fn->file -v */
308 snprintf(out, sizeof(out), "%s/%s", outdir, fn->entry);
309 INF("Output Font: %s", out);
310 pp = strdup(out);
311 p = strrchr(pp, '/');
312 *p = 0;
313 if (strstr(pp, "../"))
314 {
315 ERR("Potential security violation. attempt to write in parent dir.");
316 exit (-1);
317 }
318 ecore_file_mkpath(pp);
319 free(pp);
320 if (strstr(out, "../"))
321 {
322 ERR("Potential security violation. attempt to write in parent dir.");
323 exit (-1);
324 }
325 if (!(f = fopen(out, "wb")))
326 {
327 ERR("Could not open file: %s", out);
328 exit (-1);
329 }
330 if (fwrite(font, fontsize, 1, f) != 1)
331 ERR("Could not write font: %s", strerror(errno));
332 if (f) fclose(f);
333 free(font);
334 }
335 }
336 eina_iterator_free(it);
337 }
338 {
339 char out[4096];
340 FILE *f;
341 sf = eina_list_data_get(srcfiles->list);
342
343
344 if (build_sh)
345 {
346 snprintf(out, sizeof(out), "%s/build.sh", outdir);
347 printf("Output Build Script: %s\n", out);
348 if (strstr(out, "../"))
349 {
350 ERR("potential security violation. attempt to write in parent dir.\n");
351 exit (-1);
352 }
353 f = fopen(out, "wb");
354 fprintf(f, "#!/bin/sh\n");
355 fprintf(f, "%s $@ -id . -fd . %s -o %s.edj\n", edje_file->compiler, sf->name, outdir);
356 fclose(f);
357
358 WRN("\n*** CAUTION ***\n"
359 "Please check the build script for anything malicious "
360 "before running it!\n\n");
361 }
362
363 if (file_out)
364 {
365 snprintf(out, sizeof(out), "%s/%s", outdir, file_out);
366 if (ecore_file_symlink(sf->name, out) != EINA_TRUE)
367 {
368 ERR("symlink %s -> %s failed\n", sf->name, out);
369 }
370 }
371
372 chmod(out, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP);
373
374 }
375
376 if (edje_file->sound_dir)
377 {
378 Edje_Sound_Sample *sample;
379 void *sound_data;
380 char out[PATH_MAX];
381 char out1[PATH_MAX];
382 char *pp;
383 int sound_data_size;
384 FILE *f;
385 int i;
386
387 for (i = 0; i < (int)edje_file->sound_dir->samples_count; i++)
388 {
389 sample = &edje_file->sound_dir->samples[i];
390 if ((!sample) || (!sample->name)) continue;
391 snprintf(out, sizeof(out), "edje/sounds/%i", sample->id);
392 sound_data = (void *)eet_read_direct(tef, out, &sound_data_size);
393 if (sound_data)
394 {
395 snprintf(out1, sizeof(out1), "%s/%s", outdir, sample->name);
396 pp = strdup(out1);
397 p = strrchr(pp, '/');
398 *p = 0;
399 if (strstr(pp, "../"))
400 {
401 ERR("Potential security violation. attempt to write in parent dir.");
402 exit(-1);
403 }
404 ecore_file_mkpath(pp);
405 free(pp);
406 if (strstr(out, "../"))
407 {
408 ERR("Potential security violation. attempt to write in parent dir.");
409 exit(-1);
410 }
411 f = fopen(out1, "wb");
412 if (fwrite(sound_data, sound_data_size, 1, f) != 1)
413 ERR("Could not write sound: %s", strerror(errno));
414 fclose(f);
415 free(sound_data);
416 }
417 }
418
419 }
420 eet_close(tef);
421}
422
423static int
424compiler_cmd_is_sane()
425{
426 const char *c = edje_file->compiler, *ptr;
427
428 if ((!c) || (!*c))
429 {
430 return 0;
431 }
432
433 for (ptr = c; ptr && *ptr; ptr++)
434 {
435 /* only allow [a-z][A-Z][0-9]_- */
436 if ((!isalnum(*ptr)) && (*ptr != '_') && (*ptr != '-'))
437 {
438 return 0;
439 }
440 }
441
442 return 1;
443}
444
445static int
446root_filename_is_sane()
447{
448 SrcFile *sf = eina_list_data_get(srcfiles->list);
449 char *f = sf->name, *ptr;
450
451 if (!f || !*f)
452 {
453 return 0;
454 }
455
456 for (ptr = f; ptr && *ptr; ptr++)
457 {
458 /* only allow [a-z][A-Z][0-9]_-./ */
459 switch (*ptr)
460 {
461 case '_': case '-': case '.': case '/':
462 break;
463 default:
464 if (!isalnum(*ptr))
465 {
466 return 0;
467 }
468 }
469 }
470 return 1;
471}
diff --git a/libraries/edje/src/bin/edje_decc.h b/libraries/edje/src/bin/edje_decc.h
deleted file mode 100644
index 43e988d..0000000
--- a/libraries/edje/src/bin/edje_decc.h
+++ /dev/null
@@ -1,61 +0,0 @@
1#ifndef EDJE_DECC_H
2#define EDJE_DECC_H
3
4#include <edje_private.h>
5
6/* logging variables */
7extern int _edje_cc_log_dom ;
8#define EDJE_CC_DEFAULT_LOG_COLOR EINA_COLOR_CYAN
9#ifdef ERR
10# undef ERR
11#endif
12#define ERR(...) EINA_LOG_DOM_ERR(_edje_cc_log_dom, __VA_ARGS__)
13#ifdef INF
14# undef INF
15#endif
16#define INF(...) EINA_LOG_DOM_INFO(_edje_cc_log_dom, __VA_ARGS__)
17#ifdef WRN
18# undef WRN
19#endif
20#define WRN(...) EINA_LOG_DOM_WARN(_edje_cc_log_dom, __VA_ARGS__)
21
22/* types */
23typedef struct _Font Font;
24typedef struct _Font_List Font_List;
25typedef struct _SrcFile SrcFile;
26typedef struct _SrcFile_List SrcFile_List;
27
28struct _Font
29{
30 char *file;
31 char *name;
32};
33
34struct _Font_List
35{
36 Eina_List *list;
37};
38
39struct _SrcFile
40{
41 char *name;
42 char *file;
43};
44
45struct _SrcFile_List
46{
47 Eina_List *list;
48};
49
50void source_edd(void);
51void source_fetch(void);
52int source_append(Eet_File *ef);
53SrcFile_List *source_load(Eet_File *ef);
54int source_fontmap_save(Eet_File *ef, Eina_List *fonts);
55Font_List *source_fontmap_load(Eet_File *ef);
56
57void *mem_alloc(size_t size);
58char *mem_strdup(const char *s);
59#define SZ sizeof
60
61#endif
diff --git a/libraries/edje/src/bin/edje_external_inspector.c b/libraries/edje/src/bin/edje_external_inspector.c
deleted file mode 100644
index 6bd9a35..0000000
--- a/libraries/edje/src/bin/edje_external_inspector.c
+++ /dev/null
@@ -1,663 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <locale.h>
6#include <fnmatch.h>
7
8#include <Ecore.h>
9#include <Ecore_Getopt.h>
10
11#include "Edje.h"
12
13static int _log_dom;
14#define DBG(...) EINA_LOG_DOM_DBG(_log_dom, __VA_ARGS__)
15#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
16#define WRN(...) EINA_LOG_DOM_WARN(_log_dom, __VA_ARGS__)
17#define ERR(...) EINA_LOG_DOM_ERR(_log_dom, __VA_ARGS__)
18#define CRIT(...) EINA_LOG_DOM_CRIT(_log_dom, __VA_ARGS__)
19
20#define INDENT " "
21#define INDENT2 INDENT INDENT
22#define INDENT3 INDENT2 INDENT
23#define INDENT4 INDENT3 INDENT
24
25static char *module_patterns_str = NULL;
26
27static int detail = 1;
28static Eina_Bool machine = EINA_FALSE;
29static char *type_glob = NULL;
30static char * const *module_patterns;
31static const Eina_List *modules;
32
33
34static char *
35_module_patterns_str_new(void)
36{
37 Eina_Strbuf *buf;
38 char * const *itr;
39 char *ret;
40 if (!module_patterns) return strdup("*");
41
42 buf = eina_strbuf_new();
43 for (itr = module_patterns; *itr != NULL; itr++)
44 {
45 eina_strbuf_append(buf, *itr);
46 if (itr[1]) eina_strbuf_append(buf, ", ");
47 }
48 ret = eina_strbuf_string_steal(buf);
49 eina_strbuf_free(buf);
50 return ret;
51}
52
53static Eina_Bool
54module_matches(const char *name)
55{
56 char * const *itr;
57 if (!module_patterns) return EINA_TRUE;
58
59 for (itr = module_patterns; *itr != NULL; itr++)
60 if (fnmatch(*itr, name, 0) == 0) return EINA_TRUE;
61
62 return EINA_FALSE;
63}
64
65static inline Eina_Bool
66type_matches(const char *name)
67{
68 if (!type_glob) return EINA_TRUE;
69 return fnmatch(type_glob, name, 0) == 0;
70}
71
72static int
73_types_sort(const void *pa, const void *pb)
74{
75 const Eina_Hash_Tuple *ha = pa, *hb = pb;
76 const Edje_External_Type *ta = ha->data, *tb = hb->data;
77 const char *na = ha->key, *nb = hb->key;
78 int r;
79
80 if (!ta->module) return -1;
81 if (!tb->module) return 1;
82 r = strcmp(ta->module, tb->module);
83 if (r != 0) return r;
84
85 if (!na) return -1;
86 if (!nb) return 1;
87 return strcmp(na, nb);
88}
89
90static const char *
91_param_type_str_get(const Edje_External_Param_Info *param)
92{
93 switch (param->type)
94 {
95 case EDJE_EXTERNAL_PARAM_TYPE_INT: return "int";
96 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: return "double";
97 case EDJE_EXTERNAL_PARAM_TYPE_STRING: return "string";
98 case EDJE_EXTERNAL_PARAM_TYPE_BOOL: return "bool";
99 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: return "choice";
100 default:
101 ERR("Unknown parameter type %d", param->type);
102 return "???";
103 }
104}
105
106static const char *
107_param_value_str_get(const Edje_External_Type *type, const Edje_External_Param_Info *param, char *buf, size_t buflen)
108{
109 switch (param->type)
110 {
111 case EDJE_EXTERNAL_PARAM_TYPE_INT:
112 if (param->info.i.def == EDJE_EXTERNAL_INT_UNSET) return NULL;
113 snprintf(buf, buflen, "%d", param->info.i.def);
114 return buf;
115
116 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
117 if (param->info.d.def == EDJE_EXTERNAL_DOUBLE_UNSET) return NULL;
118 snprintf(buf, buflen, "%g", param->info.d.def);
119 return buf;
120
121 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
122 return param->info.s.def;
123
124 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
125 if (param->info.b.def == 0) return "0";
126 else if (param->info.b.def == 1) return "1";
127 return NULL;
128
129 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
130 {
131 char *def;
132 if (param->info.c.def) return param->info.c.def;
133 if (!param->info.c.def_get) return NULL;
134 def = param->info.c.def_get(type->data, param);
135 if (!def) return NULL;
136 eina_strlcpy(buf, def, buflen);
137 free(def);
138 return buf;
139 }
140
141 default:
142 ERR("Unknown parameter type %d", param->type);
143 return NULL;
144 }
145}
146
147static const char *
148_param_flags_str_get(const Edje_External_Param_Info *param)
149{
150 static char buf[] = "GET|SET|STATE|CONSTRUCTOR";
151
152 if (param->flags == EDJE_EXTERNAL_PARAM_FLAGS_NONE) return "NONE";
153 if (param->flags == EDJE_EXTERNAL_PARAM_FLAGS_REGULAR) return "REGULAR";
154
155 buf[0] = '\0';
156
157 if (param->flags & EDJE_EXTERNAL_PARAM_FLAGS_GET)
158 strcat(buf, "GET");
159
160 if (param->flags & EDJE_EXTERNAL_PARAM_FLAGS_SET)
161 {
162 if (buf[0] != '\0') strcat(buf, "|");
163 strcat(buf, "SET");
164 }
165
166 if (param->flags & EDJE_EXTERNAL_PARAM_FLAGS_STATE)
167 {
168 if (buf[0] != '\0') strcat(buf, "|");
169 strcat(buf, "STATE");
170 }
171
172 if (param->flags & EDJE_EXTERNAL_PARAM_FLAGS_CONSTRUCTOR)
173 {
174 if (buf[0] != '\0') strcat(buf, "|");
175 strcat(buf, "CONSTRUCTOR");
176 }
177
178 return buf;
179}
180
181static void
182_param_choices_print(const char * const *choices)
183{
184 if (machine) puts("CHOICES-BEGIN");
185 else fputs(", choices:", stdout);
186 for (; *choices != NULL; choices++)
187 {
188 if (machine) puts(*choices);
189 else printf(" \"%s\"", *choices);
190 }
191 if (machine) puts("CHOICES-END");
192}
193
194static void
195_param_extra_details(const Edje_External_Type *type, const Edje_External_Param_Info *param)
196{
197 const char *str = _param_flags_str_get(param);
198 if (machine) printf("FLAGS: %s\n", str);
199 else printf(" /* flags: %s", str);
200
201 switch (param->type)
202 {
203 case EDJE_EXTERNAL_PARAM_TYPE_INT:
204 if (param->info.i.min != EDJE_EXTERNAL_INT_UNSET)
205 {
206 if (machine) printf("MIN: %d\n", param->info.i.min);
207 else printf(", min: %d", param->info.i.min);
208 }
209 if (param->info.i.max != EDJE_EXTERNAL_INT_UNSET)
210 {
211 if (machine) printf("MAX: %d\n", param->info.i.max);
212 else printf(", max: %d", param->info.i.max);
213 }
214 if (param->info.i.step != EDJE_EXTERNAL_INT_UNSET)
215 {
216 if (machine) printf("STEP: %d\n", param->info.i.step);
217 else printf(", step: %d", param->info.i.step);
218 }
219 break;
220
221 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
222 if (param->info.d.min != EDJE_EXTERNAL_DOUBLE_UNSET)
223 {
224 if (machine) printf("MIN: %g\n", param->info.d.min);
225 else printf(", min: %g", param->info.d.min);
226 }
227 if (param->info.d.max != EDJE_EXTERNAL_DOUBLE_UNSET)
228 {
229 if (machine) printf("MAX: %g\n", param->info.d.max);
230 else printf(", max: %g", param->info.d.max);
231 }
232 if (param->info.d.step != EDJE_EXTERNAL_DOUBLE_UNSET)
233 {
234 if (machine) printf("STEP: %g\n", param->info.d.step);
235 else printf(", step: %g", param->info.d.step);
236 }
237 break;
238
239 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
240 if (param->info.s.accept_fmt)
241 {
242 if (machine) printf("ACCEPT_FMT: %s\n", param->info.s.accept_fmt);
243 else printf(", accept_fmt: \"%s\"", param->info.s.accept_fmt);
244 }
245 if (param->info.s.deny_fmt)
246 {
247 if (machine) printf("DENY_FMT: %s\n", param->info.s.deny_fmt);
248 else printf(", deny_fmt: \"%s\"", param->info.s.deny_fmt);
249 }
250 break;
251
252 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
253 if (param->info.b.false_str)
254 {
255 if (machine) printf("FALSE_STR: %s\n", param->info.b.false_str);
256 else printf(", false_str: \"%s\"", param->info.b.false_str);
257 }
258 if (param->info.b.true_str)
259 {
260 if (machine) printf("TRUE_STR: %s\n", param->info.b.true_str);
261 else printf(", true_str: \"%s\"", param->info.b.true_str);
262 }
263 break;
264
265 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
266 {
267 if (param->info.c.choices)
268 _param_choices_print(param->info.c.choices);
269 else if (param->info.c.query)
270 {
271 char **choices = param->info.c.query(type->data, param);
272 if (choices)
273 {
274 char **itr;
275 _param_choices_print((const char * const*)choices);
276 for (itr = choices; *itr; itr++) free(*itr);
277 free(choices);
278 }
279 }
280 }
281 break;
282
283 default:
284 ERR("Unknown parameter type %d", param->type);
285 }
286
287 if (!machine) fputs(" */", stdout); /* \n not desired */
288}
289
290static int
291_info_list(void)
292{
293 Eina_Iterator *itr;
294 Eina_List *types;
295 const Eina_Hash_Tuple *tuple;
296 const Eina_List *l;
297 const char *name, *last_module;
298 Eina_Bool module_found = EINA_FALSE, type_found = EINA_FALSE;
299 Eina_Bool in_module = EINA_FALSE;
300
301 EINA_LIST_FOREACH(modules, l, name)
302 {
303 if (!module_matches(name))
304 {
305 DBG("filter out module '%s': does not match '%s'",
306 name, module_patterns_str);
307 continue;
308 }
309
310 if (!edje_module_load(name))
311 {
312 ERR("error loading external '%s'", name);
313 continue;
314 }
315
316 module_found = EINA_TRUE;
317 }
318
319 itr = edje_external_iterator_get();
320 types = NULL;
321 EINA_ITERATOR_FOREACH(itr, tuple)
322 {
323 const Edje_External_Type *type = tuple->data;
324 name = tuple->key;
325
326 if (!type)
327 {
328 ERR("no type value for '%s'", name);
329 continue;
330 }
331 else if (type->abi_version != edje_external_type_abi_version_get())
332 {
333 ERR("type '%s' with incorrect abi_version %u (expected %u)",
334 name, type->abi_version, edje_external_type_abi_version_get());
335 continue;
336 }
337
338 if (!type_matches(name))
339 {
340 DBG("filter out type '%s': does not match '%s'", name, type_glob);
341 continue;
342 }
343
344 types = eina_list_append(types, tuple);
345 type_found = EINA_TRUE;
346 }
347 eina_iterator_free(itr);
348
349 last_module = NULL;
350 types = eina_list_sort(types, 0, _types_sort);
351 EINA_LIST_FREE(types, tuple)
352 {
353 Eina_Bool changed_module = EINA_FALSE;
354 const Edje_External_Type *type = tuple->data;
355 const Edje_External_Param_Info *param;
356 name = tuple->key;
357
358 if ((last_module) && (type->module))
359 {
360 changed_module = ((last_module != type->module) &&
361 (!strcmp(last_module, type->module)));
362 }
363 else if ((!last_module) && (type->module))
364 changed_module = EINA_TRUE;
365
366 if (changed_module)
367 {
368 if (in_module)
369 {
370 if (machine) puts("TYPES-END\nMODULE-END");
371 else puts(INDENT "}\n}");
372 }
373
374 if (machine)
375 printf("MODULE-BEGIN\n"
376 "NAME: %s\n"
377 "FRIENDLY-NAME: %s\n"
378 "TYPES-BEGIN\n",
379 type->module, type->module_name);
380 else
381 printf("module {\n"
382 INDENT "name: \"%s\";\n"
383 INDENT "friendly_name: \"%s\";\n"
384 INDENT "types {\n",
385 type->module, type->module_name);
386
387 in_module = EINA_TRUE;
388 }
389
390 if (machine) printf("TYPE-BEGIN\nNAME: %s\n", name);
391 else printf(INDENT2 "type {\n" INDENT3 "name: \"%s\";\n", name);
392
393 if (detail > 1)
394 {
395 const char *str;
396
397 if (!type->label_get) str = NULL;
398 else str = type->label_get(type->data);
399 if (machine) printf("LABEL: %s\n", str ? str : "");
400 else if (str) printf(INDENT3 "label: \"%s\";\n", str);
401
402 if (!type->description_get) str = NULL;
403 else str = type->description_get(type->data);
404 if (machine) printf("DESCRIPTION: %s\n", str ? str : "");
405 else if (str) printf(INDENT3 "description: \"%s\";\n", str);
406 }
407
408 if (machine) puts("PARAMS-BEGIN");
409 else puts(INDENT3 "params {");
410
411 for (param = type->parameters_info; param->name != NULL; param++)
412 {
413 const char *pt = _param_type_str_get(param);
414 char buf[128];
415
416 if (machine)
417 printf("PARAM-BEGIN\nNAME: %s\nTYPE: %s\n", param->name, pt);
418 else printf(INDENT4 "%s: \"%s\"", pt, param->name);
419
420 if (detail > 0)
421 {
422 const char *str = _param_value_str_get
423 (type, param, buf, sizeof(buf));
424 if (machine) printf("DEFAULT: %s\n", str ? str : "");
425 else if (str) printf(" \"%s\"", str);
426
427 if (detail > 1)
428 {
429 if (!machine) putchar(';');
430 _param_extra_details(type, param);
431 }
432 }
433
434 if (machine) puts("PARAM-END");
435 else if (detail > 1) putchar('\n');
436 else puts(";");
437 }
438
439 if (machine) puts("PARAMS-END\nTYPE-END");
440 else puts(INDENT3 "}\n" INDENT2 "}");
441
442 last_module = type->module;
443 }
444
445 if (in_module)
446 {
447 if (machine) puts("MODULE-END");
448 else puts(INDENT "}\n}");
449 }
450
451 if (!module_found) WRN("no modules match '%s'", module_patterns_str);
452 if (!type_found) WRN("no types match '%s'", type_glob);
453 return (!module_found) || (!type_found);
454}
455
456static int
457_types_names_list(void)
458{
459 Eina_Iterator *itr;
460 Eina_List *types;
461 const Eina_Hash_Tuple *tuple;
462 const Eina_List *l;
463 const char *name;
464 Eina_Bool module_found = EINA_FALSE, type_found = EINA_FALSE;
465
466 EINA_LIST_FOREACH(modules, l, name)
467 {
468 if (!module_matches(name))
469 {
470 DBG("filter out module '%s': does not match '%s'",
471 name, module_patterns_str);
472 continue;
473 }
474
475 if (!edje_module_load(name))
476 {
477 ERR("error loading external '%s'", name);
478 continue;
479 }
480
481 module_found = EINA_TRUE;
482 }
483
484 itr = edje_external_iterator_get();
485 types = NULL;
486 EINA_ITERATOR_FOREACH(itr, tuple)
487 {
488 const Edje_External_Type *type = tuple->data;
489 name = tuple->key;
490
491 if (!type)
492 {
493 ERR("no type value for '%s'", name);
494 continue;
495 }
496 else if (type->abi_version != edje_external_type_abi_version_get())
497 {
498 ERR("type '%s' with incorrect abi_version %u (expected %u)",
499 name, type->abi_version, edje_external_type_abi_version_get());
500 continue;
501 }
502
503 if (!type_matches(name))
504 {
505 DBG("filter out type '%s': does not match '%s'", name, type_glob);
506 continue;
507 }
508
509 types = eina_list_append(types, tuple);
510 type_found = EINA_TRUE;
511 }
512 eina_iterator_free(itr);
513
514 types = eina_list_sort(types, 0, _types_sort);
515 EINA_LIST_FREE(types, tuple)
516 puts(tuple->key);
517
518 if (!module_found) WRN("no modules match '%s'", module_patterns_str);
519 if (!type_found) WRN("no types match '%s'", type_glob);
520 return (!module_found) || (!type_found);
521}
522
523static int
524_modules_names_list(void)
525{
526 const Eina_List *l;
527 const char *name;
528 Eina_Bool found = EINA_FALSE;
529
530 EINA_LIST_FOREACH(modules, l, name)
531 {
532 if (!module_matches(name))
533 {
534 DBG("filter out module '%s': does not match '%s'",
535 name, module_patterns_str);
536 continue;
537 }
538 found = EINA_TRUE;
539 puts(name);
540 }
541
542 if (!found) WRN("no modules match '%s'", module_patterns_str);
543 return !found;
544}
545
546static const char *mode_choices[] = {
547 "info",
548 "modules-names",
549 "types-names",
550 NULL,
551};
552
553static const char *detail_choices[] = {
554 "none",
555 "terse",
556 "all",
557 NULL
558};
559
560const Ecore_Getopt optdesc = {
561 "edje_external_inspector",
562 "%prog [options] [module|module-glob] ... [module|module-glob]",
563 PACKAGE_VERSION,
564 "(C) 2010 - The Enlightenment Project",
565 "BSD",
566 "Edje external module inspector.",
567 0,
568 {
569 ECORE_GETOPT_CHOICE('m', "mode", "Choose which mode to operate.",
570 mode_choices),
571 ECORE_GETOPT_STORE_STR('t', "type", "Limit output to type (or glob)."),
572 ECORE_GETOPT_CHOICE('d', "detail", "Choose detail level (default=terse)",
573 detail_choices),
574 ECORE_GETOPT_STORE_TRUE('M', "machine", "Produce machine readable output."),
575 ECORE_GETOPT_LICENSE('L', "license"),
576 ECORE_GETOPT_COPYRIGHT('C', "copyright"),
577 ECORE_GETOPT_VERSION('V', "version"),
578 ECORE_GETOPT_HELP('h', "help"),
579 ECORE_GETOPT_SENTINEL
580 }
581};
582
583int
584main(int argc, char **argv)
585{
586 Eina_Bool quit_option = EINA_FALSE;
587 char *mode = NULL;
588 char *detail_name = NULL;
589 int arg_index;
590 int ret = 0;
591 Ecore_Getopt_Value values[] = {
592 ECORE_GETOPT_VALUE_STR(mode),
593 ECORE_GETOPT_VALUE_STR(type_glob),
594 ECORE_GETOPT_VALUE_STR(detail_name),
595 ECORE_GETOPT_VALUE_BOOL(machine),
596 ECORE_GETOPT_VALUE_BOOL(quit_option),
597 ECORE_GETOPT_VALUE_BOOL(quit_option),
598 ECORE_GETOPT_VALUE_BOOL(quit_option),
599 ECORE_GETOPT_VALUE_BOOL(quit_option),
600 ECORE_GETOPT_VALUE_NONE
601 };
602
603 setlocale(LC_NUMERIC, "C");
604
605 ecore_init();
606 eina_init();
607 edje_init();
608
609 _log_dom = eina_log_domain_register
610 ("edje_external_inspector", EINA_COLOR_YELLOW);
611 if (_log_dom < 0)
612 {
613 EINA_LOG_CRIT
614 ("could not register log domain 'edje_external_inspector'");
615 ret = 1;
616 goto error_log;
617 }
618
619 arg_index = ecore_getopt_parse(&optdesc, values, argc, argv);
620 if (arg_index < 0)
621 {
622 ERR("could not parse arguments.");
623 ret = 1;
624 goto error_getopt;
625 }
626 else if (quit_option) goto error_getopt;
627
628 if (!mode) mode = (char *)mode_choices[0];
629
630 if (detail_name)
631 {
632 if (!strcmp(detail_name, "none")) detail = 0;
633 else if (!strcmp(detail_name, "terse")) detail = 1;
634 else if (!strcmp(detail_name, "all")) detail = 2;
635 else ERR("Unknown detail level: '%s'", detail_name);
636 }
637
638 if (arg_index < argc) module_patterns = argv + arg_index;
639 else module_patterns = NULL;
640
641 modules = edje_available_modules_get();
642 module_patterns_str = _module_patterns_str_new();
643
644 if (!strcmp(mode, "info")) ret = _info_list();
645 else if (!strcmp(mode, "modules-names")) ret = _modules_names_list();
646 else if (!strcmp(mode, "types-names")) ret = _types_names_list();
647 else
648 {
649 ERR("Unknown mode: %s", mode);
650 ret = 1;
651 }
652
653 free(module_patterns_str);
654
655 error_getopt:
656 eina_log_domain_unregister(_log_dom);
657 error_log:
658 edje_shutdown();
659 ecore_shutdown();
660 eina_shutdown();
661
662 return ret;
663}
diff --git a/libraries/edje/src/bin/edje_inspector.c b/libraries/edje/src/bin/edje_inspector.c
deleted file mode 100644
index 676c829..0000000
--- a/libraries/edje/src/bin/edje_inspector.c
+++ /dev/null
@@ -1,1633 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include "Edje.h"
6#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT 1
7#include "Edje_Edit.h"
8
9#include <Ecore.h>
10#include <Ecore_Evas.h>
11#include <Ecore_Getopt.h>
12#include <locale.h>
13#include <fnmatch.h>
14#include <unistd.h>
15
16static int _log_dom;
17#define DBG(...) EINA_LOG_DOM_DBG(_log_dom, __VA_ARGS__)
18#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
19#define WRN(...) EINA_LOG_DOM_WARN(_log_dom, __VA_ARGS__)
20#define ERR(...) EINA_LOG_DOM_ERR(_log_dom, __VA_ARGS__)
21#define CRIT(...) EINA_LOG_DOM_CRIT(_log_dom, __VA_ARGS__)
22
23#define INDENT " "
24#define INDENT2 INDENT INDENT
25#define INDENT3 INDENT2 INDENT
26#define INDENT4 INDENT3 INDENT
27#define INDENT5 INDENT4 INDENT
28#define INDENT6 INDENT5 INDENT
29#define INDENT7 INDENT6 INDENT
30
31#define FLOAT_PRECISION 0.0001
32#define FDIFF(a, b) (fabs((a) - (b)) > FLOAT_PRECISION)
33
34/* context */
35static Eina_List *groups;
36static Ecore_Evas *ee;
37
38/* options */
39static const char *file;
40static char *group = NULL;
41static char *part = NULL;
42static char *program = NULL;
43static int detail = 1;
44static Eina_Bool api_only = EINA_FALSE;
45static Eina_Bool api_fix = EINA_FALSE;
46static Eina_Bool machine = EINA_FALSE;
47
48static const char *mode_choices[] = {
49 "groups",
50 "parts",
51 "programs",
52 "groups-names",
53 "part-names",
54 "global-data",
55 "images",
56 "fonts",
57 "externals",
58 NULL,
59};
60
61static const char *detail_choices[] = {
62 "none",
63 "terse",
64 "all",
65 NULL
66};
67
68const Ecore_Getopt optdesc = {
69 "edje_inspector",
70 "%prog [options] <file.edj>",
71 PACKAGE_VERSION,
72 "(C) 2010 - The Enlightenment Project",
73 "BSD",
74 "Edje file inspector, let one see groups, parts, programs and other details "
75 "of a compiled (binary) edje file.\n",
76 0,
77 {
78 ECORE_GETOPT_CHOICE('m', "mode", "Choose which mode to operate on file.",
79 mode_choices),
80 ECORE_GETOPT_CHOICE('d', "detail", "Choose detail level (default=terse)",
81 detail_choices),
82 ECORE_GETOPT_STORE_STR('g', "group", "Limit output to group (or glob)."),
83 ECORE_GETOPT_STORE_STR('p', "part", "Limit output to part (or glob)."),
84 ECORE_GETOPT_STORE_STR('r', "program",
85 "Limit output to program (or glob)."),
86 ECORE_GETOPT_STORE_TRUE('a', "api-only", "Limit to just api parts or "
87 "programs."),
88 ECORE_GETOPT_STORE_TRUE('A', "api-fix", "Fix API names to be C compliant."),
89 ECORE_GETOPT_STORE_TRUE('M', "machine", "Produce machine readable output."),
90 ECORE_GETOPT_LICENSE('L', "license"),
91 ECORE_GETOPT_COPYRIGHT('C', "copyright"),
92 ECORE_GETOPT_VERSION('V', "version"),
93 ECORE_GETOPT_HELP('h', "help"),
94 ECORE_GETOPT_SENTINEL
95 }
96};
97
98static inline Eina_Bool
99matches(const char *name, const char *pattern)
100{
101 if (!pattern) return EINA_TRUE;
102 return fnmatch(pattern, name, 0) == 0;
103}
104
105static void
106group_begin(const char *name)
107{
108 if (machine) printf("GROUP-BEGIN\nNAME: %s\n", name);
109 else printf("group { name: '%s';\n", name);
110}
111
112static void
113group_end(void)
114{
115 if (machine) puts("GROUP-END");
116 else puts("}");
117}
118
119static void
120group_details(Evas_Object *ed)
121{
122 int w, h;
123
124 if (detail < 1) return;
125
126 if (machine) puts("GROUP-DETAILS-BEGIN");
127
128 w = edje_edit_group_min_w_get(ed);
129 h = edje_edit_group_min_h_get(ed);
130 if (machine) printf("MIN-W: %d\nMIN-H: %d\n", w, h);
131 else if ((w > 0) || (h > 0)) printf(INDENT "min: %d %d;\n", w, h);
132
133 w = edje_edit_group_max_w_get(ed);
134 h = edje_edit_group_max_h_get(ed);
135 if (machine) printf("MAX-W: %d\nMAX-H: %d\n", w, h);
136 else if ((w > 0) || (h > 0)) printf(INDENT "max: %d %d;\n", w, h);
137
138 if (detail > 1)
139 {
140 Eina_List *dl;
141 dl = edje_edit_group_data_list_get(ed);
142 if (dl)
143 {
144 Eina_List *l;
145 const char *k;
146 if (machine) puts(INDENT "GROUP-DETAILS-DATA-BEGIN");
147 else puts(INDENT "data {");
148
149 EINA_LIST_FOREACH(dl, l, k)
150 {
151 const char *v = edje_edit_group_data_value_get(ed, k);
152 if (machine) printf("ITEM: \"%s\" \"%s\"\n", k, v);
153 else printf(INDENT2 "item: \"%s\" \"%s\";\n", k, v);
154 }
155
156 edje_edit_string_list_free(dl);
157
158 if (machine) puts(INDENT "GROUP-DETAILS-DATA-END");
159 else puts(INDENT "}");
160 }
161 }
162
163 if (machine) puts("GROUP-DETAILS-END");
164}
165
166static void
167parts_begin(void)
168{
169 if (machine) puts("PARTS-BEGIN");
170 else puts(INDENT "parts {");
171}
172
173static void
174parts_end(void)
175{
176 if (machine) puts("PARTS-END");
177 else puts(INDENT "}");
178}
179
180static const char *
181part_type_name_get(Edje_Part_Type t)
182{
183 switch (t)
184 {
185 case EDJE_PART_TYPE_RECTANGLE:
186 return "RECT";
187 case EDJE_PART_TYPE_TEXT:
188 return "TEXT";
189 case EDJE_PART_TYPE_IMAGE:
190 return "IMAGE";
191 case EDJE_PART_TYPE_PROXY:
192 return "PROXY";
193 case EDJE_PART_TYPE_SWALLOW:
194 return "SWALLOW";
195 case EDJE_PART_TYPE_TEXTBLOCK:
196 return "TEXTBLOCK";
197 case EDJE_PART_TYPE_GRADIENT:
198 return "GRADIENT";
199 case EDJE_PART_TYPE_GROUP:
200 return "GROUP";
201 case EDJE_PART_TYPE_BOX:
202 return "BOX";
203 case EDJE_PART_TYPE_TABLE:
204 return "TABLE";
205 case EDJE_PART_TYPE_EXTERNAL:
206 return "EXTERNAL";
207
208 case EDJE_PART_TYPE_NONE:
209 case EDJE_PART_TYPE_LAST:
210 ERR("Invalid part type %d", t);
211 return "???";
212 default:
213 ERR("Unknown part type %d", t);
214 return "???";
215 }
216}
217
218static void
219state_begin(const char *state, double value)
220{
221 if (machine)
222 printf("PART-STATE-BEGIN\nNAME: %s\nVALUE: %2.1f\n", state, value);
223 else
224 {
225 printf(INDENT3 "description { state: \"%s\" %2.1f;", state, value);
226 if (detail > 0) putchar('\n');
227 }
228}
229
230static const char *
231aspect_pref_name_get(int id)
232{
233 switch (id)
234 {
235 case 0: return "NONE";
236 case 1: return "VERTICAL";
237 case 2: return "HORIZONTAL";
238 case 3: return "BOTH";
239 default:
240 ERR("Unknown aspect preference %d", id);
241 return "???";
242 }
243}
244
245static const char *
246border_fill_name_get(int id)
247{
248 switch (id)
249 {
250 case 0: return "NONE";
251 case 1: return "DEFAULT";
252 case 2: return "SOLID";
253 default:
254 ERR("Unknown border fill %d", id);
255 return "???";
256 }
257}
258
259static void
260state_details(Evas_Object *ed, const char *ppart, const char *state, double value)
261{
262 Edje_Part_Type t = edje_edit_part_type_get(ed, ppart);
263 double dx, dy;
264 const char *str, *str2;
265 int x, y, r, g, b, a;
266
267 if (detail < 1) return;
268
269 b = edje_edit_state_visible_get(ed, ppart, state, value);
270 if (machine) printf("VISIBLE: %d\n", b);
271 else if (!b) puts(INDENT4 "visible: 0;");
272
273 edje_edit_state_color_get(ed, ppart, state, value, &r, &g, &b, &a);
274 if (machine)
275 printf("COLOR-R: %d\nCOLOR-G: %d\nCOLOR-B: %d\nCOLOR-A: %d\n", r, g, b, a);
276 else if ((r != 255) || (g != 255) || (b != 255) || (a != 255))
277 printf(INDENT4 "color: %d %d %d %d;\n", r, g, b, a);
278
279 if (detail > 1)
280 {
281 edje_edit_state_color2_get(ed, ppart, state, value, &r, &g, &b, &a);
282 if (machine)
283 printf("COLOR2-R: %d\nCOLOR2-G: %d\nCOLOR2-B: %d\nCOLOR2-A: %d\n",
284 r, g, b, a);
285 else if ((r != 255) || (g != 255) || (b != 255) || (a != 255))
286 printf(INDENT4 "color2: %d %d %d %d;\n", r, g, b, a);
287
288 edje_edit_state_color3_get(ed, ppart, state, value, &r, &g, &b, &a);
289 if (machine)
290 printf("COLOR3-R: %d\nCOLOR3-G: %d\nCOLOR3-B: %d\nCOLOR3-A: %d\n",
291 r, g, b, a);
292 else if ((r != 255) || (g != 255) || (b != 255) || (a != 255))
293 printf(INDENT4 "color3: %d %d %d %d;\n", r, g, b, a);
294 }
295
296 dx = edje_edit_state_align_x_get(ed, ppart, state, value);
297 dy = edje_edit_state_align_y_get(ed, ppart, state, value);
298 if (machine) printf("ALIGN-X: %g\nALIGN-Y: %g\n", dx, dy);
299 else if (FDIFF(dx, 0.5) || FDIFF(dy, 0.5))
300 printf(INDENT4 "align: %g %g;\n", dx, dy);
301
302 x = edje_edit_state_min_w_get(ed, ppart, state, value);
303 y = edje_edit_state_min_h_get(ed, ppart, state, value);
304 if (machine) printf("MIN-W: %d\nMIN-H: %d\n", x, y);
305 else if ((x) || (y)) printf(INDENT4 "min: %d %d;\n", x, y);
306
307 x = edje_edit_state_max_w_get(ed, ppart, state, value);
308 y = edje_edit_state_max_h_get(ed, ppart, state, value);
309 if (machine) printf("MAX-W: %d\nMAX-H: %d\n", x, y);
310 else if ((x != -1) || (y != -1)) printf(INDENT4 "max: %d %d;\n", x, y);
311
312 //TODO Support fixed
313 //TODO Support step
314
315 if (detail > 1)
316 {
317 dx = edje_edit_state_aspect_min_get(ed, ppart, state, value);
318 dy = edje_edit_state_aspect_max_get(ed, ppart, state, value);
319 if (machine) printf("ASPECT-MIN: %g\nASPECT-MAX: %g\n", dx, dy);
320 else if (FDIFF(dx, 0.0) || FDIFF(dy, 0.0))
321 printf(INDENT4 "aspect: %g %g;\n", dx, dy);
322
323 x = edje_edit_state_aspect_pref_get(ed, ppart, state, value);
324 str = aspect_pref_name_get(x);
325 if (machine) printf("ASPECT-PREFERENCE: %s\n", str);
326 else if (x) printf(INDENT4 "aspect_preference: %s;\n", str);
327 /* do not free this str! */
328
329 str = edje_edit_state_color_class_get(ed, ppart, state, value);
330 if (machine) printf("COLOR_CLASS: %s\n", str ? str : "");
331 else if (str) printf(INDENT4 "color_class: \"%s\";\n", str);
332 edje_edit_string_free(str);
333 }
334
335 dx = edje_edit_state_rel1_relative_x_get(ed, ppart, state, value);
336 dy = edje_edit_state_rel1_relative_y_get(ed, ppart, state, value);
337 x = edje_edit_state_rel1_offset_x_get(ed, ppart, state, value);
338 y = edje_edit_state_rel1_offset_y_get(ed, ppart, state, value);
339 str = edje_edit_state_rel1_to_x_get(ed, ppart, state, value);
340 str2 = edje_edit_state_rel1_to_y_get(ed, ppart, state, value);
341 if (FDIFF(dx, 0.0) || FDIFF(dy, 0.0) || (x) || (y) || (str) || (str2))
342 {
343 if (machine) puts("REL1-BEGIN");
344 else puts(INDENT4 "rel1 {");
345
346 if (machine) printf("RELATIVE-X: %g\nRELATIVE-Y: %g\n", dx, dy);
347 else if (FDIFF(dx, 0.0) || FDIFF(dy, 0.0))
348 printf(INDENT5 "relative: %g %g;\n", dx, dy);
349
350 if (machine) printf("OFFSET-X: %d\nOFFSET-Y: %d\n", x, y);
351 else if ((x) || (y)) printf(INDENT5 "offset: %d %d;\n", x, y);
352
353 if (machine)
354 printf("TO-X: %s\nTO-Y: %s\n", str ? str : "", str2 ? str2 : "");
355 else if (((str) && (str2)) && (!strcmp(str, str2)))
356 printf(INDENT5 "to: \"%s\";\n", str);
357 else
358 {
359 if (str) printf(INDENT5 "to_x: \"%s\";\n", str);
360 if (str2) printf(INDENT5 "to_y: \"%s\";\n", str2);
361 }
362
363 if (machine) puts("REL1-END");
364 else puts(INDENT4 "}");
365 }
366 edje_edit_string_free(str);
367 edje_edit_string_free(str2);
368
369 dx = edje_edit_state_rel2_relative_x_get(ed, ppart, state, value);
370 dy = edje_edit_state_rel2_relative_y_get(ed, ppart, state, value);
371 x = edje_edit_state_rel2_offset_x_get(ed, ppart, state, value);
372 y = edje_edit_state_rel2_offset_y_get(ed, ppart, state, value);
373 str = edje_edit_state_rel2_to_x_get(ed, ppart, state, value);
374 str2 = edje_edit_state_rel2_to_y_get(ed, ppart, state, value);
375 if (FDIFF(dx, 1.0) || FDIFF(dy, 1.0) || (x != -1) || (y != -1) ||
376 (str) || (str2))
377 {
378 if (machine) puts("REL2-BEGIN");
379 else puts(INDENT4 "rel2 {");
380
381 if (machine) printf("RELATIVE-X: %g\nRELATIVE-Y: %g\n", dx, dy);
382 else if (FDIFF(dx, 1.0) || FDIFF(dy, 1.0))
383 printf(INDENT5 "relative: %g %g;\n", dx, dy);
384
385 if (machine) printf("OFFSET-X: %d\nOFFSET-Y: %d\n", x, y);
386 else if ((x != -1) || (y != -1))
387 printf(INDENT5 "offset: %d %d;\n", x, y);
388
389 if (machine)
390 printf("TO-X: %s\nTO-Y: %s\n", str ? str : "", str2 ? str2 : "");
391 else if (((str) && (str2)) && (!strcmp(str, str2)))
392 printf(INDENT5 "to: \"%s\";\n", str);
393 else
394 {
395 if (str) printf(INDENT5 "to_x: \"%s\";\n", str);
396 if (str2) printf(INDENT5 "to_y: \"%s\";\n", str2);
397 }
398
399 if (machine) puts("REL2-END");
400 else puts(INDENT4 "}");
401 }
402 edje_edit_string_free(str);
403 edje_edit_string_free(str2);
404
405 if (t == EDJE_PART_TYPE_IMAGE)
406 {
407 str = edje_edit_state_image_get(ed, ppart, state, value);
408
409 if (machine) printf("IMAGE-BEGIN\nNORMAL: %s\n", str ? str : "");
410 else if (detail > 1)
411 {
412 puts(INDENT4 "image {");
413 if (str) printf(INDENT5 "normal: \"%s\";\n", str);
414 }
415 else if (str) printf(INDENT4 "image.normal: \"%s\";\n", str);
416
417 edje_edit_string_free(str);
418
419 if (detail > 1)
420 {
421 Eina_List *tweens, *l;
422 int bl, br, bt, bb, x2, y2;
423 double dx2, dy2;
424 Eina_Bool has_orgin, has_size;
425
426 tweens = edje_edit_state_tweens_list_get(ed, ppart, state, value);
427 EINA_LIST_FOREACH(tweens, l, str)
428 {
429 if (machine) printf("TWEEN: %s\n", str);
430 else printf(INDENT5 "tween: \"%s\";\n", str);
431 }
432 edje_edit_string_list_free(tweens);
433
434 edje_edit_state_image_border_get
435 (ed, ppart, state, value, &bl, &br, &bt, &bb);
436 if (machine)
437 printf("BORDER-LEFT: %d\nBORDER-RIGHT: %d\n"
438 "BORDER-TOP: %d\nBORDER-BOTTOM: %d\n", bl, br, bt, bb);
439 else if ((bl) || (br) || (bt) || (bb))
440 printf(INDENT5 "border: %d %d %d %d;\n", bl, br, bt, bb);
441
442 x = edje_edit_state_image_border_fill_get(ed, ppart, state, value);
443 str = border_fill_name_get(x);
444 if (machine) printf("BORDER-FILL: %s\n", str);
445 else if (x != 1) printf(INDENT5 "middle: %s;\n", str);
446 /* do not free str! */
447
448 // TODO support image.fill.smooth
449
450 dx = edje_edit_state_fill_origin_relative_x_get
451 (ed, ppart, state, value);
452 dy = edje_edit_state_fill_origin_relative_y_get
453 (ed, ppart, state, value);
454 x = edje_edit_state_fill_origin_offset_x_get
455 (ed, ppart, state, value);
456 y = edje_edit_state_fill_origin_offset_y_get
457 (ed, ppart, state, value);
458
459 dx2 = edje_edit_state_fill_size_relative_x_get
460 (ed, ppart, state, value);
461 dy2 = edje_edit_state_fill_size_relative_y_get
462 (ed, ppart, state, value);
463 x2 = edje_edit_state_fill_size_offset_x_get
464 (ed, ppart, state, value);
465 y2 = edje_edit_state_fill_size_offset_y_get
466 (ed, ppart, state, value);
467
468 has_orgin = (FDIFF(dx, 0.0) || FDIFF(dy, 0.0) || (x) || (y));
469 has_size = (FDIFF(dx2, 1.0) || FDIFF(dy2, 1.0) || (x2) || (y2));
470
471 if ((has_orgin) || (has_size))
472 {
473 if (machine) puts("IMAGE-FILL-BEGIN");
474 else puts(INDENT5 "fill {");
475
476 if (has_orgin)
477 {
478 if (machine)
479 printf("ORIGIN-RELATIVE-X: %g\n"
480 "ORIGIN-RELATIVE-Y: %g\n"
481 "ORIGIN-OFFSET-X: %d\n"
482 "ORIGIN-OFFSET-Y: %d\n",
483 dx, dy, x, y);
484 else
485 printf(INDENT6 "origin {\n"
486 INDENT7 "relative: %g %g;\n"
487 INDENT7 "offset: %d %d;\n"
488 INDENT6 "}\n",
489 dx, dy, x, y);
490 }
491
492 if (has_size)
493 {
494 if (machine)
495 printf("SIZE-RELATIVE-X: %g\n"
496 "SIZE-RELATIVE-Y: %g\n"
497 "SIZE-OFFSET-X: %d\n"
498 "SIZE-OFFSET-Y: %d\n",
499 dx2, dy2, x2, y2);
500 else
501 printf(INDENT6 "size {\n"
502 INDENT7 "relative: %g %g;\n"
503 INDENT7 "offset: %d %d;\n"
504 INDENT6 "}\n",
505 dx2, dy2, x2, y2);
506 }
507
508 if (machine) puts("IMAGE-FILL-END");
509 else puts(INDENT5 "}");
510 }
511 }
512
513 if (machine) puts("IMAGE-END");
514 else if (detail > 1) puts(INDENT4 "}");
515 }
516 else if (t == EDJE_PART_TYPE_PROXY)
517 {
518 int x2, y2;
519 double dx2, dy2;
520 Eina_Bool has_orgin, has_size;
521
522 if (machine) puts("PROXY-BEGIN");
523 else puts(INDENT4 "proxy {");
524 // TODO Support source
525 // TODO support proxy.fill.smooth
526
527 dx = edje_edit_state_fill_origin_relative_x_get
528 (ed, ppart, state, value);
529 dy = edje_edit_state_fill_origin_relative_y_get
530 (ed, ppart, state, value);
531 x = edje_edit_state_fill_origin_offset_x_get
532 (ed, ppart, state, value);
533 y = edje_edit_state_fill_origin_offset_y_get
534 (ed, ppart, state, value);
535
536 dx2 = edje_edit_state_fill_size_relative_x_get
537 (ed, ppart, state, value);
538 dy2 = edje_edit_state_fill_size_relative_y_get
539 (ed, ppart, state, value);
540 x2 = edje_edit_state_fill_size_offset_x_get
541 (ed, ppart, state, value);
542 y2 = edje_edit_state_fill_size_offset_y_get
543 (ed, ppart, state, value);
544
545 has_orgin = (FDIFF(dx, 0.0) || FDIFF(dy, 0.0) || (x) || (y));
546 has_size = (FDIFF(dx2, 1.0) || FDIFF(dy2, 1.0) || (x2) || (y2));
547
548 if ((has_orgin) || (has_size))
549 {
550 if (machine) puts("PROXY-FILL-BEGIN");
551 else puts(INDENT5 "fill {");
552
553 if (has_orgin)
554 {
555 if (machine)
556 printf("ORIGIN-RELATIVE-X: %g\n"
557 "ORIGIN-RELATIVE-Y: %g\n"
558 "ORIGIN-OFFSET-X: %d\n"
559 "ORIGIN-OFFSET-Y: %d\n",
560 dx, dy, x, y);
561 else
562 printf(INDENT6 "origin {\n"
563 INDENT7 "relative: %g %g;\n"
564 INDENT7 "offset: %d %d;\n"
565 INDENT6 "}\n",
566 dx, dy, x, y);
567 }
568
569 if (has_size)
570 {
571 if (machine)
572 printf("SIZE-RELATIVE-X: %g\n"
573 "SIZE-RELATIVE-Y: %g\n"
574 "SIZE-OFFSET-X: %d\n"
575 "SIZE-OFFSET-Y: %d\n",
576 dx2, dy2, x2, y2);
577 else
578 printf(INDENT6 "size {\n"
579 INDENT7 "relative: %g %g;\n"
580 INDENT7 "offset: %d %d;\n"
581 INDENT6 "}\n",
582 dx2, dy2, x2, y2);
583 }
584
585 if (machine) puts("PROXY-FILL-END");
586 else puts(INDENT5 "}");
587 }
588
589 if (machine) puts("PROXY-END");
590 else puts(INDENT4 "}");
591 }
592 else if ((t == EDJE_PART_TYPE_TEXTBLOCK) || (t == EDJE_PART_TYPE_TEXT))
593 {
594 if (machine) puts("TEXT-BEGIN");
595 else puts(INDENT4 "text {");
596
597 str = edje_edit_state_text_get(ed, ppart, state, value);
598 if (machine) printf("TEXT: %s\n", str ? str : "");
599 else if (str) printf(INDENT5 "text: \"%s\";\n", str);
600 edje_edit_string_free(str);
601
602 str = edje_edit_state_font_get(ed, ppart, state, value);
603 if (machine) printf("FONT: %s\n", str ? str : "");
604 else if (str) printf(INDENT5 "font: \"%s\";\n", str);
605 edje_edit_string_free(str);
606
607 x = edje_edit_state_text_size_get(ed, ppart, state, value);
608 if (machine) printf("SIZE: %d\n", x);
609 else if (x > 0) printf(INDENT5 "size: %d;\n", x);
610
611 // TODO text_class
612
613 dx = edje_edit_state_text_align_x_get(ed, ppart, state, value);
614 dy = edje_edit_state_text_align_y_get(ed, ppart, state, value);
615 if (machine) printf("TEXT-ALIGN-X: %g\nTEXT-ALIGN-Y: %g\n", dx, dy);
616 else if (FDIFF(dx, 0.5) || FDIFF(dy, 0.5))
617 printf(INDENT5 "align: %g %g;\n", dx, dy);
618
619 x = edje_edit_state_text_fit_x_get(ed, ppart, state, value);
620 y = edje_edit_state_text_fit_y_get(ed, ppart, state, value);
621 if (machine) printf("TEXT-FIT-X: %d\nTEXT-FIT-Y: %d\n", x, y);
622 else if ((x) || (y)) printf(INDENT5 "fit: %d %d;\n", x, y);
623
624 dx = edje_edit_state_text_elipsis_get(ed, ppart, state, value);
625 if (machine) printf("TEXT-ELIPSIS: %g\n", dx);
626 else if (FDIFF(dx, 0.5)) printf(INDENT5 "elipsis: %g;\n", dx);
627
628 if (machine) puts("TEXT-END");
629 else puts(INDENT4 "}");
630 }
631 else if (t == EDJE_PART_TYPE_EXTERNAL)
632 {
633 const Eina_List *params, *l;
634 const Edje_External_Param *p;
635
636 params = edje_edit_state_external_params_list_get
637 (ed, ppart, state, value);
638
639 if (params)
640 {
641 if (machine) puts("PARAMS-BEGIN");
642 else puts(INDENT4 "params {");
643
644 EINA_LIST_FOREACH(params, l, p)
645 switch (p->type)
646 {
647 case EDJE_EXTERNAL_PARAM_TYPE_INT:
648 printf(INDENT5 "int: \"%s\" \"%d\";\n", p->name, p->i);
649 break;
650 case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
651 printf(INDENT5 "double: \"%s\" \"%g\";\n", p->name, p->d);
652 break;
653 case EDJE_EXTERNAL_PARAM_TYPE_STRING:
654 if (p->s)
655 printf(INDENT5 "string: \"%s\" \"%s\";\n",
656 p->name, p->s);
657 break;
658 case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
659 printf(INDENT5 "bool: \"%s\" \"%d\";\n", p->name, p->i);
660 break;
661 case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
662 if (p->s)
663 printf(INDENT5 "choice: \"%s\" \"%s\";\n",
664 p->name, p->s);
665 break;
666 default:
667 break;
668 }
669
670 if (machine) puts("PARAMS-END");
671 else puts(INDENT4 "}");
672 }
673 }
674}
675
676static void
677state_end(void)
678{
679 if (machine) puts("PART-STATE-END");
680 else if (detail > 0) puts(INDENT3 "}");
681 else puts(" }");
682}
683
684static void
685part_begin(Evas_Object *ed, const char *name)
686{
687 const char *type = part_type_name_get(edje_edit_part_type_get(ed, name));
688 if (machine) printf("PART-BEGIN\nNAME: %s\nTYPE: %s\n", name, type);
689 else
690 {
691 printf(INDENT2 "part { name: '%s'; type: %s;", name, type);
692 if (detail > 0) putchar('\n');
693 }
694}
695
696static const char *
697text_effect_name_get(Edje_Text_Effect effect)
698{
699 switch (effect)
700 {
701 case EDJE_TEXT_EFFECT_NONE:
702 return "NONE";
703 case EDJE_TEXT_EFFECT_PLAIN:
704 return "PLAIN";
705 case EDJE_TEXT_EFFECT_OUTLINE:
706 return "OUTLINE";
707 case EDJE_TEXT_EFFECT_SOFT_OUTLINE:
708 return "SOFT_OUTLINE";
709 case EDJE_TEXT_EFFECT_SHADOW:
710 return "SHADOW";
711 case EDJE_TEXT_EFFECT_SOFT_SHADOW:
712 return "SOFT_SHADOW";
713 case EDJE_TEXT_EFFECT_OUTLINE_SHADOW:
714 return "OUTLINE_SHADOW";
715 case EDJE_TEXT_EFFECT_OUTLINE_SOFT_SHADOW:
716 return "OUTLINE_SOFT_SHADOW";
717 case EDJE_TEXT_EFFECT_FAR_SHADOW:
718 return "FAR_SHADOW";
719 case EDJE_TEXT_EFFECT_FAR_SOFT_SHADOW:
720 return "FAR_SOFT_SHADOW";
721 case EDJE_TEXT_EFFECT_GLOW:
722 return "GLOW";
723
724 case EDJE_TEXT_EFFECT_LAST:
725 ERR("Invalid part type %d", effect);
726 return "???";
727 default:
728 ERR("Unknown effect type %d", effect);
729 return "???";
730 }
731}
732
733static inline Eina_Bool
734_c_id_allowed(char c)
735{
736 if ((c >= '0') && (c <= '9')) return EINA_TRUE;
737 if ((c >= 'a') && (c <= 'z')) return EINA_TRUE;
738 if ((c >= 'A') && (c <= 'Z')) return EINA_TRUE;
739 return EINA_FALSE;
740}
741
742static char *
743_api_name_fix(const char *orig)
744{
745 char *d, *d_end, buf[256];
746 const char *s;
747
748 if (!orig) return NULL;
749 if (!api_fix) return strdup(orig);
750
751 s = orig;
752 d = buf;
753 d_end = d + sizeof(buf) - 1;
754 for (; (*s != '\0') && (d < d_end); s++, d++)
755 if (_c_id_allowed(*s)) *d = *s;
756 else *d = '_';
757 *d = '\0';
758
759 return strdup(buf);
760}
761
762static char *
763_part_api_name_get(Evas_Object *ed, const char *ppart)
764{
765 const char *orig = edje_edit_part_api_name_get(ed, ppart);
766 char *fix = _api_name_fix(orig);
767 edje_edit_string_free(orig);
768 return fix;
769}
770
771static void
772part_details(Evas_Object *ed, const char *ppart)
773{
774 Eina_List *states, *l;
775 Eina_Bool b;
776 const char *str, *str2;
777 char *api;
778
779 if (detail < 1) return;
780
781 if (machine) puts("PART-DETAILS-BEGIN");
782
783 str = api =_part_api_name_get(ed, ppart);
784 str2 = edje_edit_part_api_description_get(ed, ppart);
785 if (machine)
786 {
787 printf("API-NAME: %s\n", str ? str : "");
788 printf("API-DESCRIPTION: %s\n", str2 ? str2 : "");
789 }
790 else if ((str) || (str2))
791 printf(INDENT3 "api: \"%s\" \"%s\";\n", str ? str : "", str2 ? str2 : "");
792 free(api);
793 edje_edit_string_free(str2);
794
795 b = edje_edit_part_mouse_events_get(ed, ppart);
796 if (machine) printf("MOUSE_EVENTS: %d\n", b);
797 else if (!b) puts(INDENT3 "mouse_events: 0;");
798
799 if (detail > 1)
800 {
801 b = edje_edit_part_repeat_events_get(ed, ppart);
802 if (machine) printf("REPEAT_EVENTS: %d\n", b);
803 else if (b) puts(INDENT3 "repeat_events: 1;");
804
805 b = edje_edit_part_scale_get(ed, ppart);
806 if (machine) printf("SCALE: %d\n", b);
807 else if (b) puts(INDENT3 "scale: 1;");
808 }
809
810 str = edje_edit_part_clip_to_get(ed, ppart);
811 if (machine) printf("CLIP_TO: %s\n", str ? str : "");
812 else if (str) printf(INDENT3 "clip_to: \"%s\";\n", str);
813 edje_edit_string_free(str);
814
815 str = edje_edit_part_source_get(ed, ppart);
816 if (machine) printf("SOURCE: %s\n", str ? str : "");
817 else if (str) printf(INDENT3 "source: \"%s\";\n", str);
818 edje_edit_string_free(str);
819
820 if (detail > 1)
821 {
822 if (edje_edit_part_type_get(ed, ppart) == EDJE_PART_TYPE_TEXT)
823 {
824 str = text_effect_name_get(edje_edit_part_effect_get(ed, ppart));
825 if (machine) printf("EFFECT: %s\n", str ? str : "");
826 else if (str) printf(INDENT3 "effect: %s;\n", str);
827 /* do not free this str! */
828 }
829
830 if (edje_edit_part_drag_x_get(ed, ppart) ||
831 edje_edit_part_drag_y_get(ed, ppart))
832 {
833 int dir, step, count;
834
835 if (machine) puts("DRAGABLE-BEGIN");
836 else puts(INDENT3 "dragable {");
837
838 dir = edje_edit_part_drag_x_get(ed, ppart);
839 step = edje_edit_part_drag_step_x_get(ed, ppart);
840 count = edje_edit_part_drag_count_x_get(ed, ppart);
841 if (machine) printf("DRAG-X: %d %d %d\n", dir, step, count);
842 else printf(INDENT4 "x: %d %d %d;\n", dir, step, count);
843
844 dir = edje_edit_part_drag_y_get(ed, ppart);
845 step = edje_edit_part_drag_step_y_get(ed, ppart);
846 count = edje_edit_part_drag_count_y_get(ed, ppart);
847 if (machine) printf("DRAG-Y: %d %d %d\n", dir, step, count);
848 else printf(INDENT4 "y: %d %d %d;\n", dir, step, count);
849
850 str = edje_edit_part_drag_confine_get(ed, ppart);
851 if (machine) printf("DRAG-CONFINE: %s\n", str ? str : "");
852 else if (str) printf(INDENT4 "confine: \"%s\";\n", str);
853 edje_edit_string_free(str);
854
855 str = edje_edit_part_drag_event_get(ed, ppart);
856 if (machine) printf("DRAG-EVENTS: %s\n", str ? str : "");
857 else if (str) printf(INDENT4 "events: \"%s\";\n", str);
858 edje_edit_string_free(str);
859
860 if (machine) puts("DRAGABLE-END");
861 else puts(INDENT3 "}");
862 }
863 }
864
865 states = edje_edit_part_states_list_get(ed, ppart);
866 EINA_LIST_FOREACH(states, l, str)
867 {
868 char state[512], *delim;
869 double value;
870 eina_strlcpy(state, str, sizeof(state)); /* bad states_list! :-( */
871 delim = strchr(state, ' ');
872 *delim = '\0';
873 delim++;
874 value = strtod(delim, NULL);
875 state_begin(state, value);
876 state_details(ed, ppart, state, value);
877 state_end();
878 }
879 edje_edit_string_list_free(states);
880
881 if (machine) puts("PART-DETAILS-END");
882}
883
884static void
885part_end(void)
886{
887 if (machine) puts("PART-END");
888 else if (detail > 0) puts(INDENT2 "}");
889 else puts(" }");
890}
891
892static int
893_groups_names_list(void)
894{
895 Eina_List *l;
896 const char *name;
897 Eina_Bool found = EINA_FALSE;
898
899 EINA_LIST_FOREACH(groups, l, name)
900 {
901 if (!matches(name, group))
902 {
903 DBG("filter out group '%s': does not match '%s'", name, group);
904 continue;
905 }
906 found = EINA_TRUE;
907 puts(name);
908 }
909
910 if (!found) WRN("no groups match '%s'", group);
911 return !found;
912}
913
914static int
915_parts_names_list(void)
916{
917 Eina_List *gl, *pl, *parts;
918 const char *gname, *pname;
919 Eina_Bool found_group = EINA_FALSE, found_part = EINA_FALSE;
920
921 EINA_LIST_FOREACH(groups, gl, gname)
922 {
923 Evas_Object *ed;
924
925 if (!matches(gname, group))
926 {
927 DBG("filter out group '%s': does not match '%s'", gname, group);
928 continue;
929 }
930
931 ed = edje_edit_object_add(ecore_evas_get(ee));
932 if (!edje_object_file_set(ed, file, gname))
933 {
934 Edje_Load_Error err = edje_object_load_error_get(ed);
935 const char *errmsg = edje_load_error_str(err);
936 ERR("could not load group '%s' from file '%s': %s",
937 gname, file, errmsg);
938 evas_object_del(ed);
939 continue;
940 }
941
942 found_group = EINA_TRUE;
943 group_begin(gname);
944
945 parts = edje_edit_parts_list_get(ed);
946 EINA_LIST_FOREACH(parts, pl, pname)
947 {
948 if (!matches(pname, part))
949 {
950 DBG("filter out part '%s': does not match '%s'", pname, part);
951 continue;
952 }
953 if (api_only)
954 {
955 if (!edje_edit_part_api_name_get(ed, pname))
956 {
957 DBG("filter out part '%s': not API.", pname);
958 continue;
959 }
960 }
961 if (machine) printf("PART: %s\n", pname);
962 else printf(INDENT "part: %s\n", pname);
963 }
964 edje_edit_string_list_free(parts);
965
966 group_end();
967 evas_object_del(ed);
968 }
969
970 if (!found_group) WRN("no groups match '%s'", group);
971 if (!found_part) WRN("no parts match '%s'", part);
972 return (!found_group) || (!found_part);
973}
974
975static Eina_Bool
976_group_parts_list(Evas_Object *ed)
977{
978 Eina_Bool found = EINA_FALSE;
979 Eina_List *parts, *l;
980 const char *name;
981
982 parts_begin();
983
984 parts = edje_edit_parts_list_get(ed);
985 EINA_LIST_FOREACH(parts, l, name)
986 {
987 if (!matches(name, part))
988 {
989 DBG("filter out part '%s': does not match '%s'", name, part);
990 continue;
991 }
992 if (api_only)
993 {
994 if (!edje_edit_part_api_name_get(ed, name))
995 {
996 DBG("filter out part '%s': not API.", name);
997 continue;
998 }
999 }
1000
1001 found = EINA_TRUE;
1002 part_begin(ed, name);
1003 part_details(ed, name);
1004 part_end();
1005 }
1006
1007 parts_end();
1008 return found;
1009}
1010
1011static void
1012programs_begin(void)
1013{
1014 if (machine) puts("PROGRAMS-BEGIN");
1015 else puts(INDENT "programs {");
1016}
1017
1018static void
1019programs_end(void)
1020{
1021 if (machine) puts("PROGRAMS-END");
1022 else puts(INDENT "}");
1023}
1024
1025static void
1026program_begin(const char *name)
1027{
1028 if (machine) printf("PROGRAM-BEGIN\nNAME: %s\n", name ? name : "");
1029 else
1030 {
1031 printf(INDENT2 "program { name: '%s';\n", name ? name : "");
1032 }
1033}
1034
1035static void
1036program_end(void)
1037{
1038 if (machine) puts("PROGRAM-END");
1039 else puts(INDENT2 "}");
1040}
1041
1042
1043static char *
1044_program_api_name_get(Evas_Object *ed, const char *pprogram)
1045{
1046 const char *orig = edje_edit_program_api_name_get(ed, pprogram);
1047 char *fix = _api_name_fix(orig);
1048 edje_edit_string_free(orig);
1049 return fix;
1050}
1051
1052static const char *
1053_transition_name_get(Edje_Tween_Mode mode)
1054{
1055 switch (mode)
1056 {
1057 case EDJE_TWEEN_MODE_LINEAR: return "LINEAR";
1058 case EDJE_TWEEN_MODE_ACCELERATE: return "ACCELERATE";
1059 case EDJE_TWEEN_MODE_DECELERATE: return "DECELERATE";
1060 case EDJE_TWEEN_MODE_SINUSOIDAL: return "SINUSOIDAL";
1061 default:
1062 ERR("Unknown transition mode %d", mode);
1063 return "???";
1064 }
1065}
1066
1067static void
1068program_details(Evas_Object *ed, const char *pprogram)
1069{
1070 const char *str, *str2;
1071 char *api;
1072
1073 if (detail < 1) return;
1074
1075 if (machine) puts("PROGRAM-DETAILS-BEGIN");
1076
1077 str = api =_program_api_name_get(ed, pprogram);
1078 str2 = edje_edit_program_api_description_get(ed, pprogram);
1079 if (machine)
1080 {
1081 printf("API-NAME: %s\n", str ? str : "");
1082 printf("API-DESCRIPTION: %s\n", str2 ? str2 : "");
1083 }
1084 else if ((str) || (str2))
1085 printf(INDENT3 "api: \"%s\" \"%s\";\n", str ? str : "", str2 ? str2 : "");
1086 free(api);
1087 edje_edit_string_free(str2);
1088
1089 str = edje_edit_program_signal_get(ed, pprogram);
1090 if (machine) printf("SIGNAL: %s\n", str ? str : "");
1091 else if (str) printf(INDENT3 "signal: \"%s\";\n", str);
1092 edje_edit_string_free(str);
1093
1094 str = edje_edit_program_source_get(ed, pprogram);
1095 if (machine) printf("SOURCE: %s\n", str ? str : "");
1096 else if (str) printf(INDENT3 "source: \"%s\";\n", str);
1097 edje_edit_string_free(str);
1098
1099 if (detail >= 1)
1100 {
1101 Eina_List *lst, *l;
1102 Edje_Action_Type type = edje_edit_program_action_get(ed, pprogram);
1103 switch (type)
1104 {
1105 case EDJE_ACTION_TYPE_ACTION_STOP:
1106 if (machine) puts("ACTION: ACTION_STOP");
1107 else puts(INDENT3 "action: ACTION_STOP;");
1108 break;
1109 case EDJE_ACTION_TYPE_STATE_SET:
1110 str = edje_edit_program_state_get(ed, pprogram);
1111 if (machine)
1112 printf("ACTION: STATE_SET\nACTION-STATE: %s %g\n",
1113 str, edje_edit_program_value_get(ed, pprogram));
1114 else
1115 printf(INDENT3 "action: STATE_SET \"%s\" %2.1f;\n",
1116 str, edje_edit_program_value_get(ed, pprogram));
1117 edje_edit_string_free(str);
1118 break;
1119 case EDJE_ACTION_TYPE_SIGNAL_EMIT:
1120 str = edje_edit_program_state_get(ed, pprogram);
1121 str2 = edje_edit_program_state2_get(ed, pprogram);
1122 if (machine)
1123 printf("ACTION: SIGNAL_EMIT\nACTION-SIGNAL: %s\n"
1124 "ACTION-SOURCE: %s\n",
1125 str ? str : "", str2 ? str2 : "");
1126 else if ((str) || (str2))
1127 printf(INDENT3 "action: SIGNAL_EMIT \"%s\" \"%s\";\n",
1128 str ? str : "", str2 ? str2 : "");
1129 edje_edit_string_free(str);
1130 edje_edit_string_free(str2);
1131 break;
1132 //TODO Support Drag
1133 //~ case EDJE_ACTION_TYPE_DRAG_VAL_SET:
1134 //~ eina_strbuf_append(buf, I4"action: DRAG_VAL_SET TODO;\n");
1135 //~ break;
1136 //~ case EDJE_ACTION_TYPE_DRAG_VAL_STEP:
1137 //~ eina_strbuf_append(buf, I4"action: DRAG_VAL_STEP TODO;\n");
1138 //~ break;
1139 //~ case EDJE_ACTION_TYPE_DRAG_VAL_PAGE:
1140 //~ eina_strbuf_append(buf, I4"action: DRAG_VAL_PAGE TODO;\n");
1141 //~ break;
1142 default:
1143 ERR("Unhandled pprogram action type %d", type);
1144 break;
1145 }
1146
1147 if (detail > 1)
1148 {
1149 double from, range;
1150
1151 from = edje_edit_program_transition_time_get(ed, pprogram);
1152 if (from > 0.0)
1153 {
1154 str = _transition_name_get
1155 (edje_edit_program_transition_get(ed, pprogram));
1156 if (machine)
1157 printf("TRANSITION-NAME: %s\nTRANSITION-DURATION: %g\n",
1158 str, from);
1159 else printf(INDENT3 "transition: %s %g;\n", str, from);
1160 /* do not free str! */
1161 }
1162
1163 from = edje_edit_program_in_from_get(ed, pprogram);
1164 range = edje_edit_program_in_range_get(ed, pprogram);
1165 if (FDIFF(from, 0.0) || FDIFF(range, 0.0))
1166 {
1167 if (machine)
1168 printf("IN-FROM: %g\nIN-RANGE: %g\n", from, range);
1169 else printf(INDENT3 "in: %g %g;\n", from, range);
1170 }
1171 }
1172
1173 lst = edje_edit_program_targets_get(ed, pprogram);
1174 EINA_LIST_FOREACH(lst, l, str)
1175 if (machine) printf("TARGET: %s\n", str);
1176 else printf(INDENT3 "target: \"%s\";\n", str);
1177 edje_edit_string_list_free(lst);
1178
1179 lst = edje_edit_program_afters_get(ed, pprogram);
1180 EINA_LIST_FOREACH(lst, l, str)
1181 if (machine) printf("AFTER: %s\n", str);
1182 else printf(INDENT3 "after: \"%s\";\n", str);
1183 edje_edit_string_list_free(lst);
1184
1185 // TODO Support script {}
1186 }
1187
1188 if (machine) puts("PROGRAM-DETAILS-END");
1189}
1190
1191static Eina_Bool
1192_group_programs_list(Evas_Object *ed)
1193{
1194 Eina_Bool found = EINA_FALSE;
1195 Eina_List *programs, *l;
1196 const char *name;
1197
1198 programs_begin();
1199
1200 /* TODO: change programs to operate on their ID instead of names!
1201 * needs huge change in Edje_Edit.h
1202 */
1203 WRN("listing only programs with names!");
1204 programs = edje_edit_programs_list_get(ed);
1205 EINA_LIST_FOREACH(programs, l, name)
1206 {
1207 if (!matches(name, program))
1208 {
1209 DBG("filter out program '%s': does not match '%s'", name, program);
1210 continue;
1211 }
1212 if (api_only)
1213 {
1214 if (!edje_edit_program_api_name_get(ed, name))
1215 {
1216 DBG("filter out program '%s': not API.", name);
1217 continue;
1218 }
1219 }
1220
1221 found = EINA_TRUE;
1222 program_begin(name);
1223 program_details(ed, name);
1224 program_end();
1225 }
1226
1227 programs_end();
1228 return found;
1229}
1230
1231static int
1232_list(const char *mode)
1233{
1234 Eina_List *l;
1235 const char *name;
1236 int ret = 0;
1237 Eina_Bool found_group = EINA_FALSE;
1238 Eina_Bool req_part, found_part, req_prog, found_prog;
1239
1240 if ((!strcmp(mode, "parts")) || (!strcmp(mode, "groups")))
1241 {
1242 req_part = EINA_TRUE;
1243 found_part = EINA_FALSE;
1244 }
1245 else
1246 {
1247 req_part = EINA_FALSE;
1248 found_part = EINA_TRUE;
1249 }
1250
1251 if ((!strcmp(mode, "programs")) || (!strcmp(mode, "groups")))
1252 {
1253 req_prog = EINA_TRUE;
1254 found_prog = EINA_FALSE;
1255 }
1256 else
1257 {
1258 req_prog = EINA_FALSE;
1259 found_prog = EINA_TRUE;
1260 }
1261
1262 EINA_LIST_FOREACH(groups, l, name)
1263 {
1264 Evas_Object *ed;
1265
1266 if (!matches(name, group))
1267 {
1268 DBG("filter out group '%s': does not match '%s'", name, group);
1269 continue;
1270 }
1271
1272 ed = edje_edit_object_add(ecore_evas_get(ee));
1273 if (!edje_object_file_set(ed, file, name))
1274 {
1275 Edje_Load_Error err = edje_object_load_error_get(ed);
1276 const char *errmsg = edje_load_error_str(err);
1277 ERR("could not load group '%s' from file '%s': %s",
1278 name, file, errmsg);
1279 evas_object_del(ed);
1280 continue;
1281 }
1282
1283 found_group = EINA_TRUE;
1284 group_begin(name);
1285 group_details(ed);
1286
1287 if (req_part) found_part |= _group_parts_list(ed);
1288 if (req_prog) found_prog |= _group_programs_list(ed);
1289
1290 group_end();
1291 evas_object_del(ed);
1292 }
1293
1294 /* no hard requirement for parts or programs for group listing */
1295 if (!strcmp(mode, "groups")) req_part = req_prog = EINA_FALSE;
1296
1297 if (!found_group)
1298 {
1299 WRN("no groups match '%s'", group);
1300 ret = 1;
1301 }
1302 if ((req_part) && (!found_part))
1303 {
1304 WRN("no parts match '%s'", part);
1305 ret = 1;
1306 }
1307 if ((req_prog) && (!found_prog))
1308 {
1309 WRN("no programs match '%s'", program);
1310 ret = 1;
1311 }
1312 return ret;
1313}
1314
1315static Evas_Object *
1316_edje_object_any_get(void)
1317{
1318 Evas_Object *ed = edje_edit_object_add(ecore_evas_get(ee));
1319 Eina_List *l;
1320 const char *name;
1321 if (!ed) return NULL;
1322 EINA_LIST_FOREACH(groups, l, name)
1323 if (edje_object_file_set(ed, file, name)) return ed;
1324 evas_object_del(ed);
1325 return NULL;
1326}
1327
1328static Eina_Bool
1329_gdata_list(void)
1330{
1331 Evas_Object *ed = _edje_object_any_get();
1332 Eina_List *l, *data;
1333 const char *key;
1334
1335 if (!ed) return EINA_FALSE;
1336
1337 data = edje_edit_data_list_get(ed);
1338
1339 if (machine) puts("DATA-BEGIN");
1340 else puts("data {");
1341
1342 EINA_LIST_FOREACH(data, l, key)
1343 {
1344 const char *value = edje_edit_data_value_get(ed, key);
1345 if (machine) printf("ITEM: \"%s\" \"%s\"\n", key, value);
1346 else printf(INDENT "item: \"%s\" \"%s\";\n", key, value);
1347 }
1348
1349 if (machine) puts("DATA-END");
1350 else puts("}");
1351
1352 edje_edit_string_list_free(data);
1353 evas_object_del(ed);
1354 return EINA_TRUE;
1355}
1356
1357static const char *
1358_comp_str_get(Evas_Object *ed, const char *img)
1359{
1360 static char buf[128];
1361 Edje_Edit_Image_Comp type = edje_edit_image_compression_type_get(ed, img);
1362 int rate;
1363
1364 switch (type)
1365 {
1366 case EDJE_EDIT_IMAGE_COMP_RAW:
1367 return "RAW";
1368 case EDJE_EDIT_IMAGE_COMP_USER:
1369 return "USER";
1370 case EDJE_EDIT_IMAGE_COMP_COMP:
1371 return "COMP";
1372 case EDJE_EDIT_IMAGE_COMP_LOSSY:
1373 rate = edje_edit_image_compression_rate_get(ed, img);
1374 snprintf(buf, sizeof(buf), "LOSSY %d", rate);
1375 return buf;
1376 default:
1377 ERR("Unknown compression type %d", type);
1378 return "???";
1379 }
1380}
1381
1382static Eina_Bool
1383_images_list(void)
1384{
1385 Evas_Object *ed = _edje_object_any_get();
1386 Eina_List *l, *images;
1387 const char *img;
1388
1389 if (!ed) return EINA_FALSE;
1390
1391 images = edje_edit_images_list_get(ed);
1392
1393 if (machine) puts("IMAGES-BEGIN");
1394 else puts("images {");
1395
1396 EINA_LIST_FOREACH(images, l, img)
1397 {
1398 int id = edje_edit_image_id_get(ed, img);
1399 const char *comp = _comp_str_get(ed, img);
1400
1401 if (detail < 1)
1402 {
1403 if (machine) printf("IMAGE: %s\n", img);
1404 else printf(INDENT "image: \"%s\" %s;\n", img, comp);
1405 }
1406 else if (detail == 1)
1407 {
1408 if (machine) printf("IMAGE: \"%s\" \"%s\"\n", img, comp);
1409 else printf(INDENT "image: \"%s\" %s;\n", img, comp);
1410 }
1411 else
1412 {
1413 if (machine)
1414 printf("IMAGE: \"edje/images/%d\" \"%s\" \"%s\"\n",
1415 id, img, comp);
1416 else
1417 printf(INDENT "image: \"%s\" %s; /* id: \"edje/images/%d\" */\n",
1418 img, comp, id);
1419 }
1420 }
1421
1422 if (machine) puts("IMAGES-END");
1423 else puts("}");
1424
1425 edje_edit_string_list_free(images);
1426 evas_object_del(ed);
1427 return EINA_TRUE;
1428}
1429
1430static Eina_Bool
1431_fonts_list(void)
1432{
1433 Evas_Object *ed = _edje_object_any_get();
1434 Eina_List *l, *fonts;
1435 const char *alias;
1436
1437 if (!ed) return EINA_FALSE;
1438
1439 fonts = edje_edit_fonts_list_get(ed);
1440
1441 if (machine) puts("FONTS-BEGIN");
1442 else puts("fonts {");
1443
1444 EINA_LIST_FOREACH(fonts, l, alias)
1445 {
1446 const char *path = edje_edit_font_path_get(ed, alias);
1447
1448 if (detail < 1)
1449 {
1450 if (machine) printf("FONT: %s\n", alias);
1451 else printf(INDENT "font: \"%s\" \"%s\";\n", path, alias);
1452 }
1453 else if (detail == 1)
1454 {
1455 if (machine) printf("FONT: \"%s\" \"%s\"\n", path, alias);
1456 else printf(INDENT "font: \"%s\" \"%s\";\n", path, alias);
1457 }
1458 else
1459 {
1460 if (machine)
1461 printf("FONT: \"edje/fonts/%s\" \"%s\" \"%s\"\n",
1462 alias, path, alias);
1463 else
1464 printf(INDENT
1465 "font: \"%s\" \"%s\"; /* id: \"edje/fonts/%s\" */\n",
1466 path, alias, alias);
1467 }
1468
1469 edje_edit_string_free(path);
1470 }
1471
1472 if (machine) puts("FONTS-END");
1473 else puts("}");
1474
1475 edje_edit_string_list_free(fonts);
1476 evas_object_del(ed);
1477 return EINA_TRUE;
1478}
1479
1480static Eina_Bool
1481_externals_list(void)
1482{
1483 Evas_Object *ed = _edje_object_any_get();
1484 Eina_List *l, *externals;
1485 const char *key;
1486
1487 if (!ed) return EINA_FALSE;
1488
1489 externals = edje_edit_externals_list_get(ed);
1490
1491 if (machine) puts("EXTERNALS-BEGIN");
1492 else puts("externals {");
1493
1494 EINA_LIST_FOREACH(externals, l, key)
1495 {
1496 if (machine) printf("EXTERNAL: %s\n", key);
1497 else printf(INDENT "external: \"%s\";\n", key);
1498 }
1499
1500 if (machine) puts("EXTERNALS-END");
1501 else puts("}");
1502
1503 edje_edit_string_list_free(externals);
1504 evas_object_del(ed);
1505 return EINA_TRUE;
1506}
1507
1508
1509int
1510main(int argc, char **argv)
1511{
1512 Eina_Bool quit_option = EINA_FALSE;
1513 char *mode = NULL;
1514 char *detail_name = NULL;
1515 int arg_index;
1516 int ret = 0;
1517 Ecore_Getopt_Value values[] = {
1518 ECORE_GETOPT_VALUE_STR(mode),
1519 ECORE_GETOPT_VALUE_STR(detail_name),
1520 ECORE_GETOPT_VALUE_STR(group),
1521 ECORE_GETOPT_VALUE_STR(part),
1522 ECORE_GETOPT_VALUE_STR(program),
1523 ECORE_GETOPT_VALUE_BOOL(api_only),
1524 ECORE_GETOPT_VALUE_BOOL(api_fix),
1525 ECORE_GETOPT_VALUE_BOOL(machine),
1526 ECORE_GETOPT_VALUE_BOOL(quit_option),
1527 ECORE_GETOPT_VALUE_BOOL(quit_option),
1528 ECORE_GETOPT_VALUE_BOOL(quit_option),
1529 ECORE_GETOPT_VALUE_BOOL(quit_option),
1530 ECORE_GETOPT_VALUE_NONE
1531 };
1532
1533 setlocale(LC_NUMERIC, "C");
1534
1535 ecore_init();
1536 ecore_evas_init();
1537 eina_init();
1538 edje_init();
1539
1540 _log_dom = eina_log_domain_register("edje_inspector", EINA_COLOR_YELLOW);
1541 if (_log_dom < 0)
1542 {
1543 EINA_LOG_CRIT("could not register log domain 'edje_inspector'");
1544 ret = 1;
1545 goto error_log;
1546 }
1547
1548 arg_index = ecore_getopt_parse(&optdesc, values, argc, argv);
1549 if (arg_index < 0)
1550 {
1551 ERR("could not parse arguments.");
1552 ret = 1;
1553 goto error_getopt;
1554 }
1555 else if (quit_option) goto error_getopt;
1556 else if (arg_index != argc - 1)
1557 {
1558 ERR("incorrect number of parameters. Requires one single file.");
1559 ret = 1;
1560 goto error_getopt;
1561 }
1562
1563 if (!mode) mode = (char *)mode_choices[0];
1564
1565 if (detail_name)
1566 {
1567 if (!strcmp(detail_name, "none")) detail = 0;
1568 else if (!strcmp(detail_name, "terse")) detail = 1;
1569 else if (!strcmp(detail_name, "all")) detail = 2;
1570 else ERR("Unknown detail level: '%s'", detail_name);
1571 }
1572
1573 file = argv[arg_index];
1574
1575 // check if the file is accessible
1576 if (access(file, R_OK) == -1)
1577 {
1578 int e = errno;
1579 ERR("File '%s' not accessible, error %d (%s).\n",
1580 file, e, strerror(e));
1581 ret = 1;
1582 goto error_getopt;
1583 }
1584
1585 DBG("mode=%s, detail=%d(%s), group=%s, part=%s, program=%s, api-only=%hhu"
1586 ", api-fix=%hhu, machine=%hhu, file=%s",
1587 mode, detail, detail_name,
1588 group ? group : "",
1589 part ? part : "",
1590 program ? program : "",
1591 api_only, api_fix, machine, file);
1592
1593
1594 groups = edje_file_collection_list(file);
1595 if (!groups)
1596 {
1597 ERR("no groups in edje file '%s'", file);
1598 ret = 1;
1599 goto error_getopt;
1600 }
1601
1602 if (!strcmp(mode, "groups-names")) ret = _groups_names_list();
1603 else
1604 {
1605 ee = ecore_evas_buffer_new(1, 1);
1606 if (!ee)
1607 {
1608 ERR("could not create ecore_evas_buffer");
1609 ret = 1;
1610 }
1611 else
1612 {
1613 if (!strcmp(mode, "parts-names")) ret = _parts_names_list();
1614 else if (!strcmp(mode, "global-data")) ret = _gdata_list();
1615 else if (!strcmp(mode, "images")) ret = _images_list();
1616 else if (!strcmp(mode, "fonts")) ret = _fonts_list();
1617 else if (!strcmp(mode, "externals")) ret = _externals_list();
1618 else ret = _list(mode);
1619 ecore_evas_free(ee);
1620 }
1621 }
1622
1623 edje_file_collection_list_free(groups);
1624 error_getopt:
1625 eina_log_domain_unregister(_log_dom);
1626 error_log:
1627 edje_shutdown();
1628 ecore_evas_shutdown();
1629 ecore_shutdown();
1630 eina_shutdown();
1631
1632 return ret;
1633}
diff --git a/libraries/edje/src/bin/edje_multisense_convert.c b/libraries/edje/src/bin/edje_multisense_convert.c
deleted file mode 100644
index 62c2f67..0000000
--- a/libraries/edje/src/bin/edje_multisense_convert.c
+++ /dev/null
@@ -1,329 +0,0 @@
1#include "edje_multisense_convert.h"
2
3#ifdef HAVE_LIBSNDFILE
4# define READBUF 1024
5# ifdef HAVE_VORBIS
6# include <vorbis/vorbisenc.h>
7# endif
8
9# ifdef HAVE_LIBFLAC
10# include <FLAC/metadata.h>
11# include <FLAC/stream_encoder.h>
12# endif
13
14Edje_Sound_Encode *
15_edje_multisense_encode(const char *filename, Edje_Sound_Sample *sample, double quality __UNUSED__)
16{
17 SF_INFO sfinfo;
18 SNDFILE* sfile;
19 Edje_Sound_Encode *enc_info;
20
21 enc_info = calloc(1, sizeof(Edje_Sound_Encode));
22 if (!enc_info)
23 {
24 ERR("Error. while allocating memory to load file ");
25 exit(-1);
26 }
27 memset (&sfinfo, 0, sizeof (SF_INFO));
28
29 enc_info->encoded = EINA_FALSE;
30 enc_info->comp_type = "RAW PCM";
31
32 // Open wav file using sndfile
33 sfile = sf_open (filename, SFM_READ, &sfinfo);
34 if (!sfile)
35 {
36 ERR("Error. Unable to open audio file : %s", filename);
37 exit(-1);
38 }
39
40 if (!sf_format_check(&sfinfo))
41 {
42 ERR("Error. Unknown file, not a valid audio file");
43 exit(-1);
44 }
45
46 if (sample->compression == EDJE_SOUND_SOURCE_TYPE_INLINE_COMP)
47 {
48 sf_close(sfile);
49#ifdef HAVE_LIBFLAC
50 //encode provided wav file to flac
51 enc_info->file = _edje_multisense_encode_to_flac((char *)filename, sfinfo);
52 if (enc_info->file)
53 {
54 enc_info->comp_type = "FLAC";
55 enc_info->encoded = EINA_TRUE;
56 }
57#else
58 WRN("WARNING: Unable to encode sound %s to FLAC compression",
59 sample->name);
60#endif
61 }
62 else if (sample->compression == EDJE_SOUND_SOURCE_TYPE_INLINE_LOSSY)
63 {
64 sf_close(sfile);
65#ifdef HAVE_VORBIS
66 //encode provided wav file to ogg-vorbis
67 enc_info->file = _edje_multisense_encode_to_ogg_vorbis((char *)filename,
68 quality, sfinfo);
69 if (enc_info->file)
70 {
71 enc_info->comp_type = "OGG-VORBIS";
72 enc_info->encoded = EINA_TRUE;
73 }
74#else
75 WRN("WARNING: Unable to encode sound %s to Ogg-Vorbis",
76 sample->name);
77#endif
78 }
79 else
80 eina_stringshare_replace(&enc_info->file, filename);
81 return enc_info;
82}
83
84#ifdef HAVE_LIBFLAC
85const char*
86_edje_multisense_encode_to_flac(char *snd_path, SF_INFO sfinfo)
87{
88 unsigned int total_samples = 0; /* can use a 32-bit number due to WAVE size limitations */
89 FLAC__bool ok = 1;
90 FLAC__StreamEncoder *encoder = 0;
91 FLAC__StreamEncoderInitStatus init_status;
92 FLAC__StreamMetadata *metadata[2];
93 FLAC__StreamMetadata_VorbisComment_Entry entry;
94 SNDFILE *sfile;
95 sf_count_t size;
96 char *tmp;
97
98 sfile = sf_open(snd_path, SFM_READ, &sfinfo);
99 if (!sfile) return NULL;
100 if (!sf_format_check(&sfinfo))
101 {
102 sf_close(sfile);
103 return NULL;
104 }
105 size = sf_seek(sfile, 0, SEEK_END);
106 sf_seek(sfile, 0, SEEK_SET);
107 tmp = malloc(strlen(snd_path) + 1 + 5);
108 if (!tmp)
109 {
110 sf_close(sfile);
111 return NULL;
112 }
113 strcpy(tmp, snd_path);
114 snd_path = tmp;
115 strcat(snd_path, ".flac");
116
117 total_samples = size;
118
119 /* allocate the encoder */
120 if ((encoder = FLAC__stream_encoder_new()) == NULL)
121 {
122 ERR("ERROR: Creating FLAC encoder\n");
123 free(snd_path);
124 sf_close(sfile);
125 return NULL;
126 }
127
128 /* Verify it's own encoded output. This will slow the encoding process. */
129 ok &= FLAC__stream_encoder_set_verify(encoder, 1);
130
131 //Levels range from 0 (fastest, least compression) to 8 (slowest, most compression).
132 //A value larger than 8 will be treated as 8.
133 //5 is used for good compression and moderate compression/decompression speed.
134 ok &= FLAC__stream_encoder_set_compression_level(encoder, 5);
135 ok &= FLAC__stream_encoder_set_channels(encoder, sfinfo.channels);
136 ok &= FLAC__stream_encoder_set_bits_per_sample(encoder, 16);
137 ok &= FLAC__stream_encoder_set_sample_rate(encoder, sfinfo.samplerate);
138 ok &= FLAC__stream_encoder_set_total_samples_estimate(encoder, total_samples);
139
140 /* now add some metadata; we'll add some tags and a padding block */
141 if (ok)
142 {
143 if ((metadata[0] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT)) == NULL
144 || (metadata[1] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING)) == NULL
145 || !FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, "Encoder", "flac")
146 || !FLAC__metadata_object_vorbiscomment_append_comment(metadata[0], entry, 0))
147 {
148 ERR("ERROR: out of memory error or tag error\n");
149 ok = 0;
150 }
151 metadata[1]->length = 16; /* set the padding length */
152 ok = FLAC__stream_encoder_set_metadata(encoder, metadata, 2);
153 }
154
155 /* initialize encoder */
156 if (ok)
157 {
158 init_status = FLAC__stream_encoder_init_file(encoder, snd_path, NULL,
159 (void *)(long)(total_samples));
160 if (init_status != FLAC__STREAM_ENCODER_INIT_STATUS_OK)
161 {
162 ERR("ERROR: unable to initialize FLAC encoder: %s\n",
163 FLAC__StreamEncoderInitStatusString[init_status]);
164 ok = 0;
165 }
166 }
167
168 /* read blocks of samples from WAVE file and feed to encoder */
169 while (ok)
170 {
171 FLAC__int32 readbuffer[READBUF * 2];
172 sf_count_t count;
173 int i;
174
175 count = sf_readf_int(sfile, readbuffer, READBUF);
176 if (count <= 0) break;
177 for (i = 0; i < (count * sfinfo.channels); i++)
178 readbuffer[i] = readbuffer[i] >> 16;
179 ok = FLAC__stream_encoder_process_interleaved(encoder, readbuffer,
180 count);
181 }
182
183 FLAC__stream_encoder_finish(encoder);
184 /* now that encoding is finished, the metadata can be freed */
185 FLAC__metadata_object_delete(metadata[0]);
186 FLAC__metadata_object_delete(metadata[1]);
187
188 FLAC__stream_encoder_delete(encoder);
189 sf_close(sfile);
190 return (snd_path);
191}
192#endif
193
194#ifdef HAVE_VORBIS
195const char *
196_edje_multisense_encode_to_ogg_vorbis(char *snd_path, double quality, SF_INFO sfinfo)
197{
198 ogg_stream_state os; /* take physical pages, weld into a logical stream of packets */
199 ogg_page og; /* one Ogg bitstream page. Vorbis packets are inside */
200 ogg_packet op; /* one raw packet of data for decode */
201 vorbis_info vi; /* struct that stores all the static vorbis bitstream settings */
202 vorbis_comment vc; /* struct that stores all the user comments */
203 vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
204 vorbis_block vb; /* local working space for packet->PCM decode */
205 int eos = 0, ret;
206 char *tmp;
207 SNDFILE *sfile;
208 FILE *fout;
209
210 sfile = sf_open(snd_path, SFM_READ, &sfinfo);
211 if (!sfile) return NULL;
212 if (!sf_format_check(&sfinfo))
213 {
214 sf_close(sfile);
215 return NULL;
216 }
217 tmp = malloc(strlen(snd_path) + 1 + 4);
218 if (!tmp)
219 {
220 sf_close(sfile);
221 return NULL;
222 }
223 strcpy(tmp, snd_path);
224 snd_path = tmp;
225 strcat(snd_path, ".ogg");
226 fout = fopen(snd_path, "wb");
227 if (!fout)
228 {
229 free(snd_path);
230 sf_close(sfile);
231 return NULL;
232 }
233
234 /********** Encode setup ************/
235 vorbis_info_init(&vi);
236 ret = vorbis_encode_init(&vi, sfinfo.channels, sfinfo.samplerate,
237 -1, (long)(quality * 1000), -1);
238 if (ret == OV_EFAULT) printf("OV_EFAULT\n");
239 if (ret == OV_EINVAL) printf("OV_EINVAL\n");
240 if (ret == OV_EIMPL) printf("OV_EIMPL\n");
241
242 if (ret)
243 {
244 fclose(fout);
245 free(snd_path);
246 sf_close(sfile);
247 return NULL;
248 }
249
250 /* add a comment */
251 vorbis_comment_init(&vc);
252 vorbis_comment_add_tag(&vc, "", "");
253
254 /* set up the analysis state and auxiliary encoding storage */
255 vorbis_analysis_init(&vd, &vi);
256 vorbis_block_init(&vd, &vb);
257
258 srand(time(NULL));
259 ogg_stream_init(&os, rand());
260
261 ogg_packet header;
262 ogg_packet header_comm;
263 ogg_packet header_code;
264
265 vorbis_analysis_headerout(&vd, &vc, &header, &header_comm, &header_code);
266 ogg_stream_packetin(&os, &header); /* automatically placed in its own page */
267 ogg_stream_packetin(&os, &header_comm);
268 ogg_stream_packetin(&os, &header_code);
269
270 while (!eos)
271 {
272 int result = ogg_stream_flush(&os, &og);
273 if (!result) break;
274 fwrite(og.header, 1, og.header_len, fout);
275 fwrite(og.body, 1, og.body_len, fout);
276 }
277
278 while (!eos)
279 {
280 int i, ch;
281 float readbuffer[READBUF * 2];
282 sf_count_t count;
283
284 count = sf_readf_float(sfile, readbuffer, READBUF);
285
286 if (!count)
287 vorbis_analysis_wrote(&vd, 0);
288 else
289 {
290 float **buffer = vorbis_analysis_buffer(&vd, count);
291
292 /* uninterleave samples */
293 for (i = 0; i < count; i++)
294 {
295 for (ch = 0; ch < sfinfo.channels; ch++)
296 buffer[ch][i]= readbuffer[(i * sfinfo.channels) + ch];
297 }
298 vorbis_analysis_wrote(&vd, i);
299 }
300 while (vorbis_analysis_blockout(&vd, &vb) == 1)
301 {
302 vorbis_analysis(&vb, NULL);
303 vorbis_bitrate_addblock(&vb);
304
305 while (vorbis_bitrate_flushpacket(&vd, &op))
306 {
307 ogg_stream_packetin(&os, &op);
308 while (!eos)
309 {
310 int result = ogg_stream_pageout(&os, &og);
311 if (!result) break;
312 fwrite(og.header, 1, og.header_len, fout);
313 fwrite(og.body, 1, og.body_len, fout);
314 if (ogg_page_eos(&og)) eos = 1;
315 }
316 }
317 }
318 }
319 ogg_stream_clear(&os);
320 vorbis_block_clear(&vb);
321 vorbis_dsp_clear(&vd);
322 vorbis_comment_clear(&vc);
323 vorbis_info_clear(&vi);
324 sf_close(sfile);
325 fclose (fout);
326 return snd_path;
327}
328#endif
329#endif
diff --git a/libraries/edje/src/bin/edje_multisense_convert.h b/libraries/edje/src/bin/edje_multisense_convert.h
deleted file mode 100644
index 05ee2f7..0000000
--- a/libraries/edje/src/bin/edje_multisense_convert.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef EDJE_SND_CONVERT_H__
2# define EDJE_SND_CONVERT_H__
3#include "edje_private.h"
4
5#ifdef HAVE_LIBSNDFILE
6#include <sndfile.h>
7
8#define SF_CONTAINER(x) ((x) & SF_FORMAT_TYPEMASK)
9#define SF_CODEC(x) ((x) & SF_FORMAT_SUBMASK)
10
11typedef struct _Edje_Sound_Encode Edje_Sound_Encode;
12
13struct _Edje_Sound_Encode /*Encoding information*/
14{
15 const char *file; /* the encode sound file path */
16 Eina_Bool encoded; /* True if encoding is successful else False */
17 char *comp_type; /* either LOSSLESS (FLAC) or LOSSY (Ogg/Vorbis) Compression */
18};
19
20Edje_Sound_Encode *_edje_multisense_encode(const char* filename, Edje_Sound_Sample *sample, double quality);
21const char *_edje_multisense_encode_to_flac(char *snd_path, SF_INFO sfinfo);
22const char *_edje_multisense_encode_to_ogg_vorbis(char *snd_path, double quality, SF_INFO sfinfo);
23
24#endif
25#endif
diff --git a/libraries/edje/src/bin/edje_player.c b/libraries/edje/src/bin/edje_player.c
deleted file mode 100644
index 208fbb4..0000000
--- a/libraries/edje/src/bin/edje_player.c
+++ /dev/null
@@ -1,789 +0,0 @@
1#ifdef HAVE_CONFIG_H
2#include <config.h>
3#endif
4
5#include <stdio.h>
6#include <string.h>
7#include <stdlib.h>
8#include <errno.h>
9#include <unistd.h>
10#include <fcntl.h>
11#include <ctype.h>
12
13#ifdef HAVE_EVIL
14# include <Evil.h>
15#endif
16
17#include <Evas.h>
18#include <Ecore.h>
19#include <Ecore_Getopt.h>
20#include <Ecore_Evas.h>
21#include <Edje.h>
22
23struct opts {
24 char *file;
25 char *group;
26 Eina_Bool list_groups;
27 char *engine;
28 Eina_Rectangle size;
29 unsigned char color[3];
30 Eina_Bool borderless;
31 Eina_Bool sticky;
32 Eina_Bool shaped;
33 Eina_Bool alpha;
34 Eina_Bool print;
35 Eina_Bool slave_mode;
36 double scale;
37 char *title;
38};
39
40static Ecore_Evas *win;
41
42static void
43_win_title_set(const char *group, const char *file)
44{
45 char buf[1024];
46 snprintf(buf, sizeof(buf), "Edje_Player - %s of %s", group, file);
47 ecore_evas_title_set(win, buf);
48}
49
50static char *
51_slave_mode_tok(char **p_arg)
52{
53 char *s, *e;
54 Eina_Bool is_quoted;
55
56 if (!*p_arg) return NULL;
57
58 s = *p_arg;
59 while (isspace(*s))
60 s++;
61
62 if (*s == '\0')
63 {
64 *p_arg = NULL;
65 return NULL;
66 }
67 else if (*s == '"')
68 {
69 is_quoted = EINA_TRUE;
70 s++;
71 *p_arg = s;
72 }
73 else
74 {
75 is_quoted = EINA_FALSE;
76 *p_arg = s;
77 }
78
79 for (e = s; *e != '\0'; e++)
80 {
81 if ((!is_quoted) && (isspace(*e)))
82 break;
83 else if ((is_quoted) && (*e == '"'))
84 break;
85 }
86
87 if (*e == '\0') return NULL;
88
89 *e = '\0';
90 return e + 1;
91}
92
93static void
94_slave_mode_signal(Evas_Object *edje, char *args)
95{
96 char *emission, *source;
97
98 emission = args;
99 source = _slave_mode_tok(&emission);
100 _slave_mode_tok(&source);
101
102 if ((!emission) || (!source))
103 {
104 fputs("ERROR: Invalid command arguments.\n", stderr);
105 return;
106 }
107
108 edje_object_signal_emit(edje, emission, source);
109}
110
111static void
112_slave_mode_info(Evas_Object *edje, char *args)
113{
114 _slave_mode_tok(&args);
115
116 if (!args)
117 {
118 fputs("ERROR: Invalid command arguments.\n", stderr);
119 return;
120 }
121
122 if (!edje_object_part_exists(edje, args))
123 {
124 printf("INFO: \"%s\" does not exist.\n", args);
125 }
126 else
127 {
128 Evas_Coord x, y, w, h;
129 edje_object_part_geometry_get(edje, args, &x, &y, &w, &h);
130 printf("INFO: \"%s\" %d,%d,%d,%d\n", args, x, y, w, h);
131 }
132}
133
134static void
135_slave_mode_quit(Evas_Object *edje __UNUSED__, char *args __UNUSED__)
136{
137 puts("Bye!");
138 ecore_main_loop_quit();
139}
140
141static void
142_slave_mode_help(Evas_Object *edje __UNUSED__, char *args __UNUSED__)
143{
144 puts("Help:\n"
145 "One command per line, arguments separated by space. Strings may have "
146 "spaces if enclosed in quotes (\").\n"
147 "\n"
148 "\t<command> [arguments]\n"
149 "\n"
150 "Available commands:\n"
151 "\tsignal <emission> <source>\n"
152 "\t sends a signal to edje\n"
153 "\tinfo <part>\n"
154 "\t Print part geometry: <x>,<y>,<w>,<h>\n"
155 "\tquit\n"
156 "\t exit edje player.\n"
157 "\thelp\n"
158 "\t shows this message.\n");
159 /*
160 * Extension ideas (are they useful?):
161 * - message: send a message
162 * - data: show data value
163 * - color_class: set color class values (maybe also list?)
164 * - text_class: set text class values (maybe also list?)
165 * - play_set: change play state
166 * - animation_set: change animation state
167 */
168}
169
170struct slave_cmd
171{
172 const char *cmd;
173 void (*func)(Evas_Object *edje, char *args);
174} _slave_mode_commands[] = {
175 {"signal", _slave_mode_signal},
176 {"info", _slave_mode_info},
177 {"quit", _slave_mode_quit},
178 {"help", _slave_mode_help},
179 {NULL, NULL}
180};
181
182static Eina_Bool
183_slave_mode(void *data, Ecore_Fd_Handler *fd_handler)
184{
185 Evas_Object *edje = data;
186 char buf[1024], *p;
187 const struct slave_cmd *itr;
188 size_t len;
189
190 if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_ERROR))
191 {
192 fputs("ERROR: error on stdin! Exit.\n", stderr);
193 ecore_main_loop_quit();
194 return ECORE_CALLBACK_CANCEL;
195 }
196 if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
197 return ECORE_CALLBACK_RENEW;
198
199 if (!fgets(buf, sizeof(buf), stdin))
200 {
201 fputs("ERROR: end of stdin! Exit.\n", stderr);
202 ecore_main_loop_quit();
203 return ECORE_CALLBACK_CANCEL;
204 }
205
206 len = strlen(buf);
207 if (len < 1)
208 {
209 fputs("ERROR: no input! Try: help\n", stderr);
210 return ECORE_CALLBACK_RENEW;
211 }
212 if (buf[len - 1] == '\n')
213 {
214 len--;
215 buf[len] = '\0';
216 }
217
218 p = strchr(buf, ' ');
219 if (p)
220 {
221 *p = '\0';
222 p++;
223
224 while (isspace(*p))
225 p++;
226 if (*p == '\0')
227 p = NULL;
228
229 if (p)
230 {
231 char *q = p + strlen(p) - 1;
232 while (isspace(*q))
233 {
234 *q = '\0';
235 q--;
236 }
237 }
238 }
239
240 for (itr = _slave_mode_commands; itr->cmd; itr++)
241 {
242 if (strcmp(itr->cmd, buf) == 0)
243 {
244 itr->func(edje, p);
245 break;
246 }
247 }
248
249 return ECORE_CALLBACK_RENEW;
250}
251
252static void
253_print_signal(void *data __UNUSED__, Evas_Object *o __UNUSED__, const char *emission, const char *source)
254{
255 printf("SIGNAL: \"%s\" \"%s\"\n", emission, source);
256}
257
258static void
259_print_message(void *data __UNUSED__, Evas_Object *edje __UNUSED__, Edje_Message_Type type, int id, void *msg)
260{
261 const char *typestr;
262 char buf[64];
263
264 switch (type)
265 {
266 case EDJE_MESSAGE_NONE:
267 typestr = "NONE";
268 break;
269 case EDJE_MESSAGE_SIGNAL:
270 typestr = "SIGNAL";
271 break;
272 case EDJE_MESSAGE_STRING:
273 typestr = "STRING";
274 break;
275 case EDJE_MESSAGE_INT:
276 typestr = "INT";
277 break;
278 case EDJE_MESSAGE_FLOAT:
279 typestr = "FLOAT";
280 break;
281 case EDJE_MESSAGE_STRING_SET:
282 typestr = "STRING_SET";
283 break;
284 case EDJE_MESSAGE_INT_SET:
285 typestr = "INT_SET";
286 break;
287 case EDJE_MESSAGE_FLOAT_SET:
288 typestr = "FLOAT_SET";
289 break;
290 case EDJE_MESSAGE_STRING_INT:
291 typestr = "STRING_INT";
292 break;
293 case EDJE_MESSAGE_STRING_FLOAT:
294 typestr = "STRING_FLOAT";
295 break;
296 case EDJE_MESSAGE_STRING_INT_SET:
297 typestr = "INT_SET";
298 break;
299 case EDJE_MESSAGE_STRING_FLOAT_SET:
300 typestr = "FLOAT_SET";
301 break;
302 default:
303 snprintf(buf, sizeof(buf), "UNKNOWN(%d)", type);
304 typestr = buf;
305 }
306
307 printf("MESSAGE: type=%s, id=%d", typestr, id);
308
309 switch (type)
310 {
311 case EDJE_MESSAGE_NONE: break;
312 case EDJE_MESSAGE_SIGNAL: break;
313 case EDJE_MESSAGE_STRING:
314 {
315 Edje_Message_String *m = msg;
316 printf(" \"%s\"", m->str);
317 }
318 break;
319 case EDJE_MESSAGE_INT:
320 {
321 Edje_Message_Int *m = msg;
322 printf(" %d", m->val);
323 }
324 break;
325 case EDJE_MESSAGE_FLOAT:
326 {
327 Edje_Message_Float *m = msg;
328 printf(" %f", m->val);
329 }
330 break;
331 case EDJE_MESSAGE_STRING_SET:
332 {
333 Edje_Message_String_Set *m = msg;
334 int i;
335 for (i = 0; i < m->count; i++)
336 printf(" \"%s\"", m->str[i]);
337 }
338 break;
339 case EDJE_MESSAGE_INT_SET:
340 {
341 Edje_Message_Int_Set *m = msg;
342 int i;
343 for (i = 0; i < m->count; i++)
344 printf(" %d", m->val[i]);
345 }
346 break;
347 case EDJE_MESSAGE_FLOAT_SET:
348 {
349 Edje_Message_Float_Set *m = msg;
350 int i;
351 for (i = 0; i < m->count; i++)
352 printf(" %f", m->val[i]);
353 }
354 break;
355 case EDJE_MESSAGE_STRING_INT:
356 {
357 Edje_Message_String_Int *m = msg;
358 printf(" \"%s\" %d", m->str, m->val);
359 }
360 break;
361 case EDJE_MESSAGE_STRING_FLOAT:
362 {
363 Edje_Message_String_Float *m = msg;
364 printf(" \"%s\" %f", m->str, m->val);
365 }
366 break;
367 case EDJE_MESSAGE_STRING_INT_SET:
368 {
369 Edje_Message_String_Int_Set *m = msg;
370 int i;
371 printf(" \"%s\"", m->str);
372 for (i = 0; i < m->count; i++)
373 printf(" %d", m->val[i]);
374 }
375 break;
376 case EDJE_MESSAGE_STRING_FLOAT_SET:
377 {
378 Edje_Message_String_Float_Set *m = msg;
379 int i;
380 printf(" \"%s\"", m->str);
381 for (i = 0; i < m->count; i++)
382 printf(" %f", m->val[i]);
383 }
384 break;
385 default:
386 break;
387 }
388
389 putchar('\n');
390}
391
392static void
393_reset_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *stack, void *event_info __UNUSED__)
394{
395 Evas_Coord minw, minh;
396 Evas_Object *edje = data;
397
398 edje_object_size_min_get(edje, &minw, &minh);
399 if ((minw <= 0) && (minh <= 0))
400 edje_object_size_min_calc(edje, &minw, &minh);
401
402 evas_object_size_hint_min_set(stack, minw, minh);
403}
404
405static void
406_key_down(void *data, Evas *e __UNUSED__, Evas_Object *stack __UNUSED__, void *event_info)
407{
408 Evas_Event_Key_Down *ev = event_info;
409 struct opts *opts = data;
410
411 if ((!strcmp(ev->keyname, "equal")) ||
412 (!strcmp(ev->keyname, "plus")))
413 opts->scale += 0.1;
414 else if ((!strcmp(ev->keyname, "minus")) ||
415 (!strcmp(ev->keyname, "underscore")))
416 opts->scale -= 0.1;
417 else if ((!strcmp(ev->keyname, "0")))
418 opts->scale = 1.0;
419 if (opts->scale < 0.1) opts->scale = 0.1;
420 else if (opts->scale > 10.0) opts->scale = 1.0;
421 edje_scale_set(opts->scale);
422}
423
424static Evas_Object *
425_create_stack(Evas *evas, const struct opts *opts)
426{
427 Evas_Object *stack = evas_object_box_add(evas);
428 if (!stack)
429 {
430 fputs("ERROR: could not create object stack (box).\n", stderr);
431 return NULL;
432 }
433 evas_object_box_layout_set(stack, evas_object_box_layout_stack, NULL, NULL);
434 evas_object_resize(stack, opts->size.w, opts->size.h);
435 evas_object_size_hint_weight_set(stack, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
436 evas_object_size_hint_align_set(stack, EVAS_HINT_FILL, EVAS_HINT_FILL);
437 evas_object_show(stack);
438 return stack;
439}
440
441static Evas_Object *
442_create_bg(Evas *evas, const struct opts *opts)
443{
444 const unsigned char *color = opts->color;
445 Evas_Object *bg = evas_object_rectangle_add(evas);
446 if (!bg)
447 {
448 fputs("ERROR: could not create background.\n", stderr);
449 return NULL;
450 }
451 evas_object_resize(bg, opts->size.w, opts->size.h);
452 evas_object_color_set(bg, color[0], color[1], color[2], 255);
453 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
454 evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
455 evas_object_show(bg);
456 return bg;
457}
458
459static Eina_Bool
460_edje_load_or_show_error(Evas_Object *edje, const char *file, const char *group)
461{
462 const char *errmsg;
463 int err;
464
465 if (edje_object_file_set(edje, file, group))
466 {
467 evas_object_focus_set(edje, EINA_TRUE);
468 return EINA_TRUE;
469 }
470
471 err = edje_object_load_error_get(edje);
472 errmsg = edje_load_error_str(err);
473 fprintf(stderr, "ERROR: could not load edje file '%s', group '%s': %s\n",
474 file, group, errmsg);
475 return EINA_FALSE;
476}
477
478static Evas_Object *
479_create_edje(Evas *evas, const struct opts *opts)
480{
481 Evas_Coord minw, minh, maxw, maxh;
482 Evas_Object *edje = edje_object_add(evas);
483 if (!edje)
484 {
485 fputs("ERROR: could not create edje.\n", stderr);
486 return NULL;
487 }
488
489 if (opts->group)
490 {
491 if (!_edje_load_or_show_error(edje, opts->file, opts->group))
492 {
493 evas_object_del(edje);
494 return NULL;
495 }
496 if (!opts->title) _win_title_set(opts->group, opts->file);
497 }
498 else
499 {
500 if (edje_file_group_exists(opts->file, "main"))
501 {
502 if (!_edje_load_or_show_error(edje, opts->file, "main"))
503 {
504 evas_object_del(edje);
505 return NULL;
506 }
507 if (!opts->title) _win_title_set("main", opts->file);
508 }
509 else
510 {
511 Eina_List *groups = edje_file_collection_list(opts->file);
512 const char *group;
513 if (!groups)
514 {
515 fprintf(stderr, "ERROR: file '%s' has no groups!\n",
516 opts->file);
517 evas_object_del(edje);
518 return NULL;
519 }
520 group = groups->data;
521 if (!_edje_load_or_show_error(edje, opts->file, group))
522 {
523 edje_file_collection_list_free(groups);
524 evas_object_del(edje);
525 return NULL;
526 }
527 if (!opts->title) _win_title_set(group, opts->file);
528 edje_file_collection_list_free(groups);
529 }
530 }
531
532 edje_object_size_max_get(edje, &maxw, &maxh);
533 edje_object_size_min_get(edje, &minw, &minh);
534 if ((minw <= 0) && (minh <= 0))
535 edje_object_size_min_calc(edje, &minw, &minh);
536
537 evas_object_size_hint_max_set(edje, maxw, maxh);
538 evas_object_size_hint_min_set(edje, minw, minh);
539
540 evas_object_size_hint_weight_set(edje, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
541 evas_object_size_hint_align_set(edje, EVAS_HINT_FILL, EVAS_HINT_FILL);
542 evas_object_show(edje);
543
544 return edje;
545}
546
547static unsigned char _parse_color(__UNUSED__ const Ecore_Getopt *parser, __UNUSED__ const Ecore_Getopt_Desc *desc, const char *str, __UNUSED__ void *data, Ecore_Getopt_Value *storage)
548{
549 unsigned char *color = (unsigned char *)storage->ptrp;
550
551 if (sscanf(str, "%hhu,%hhu,%hhu", color, color + 1, color + 2) != 3)
552 {
553 fprintf(stderr, "ERROR: incorrect color value '%s'\n", str);
554 return 0;
555 }
556
557 return 1;
558}
559
560static void _cb_delete(__UNUSED__ Ecore_Evas *ee)
561{
562 ecore_main_loop_quit();
563}
564
565const Ecore_Getopt optdesc = {
566 "edje_player",
567 "%prog [options] <filename.edj>",
568 PACKAGE_VERSION,
569 "(C) 2010 Enlightenment",
570 "BSD with advertisement clause",
571 "Simple application to view edje files.",
572 0,
573 {
574 ECORE_GETOPT_STORE_STR
575 ('g', "group", "The edje group to view (defaults to 'main')."),
576 ECORE_GETOPT_STORE_TRUE
577 ('G', "list-groups", "The groups in the given file."),
578 ECORE_GETOPT_STORE_STR
579 ('e', "engine", "The Ecore-Evas engine to use (see --list-engines)"),
580 ECORE_GETOPT_CALLBACK_NOARGS
581 ('E', "list-engines", "list Ecore-Evas engines",
582 ecore_getopt_callback_ecore_evas_list_engines, NULL),
583 ECORE_GETOPT_CALLBACK_ARGS
584 ('Z', "size", "size to use in wxh form.", "WxH",
585 ecore_getopt_callback_size_parse, NULL),
586 ECORE_GETOPT_CALLBACK_ARGS
587 ('c', "bg-color", "Color of the background (if not shaped or alpha)",
588 "RRGGBB", _parse_color, NULL),
589 ECORE_GETOPT_STORE_TRUE
590 ('b', "borderless", "Display window without border."),
591 ECORE_GETOPT_STORE_TRUE
592 ('y', "sticky", "Display window sticky."),
593 ECORE_GETOPT_STORE_TRUE
594 ('s', "shaped", "Display window shaped."),
595 ECORE_GETOPT_STORE_TRUE
596 ('a', "alpha", "Display window with alpha channel "
597 "(needs composite manager!)"),
598 ECORE_GETOPT_STORE_STR
599 ('t', "title", "Define the window title string"),
600 ECORE_GETOPT_STORE_TRUE
601 ('p', "print", "Print signals and messages to stdout"),
602 ECORE_GETOPT_STORE_TRUE
603 ('S', "slave-mode", "Listen for commands on stdin"),
604 ECORE_GETOPT_STORE_DOUBLE
605 ('z', "scale", "Set scale factor"),
606 ECORE_GETOPT_LICENSE('L', "license"),
607 ECORE_GETOPT_COPYRIGHT('C', "copyright"),
608 ECORE_GETOPT_VERSION('V', "version"),
609 ECORE_GETOPT_HELP('h', "help"),
610 ECORE_GETOPT_SENTINEL
611 }
612};
613
614int main(int argc, char **argv)
615{
616 Evas *evas;
617 Evas_Object *stack, *edje;
618 struct opts opts;
619 Eina_Bool quit_option = EINA_FALSE;
620 int args;
621 Ecore_Getopt_Value values[] = {
622 ECORE_GETOPT_VALUE_STR(opts.group),
623 ECORE_GETOPT_VALUE_BOOL(opts.list_groups),
624 ECORE_GETOPT_VALUE_STR(opts.engine),
625 ECORE_GETOPT_VALUE_BOOL(quit_option),
626 ECORE_GETOPT_VALUE_PTR_CAST(opts.size),
627 ECORE_GETOPT_VALUE_PTR_CAST(opts.color),
628 ECORE_GETOPT_VALUE_BOOL(opts.borderless),
629 ECORE_GETOPT_VALUE_BOOL(opts.sticky),
630 ECORE_GETOPT_VALUE_BOOL(opts.shaped),
631 ECORE_GETOPT_VALUE_BOOL(opts.alpha),
632 ECORE_GETOPT_VALUE_STR(opts.title),
633 ECORE_GETOPT_VALUE_BOOL(opts.print),
634 ECORE_GETOPT_VALUE_BOOL(opts.slave_mode),
635 ECORE_GETOPT_VALUE_DOUBLE(opts.scale),
636 ECORE_GETOPT_VALUE_BOOL(quit_option),
637 ECORE_GETOPT_VALUE_BOOL(quit_option),
638 ECORE_GETOPT_VALUE_BOOL(quit_option),
639 ECORE_GETOPT_VALUE_BOOL(quit_option),
640 ECORE_GETOPT_VALUE_NONE
641 };
642
643 memset(&opts, 0, sizeof(opts));
644 opts.scale = 1.0;
645
646 if (!ecore_evas_init())
647 return EXIT_FAILURE;
648 if (!edje_init())
649 goto shutdown_ecore_evas;
650 edje_frametime_set(1.0/60.0);
651
652 args = ecore_getopt_parse(&optdesc, values, argc, argv);
653 if (args < 0)
654 {
655 fputs("Could not parse arguments.\n", stderr);
656 goto shutdown_edje;
657 }
658 else if (quit_option)
659 {
660 goto end;
661 }
662 else if (args >= argc)
663 {
664 fputs("Missing edje file to load.\n", stderr);
665 goto shutdown_edje;
666 }
667
668 ecore_app_args_set(argc, (const char **)argv);
669 edje_scale_set(opts.scale);
670
671 // check if the given edj file is there
672 if (access(argv[args], R_OK) == -1)
673 {
674 int e = errno;
675 fprintf(stderr, "ERROR: file '%s' not accessible, error %d (%s).\n",
676 argv[args], e, strerror(e));
677 goto end;
678 }
679
680 opts.file = argv[args];
681 if (opts.list_groups)
682 {
683 Eina_List *groups, *n;
684 const char *group;
685 groups = edje_file_collection_list(opts.file);
686 printf("%d groups in file '%s':\n", eina_list_count(groups), opts.file);
687 EINA_LIST_FOREACH(groups, n, group)
688 printf("\t'%s'\n", group);
689 edje_file_collection_list_free(groups);
690 goto end;
691 }
692
693 win = ecore_evas_new(opts.engine, 0, 0, opts.size.w, opts.size.h, NULL);
694 if (!win)
695 {
696 fprintf(stderr,
697 "ERROR: could not create window of "
698 "size %dx%d using engine %s.\n",
699 opts.size.w, opts.size.h, opts.engine ? opts.engine : "(auto)");
700 goto shutdown_edje;
701 }
702
703 ecore_evas_callback_delete_request_set(win, _cb_delete);
704 evas = ecore_evas_get(win);
705 stack = _create_stack(evas, &opts);
706 if (!stack)
707 {
708 goto free_ecore_evas;
709 }
710
711 ecore_evas_object_associate(win, stack, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);
712
713 if (opts.alpha)
714 ecore_evas_alpha_set(win, EINA_TRUE);
715 else if (opts.shaped)
716 ecore_evas_shaped_set(win, EINA_TRUE);
717 else
718 {
719 Evas_Object *bg = _create_bg(evas, &opts);
720 if (bg) evas_object_box_append(stack, bg);
721 }
722
723 edje = _create_edje(evas, &opts);
724 if (edje)
725 evas_object_box_append(stack, edje);
726 else
727 {
728 goto free_ecore_evas;
729 }
730
731 evas_object_focus_set(stack, EINA_TRUE);
732 evas_object_event_callback_add(stack, EVAS_CALLBACK_KEY_DOWN,
733 _key_down, &opts);
734 evas_object_event_callback_add(stack, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
735 _reset_size_hints, edje);
736
737 if (opts.print)
738 {
739 edje_object_signal_callback_add(edje, "*", "*", _print_signal, NULL);
740 edje_object_message_handler_set(edje, _print_message, NULL);
741 }
742
743 if (opts.slave_mode)
744 {
745#ifndef _WIN32
746 int flags;
747 flags = fcntl(STDIN_FILENO, F_GETFL, 0);
748 flags |= O_NONBLOCK;
749 if (fcntl(STDIN_FILENO, F_SETFL, flags) < 0)
750 {
751 fprintf(stderr, "ERROR: Could not set stdin to non-block: %s\n",
752 strerror(errno));
753 goto free_ecore_evas;
754 }
755 ecore_main_fd_handler_add(STDIN_FILENO, ECORE_FD_READ | ECORE_FD_ERROR,
756 _slave_mode, edje, NULL, NULL);
757#else
758 /* TODO: port the code above to Windows */
759 fprintf (stderr, "ERROR: slave mode not working on Windows\n");
760 goto free_ecore_evas;
761#endif
762 }
763
764 ecore_evas_borderless_set(win, opts.borderless);
765 ecore_evas_sticky_set(win, opts.sticky);
766 if (opts.title)
767 ecore_evas_title_set(win, opts.title);
768
769 if (opts.size.w <= 0) opts.size.w = 320;
770 if (opts.size.h <= 0) opts.size.h = 240;
771 ecore_evas_resize(win, opts.size.w, opts.size.h);
772 ecore_evas_show(win);
773 ecore_main_loop_begin();
774
775 ecore_evas_free(win);
776 end:
777 edje_shutdown();
778 ecore_evas_shutdown();
779
780 return 0;
781
782 free_ecore_evas:
783 ecore_evas_free(win);
784 shutdown_edje:
785 edje_shutdown();
786 shutdown_ecore_evas:
787 ecore_evas_shutdown();
788 return EXIT_FAILURE;
789}
diff --git a/libraries/edje/src/bin/edje_recc b/libraries/edje/src/bin/edje_recc
deleted file mode 100644
index 2ae81ad..0000000
--- a/libraries/edje/src/bin/edje_recc
+++ /dev/null
@@ -1,69 +0,0 @@
1#!/bin/sh
2
3set -e
4
5usage () {
6 echo "Usage:"
7 echo " edje_recc [OPTIONS] input_file.edj"
8 echo ""
9 echo "Where OPTIONS is one or more of:"
10 echo ""
11 echo "-v Verbose output"
12 echo "-no-lossy Do NOT allow images to be lossy"
13 echo "-no-comp Do NOT allow images to be lossless compression"
14 echo "-no-raw Do NOT allow images to be zero compression"
15 echo "-min-quality VAL Do NOT allow lossy images with quality < VAL (0-100)"
16 echo "-max-quality VAL Do NOT allow lossy images with quality > VAL (0-100)"
17 exit -1
18}
19
20if [ $# -lt 1 ]; then
21 usage
22fi
23
24OPT=""
25if [ $# -ge 1 ]; then
26 for I in $@; do
27 case "$I" in
28 -h)
29 usage
30 ;;
31
32 -help)
33 usage
34 ;;
35
36 --help)
37 usage
38 ;;
39
40 *.edj)
41 IN=$I
42 ;;
43
44 *)
45 OPT=$OPT" "$I
46 ;;
47 esac
48 done
49fi
50
51if [ -z "$IN" ]; then
52 echo "ERROR: NO input file.edj provided!"
53 echo ""
54 usage;
55fi
56
57F=`basename $IN`
58B=`basename $F .edj`
59T="./...edje_tmp"
60rm -rf $T
61mkdir -p $T
62cp $IN $T
63cd $T
64edje_decc $F
65cd $B
66./build.sh $OPT
67cd ../..
68mv $T/$B/$F $IN
69rm -rf $T
diff --git a/libraries/edje/src/bin/epp/Makefile.am b/libraries/edje/src/bin/epp/Makefile.am
deleted file mode 100644
index 6db5016..0000000
--- a/libraries/edje/src/bin/epp/Makefile.am
+++ /dev/null
@@ -1,59 +0,0 @@
1# Makefile for GNU C compiler.
2# Copyright (C) 1987, 88, 90-94, 1995 Free Software Foundation, Inc.
3
4#This file is part of GNU CC.
5
6#GNU CC is free software; you can redistribute it and/or modify
7#it under the terms of the GNU General Public License as published by
8#the Free Software Foundation; either version 2, or (at your option)
9#any later version.
10
11#GNU CC is distributed in the hope that it will be useful,
12#but WITHOUT ANY WARRANTY; without even the implied warranty of
13#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14#GNU General Public License for more details.
15
16#You should have received a copy of the GNU General Public License
17#along with GNU CC; see the file COPYING. If not, write to
18#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19
20MAINTAINERCLEANFILES = Makefile.in
21
22eppdir = @libdir@/@PACKAGE@/utils
23
24epp_PROGRAMS = epp
25
26epp_SOURCES = \
27cpplib.h \
28cpphash.h \
29cppalloc.c \
30cpperror.c \
31cppexp.c \
32cpphash.c \
33cpplib.c \
34cppmain.c
35
36epp_CPPFLAGS = \
37-I$(top_builddir) \
38$(CWARNFLAGS)
39
40DEFS= \
41-DHAVE_CONFIG_H \
42-DHAVE_STRERROR \
43-DFATAL_EXIT_CODE=1 \
44-DSUCCESS_EXIT_CODE=0 \
45-DGCC_INCLUDE_DIR=\"/usr/include\" \
46-DGPLUSPLUS_INCLUDE_DIR=\"/usr/include\" \
47-DTOOL_INCLUDE_DIR=\"/usr/bin\" \
48-DHOST_BITS_PER_LONG=32 \
49-DBITS_PER_UNIT=8 \
50-DHOST_BITS_PER_INT=32 \
51-DBITS_PER_WORD=16 \
52-DTARGET_BELL=7 \
53-DTARGET_BS=8 \
54-DTARGET_FF=12 \
55-DTARGET_NEWLINE=10 \
56-DTARGET_CR=13 \
57-DTARGET_TAB=9 \
58-DTARGET_VT=11
59
diff --git a/libraries/edje/src/bin/epp/Makefile.in b/libraries/edje/src/bin/epp/Makefile.in
deleted file mode 100644
index 2ef2e56..0000000
--- a/libraries/edje/src/bin/epp/Makefile.in
+++ /dev/null
@@ -1,756 +0,0 @@
1# Makefile.in generated by automake 1.11.1 from Makefile.am.
2# @configure_input@
3
4# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
6# Inc.
7# This Makefile.in is free software; the Free Software Foundation
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
16@SET_MAKE@
17
18# Makefile for GNU C compiler.
19# Copyright (C) 1987, 88, 90-94, 1995 Free Software Foundation, Inc.
20
21#This file is part of GNU CC.
22
23#GNU CC is free software; you can redistribute it and/or modify
24#it under the terms of the GNU General Public License as published by
25#the Free Software Foundation; either version 2, or (at your option)
26#any later version.
27
28#GNU CC is distributed in the hope that it will be useful,
29#but WITHOUT ANY WARRANTY; without even the implied warranty of
30#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31#GNU General Public License for more details.
32
33#You should have received a copy of the GNU General Public License
34#along with GNU CC; see the file COPYING. If not, write to
35#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
36
37VPATH = @srcdir@
38pkgdatadir = $(datadir)/@PACKAGE@
39pkgincludedir = $(includedir)/@PACKAGE@
40pkglibdir = $(libdir)/@PACKAGE@
41pkglibexecdir = $(libexecdir)/@PACKAGE@
42am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
43install_sh_DATA = $(install_sh) -c -m 644
44install_sh_PROGRAM = $(install_sh) -c
45install_sh_SCRIPT = $(install_sh) -c
46INSTALL_HEADER = $(INSTALL_DATA)
47transform = $(program_transform_name)
48NORMAL_INSTALL = :
49PRE_INSTALL = :
50POST_INSTALL = :
51NORMAL_UNINSTALL = :
52PRE_UNINSTALL = :
53POST_UNINSTALL = :
54build_triplet = @build@
55host_triplet = @host@
56epp_PROGRAMS = epp$(EXEEXT)
57subdir = src/bin/epp
58DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
59ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
60am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \
61 $(top_srcdir)/m4/efl_binary.m4 \
62 $(top_srcdir)/m4/efl_coverage.m4 \
63 $(top_srcdir)/m4/efl_doxygen.m4 \
64 $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \
65 $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
66 $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
67 $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
68am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
69 $(ACLOCAL_M4)
70mkinstalldirs = $(install_sh) -d
71CONFIG_HEADER = $(top_builddir)/config.h
72CONFIG_CLEAN_FILES =
73CONFIG_CLEAN_VPATH_FILES =
74am__installdirs = "$(DESTDIR)$(eppdir)"
75PROGRAMS = $(epp_PROGRAMS)
76am_epp_OBJECTS = epp-cppalloc.$(OBJEXT) epp-cpperror.$(OBJEXT) \
77 epp-cppexp.$(OBJEXT) epp-cpphash.$(OBJEXT) \
78 epp-cpplib.$(OBJEXT) epp-cppmain.$(OBJEXT)
79epp_OBJECTS = $(am_epp_OBJECTS)
80epp_LDADD = $(LDADD)
81AM_V_lt = $(am__v_lt_$(V))
82am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
83am__v_lt_0 = --silent
84DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
85depcomp = $(SHELL) $(top_srcdir)/depcomp
86am__depfiles_maybe = depfiles
87am__mv = mv -f
88COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
89 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
90LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
91 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
92 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
93 $(AM_CFLAGS) $(CFLAGS)
94AM_V_CC = $(am__v_CC_$(V))
95am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
96am__v_CC_0 = @echo " CC " $@;
97AM_V_at = $(am__v_at_$(V))
98am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
99am__v_at_0 = @
100CCLD = $(CC)
101LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
102 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
103 $(AM_LDFLAGS) $(LDFLAGS) -o $@
104AM_V_CCLD = $(am__v_CCLD_$(V))
105am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
106am__v_CCLD_0 = @echo " CCLD " $@;
107AM_V_GEN = $(am__v_GEN_$(V))
108am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
109am__v_GEN_0 = @echo " GEN " $@;
110SOURCES = $(epp_SOURCES)
111DIST_SOURCES = $(epp_SOURCES)
112ETAGS = etags
113CTAGS = ctags
114DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
115ACLOCAL = @ACLOCAL@
116ALLOCA = @ALLOCA@
117ALSA_CFLAGS = @ALSA_CFLAGS@
118ALSA_LIBS = @ALSA_LIBS@
119AMTAR = @AMTAR@
120AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
121AR = @AR@
122AS = @AS@
123AUTOCONF = @AUTOCONF@
124AUTOHEADER = @AUTOHEADER@
125AUTOMAKE = @AUTOMAKE@
126AWK = @AWK@
127CC = @CC@
128CCDEPMODE = @CCDEPMODE@
129CFLAGS = @CFLAGS@
130CHECK_CFLAGS = @CHECK_CFLAGS@
131CHECK_LIBS = @CHECK_LIBS@
132CPP = @CPP@
133CPPFLAGS = @CPPFLAGS@
134CYGPATH_W = @CYGPATH_W@
135DEFS = \
136-DHAVE_CONFIG_H \
137-DHAVE_STRERROR \
138-DFATAL_EXIT_CODE=1 \
139-DSUCCESS_EXIT_CODE=0 \
140-DGCC_INCLUDE_DIR=\"/usr/include\" \
141-DGPLUSPLUS_INCLUDE_DIR=\"/usr/include\" \
142-DTOOL_INCLUDE_DIR=\"/usr/bin\" \
143-DHOST_BITS_PER_LONG=32 \
144-DBITS_PER_UNIT=8 \
145-DHOST_BITS_PER_INT=32 \
146-DBITS_PER_WORD=16 \
147-DTARGET_BELL=7 \
148-DTARGET_BS=8 \
149-DTARGET_FF=12 \
150-DTARGET_NEWLINE=10 \
151-DTARGET_CR=13 \
152-DTARGET_TAB=9 \
153-DTARGET_VT=11
154
155DEPDIR = @DEPDIR@
156DLLTOOL = @DLLTOOL@
157DSYMUTIL = @DSYMUTIL@
158DUMPBIN = @DUMPBIN@
159ECHO_C = @ECHO_C@
160ECHO_N = @ECHO_N@
161ECHO_T = @ECHO_T@
162ECORE_IMF_CFLAGS = @ECORE_IMF_CFLAGS@
163ECORE_IMF_LIBS = @ECORE_IMF_LIBS@
164EDJE_CC_CFLAGS = @EDJE_CC_CFLAGS@
165EDJE_CC_LIBS = @EDJE_CC_LIBS@
166EDJE_CC_PRG = @EDJE_CC_PRG@
167EDJE_CFLAGS = @EDJE_CFLAGS@
168EDJE_DECC_CFLAGS = @EDJE_DECC_CFLAGS@
169EDJE_DECC_LIBS = @EDJE_DECC_LIBS@
170EDJE_DECC_PRG = @EDJE_DECC_PRG@
171EDJE_EXTERNAL_INSPECTOR_CFLAGS = @EDJE_EXTERNAL_INSPECTOR_CFLAGS@
172EDJE_EXTERNAL_INSPECTOR_LIBS = @EDJE_EXTERNAL_INSPECTOR_LIBS@
173EDJE_EXTERNAL_INSPECTOR_PRG = @EDJE_EXTERNAL_INSPECTOR_PRG@
174EDJE_INSPECTOR_CFLAGS = @EDJE_INSPECTOR_CFLAGS@
175EDJE_INSPECTOR_LIBS = @EDJE_INSPECTOR_LIBS@
176EDJE_INSPECTOR_PRG = @EDJE_INSPECTOR_PRG@
177EDJE_LIBS = @EDJE_LIBS@
178EDJE_PLAYER_CFLAGS = @EDJE_PLAYER_CFLAGS@
179EDJE_PLAYER_LIBS = @EDJE_PLAYER_LIBS@
180EDJE_PLAYER_PRG = @EDJE_PLAYER_PRG@
181EDJE_RECC_PRG = @EDJE_RECC_PRG@
182EFL_COVERAGE_CFLAGS = @EFL_COVERAGE_CFLAGS@
183EFL_COVERAGE_LIBS = @EFL_COVERAGE_LIBS@
184EFL_EDJE_BUILD = @EFL_EDJE_BUILD@
185EGREP = @EGREP@
186EVIL_CFLAGS = @EVIL_CFLAGS@
187EVIL_LIBS = @EVIL_LIBS@
188EXEEXT = @EXEEXT@
189FGREP = @FGREP@
190FLAC_CFLAGS = @FLAC_CFLAGS@
191FLAC_LIBS = @FLAC_LIBS@
192GREP = @GREP@
193INSTALL = @INSTALL@
194INSTALL_DATA = @INSTALL_DATA@
195INSTALL_PROGRAM = @INSTALL_PROGRAM@
196INSTALL_SCRIPT = @INSTALL_SCRIPT@
197INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
198LD = @LD@
199LDFLAGS = @LDFLAGS@
200LIBOBJS = @LIBOBJS@
201LIBS = @LIBS@
202LIBTOOL = @LIBTOOL@
203LIPO = @LIPO@
204LN_S = @LN_S@
205LTLIBOBJS = @LTLIBOBJS@
206LUA_CFLAGS = @LUA_CFLAGS@
207LUA_LIBS = @LUA_LIBS@
208MAKEINFO = @MAKEINFO@
209MINIMAL_CFLAGS = @MINIMAL_CFLAGS@
210MINIMAL_LIBS = @MINIMAL_LIBS@
211MKDIR_P = @MKDIR_P@
212MODULE_ARCH = @MODULE_ARCH@
213NM = @NM@
214NMEDIT = @NMEDIT@
215OBJDUMP = @OBJDUMP@
216OBJEXT = @OBJEXT@
217OTOOL = @OTOOL@
218OTOOL64 = @OTOOL64@
219PACKAGE = @PACKAGE@
220PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
221PACKAGE_NAME = @PACKAGE_NAME@
222PACKAGE_STRING = @PACKAGE_STRING@
223PACKAGE_TARNAME = @PACKAGE_TARNAME@
224PACKAGE_URL = @PACKAGE_URL@
225PACKAGE_VERSION = @PACKAGE_VERSION@
226PATH_SEPARATOR = @PATH_SEPARATOR@
227PKG_CONFIG = @PKG_CONFIG@
228PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
229PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
230PYTHON = @PYTHON@
231PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
232PYTHON_PLATFORM = @PYTHON_PLATFORM@
233PYTHON_PREFIX = @PYTHON_PREFIX@
234PYTHON_VERSION = @PYTHON_VERSION@
235RANLIB = @RANLIB@
236REMIX_CFLAGS = @REMIX_CFLAGS@
237REMIX_LIBS = @REMIX_LIBS@
238REMIX_PLUGIN_DIR = @REMIX_PLUGIN_DIR@
239SED = @SED@
240SET_MAKE = @SET_MAKE@
241SHELL = @SHELL@
242SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
243SNDFILE_LIBS = @SNDFILE_LIBS@
244STRIP = @STRIP@
245VERSION = @VERSION@
246VMAJ = @VMAJ@
247VORBISENC_CFLAGS = @VORBISENC_CFLAGS@
248VORBISENC_LIBS = @VORBISENC_LIBS@
249abs_builddir = @abs_builddir@
250abs_srcdir = @abs_srcdir@
251abs_top_builddir = @abs_top_builddir@
252abs_top_srcdir = @abs_top_srcdir@
253ac_ct_CC = @ac_ct_CC@
254ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
255am__include = @am__include@
256am__leading_dot = @am__leading_dot@
257am__quote = @am__quote@
258am__tar = @am__tar@
259am__untar = @am__untar@
260bindir = @bindir@
261build = @build@
262build_alias = @build_alias@
263build_cpu = @build_cpu@
264build_os = @build_os@
265build_vendor = @build_vendor@
266builddir = @builddir@
267datadir = @datadir@
268datarootdir = @datarootdir@
269docdir = @docdir@
270dvidir = @dvidir@
271edje_cc = @edje_cc@
272efl_doxygen = @efl_doxygen@
273efl_have_doxygen = @efl_have_doxygen@
274exec_prefix = @exec_prefix@
275have_lcov = @have_lcov@
276host = @host@
277host_alias = @host_alias@
278host_cpu = @host_cpu@
279host_os = @host_os@
280host_vendor = @host_vendor@
281htmldir = @htmldir@
282includedir = @includedir@
283infodir = @infodir@
284install_sh = @install_sh@
285libdir = @libdir@
286libexecdir = @libexecdir@
287localedir = @localedir@
288localstatedir = @localstatedir@
289lt_ECHO = @lt_ECHO@
290lt_enable_auto_import = @lt_enable_auto_import@
291lua_libs = @lua_libs@
292mandir = @mandir@
293mkdir_p = @mkdir_p@
294oldincludedir = @oldincludedir@
295pdfdir = @pdfdir@
296pkgconfig_requires_private = @pkgconfig_requires_private@
297pkgpyexecdir = @pkgpyexecdir@
298pkgpythondir = @pkgpythondir@
299prefix = @prefix@
300program_transform_name = @program_transform_name@
301psdir = @psdir@
302pyexecdir = @pyexecdir@
303pythondir = @pythondir@
304release_info = @release_info@
305requirement_edje = @requirement_edje@
306sbindir = @sbindir@
307sharedstatedir = @sharedstatedir@
308srcdir = @srcdir@
309sysconfdir = @sysconfdir@
310target_alias = @target_alias@
311top_build_prefix = @top_build_prefix@
312top_builddir = @top_builddir@
313top_srcdir = @top_srcdir@
314version_info = @version_info@
315vimdir = @vimdir@
316MAINTAINERCLEANFILES = Makefile.in
317eppdir = @libdir@/@PACKAGE@/utils
318epp_SOURCES = \
319cpplib.h \
320cpphash.h \
321cppalloc.c \
322cpperror.c \
323cppexp.c \
324cpphash.c \
325cpplib.c \
326cppmain.c
327
328epp_CPPFLAGS = \
329-I$(top_builddir) \
330$(CWARNFLAGS)
331
332all: all-am
333
334.SUFFIXES:
335.SUFFIXES: .c .lo .o .obj
336$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
337 @for dep in $?; do \
338 case '$(am__configure_deps)' in \
339 *$$dep*) \
340 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
341 && { if test -f $@; then exit 0; else break; fi; }; \
342 exit 1;; \
343 esac; \
344 done; \
345 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/bin/epp/Makefile'; \
346 $(am__cd) $(top_srcdir) && \
347 $(AUTOMAKE) --gnu src/bin/epp/Makefile
348.PRECIOUS: Makefile
349Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
350 @case '$?' in \
351 *config.status*) \
352 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
353 *) \
354 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
355 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
356 esac;
357
358$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
359 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
360
361$(top_srcdir)/configure: $(am__configure_deps)
362 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
363$(ACLOCAL_M4): $(am__aclocal_m4_deps)
364 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
365$(am__aclocal_m4_deps):
366install-eppPROGRAMS: $(epp_PROGRAMS)
367 @$(NORMAL_INSTALL)
368 test -z "$(eppdir)" || $(MKDIR_P) "$(DESTDIR)$(eppdir)"
369 @list='$(epp_PROGRAMS)'; test -n "$(eppdir)" || list=; \
370 for p in $$list; do echo "$$p $$p"; done | \
371 sed 's/$(EXEEXT)$$//' | \
372 while read p p1; do if test -f $$p || test -f $$p1; \
373 then echo "$$p"; echo "$$p"; else :; fi; \
374 done | \
375 sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
376 -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
377 sed 'N;N;N;s,\n, ,g' | \
378 $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
379 { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
380 if ($$2 == $$4) files[d] = files[d] " " $$1; \
381 else { print "f", $$3 "/" $$4, $$1; } } \
382 END { for (d in files) print "f", d, files[d] }' | \
383 while read type dir files; do \
384 if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
385 test -z "$$files" || { \
386 echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(eppdir)$$dir'"; \
387 $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(eppdir)$$dir" || exit $$?; \
388 } \
389 ; done
390
391uninstall-eppPROGRAMS:
392 @$(NORMAL_UNINSTALL)
393 @list='$(epp_PROGRAMS)'; test -n "$(eppdir)" || list=; \
394 files=`for p in $$list; do echo "$$p"; done | \
395 sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
396 -e 's/$$/$(EXEEXT)/' `; \
397 test -n "$$list" || exit 0; \
398 echo " ( cd '$(DESTDIR)$(eppdir)' && rm -f" $$files ")"; \
399 cd "$(DESTDIR)$(eppdir)" && rm -f $$files
400
401clean-eppPROGRAMS:
402 @list='$(epp_PROGRAMS)'; test -n "$$list" || exit 0; \
403 echo " rm -f" $$list; \
404 rm -f $$list || exit $$?; \
405 test -n "$(EXEEXT)" || exit 0; \
406 list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
407 echo " rm -f" $$list; \
408 rm -f $$list
409epp$(EXEEXT): $(epp_OBJECTS) $(epp_DEPENDENCIES)
410 @rm -f epp$(EXEEXT)
411 $(AM_V_CCLD)$(LINK) $(epp_OBJECTS) $(epp_LDADD) $(LIBS)
412
413mostlyclean-compile:
414 -rm -f *.$(OBJEXT)
415
416distclean-compile:
417 -rm -f *.tab.c
418
419@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epp-cppalloc.Po@am__quote@
420@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epp-cpperror.Po@am__quote@
421@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epp-cppexp.Po@am__quote@
422@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epp-cpphash.Po@am__quote@
423@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epp-cpplib.Po@am__quote@
424@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epp-cppmain.Po@am__quote@
425
426.c.o:
427@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
428@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
429@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
430@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
431@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
432@am__fastdepCC_FALSE@ $(COMPILE) -c $<
433
434.c.obj:
435@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
436@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
437@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
438@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
439@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
440@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
441
442.c.lo:
443@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
444@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
445@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
446@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
447@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
448@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
449
450epp-cppalloc.o: cppalloc.c
451@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cppalloc.o -MD -MP -MF $(DEPDIR)/epp-cppalloc.Tpo -c -o epp-cppalloc.o `test -f 'cppalloc.c' || echo '$(srcdir)/'`cppalloc.c
452@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cppalloc.Tpo $(DEPDIR)/epp-cppalloc.Po
453@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
454@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cppalloc.c' object='epp-cppalloc.o' libtool=no @AMDEPBACKSLASH@
455@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
456@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cppalloc.o `test -f 'cppalloc.c' || echo '$(srcdir)/'`cppalloc.c
457
458epp-cppalloc.obj: cppalloc.c
459@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cppalloc.obj -MD -MP -MF $(DEPDIR)/epp-cppalloc.Tpo -c -o epp-cppalloc.obj `if test -f 'cppalloc.c'; then $(CYGPATH_W) 'cppalloc.c'; else $(CYGPATH_W) '$(srcdir)/cppalloc.c'; fi`
460@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cppalloc.Tpo $(DEPDIR)/epp-cppalloc.Po
461@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
462@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cppalloc.c' object='epp-cppalloc.obj' libtool=no @AMDEPBACKSLASH@
463@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
464@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cppalloc.obj `if test -f 'cppalloc.c'; then $(CYGPATH_W) 'cppalloc.c'; else $(CYGPATH_W) '$(srcdir)/cppalloc.c'; fi`
465
466epp-cpperror.o: cpperror.c
467@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cpperror.o -MD -MP -MF $(DEPDIR)/epp-cpperror.Tpo -c -o epp-cpperror.o `test -f 'cpperror.c' || echo '$(srcdir)/'`cpperror.c
468@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cpperror.Tpo $(DEPDIR)/epp-cpperror.Po
469@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
470@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpperror.c' object='epp-cpperror.o' libtool=no @AMDEPBACKSLASH@
471@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
472@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cpperror.o `test -f 'cpperror.c' || echo '$(srcdir)/'`cpperror.c
473
474epp-cpperror.obj: cpperror.c
475@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cpperror.obj -MD -MP -MF $(DEPDIR)/epp-cpperror.Tpo -c -o epp-cpperror.obj `if test -f 'cpperror.c'; then $(CYGPATH_W) 'cpperror.c'; else $(CYGPATH_W) '$(srcdir)/cpperror.c'; fi`
476@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cpperror.Tpo $(DEPDIR)/epp-cpperror.Po
477@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
478@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpperror.c' object='epp-cpperror.obj' libtool=no @AMDEPBACKSLASH@
479@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
480@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cpperror.obj `if test -f 'cpperror.c'; then $(CYGPATH_W) 'cpperror.c'; else $(CYGPATH_W) '$(srcdir)/cpperror.c'; fi`
481
482epp-cppexp.o: cppexp.c
483@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cppexp.o -MD -MP -MF $(DEPDIR)/epp-cppexp.Tpo -c -o epp-cppexp.o `test -f 'cppexp.c' || echo '$(srcdir)/'`cppexp.c
484@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cppexp.Tpo $(DEPDIR)/epp-cppexp.Po
485@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
486@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cppexp.c' object='epp-cppexp.o' libtool=no @AMDEPBACKSLASH@
487@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
488@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cppexp.o `test -f 'cppexp.c' || echo '$(srcdir)/'`cppexp.c
489
490epp-cppexp.obj: cppexp.c
491@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cppexp.obj -MD -MP -MF $(DEPDIR)/epp-cppexp.Tpo -c -o epp-cppexp.obj `if test -f 'cppexp.c'; then $(CYGPATH_W) 'cppexp.c'; else $(CYGPATH_W) '$(srcdir)/cppexp.c'; fi`
492@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cppexp.Tpo $(DEPDIR)/epp-cppexp.Po
493@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
494@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cppexp.c' object='epp-cppexp.obj' libtool=no @AMDEPBACKSLASH@
495@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
496@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cppexp.obj `if test -f 'cppexp.c'; then $(CYGPATH_W) 'cppexp.c'; else $(CYGPATH_W) '$(srcdir)/cppexp.c'; fi`
497
498epp-cpphash.o: cpphash.c
499@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cpphash.o -MD -MP -MF $(DEPDIR)/epp-cpphash.Tpo -c -o epp-cpphash.o `test -f 'cpphash.c' || echo '$(srcdir)/'`cpphash.c
500@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cpphash.Tpo $(DEPDIR)/epp-cpphash.Po
501@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
502@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpphash.c' object='epp-cpphash.o' libtool=no @AMDEPBACKSLASH@
503@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
504@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cpphash.o `test -f 'cpphash.c' || echo '$(srcdir)/'`cpphash.c
505
506epp-cpphash.obj: cpphash.c
507@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cpphash.obj -MD -MP -MF $(DEPDIR)/epp-cpphash.Tpo -c -o epp-cpphash.obj `if test -f 'cpphash.c'; then $(CYGPATH_W) 'cpphash.c'; else $(CYGPATH_W) '$(srcdir)/cpphash.c'; fi`
508@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cpphash.Tpo $(DEPDIR)/epp-cpphash.Po
509@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
510@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpphash.c' object='epp-cpphash.obj' libtool=no @AMDEPBACKSLASH@
511@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
512@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cpphash.obj `if test -f 'cpphash.c'; then $(CYGPATH_W) 'cpphash.c'; else $(CYGPATH_W) '$(srcdir)/cpphash.c'; fi`
513
514epp-cpplib.o: cpplib.c
515@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cpplib.o -MD -MP -MF $(DEPDIR)/epp-cpplib.Tpo -c -o epp-cpplib.o `test -f 'cpplib.c' || echo '$(srcdir)/'`cpplib.c
516@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cpplib.Tpo $(DEPDIR)/epp-cpplib.Po
517@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
518@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpplib.c' object='epp-cpplib.o' libtool=no @AMDEPBACKSLASH@
519@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
520@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cpplib.o `test -f 'cpplib.c' || echo '$(srcdir)/'`cpplib.c
521
522epp-cpplib.obj: cpplib.c
523@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cpplib.obj -MD -MP -MF $(DEPDIR)/epp-cpplib.Tpo -c -o epp-cpplib.obj `if test -f 'cpplib.c'; then $(CYGPATH_W) 'cpplib.c'; else $(CYGPATH_W) '$(srcdir)/cpplib.c'; fi`
524@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cpplib.Tpo $(DEPDIR)/epp-cpplib.Po
525@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
526@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpplib.c' object='epp-cpplib.obj' libtool=no @AMDEPBACKSLASH@
527@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
528@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cpplib.obj `if test -f 'cpplib.c'; then $(CYGPATH_W) 'cpplib.c'; else $(CYGPATH_W) '$(srcdir)/cpplib.c'; fi`
529
530epp-cppmain.o: cppmain.c
531@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cppmain.o -MD -MP -MF $(DEPDIR)/epp-cppmain.Tpo -c -o epp-cppmain.o `test -f 'cppmain.c' || echo '$(srcdir)/'`cppmain.c
532@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cppmain.Tpo $(DEPDIR)/epp-cppmain.Po
533@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
534@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cppmain.c' object='epp-cppmain.o' libtool=no @AMDEPBACKSLASH@
535@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
536@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cppmain.o `test -f 'cppmain.c' || echo '$(srcdir)/'`cppmain.c
537
538epp-cppmain.obj: cppmain.c
539@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT epp-cppmain.obj -MD -MP -MF $(DEPDIR)/epp-cppmain.Tpo -c -o epp-cppmain.obj `if test -f 'cppmain.c'; then $(CYGPATH_W) 'cppmain.c'; else $(CYGPATH_W) '$(srcdir)/cppmain.c'; fi`
540@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/epp-cppmain.Tpo $(DEPDIR)/epp-cppmain.Po
541@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
542@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cppmain.c' object='epp-cppmain.obj' libtool=no @AMDEPBACKSLASH@
543@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
544@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(epp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o epp-cppmain.obj `if test -f 'cppmain.c'; then $(CYGPATH_W) 'cppmain.c'; else $(CYGPATH_W) '$(srcdir)/cppmain.c'; fi`
545
546mostlyclean-libtool:
547 -rm -f *.lo
548
549clean-libtool:
550 -rm -rf .libs _libs
551
552ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
553 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
554 unique=`for i in $$list; do \
555 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
556 done | \
557 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
558 END { if (nonempty) { for (i in files) print i; }; }'`; \
559 mkid -fID $$unique
560tags: TAGS
561
562TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
563 $(TAGS_FILES) $(LISP)
564 set x; \
565 here=`pwd`; \
566 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
567 unique=`for i in $$list; do \
568 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
569 done | \
570 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
571 END { if (nonempty) { for (i in files) print i; }; }'`; \
572 shift; \
573 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
574 test -n "$$unique" || unique=$$empty_fix; \
575 if test $$# -gt 0; then \
576 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
577 "$$@" $$unique; \
578 else \
579 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
580 $$unique; \
581 fi; \
582 fi
583ctags: CTAGS
584CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
585 $(TAGS_FILES) $(LISP)
586 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
587 unique=`for i in $$list; do \
588 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
589 done | \
590 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
591 END { if (nonempty) { for (i in files) print i; }; }'`; \
592 test -z "$(CTAGS_ARGS)$$unique" \
593 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
594 $$unique
595
596GTAGS:
597 here=`$(am__cd) $(top_builddir) && pwd` \
598 && $(am__cd) $(top_srcdir) \
599 && gtags -i $(GTAGS_ARGS) "$$here"
600
601distclean-tags:
602 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
603
604distdir: $(DISTFILES)
605 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
606 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
607 list='$(DISTFILES)'; \
608 dist_files=`for file in $$list; do echo $$file; done | \
609 sed -e "s|^$$srcdirstrip/||;t" \
610 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
611 case $$dist_files in \
612 */*) $(MKDIR_P) `echo "$$dist_files" | \
613 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
614 sort -u` ;; \
615 esac; \
616 for file in $$dist_files; do \
617 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
618 if test -d $$d/$$file; then \
619 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
620 if test -d "$(distdir)/$$file"; then \
621 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
622 fi; \
623 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
624 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
625 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
626 fi; \
627 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
628 else \
629 test -f "$(distdir)/$$file" \
630 || cp -p $$d/$$file "$(distdir)/$$file" \
631 || exit 1; \
632 fi; \
633 done
634check-am: all-am
635check: check-am
636all-am: Makefile $(PROGRAMS)
637installdirs:
638 for dir in "$(DESTDIR)$(eppdir)"; do \
639 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
640 done
641install: install-am
642install-exec: install-exec-am
643install-data: install-data-am
644uninstall: uninstall-am
645
646install-am: all-am
647 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
648
649installcheck: installcheck-am
650install-strip:
651 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
652 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
653 `test -z '$(STRIP)' || \
654 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
655mostlyclean-generic:
656
657clean-generic:
658
659distclean-generic:
660 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
661 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
662
663maintainer-clean-generic:
664 @echo "This command is intended for maintainers to use"
665 @echo "it deletes files that may require special tools to rebuild."
666 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
667clean: clean-am
668
669clean-am: clean-eppPROGRAMS clean-generic clean-libtool mostlyclean-am
670
671distclean: distclean-am
672 -rm -rf ./$(DEPDIR)
673 -rm -f Makefile
674distclean-am: clean-am distclean-compile distclean-generic \
675 distclean-tags
676
677dvi: dvi-am
678
679dvi-am:
680
681html: html-am
682
683html-am:
684
685info: info-am
686
687info-am:
688
689install-data-am: install-eppPROGRAMS
690
691install-dvi: install-dvi-am
692
693install-dvi-am:
694
695install-exec-am:
696
697install-html: install-html-am
698
699install-html-am:
700
701install-info: install-info-am
702
703install-info-am:
704
705install-man:
706
707install-pdf: install-pdf-am
708
709install-pdf-am:
710
711install-ps: install-ps-am
712
713install-ps-am:
714
715installcheck-am:
716
717maintainer-clean: maintainer-clean-am
718 -rm -rf ./$(DEPDIR)
719 -rm -f Makefile
720maintainer-clean-am: distclean-am maintainer-clean-generic
721
722mostlyclean: mostlyclean-am
723
724mostlyclean-am: mostlyclean-compile mostlyclean-generic \
725 mostlyclean-libtool
726
727pdf: pdf-am
728
729pdf-am:
730
731ps: ps-am
732
733ps-am:
734
735uninstall-am: uninstall-eppPROGRAMS
736
737.MAKE: install-am install-strip
738
739.PHONY: CTAGS GTAGS all all-am check check-am clean clean-eppPROGRAMS \
740 clean-generic clean-libtool ctags distclean distclean-compile \
741 distclean-generic distclean-libtool distclean-tags distdir dvi \
742 dvi-am html html-am info info-am install install-am \
743 install-data install-data-am install-dvi install-dvi-am \
744 install-eppPROGRAMS install-exec install-exec-am install-html \
745 install-html-am install-info install-info-am install-man \
746 install-pdf install-pdf-am install-ps install-ps-am \
747 install-strip installcheck installcheck-am installdirs \
748 maintainer-clean maintainer-clean-generic mostlyclean \
749 mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
750 pdf pdf-am ps ps-am tags uninstall uninstall-am \
751 uninstall-eppPROGRAMS
752
753
754# Tell versions [3.59,3.63) of GNU make to not export all variables.
755# Otherwise a system limit (for SysV at least) may be exceeded.
756.NOEXPORT:
diff --git a/libraries/edje/src/bin/epp/cppalloc.c b/libraries/edje/src/bin/epp/cppalloc.c
deleted file mode 100644
index 4ce0dd0..0000000
--- a/libraries/edje/src/bin/epp/cppalloc.c
+++ /dev/null
@@ -1,70 +0,0 @@
1/* Part of CPP library. (memory allocation - xmalloc etc)
2 * Copyright (C) 1986, 87, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
3 * Written by Per Bothner, 1994.
4 * Based on CCCP program by by Paul Rubin, June 1986
5 * Adapted to ANSI C, Richard Stallman, Jan 1987
6 * Copyright (C) 2003-2011 Kim Woelders
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * In other words, you are welcome to use, share and improve this program.
23 * You are forbidden to forbid anyone else to use, share and improve
24 * what you give them. Help stamp out software-hoarding! */
25
26#ifdef HAVE_CONFIG_H
27# include <config.h>
28#endif
29
30#include <stdlib.h>
31
32#include "cpplib.h"
33
34static void
35memory_full(void)
36{
37 cpp_fatal("Memory exhausted.");
38}
39
40void *
41xmalloc(unsigned size)
42{
43 char *ptr = (char *)malloc(size);
44
45 if (ptr)
46 return (ptr);
47 memory_full();
48 /*NOTREACHED */
49 return 0;
50}
51
52void *
53xrealloc(void *old, unsigned size)
54{
55 char *ptr = (char *)realloc(old, size);
56
57 if (!ptr)
58 memory_full();
59 return ptr;
60}
61
62void *
63xcalloc(unsigned number, unsigned size)
64{
65 char *ptr = (char *)calloc(number, size);
66
67 if (!ptr)
68 memory_full();
69 return ptr;
70}
diff --git a/libraries/edje/src/bin/epp/cpperror.c b/libraries/edje/src/bin/epp/cpperror.c
deleted file mode 100644
index f4cd5eb..0000000
--- a/libraries/edje/src/bin/epp/cpperror.c
+++ /dev/null
@@ -1,147 +0,0 @@
1/* Default error handlers for CPP Library.
2 * Copyright (C) 1986, 87, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
3 * Written by Per Bothner, 1994.
4 * Based on CCCP program by by Paul Rubin, June 1986
5 * Adapted to ANSI C, Richard Stallman, Jan 1987
6 * Copyright (C) 2003-2011 Kim Woelders
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * In other words, you are welcome to use, share and improve this program.
23 * You are forbidden to forbid anyone else to use, share and improve
24 * what you give them. Help stamp out software-hoarding! */
25
26#ifdef HAVE_CONFIG_H
27# include <config.h>
28#endif
29
30#include <stdio.h>
31#include <stdlib.h>
32
33#include "cpplib.h"
34
35/* Print the file names and line numbers of the #include
36 * commands which led to the current file. */
37
38void
39cpp_print_containing_files(cpp_reader * pfile)
40{
41 cpp_buffer *ip;
42 int first = 1;
43
44 /* If stack of files hasn't changed since we last printed
45 * this info, don't repeat it. */
46 if (pfile->input_stack_listing_current)
47 return;
48
49 ip = cpp_file_buffer(pfile);
50
51 /* Give up if we don't find a source file. */
52 if (!ip)
53 return;
54
55 /* Find the other, outer source files. */
56 while ((ip = CPP_PREV_BUFFER(ip)), ip != CPP_NULL_BUFFER(pfile))
57 {
58 long line, col;
59
60 cpp_buf_line_and_col(ip, &line, &col);
61 if (ip->fname)
62 {
63 if (first)
64 {
65 first = 0;
66 fprintf(stderr, "In file included");
67 }
68 else
69 fprintf(stderr, ",\n ");
70 }
71 }
72 if (!first)
73 fprintf(stderr, ":\n");
74
75 /* Record we have printed the status as of this time. */
76 pfile->input_stack_listing_current = 1;
77}
78
79void
80cpp_file_line_for_message(cpp_reader * pfile __UNUSED__, const char *filename,
81 int line, int column)
82{
83 if (column > 0)
84 {
85 fprintf(stderr, "%s:%d:%d: ", filename, line, column);
86 }
87 else
88 {
89 fprintf(stderr, "%s:%d: ", filename, line);
90 }
91}
92
93/* IS_ERROR is 1 for error, 0 for warning */
94void
95cpp_message_v(cpp_reader * pfile, int is_error, const char *msg, va_list args)
96{
97 if (is_error)
98 pfile->errors++;
99 else
100 fprintf(stderr, "warning: ");
101 vfprintf(stderr, msg, args);
102 fprintf(stderr, "\n");
103}
104
105void
106cpp_message(cpp_reader * pfile, int is_error, const char *msg, ...)
107{
108 va_list args;
109
110 va_start(args, msg);
111
112 cpp_message_v(pfile, is_error, msg, args);
113
114 va_end(args);
115}
116
117static void
118cpp_fatal_v(const char *msg, va_list args)
119{
120 fprintf(stderr, "%s: ", progname);
121 vfprintf(stderr, msg, args);
122 fprintf(stderr, "\n");
123 exit(FATAL_EXIT_CODE);
124}
125
126void
127cpp_fatal(const char *msg, ...)
128{
129 va_list args;
130
131 va_start(args, msg);
132
133 cpp_fatal_v(msg, args);
134
135 va_end(args);
136}
137
138void
139cpp_pfatal_with_name(cpp_reader * pfile, const char *name)
140{
141 cpp_perror_with_name(pfile, name);
142#ifdef VMS
143 exit(vaxc$errno);
144#else
145 exit(FATAL_EXIT_CODE);
146#endif
147}
diff --git a/libraries/edje/src/bin/epp/cppexp.c b/libraries/edje/src/bin/epp/cppexp.c
deleted file mode 100644
index 5fcb33f..0000000
--- a/libraries/edje/src/bin/epp/cppexp.c
+++ /dev/null
@@ -1,1090 +0,0 @@
1/* Parse C expressions for CCCP.
2 * Copyright (C) 1987, 1992, 1994, 1995 Free Software Foundation.
3 * Copyright (C) 2003-2011 Kim Woelders
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2, or (at your option) any
8 * later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * In other words, you are welcome to use, share and improve this program.
20 * You are forbidden to forbid anyone else to use, share and improve
21 * what you give them. Help stamp out software-hoarding!
22 *
23 * Written by Per Bothner 1994. */
24
25/* Parse a C expression from text in a string */
26
27#ifdef HAVE_CONFIG_H
28# include <config.h>
29#endif
30
31#ifdef __EMX__
32# include <strings.h>
33#endif
34
35#ifdef MULTIBYTE_CHARS
36# include <locale.h>
37#endif
38
39#include <stdlib.h>
40#include <stdio.h>
41#include <string.h>
42
43#include "cpplib.h"
44#include "cpphash.h"
45
46/* This is used for communicating lists of keywords with cccp.c. */
47struct arglist {
48 struct arglist *next;
49 unsigned char *name;
50 int length;
51 int argno;
52};
53
54/* Define a generic NULL if one hasn't already been defined. */
55
56#ifndef NULL
57#define NULL 0
58#endif
59
60#ifndef GENERIC_PTR
61#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
62#define GENERIC_PTR void *
63#else
64#define GENERIC_PTR char *
65#endif
66#endif
67
68#ifndef NULL_PTR
69#define NULL_PTR ((GENERIC_PTR)0)
70#endif
71
72#ifndef CHAR_TYPE_SIZE
73#define CHAR_TYPE_SIZE BITS_PER_UNIT
74#endif
75
76#ifndef INT_TYPE_SIZE
77#define INT_TYPE_SIZE BITS_PER_WORD
78#endif
79
80#ifndef LONG_TYPE_SIZE
81#define LONG_TYPE_SIZE BITS_PER_WORD
82#endif
83
84#ifndef WCHAR_TYPE_SIZE
85#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
86#endif
87
88#ifndef MAX_CHAR_TYPE_SIZE
89#define MAX_CHAR_TYPE_SIZE CHAR_TYPE_SIZE
90#endif
91
92#ifndef MAX_INT_TYPE_SIZE
93#define MAX_INT_TYPE_SIZE INT_TYPE_SIZE
94#endif
95
96#ifndef MAX_LONG_TYPE_SIZE
97#define MAX_LONG_TYPE_SIZE LONG_TYPE_SIZE
98#endif
99
100#ifndef MAX_WCHAR_TYPE_SIZE
101#define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE
102#endif
103
104/* Yield nonzero if adding two numbers with A's and B's signs can yield a
105 * number with SUM's sign, where A, B, and SUM are all C integers. */
106#define possible_sum_sign(a, b, sum) ((((a) ^ (b)) | ~ ((a) ^ (sum))) < 0)
107
108#define ERROR 299
109#define OROR 300
110#define ANDAND 301
111#define EQUAL 302
112#define NOTEQUAL 303
113#define LEQ 304
114#define GEQ 305
115#define LSH 306
116#define RSH 307
117#define NAME 308
118#define INT 309
119#define CHAR 310
120
121#define LEFT_OPERAND_REQUIRED 1
122#define RIGHT_OPERAND_REQUIRED 2
123#define HAVE_VALUE 4
124/* SKIP_OPERAND is set for '&&' '||' '?' and ':' when the
125 * following operand should be short-circuited instead of evaluated. */
126#define SKIP_OPERAND 8
127/*#define UNSIGNEDP 16 */
128
129struct operation {
130 short op;
131 char rprio; /* Priority of op (relative to it right operand). */
132 char flags;
133 char unsignedp; /* true if value should be treated as unsigned */
134 HOST_WIDE_INT value; /* The value logically "right" of op. */
135};
136
137/* Take care of parsing a number (anything that starts with a digit).
138 * LEN is the number of characters in it. */
139
140/* maybe needs to actually deal with floating point numbers */
141
142static void
143parse_number(struct operation *op, cpp_reader * pfile, const char *start,
144 int olen)
145{
146 const char *p = start;
147 int c;
148 unsigned long n = 0, nd, ULONG_MAX_over_base;
149 int base = 10;
150 int len = olen;
151 int overflow = 0;
152 int digit, largest_digit = 0;
153 int spec_long = 0;
154
155 op->unsignedp = 0;
156
157 for (c = 0; c < len; c++)
158 if (p[c] == '.')
159 {
160 /* It's a float since it contains a point. */
161 cpp_error(pfile,
162 "floating point numbers not allowed in #if expressions");
163 op->op = ERROR;
164 return;
165 }
166 if (len >= 3 && (!strncmp(p, "0x", 2) || !strncmp(p, "0X", 2)))
167 {
168 p += 2;
169 base = 16;
170 len -= 2;
171 }
172 else if (*p == '0')
173 base = 8;
174
175 /* Some buggy compilers (e.g. MPW C) seem to need both casts. */
176 ULONG_MAX_over_base = ((unsigned long)-1) / ((unsigned long)base);
177
178 for (; len > 0; len--)
179 {
180 c = *p++;
181
182 if (c >= '0' && c <= '9')
183 digit = c - '0';
184 else if (base == 16 && c >= 'a' && c <= 'f')
185 digit = c - 'a' + 10;
186 else if (base == 16 && c >= 'A' && c <= 'F')
187 digit = c - 'A' + 10;
188 else
189 {
190 /* `l' means long, and `u' means unsigned. */
191 while (1)
192 {
193 if (c == 'l' || c == 'L')
194 {
195 if (spec_long)
196 cpp_error(pfile, "two `l's in integer constant");
197 spec_long = 1;
198 }
199 else if (c == 'u' || c == 'U')
200 {
201 if (op->unsignedp)
202 cpp_error(pfile, "two `u's in integer constant");
203 op->unsignedp = 1;
204 }
205 else
206 break;
207
208 if (--len == 0)
209 break;
210 c = *p++;
211 }
212 /* Don't look for any more digits after the suffixes. */
213 break;
214 }
215 if (largest_digit < digit)
216 largest_digit = digit;
217 nd = n * base + digit;
218 overflow |= (ULONG_MAX_over_base < n) | (nd < n);
219 n = nd;
220 }
221
222 if (len != 0)
223 {
224 cpp_error(pfile, "Invalid number in #if expression");
225 op->op = ERROR;
226 return;
227 }
228 if (base <= largest_digit)
229 cpp_warning(pfile, "integer constant contains digits beyond the radix");
230
231 if (overflow)
232 cpp_warning(pfile, "integer constant out of range");
233
234 /* If too big to be signed, consider it unsigned. */
235 if ((long)n < 0 && !op->unsignedp)
236 {
237 if (base == 10)
238 cpp_warning(pfile,
239 "integer constant is so large that it is unsigned");
240 op->unsignedp = 1;
241 }
242 op->value = n;
243 op->op = INT;
244}
245
246struct token {
247 const char *oper;
248 int token;
249};
250
251static struct token tokentab2[] = {
252 {"&&", ANDAND},
253 {"||", OROR},
254 {"<<", LSH},
255 {">>", RSH},
256 {"==", EQUAL},
257 {"!=", NOTEQUAL},
258 {"<=", LEQ},
259 {">=", GEQ},
260 {"++", ERROR},
261 {"--", ERROR},
262 {NULL, ERROR}
263};
264
265/* Read one token. */
266
267static void
268cpp_lex(struct operation *op, cpp_reader * pfile)
269{
270 int c;
271 struct token *toktab;
272 enum cpp_token token;
273 unsigned char *tok_start, *tok_end;
274 int old_written;
275
276 op->value = 0;
277 op->unsignedp = 0;
278
279 retry:
280
281 old_written = CPP_WRITTEN(pfile);
282 cpp_skip_hspace(pfile);
283 c = CPP_BUF_PEEK(CPP_BUFFER(pfile));
284 if (c == '#')
285 {
286 parse_number(op, pfile, cpp_read_check_assertion(pfile) ? "1" : "0", 1);
287 return;
288 }
289
290 if (c == '\n')
291 {
292 op->op = 0;
293 return;
294 }
295 token = cpp_get_token(pfile);
296 tok_start = pfile->token_buffer + old_written;
297 tok_end = CPP_PWRITTEN(pfile);
298 pfile->limit = tok_start;
299 switch (token)
300 {
301 case CPP_EOF: /* Should not happen ... */
302 op->op = 0;
303 break;
304
305 case CPP_VSPACE:
306 case CPP_POP:
307 if (CPP_BUFFER(pfile)->fname)
308 {
309 op->op = 0;
310 break;
311 }
312 goto retry;
313
314 case CPP_HSPACE:
315 case CPP_COMMENT:
316 goto retry;
317
318 case CPP_NUMBER:
319 parse_number(op, pfile, (char *)tok_start, tok_end - tok_start);
320 break;
321
322 case CPP_STRING:
323 cpp_error(pfile, "string constants not allowed in #if expressions");
324 op->op = ERROR;
325 break;
326
327 case CPP_CHAR:
328 /* This code for reading a character constant
329 * handles multicharacter constants and wide characters.
330 * It is mostly copied from c-lex.c. */
331 {
332 int result = 0;
333 int num_chars = 0;
334 unsigned width = MAX_CHAR_TYPE_SIZE;
335 int wide_flag = 0;
336 int max_chars;
337 char *ptr = (char *)tok_start;
338
339#ifdef MULTIBYTE_CHARS
340 char token_buffer[MAX_LONG_TYPE_SIZE /
341 MAX_CHAR_TYPE_SIZE + MB_CUR_MAX];
342#endif
343
344 if (*ptr == 'L')
345 {
346 ptr++;
347 wide_flag = 1;
348 width = MAX_WCHAR_TYPE_SIZE;
349#ifdef MULTIBYTE_CHARS
350 max_chars = MB_CUR_MAX;
351#else
352 max_chars = 1;
353#endif
354 }
355 else
356 max_chars = MAX_LONG_TYPE_SIZE / width;
357
358 while (1)
359 {
360 if (ptr >= (char *)CPP_PWRITTEN(pfile) || (c = *ptr++) == '\'')
361 break;
362
363 if (c == '\\')
364 {
365 c = cpp_parse_escape(pfile, &ptr);
366 if (width < HOST_BITS_PER_INT
367 && (unsigned)c >= (unsigned)(1 << width))
368 cpp_pedwarn(pfile,
369 "escape sequence out of range for character");
370 }
371 num_chars++;
372
373 /* Merge character into result; ignore excess chars. */
374 if (num_chars < max_chars + 1)
375 {
376 if (width < HOST_BITS_PER_INT)
377 result = (result << width) | (c & ((1 << width) - 1));
378 else
379 result = c;
380#ifdef MULTIBYTE_CHARS
381 token_buffer[num_chars - 1] = c;
382#endif
383 }
384 }
385
386#ifdef MULTIBYTE_CHARS
387 token_buffer[num_chars] = 0;
388#endif
389
390 if (c != '\'')
391 cpp_error(pfile, "malformatted character constant");
392 else if (num_chars == 0)
393 cpp_error(pfile, "empty character constant");
394 else if (num_chars > max_chars)
395 {
396 num_chars = max_chars;
397 cpp_error(pfile, "character constant too long");
398 }
399 else if (num_chars != 1 && !CPP_TRADITIONAL(pfile))
400 cpp_warning(pfile, "multi-character character constant");
401
402 /* If char type is signed, sign-extend the constant. */
403 if (!wide_flag)
404 {
405 int num_bits = num_chars * width;
406
407 if (cpp_lookup("__CHAR_UNSIGNED__",
408 sizeof("__CHAR_UNSIGNED__") - 1, -1)
409 || ((result >> (num_bits - 1)) & 1) == 0)
410 op->value =
411 result & ((unsigned long)~0 >>
412 (HOST_BITS_PER_LONG - num_bits));
413 else
414 op->value =
415 result | ~((unsigned long)~0 >>
416 (HOST_BITS_PER_LONG - num_bits));
417 }
418 else
419 {
420#ifdef MULTIBYTE_CHARS
421 /* Set the initial shift state and convert the next sequence. */
422 result = 0;
423 /* In all locales L'\0' is zero and mbtowc will return zero,
424 * so don't use it. */
425 if (num_chars > 1
426 || (num_chars == 1 && token_buffer[0] != '\0'))
427 {
428 wchar_t wc;
429
430 (void)mbtowc(NULL_PTR, NULL_PTR, 0);
431 if (mbtowc(&wc, token_buffer, num_chars) == num_chars)
432 result = wc;
433 else
434 cpp_warning(pfile,
435 "Ignoring invalid multibyte character");
436 }
437#endif
438 op->value = result;
439 }
440 }
441
442 /* This is always a signed type. */
443 op->unsignedp = 0;
444 op->op = CHAR;
445 break;
446
447 case CPP_NAME:
448 parse_number(op, pfile, "0", 0);
449 break;
450
451 case CPP_OTHER:
452 /* See if it is a special token of length 2. */
453 if (tok_start + 2 == tok_end)
454 {
455 for (toktab = tokentab2; toktab->oper; toktab++)
456 if (tok_start[0] == toktab->oper[0]
457 && tok_start[1] == toktab->oper[1])
458 break;
459 if (toktab->token == ERROR)
460 {
461 char *buf = (char *)malloc(40);
462
463 memset(buf, 0, 40);
464
465 sprintf(buf, "`%s' not allowed in operand of `#if'",
466 tok_start);
467 cpp_error(pfile, buf);
468 free(buf);
469 }
470 op->op = toktab->token;
471 break;
472 }
473 /* fall through */
474 default:
475 op->op = *tok_start;
476 break;
477 }
478}
479
480/* Parse a C escape sequence. STRING_PTR points to a variable
481 * containing a pointer to the string to parse. That pointer
482 * is updated past the characters we use. The value of the
483 * escape sequence is returned.
484 *
485 * A negative value means the sequence \ newline was seen,
486 * which is supposed to be equivalent to nothing at all.
487 *
488 * If \ is followed by a null character, we return a negative
489 * value and leave the string pointer pointing at the null character.
490 *
491 * If \ is followed by 000, we return 0 and leave the string pointer
492 * after the zeros. A value of 0 does not mean end of string. */
493
494int
495cpp_parse_escape(cpp_reader * pfile, char **string_ptr)
496{
497 int c = *(*string_ptr)++;
498
499 switch (c)
500 {
501 case 'a':
502 return TARGET_BELL;
503 case 'b':
504 return TARGET_BS;
505 case 'e':
506 case 'E':
507 if (CPP_PEDANTIC(pfile))
508 cpp_pedwarn(pfile, "non-ANSI-standard escape sequence, `\\%c'", c);
509 return 033;
510 case 'f':
511 return TARGET_FF;
512 case 'n':
513 return TARGET_NEWLINE;
514 case 'r':
515 return TARGET_CR;
516 case 't':
517 return TARGET_TAB;
518 case 'v':
519 return TARGET_VT;
520 case '\n':
521 return -2;
522 case 0:
523 (*string_ptr)--;
524 return 0;
525
526 case '0':
527 case '1':
528 case '2':
529 case '3':
530 case '4':
531 case '5':
532 case '6':
533 case '7':
534 {
535 int i = c - '0';
536 int count = 0;
537
538 while (++count < 3)
539 {
540 c = *(*string_ptr)++;
541 if (c >= '0' && c <= '7')
542 i = (i << 3) + c - '0';
543 else
544 {
545 (*string_ptr)--;
546 break;
547 }
548 }
549 if ((i & ~((1 << MAX_CHAR_TYPE_SIZE) - 1)) != 0)
550 {
551 i &= (1 << MAX_CHAR_TYPE_SIZE) - 1;
552 cpp_warning(pfile,
553 "octal character constant does not fit in a byte");
554 }
555 return i;
556 }
557 case 'x':
558 {
559 unsigned i = 0, overflow = 0, digits_found = 0, digit;
560
561 for (;;)
562 {
563 c = *(*string_ptr)++;
564 if (c >= '0' && c <= '9')
565 digit = c - '0';
566 else if (c >= 'a' && c <= 'f')
567 digit = c - 'a' + 10;
568 else if (c >= 'A' && c <= 'F')
569 digit = c - 'A' + 10;
570 else
571 {
572 (*string_ptr)--;
573 break;
574 }
575 overflow |= i ^ (i << 4 >> 4);
576 i = (i << 4) + digit;
577 digits_found = 1;
578 }
579 if (!digits_found)
580 cpp_error(pfile, "\\x used with no following hex digits");
581 if (overflow | (i & ~((1 << BITS_PER_UNIT) - 1)))
582 {
583 i &= (1 << BITS_PER_UNIT) - 1;
584 cpp_warning(pfile,
585 "hex character constant does not fit in a byte");
586 }
587 return i;
588 }
589 default:
590 return c;
591 }
592}
593
594static void
595integer_overflow(cpp_reader * pfile)
596{
597 if (CPP_PEDANTIC(pfile))
598 cpp_pedwarn(pfile, "integer overflow in preprocessor expression");
599}
600
601static long
602left_shift(cpp_reader * pfile, long a, int unsignedp, unsigned long b)
603{
604 if (b >= HOST_BITS_PER_LONG)
605 {
606 if (!unsignedp && a != 0)
607 integer_overflow(pfile);
608 return 0;
609 }
610 else if (unsignedp)
611 return (unsigned long)a << b;
612 else
613 {
614 long l = a << b;
615
616 if (l >> b != a)
617 integer_overflow(pfile);
618 return l;
619 }
620}
621
622static long
623right_shift(cpp_reader * pfile __UNUSED__, long a, int unsignedp,
624 unsigned long b)
625{
626 if (b >= HOST_BITS_PER_LONG)
627 {
628 return unsignedp ? 0 : a >> (HOST_BITS_PER_LONG - 1);
629 }
630 else if (unsignedp)
631 {
632 return (unsigned long)a >> b;
633 }
634 else
635 {
636 return a >> b;
637 }
638}
639
640/* These priorities are all even, so we can handle associatively. */
641#define PAREN_INNER_PRIO 0
642#define COMMA_PRIO 4
643#define COND_PRIO (COMMA_PRIO+2)
644#define OROR_PRIO (COND_PRIO+2)
645#define ANDAND_PRIO (OROR_PRIO+2)
646#define OR_PRIO (ANDAND_PRIO+2)
647#define XOR_PRIO (OR_PRIO+2)
648#define AND_PRIO (XOR_PRIO+2)
649#define EQUAL_PRIO (AND_PRIO+2)
650#define LESS_PRIO (EQUAL_PRIO+2)
651#define SHIFT_PRIO (LESS_PRIO+2)
652#define PLUS_PRIO (SHIFT_PRIO+2)
653#define MUL_PRIO (PLUS_PRIO+2)
654#define UNARY_PRIO (MUL_PRIO+2)
655#define PAREN_OUTER_PRIO (UNARY_PRIO+2)
656
657#define COMPARE(OP) \
658 top->unsignedp = 0;\
659 top->value = (unsigned1 || unsigned2) ? (unsigned long) v1 OP (unsigned long) v2 : (v1 OP v2)
660
661/* Parse and evaluate a C expression, reading from PFILE.
662 * Returns the value of the expression. */
663
664HOST_WIDE_INT
665cpp_parse_expr(cpp_reader * pfile)
666{
667 /* The implementation is an operator precedence parser,
668 * i.e. a bottom-up parser, using a stack for not-yet-reduced tokens.
669 *
670 * The stack base is 'stack', and the current stack pointer is 'top'.
671 * There is a stack element for each operator (only),
672 * and the most recently pushed operator is 'top->op'.
673 * An operand (value) is stored in the 'value' field of the stack
674 * element of the operator that precedes it.
675 * In that case the 'flags' field has the HAVE_VALUE flag set. */
676
677#define INIT_STACK_SIZE 20
678 struct operation init_stack[INIT_STACK_SIZE];
679 struct operation *stack = init_stack;
680 struct operation *limit = stack + INIT_STACK_SIZE;
681 struct operation *top = stack;
682 int lprio = 0, rprio = 0;
683 int skip_evaluation = 0;
684
685 top->rprio = 0;
686 top->flags = 0;
687 for (;;)
688 {
689 struct operation op;
690 char flags = 0;
691
692 /* Read a token */
693 cpp_lex(&op, pfile);
694
695 /* See if the token is an operand, in which case go to set_value.
696 * If the token is an operator, figure out its left and right
697 * priorities, and then goto maybe_reduce. */
698
699 switch (op.op)
700 {
701 case NAME:
702 top->value = 0, top->unsignedp = 0;
703 goto set_value;
704 case INT:
705 case CHAR:
706 top->value = op.value;
707 top->unsignedp = op.unsignedp;
708 goto set_value;
709 case 0:
710 lprio = 0;
711 goto maybe_reduce;
712 case '+':
713 case '-':
714 /* Is this correct if unary ? FIXME */
715 flags = RIGHT_OPERAND_REQUIRED;
716 lprio = PLUS_PRIO;
717 rprio = lprio + 1;
718 goto maybe_reduce;
719 case '!':
720 case '~':
721 flags = RIGHT_OPERAND_REQUIRED;
722 rprio = UNARY_PRIO;
723 lprio = rprio + 1;
724 goto maybe_reduce;
725 case '*':
726 case '/':
727 case '%':
728 lprio = MUL_PRIO;
729 goto binop;
730 case '<':
731 case '>':
732 case LEQ:
733 case GEQ:
734 lprio = LESS_PRIO;
735 goto binop;
736 case EQUAL:
737 case NOTEQUAL:
738 lprio = EQUAL_PRIO;
739 goto binop;
740 case LSH:
741 case RSH:
742 lprio = SHIFT_PRIO;
743 goto binop;
744 case '&':
745 lprio = AND_PRIO;
746 goto binop;
747 case '^':
748 lprio = XOR_PRIO;
749 goto binop;
750 case '|':
751 lprio = OR_PRIO;
752 goto binop;
753 case ANDAND:
754 lprio = ANDAND_PRIO;
755 goto binop;
756 case OROR:
757 lprio = OROR_PRIO;
758 goto binop;
759 case ',':
760 lprio = COMMA_PRIO;
761 goto binop;
762 case '(':
763 lprio = PAREN_OUTER_PRIO;
764 rprio = PAREN_INNER_PRIO;
765 goto maybe_reduce;
766 case ')':
767 lprio = PAREN_INNER_PRIO;
768 rprio = PAREN_OUTER_PRIO;
769 goto maybe_reduce;
770 case ':':
771 lprio = COND_PRIO;
772 rprio = COND_PRIO;
773 goto maybe_reduce;
774 case '?':
775 lprio = COND_PRIO + 1;
776 rprio = COND_PRIO;
777 goto maybe_reduce;
778 binop:
779 flags = LEFT_OPERAND_REQUIRED | RIGHT_OPERAND_REQUIRED;
780 rprio = lprio + 1;
781 goto maybe_reduce;
782 default:
783 cpp_error(pfile, "invalid character in #if");
784 goto syntax_error;
785 }
786
787 set_value:
788 /* Push a value onto the stack. */
789 if (top->flags & HAVE_VALUE)
790 {
791 cpp_error(pfile, "syntax error in #if");
792 goto syntax_error;
793 }
794 top->flags |= HAVE_VALUE;
795 continue;
796
797 maybe_reduce:
798 /* Push an operator, and check if we can reduce now. */
799 while (top->rprio > lprio)
800 {
801 long v1 = top[-1].value, v2 = top[0].value;
802 int unsigned1 = top[-1].unsignedp, unsigned2 =
803 top[0].unsignedp;
804
805 top--;
806 if ((top[1].flags & LEFT_OPERAND_REQUIRED)
807 && !(top[0].flags & HAVE_VALUE))
808 {
809 cpp_error(pfile, "syntax error - missing left operand");
810 goto syntax_error;
811 }
812 if ((top[1].flags & RIGHT_OPERAND_REQUIRED)
813 && !(top[1].flags & HAVE_VALUE))
814 {
815 cpp_error(pfile, "syntax error - missing right operand");
816 goto syntax_error;
817 }
818 /* top[0].value = (top[1].op)(v1, v2); */
819 switch (top[1].op)
820 {
821 case '+':
822 if (!(top->flags & HAVE_VALUE))
823 { /* Unary '+' */
824 top->value = v2;
825 top->unsignedp = unsigned2;
826 top->flags |= HAVE_VALUE;
827 }
828 else
829 {
830 top->value = v1 + v2;
831 top->unsignedp = unsigned1 || unsigned2;
832 if (!top->unsignedp && !skip_evaluation
833 && !possible_sum_sign(v1, v2, top->value))
834 integer_overflow(pfile);
835 }
836 break;
837 case '-':
838 if (skip_evaluation); /* do nothing */
839 else if (!(top->flags & HAVE_VALUE))
840 { /* Unary '-' */
841 top->value = -v2;
842 if ((top->value & v2) < 0 && !unsigned2)
843 integer_overflow(pfile);
844 top->unsignedp = unsigned2;
845 top->flags |= HAVE_VALUE;
846 }
847 else
848 { /* Binary '-' */
849 top->value = v1 - v2;
850 top->unsignedp = unsigned1 || unsigned2;
851 if (!top->unsignedp
852 && !possible_sum_sign(top->value, v2, v1))
853 integer_overflow(pfile);
854 }
855 break;
856 case '*':
857 top->unsignedp = unsigned1 || unsigned2;
858 if (top->unsignedp)
859 top->value = (unsigned long)v1 *v2;
860
861 else if (!skip_evaluation)
862 {
863 top->value = v1 * v2;
864 if (v1
865 && (top->value / v1 != v2
866 || (top->value & v1 & v2) < 0))
867 integer_overflow(pfile);
868 }
869 break;
870 case '/':
871 if (skip_evaluation)
872 break;
873 if (v2 == 0)
874 {
875 cpp_error(pfile, "division by zero in #if");
876 v2 = 1;
877 }
878 top->unsignedp = unsigned1 || unsigned2;
879 if (top->unsignedp)
880 top->value = (unsigned long)v1 / v2;
881 else
882 {
883 top->value = v1 / v2;
884 if ((top->value & v1 & v2) < 0)
885 integer_overflow(pfile);
886 }
887 break;
888 case '%':
889 if (skip_evaluation)
890 break;
891 if (v2 == 0)
892 {
893 cpp_error(pfile, "division by zero in #if");
894 v2 = 1;
895 }
896 top->unsignedp = unsigned1 || unsigned2;
897 if (top->unsignedp)
898 top->value = (unsigned long)v1 % v2;
899 else
900 top->value = v1 % v2;
901 break;
902 case '!':
903 if (top->flags & HAVE_VALUE)
904 {
905 cpp_error(pfile, "syntax error");
906 goto syntax_error;
907 }
908 top->value = !v2;
909 top->unsignedp = 0;
910 top->flags |= HAVE_VALUE;
911 break;
912 case '~':
913 if (top->flags & HAVE_VALUE)
914 {
915 cpp_error(pfile, "syntax error");
916 goto syntax_error;
917 }
918 top->value = ~v2;
919 top->unsignedp = unsigned2;
920 top->flags |= HAVE_VALUE;
921 break;
922 case '<':
923 COMPARE(<);
924 break;
925 case '>':
926 COMPARE(>);
927 break;
928 case LEQ:
929 COMPARE(<=);
930 break;
931 case GEQ:
932 COMPARE(>=);
933 break;
934 case EQUAL:
935 top->value = (v1 == v2);
936 top->unsignedp = 0;
937 break;
938 case NOTEQUAL:
939 top->value = (v1 != v2);
940 top->unsignedp = 0;
941 break;
942 case LSH:
943 if (skip_evaluation)
944 break;
945 top->unsignedp = unsigned1;
946 if (v2 < 0 && !unsigned2)
947 top->value = right_shift(pfile, v1, unsigned1, -v2);
948 else
949 top->value = left_shift(pfile, v1, unsigned1, v2);
950 break;
951 case RSH:
952 if (skip_evaluation)
953 break;
954 top->unsignedp = unsigned1;
955 if (v2 < 0 && !unsigned2)
956 top->value = left_shift(pfile, v1, unsigned1, -v2);
957 else
958 top->value = right_shift(pfile, v1, unsigned1, v2);
959 break;
960#define LOGICAL(OP) \
961 top->value = v1 OP v2;\
962 top->unsignedp = unsigned1 || unsigned2;
963 case '&':
964 LOGICAL(&);
965 break;
966 case '^':
967 LOGICAL(^);
968 break;
969 case '|':
970 LOGICAL(|);
971 break;
972 case ANDAND:
973 top->value = v1 && v2;
974 top->unsignedp = 0;
975 if (!v1)
976 skip_evaluation--;
977 break;
978 case OROR:
979 top->value = v1 || v2;
980 top->unsignedp = 0;
981 if (v1)
982 skip_evaluation--;
983 break;
984 case ',':
985 if (CPP_PEDANTIC(pfile))
986 cpp_pedwarn(pfile, "comma operator in operand of `#if'");
987 top->value = v2;
988 top->unsignedp = unsigned2;
989 break;
990 case '(':
991 case '?':
992 cpp_error(pfile, "syntax error in #if");
993 goto syntax_error;
994 case ':':
995 if (top[0].op != '?')
996 {
997 cpp_error(pfile,
998 "syntax error ':' without preceding '?'");
999 goto syntax_error;
1000 }
1001 else if (!(top[1].flags & HAVE_VALUE)
1002 || !(top[-1].flags & HAVE_VALUE)
1003 || !(top[0].flags & HAVE_VALUE))
1004 {
1005 cpp_error(pfile, "bad syntax for ?: operator");
1006 goto syntax_error;
1007 }
1008 else
1009 {
1010 top--;
1011 if (top->value)
1012 skip_evaluation--;
1013 top->value = top->value ? v1 : v2;
1014 top->unsignedp = unsigned1 || unsigned2;
1015 }
1016 break;
1017 case ')':
1018 if ((top[1].flags & HAVE_VALUE)
1019 || !(top[0].flags & HAVE_VALUE)
1020 || top[0].op != '(' || (top[-1].flags & HAVE_VALUE))
1021 {
1022 cpp_error(pfile, "mismatched parentheses in #if");
1023 goto syntax_error;
1024 }
1025 else
1026 {
1027 top--;
1028 top->value = v1;
1029 top->unsignedp = unsigned1;
1030 top->flags |= HAVE_VALUE;
1031 }
1032 break;
1033 default:
1034 fprintf(stderr,
1035 top[1].op >= ' ' && top[1].op <= '~'
1036 ? "unimplemented operator '%c'\n"
1037 : "unimplemented operator '\\%03o'\n", top[1].op);
1038 }
1039 }
1040 if (op.op == 0)
1041 {
1042 if (top != stack)
1043 cpp_error(pfile, "internal error in #if expression");
1044 if (stack != init_stack)
1045 free(stack);
1046 return top->value;
1047 }
1048 top++;
1049
1050 /* Check for and handle stack overflow. */
1051 if (top == limit)
1052 {
1053 struct operation *new_stack;
1054 int old_size = (char *)limit - (char *)stack;
1055 int new_size = 2 * old_size;
1056
1057 if (stack != init_stack)
1058 new_stack = (struct operation *)xrealloc(stack, new_size);
1059 else
1060 {
1061 new_stack = (struct operation *)xmalloc(new_size);
1062 memcpy((char *)new_stack, (char *)stack, old_size);
1063 }
1064 stack = new_stack;
1065 top = (struct operation *)((char *)new_stack + old_size);
1066 limit = (struct operation *)((char *)new_stack + new_size);
1067 }
1068 top->flags = flags;
1069 top->rprio = rprio;
1070 top->op = op.op;
1071 if ((op.op == OROR && top[-1].value)
1072 || (op.op == ANDAND && !top[-1].value)
1073 || (op.op == '?' && !top[-1].value))
1074 {
1075 skip_evaluation++;
1076 }
1077 else if (op.op == ':')
1078 {
1079 if (top[-2].value) /* Was condition true? */
1080 skip_evaluation++;
1081 else
1082 skip_evaluation--;
1083 }
1084 }
1085 syntax_error:
1086 if (stack != init_stack)
1087 free(stack);
1088 skip_rest_of_line(pfile);
1089 return 0;
1090}
diff --git a/libraries/edje/src/bin/epp/cpphash.c b/libraries/edje/src/bin/epp/cpphash.c
deleted file mode 100644
index e3b68e0..0000000
--- a/libraries/edje/src/bin/epp/cpphash.c
+++ /dev/null
@@ -1,198 +0,0 @@
1/* Part of CPP library. (Macro hash table support.)
2 * Copyright (C) 1986, 87, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
3 * Written by Per Bothner, 1994.
4 * Based on CCCP program by by Paul Rubin, June 1986
5 * Adapted to ANSI C, Richard Stallman, Jan 1987
6 * Copyright (C) 2003-2011 Kim Woelders
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * In other words, you are welcome to use, share and improve this program.
23 * You are forbidden to forbid anyone else to use, share and improve
24 * what you give them. Help stamp out software-hoarding! */
25
26#ifdef HAVE_CONFIG_H
27# include <config.h>
28#endif
29
30#include <string.h>
31#include <stdlib.h>
32
33#include "cpplib.h"
34#include "cpphash.h"
35
36static HASHNODE *hashtab[HASHSIZE];
37
38#define IS_IDCHAR(ch) is_idchar[(unsigned char)(ch)]
39
40/*
41 * return hash function on name. must be compatible with the one
42 * computed a step at a time, elsewhere
43 */
44int
45hashf(const char *name, int len, int hashsize)
46{
47 int r = 0;
48
49 while (len--)
50 r = HASHSTEP(r, *name++);
51
52 return MAKE_POS(r) % hashsize;
53}
54
55/*
56 * find the most recent hash node for name name (ending with first
57 * non-identifier char) installed by install
58 *
59 * If LEN is >= 0, it is the length of the name.
60 * Otherwise, compute the length by scanning the entire name.
61 *
62 * If HASH is >= 0, it is the precomputed hash code.
63 * Otherwise, compute the hash code.
64 */
65HASHNODE *
66cpp_lookup(const char *name, int len, int hash)
67{
68 const char *bp;
69 HASHNODE *bucket;
70
71 if (len < 0)
72 {
73 for (bp = name; IS_IDCHAR(*bp); bp++)
74 ;
75 len = bp - name;
76 }
77 if (hash < 0)
78 hash = hashf(name, len, HASHSIZE);
79
80 bucket = hashtab[hash];
81 while (bucket)
82 {
83 if (bucket->length == len
84 && strncmp((const char *)bucket->name, name, len) == 0)
85 return bucket;
86 bucket = bucket->next;
87 }
88 return (HASHNODE *) 0;
89}
90
91/*
92 * Delete a hash node. Some weirdness to free junk from macros.
93 * More such weirdness will have to be added if you define more hash
94 * types that need it.
95 */
96
97/* Note that the DEFINITION of a macro is removed from the hash table
98 * but its storage is not freed. This would be a storage leak
99 * except that it is not reasonable to keep undefining and redefining
100 * large numbers of macros many times.
101 * In any case, this is necessary, because a macro can be #undef'd
102 * in the middle of reading the arguments to a call to it.
103 * If #undef freed the DEFINITION, that would crash. */
104
105void
106delete_macro(HASHNODE * hp)
107{
108
109 if (hp->prev)
110 hp->prev->next = hp->next;
111 if (hp->next)
112 hp->next->prev = hp->prev;
113
114 /* make sure that the bucket chain header that
115 * the deleted guy was on points to the right thing afterwards. */
116 if (hp == *hp->bucket_hdr)
117 *hp->bucket_hdr = hp->next;
118
119 if (hp->type == T_MACRO)
120 {
121 DEFINITION *d = hp->value.defn;
122 struct reflist *ap, *nextap;
123
124 for (ap = d->pattern; ap; ap = nextap)
125 {
126 nextap = ap->next;
127 free(ap);
128 }
129 if (d->nargs >= 0)
130 free(d->args.argnames);
131 free(d);
132 }
133 free(hp);
134}
135/*
136 * install a name in the main hash table, even if it is already there.
137 * name stops with first non alphanumeric, except leading '#'.
138 * caller must check against redefinition if that is desired.
139 * delete_macro () removes things installed by install () in fifo order.
140 * this is important because of the `defined' special symbol used
141 * in #if, and also if pushdef/popdef directives are ever implemented.
142 *
143 * If LEN is >= 0, it is the length of the name.
144 * Otherwise, compute the length by scanning the entire name.
145 *
146 * If HASH is >= 0, it is the precomputed hash code.
147 * Otherwise, compute the hash code.
148 */
149HASHNODE *
150install(const char *name, int len, enum node_type type, int ivalue, char *value,
151 int hash)
152{
153 HASHNODE *hp;
154 int i, bucket;
155 const char *p;
156
157 if (len < 0)
158 {
159 p = name;
160 while (IS_IDCHAR(*p))
161 p++;
162 len = p - name;
163 }
164 if (hash < 0)
165 hash = hashf(name, len, HASHSIZE);
166
167 i = sizeof(HASHNODE) + len + 1;
168 hp = (HASHNODE *) xmalloc(i);
169 bucket = hash;
170 hp->bucket_hdr = &hashtab[bucket];
171 hp->next = hashtab[bucket];
172 hashtab[bucket] = hp;
173 hp->prev = NULL;
174 if (hp->next)
175 hp->next->prev = hp;
176 hp->type = type;
177 hp->length = len;
178 if (hp->type == T_CONST)
179 hp->value.ival = ivalue;
180 else
181 hp->value.cpval = value;
182 hp->name = ((char *)hp) + sizeof(HASHNODE);
183 memcpy(hp->name, name, len);
184 hp->name[len] = 0;
185 return hp;
186}
187
188void
189cpp_hash_cleanup(cpp_reader * pfile __UNUSED__)
190{
191 int i;
192
193 for (i = HASHSIZE; --i >= 0;)
194 {
195 while (hashtab[i])
196 delete_macro(hashtab[i]);
197 }
198}
diff --git a/libraries/edje/src/bin/epp/cpphash.h b/libraries/edje/src/bin/epp/cpphash.h
deleted file mode 100644
index 524a850..0000000
--- a/libraries/edje/src/bin/epp/cpphash.h
+++ /dev/null
@@ -1,41 +0,0 @@
1enum node_type;
2
3/* different kinds of things that can appear in the value field
4 of a hash node. Actually, this may be useless now. */
5union hashval {
6 int ival;
7 char *cpval;
8 DEFINITION *defn;
9};
10
11struct hashnode {
12 struct hashnode *next; /* double links for easy deletion */
13 struct hashnode *prev;
14 struct hashnode **bucket_hdr; /* also, a back pointer to this node's hash
15 * chain is kept, in case the node is the head
16 * of the chain and gets deleted. */
17 enum node_type type; /* type of special token */
18 int length; /* length of token, for quick comparison */
19 char *name; /* the actual name */
20 union hashval value; /* pointer to expansion, or whatever */
21};
22
23typedef struct hashnode HASHNODE;
24
25/* Some definitions for the hash table. The hash function MUST be
26 computed as shown in hashf () below. That is because the rescan
27 loop computes the hash value `on the fly' for most tokens,
28 in order to avoid the overhead of a lot of procedure calls to
29 the hashf () function. Hashf () only exists for the sake of
30 politeness, for use when speed isn't so important. */
31
32#define HASHSIZE 1403
33#define HASHSTEP(old, c) ((old << 2) + c)
34#define MAKE_POS(v) (v & 0x7fffffff) /* make number positive */
35
36extern int hashf(const char *name, int len, int hashsize);
37extern HASHNODE *cpp_lookup(const char *name, int len, int hash);
38extern void delete_macro(HASHNODE * hp);
39extern HASHNODE *install(const char *name, int len, enum node_type type,
40 int ivalue, char *value, int hash);
41extern void cpp_hash_cleanup(cpp_reader * pfile);
diff --git a/libraries/edje/src/bin/epp/cpplib.c b/libraries/edje/src/bin/epp/cpplib.c
deleted file mode 100644
index 132d2a9..0000000
--- a/libraries/edje/src/bin/epp/cpplib.c
+++ /dev/null
@@ -1,7427 +0,0 @@
1/* CPP Library.
2 * Copyright (C) 1986, 87, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
3 * Written by Per Bothner, 1994-95.
4 * Based on CCCP program by by Paul Rubin, June 1986
5 * Adapted to ANSI C, Richard Stallman, Jan 1987
6 * Copyright (C) 2003-2011 Kim Woelders
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * In other words, you are welcome to use, share and improve this program.
23 * You are forbidden to forbid anyone else to use, share and improve
24 * what you give them. Help stamp out software-hoarding! */
25
26#ifdef HAVE_CONFIG_H
27# include <config.h>
28#endif
29
30#ifdef HAVE_ALLOCA_H
31# include <alloca.h>
32#elif defined __GNUC__
33# define alloca __builtin_alloca
34#elif defined _AIX
35# define alloca __alloca
36#elif defined _MSC_VER
37# include <malloc.h>
38# define alloca _alloca
39#else
40# include <stddef.h>
41void *alloca (size_t);
42#endif
43
44#ifdef __EMX__
45#include <strings.h>
46#endif
47
48#ifndef STANDARD_INCLUDE_DIR
49#define STANDARD_INCLUDE_DIR "/usr/include"
50#endif
51
52#ifndef LOCAL_INCLUDE_DIR
53#define LOCAL_INCLUDE_DIR "/usr/local/include"
54#endif
55
56#include "cpplib.h"
57#include "cpphash.h"
58
59/*
60 * On Windows, if the file is not opened in binary mode,
61 * read does not return the correct size, because of
62 * CR / LF translation.
63 */
64#ifndef O_BINARY
65# define O_BINARY 0
66#endif
67
68const char *version_string = "0.0.0";
69
70#ifndef STDC_VALUE
71#define STDC_VALUE 1
72#endif
73
74/* By default, colon separates directories in a path. */
75#ifndef PATH_SEPARATOR
76#define PATH_SEPARATOR ':'
77#endif
78
79#include <ctype.h>
80#include <stdio.h>
81#include <string.h>
82#include <signal.h>
83#include <stdlib.h>
84#include <unistd.h>
85#include <sys/types.h>
86#include <sys/stat.h>
87#include <fcntl.h>
88#include <stdlib.h>
89
90#ifndef VMS
91#ifndef USG
92#include <time.h>
93#include <sys/time.h> /* for __DATE__ and __TIME__ */
94#ifdef HAVE_SYS_RESOURCE_H
95# include <sys/resource.h>
96#endif
97#else
98#include <sys/param.h> /* CYGNUS LOCAL: shebs -noquiet */
99#include <sys/times.h>
100#include <time.h>
101#include <fcntl.h>
102#endif /* USG */
103#endif /* not VMS */
104
105/* This defines "errno" properly for VMS, and gives us EACCES. */
106#include <errno.h>
107
108#ifndef O_RDONLY
109#define O_RDONLY 0
110#endif
111
112#undef MIN
113#undef MAX
114#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
115#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
116
117#ifndef S_ISREG
118#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
119#endif
120
121#ifndef S_ISDIR
122#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
123#endif
124
125/* Define a generic NULL if one hasn't already been defined. */
126
127#ifndef GENERIC_PTR
128#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
129#define GENERIC_PTR void *
130#else
131#define GENERIC_PTR char *
132#endif
133#endif
134
135#ifndef INCLUDE_LEN_FUDGE
136#define INCLUDE_LEN_FUDGE 0
137#endif
138
139#define USE_FILE_NAME_MAPS 0
140
141/* Symbols to predefine. */
142
143#ifdef CPP_PREDEFINES
144static const char *predefs = CPP_PREDEFINES;
145
146#else
147static const char *predefs = "";
148
149#endif
150
151/* We let tm.h override the types used here, to handle trivial differences
152 * such as the choice of unsigned int or long unsigned int for size_t.
153 * When machines start needing nontrivial differences in the size type,
154 * it would be best to do something here to figure out automatically
155 * from other information what type to use. */
156
157/* The string value for __SIZE_TYPE__. */
158
159#ifndef SIZE_TYPE
160#define SIZE_TYPE "long unsigned int"
161#endif
162
163/* The string value for __PTRDIFF_TYPE__. */
164
165#ifndef PTRDIFF_TYPE
166#define PTRDIFF_TYPE "long int"
167#endif
168
169/* The string value for __WCHAR_TYPE__. */
170
171#ifndef WCHAR_TYPE
172#define WCHAR_TYPE "int"
173#endif
174#define CPP_WCHAR_TYPE(PFILE) \
175 (CPP_OPTIONS (PFILE)->cplusplus ? "__wchar_t" : WCHAR_TYPE)
176
177/* The string value for __USER_LABEL_PREFIX__ */
178
179#ifndef USER_LABEL_PREFIX
180#define USER_LABEL_PREFIX ""
181#endif
182
183/* The string value for __REGISTER_PREFIX__ */
184
185#ifndef REGISTER_PREFIX
186#define REGISTER_PREFIX ""
187#endif
188
189struct directive {
190 int length;
191 int (*func) (cpp_reader * pfile, struct directive * keyword,
192 unsigned char *buf, unsigned char *limit);
193 const char *name;
194 enum node_type type;
195 char command_reads_line;
196 char traditional_comments;
197 char pass_thru;
198};
199
200/* In the definition of a #assert name, this structure forms
201 * a list of the individual values asserted.
202 * Each value is itself a list of "tokens".
203 * These are strings that are compared by name. */
204
205struct tokenlist_list {
206 struct tokenlist_list *next;
207 struct arglist *tokens;
208};
209
210struct assertion_hashnode {
211 struct assertion_hashnode *next; /* double links for easy deletion */
212 struct assertion_hashnode *prev;
213 /* also, a back pointer to this node's hash
214 * chain is kept, in case the node is the head
215 * of the chain and gets deleted. */
216 struct assertion_hashnode **bucket_hdr;
217 int length; /* length of token, for quick comparison */
218 char *name; /* the actual name */
219 /* List of token-sequences. */
220 struct tokenlist_list *value;
221};
222
223#define SKIP_WHITE_SPACE(p) do { while (is_hor_space[(unsigned char)(*p)]) p++; } while (0)
224#define SKIP_ALL_WHITE_SPACE(p) do { while (is_space[(unsigned char)(*p)]) p++; } while (0)
225
226#define PEEKN(N) (CPP_BUFFER (pfile)->rlimit - CPP_BUFFER (pfile)->cur >= (N) ? CPP_BUFFER (pfile)->cur[N] : EOF)
227#define FORWARD(N) CPP_FORWARD (CPP_BUFFER (pfile), (N))
228#define GETC() CPP_BUF_GET (CPP_BUFFER (pfile))
229#define PEEKC() CPP_BUF_PEEK (CPP_BUFFER (pfile))
230/* CPP_IS_MACRO_BUFFER is true if the buffer contains macro expansion.
231 * (Note that it is false while we're expanding marco *arguments*.) */
232#define CPP_IS_MACRO_BUFFER(PBUF) ((PBUF)->cleanup == macro_cleanup)
233
234/* Move all backslash-newline pairs out of embarrassing places.
235 * Exchange all such pairs following BP
236 * with any potentially-embarrassing characters that follow them.
237 * Potentially-embarrassing characters are / and *
238 * (because a backslash-newline inside a comment delimiter
239 * would cause it not to be recognized). */
240
241#define NEWLINE_FIX \
242 do {while (PEEKC() == '\\' && PEEKN(1) == '\n') FORWARD(2); } while(0)
243
244/* Same, but assume we've already read the potential '\\' into C. */
245#define NEWLINE_FIX1(C) do { \
246 while ((C) == '\\' && PEEKC() == '\n') { FORWARD(1); (C) = GETC(); }\
247 } while(0)
248
249/* Name under which this program was invoked. */
250
251char *progname;
252
253struct cpp_pending {
254 struct cpp_pending *next;
255 const char *cmd;
256 const char *arg;
257};
258
259/* Structure returned by create_definition */
260typedef struct {
261 struct definition *defn;
262 char *symnam;
263 int symlen;
264} MACRODEF;
265
266/* Forward declarations. */
267typedef struct file_name_list file_name_list;
268
269static void add_import(cpp_reader * pfile, int fd, char *fname);
270static int finclude(cpp_reader * pfile, int f, const char *fname,
271 int system_header_p, file_name_list * dirptr);
272static void validate_else(cpp_reader * pfile, const char *directive);
273static int comp_def_part(int first, unsigned char *beg1, int len1,
274 unsigned char *beg2, int len2, int last);
275static int lookup_import(cpp_reader * pfile, char *filename,
276 file_name_list * searchptr);
277static int redundant_include_p(cpp_reader * pfile, char *name);
278
279static int is_system_include(cpp_reader * pfile, char *filename);
280
281static int open_include_file(cpp_reader * pfile, char *filename,
282 file_name_list * searchptr);
283static int check_macro_name(cpp_reader * pfile, unsigned char *symname,
284 const char *usage);
285
286static int compare_token_lists(struct arglist *l1, struct arglist *l2);
287static HOST_WIDE_INT eval_if_expression(cpp_reader * pfile, unsigned char *buf,
288 int length);
289
290static int file_size_and_mode(int fd, int *mode_pointer,
291 long int *size_pointer);
292static struct arglist *read_token_list(cpp_reader * pfile, int *error_flag);
293static void free_token_list(struct arglist *tokens);
294static int safe_read(int desc, char *ptr, int len);
295static void push_macro_expansion(cpp_reader * pfile,
296 unsigned char *x,
297 int xbuf_len, HASHNODE * hp);
298
299static struct cpp_pending *nreverse_pending(struct cpp_pending *list);
300static char *savestring(const char *input);
301
302static void conditional_skip(cpp_reader * pfile, int skip,
303 enum node_type type,
304 unsigned char *control_macro);
305static void skip_if_group(cpp_reader * pfile, int any);
306
307static void cpp_error_with_line(cpp_reader * pfile, int line,
308 int column, const char *msg);
309static void cpp_pedwarn_with_line(cpp_reader * pfile, int line,
310 int column, const char *msg);
311static void cpp_pedwarn_with_file_and_line(cpp_reader * pfile,
312 const char *file, int line,
313 const char *msg,
314 const char *arg1,
315 const char *arg2,
316 const char *arg3);
317static void cpp_error_from_errno(cpp_reader * pfile, const char *name);
318
319static cpp_buffer *cpp_push_buffer(cpp_reader * pfile, unsigned char *buffer,
320 long length);
321static cpp_buffer *cpp_pop_buffer(cpp_reader * pfile);
322
323/* Last arg to output_line_command. */
324enum file_change_code {
325 same_file, enter_file, leave_file
326};
327
328/* These functions are declared to return int instead of void since they
329 * are going to be placed in a table and some old compilers have trouble with
330 * pointers to functions returning void. */
331
332static int do_define(cpp_reader * pfile, struct directive *keyword,
333 unsigned char *buf, unsigned char *limit);
334
335static int do_line(cpp_reader * pfile, struct directive *keyword,
336 unsigned char *unused1, unsigned char *unused2);
337
338static int do_include(cpp_reader * pfile, struct directive *keyword,
339 unsigned char *unused1, unsigned char *unused2);
340
341static int do_undef(cpp_reader * pfile, struct directive *keyword,
342 unsigned char *buf, unsigned char *limit);
343
344static int do_error(cpp_reader * pfile, struct directive *keyword,
345 unsigned char *buf, unsigned char *limit);
346
347static int do_pragma(cpp_reader * pfile, struct directive *keyword,
348 unsigned char *buf, unsigned char *limit);
349
350static int do_ident(cpp_reader * pfile, struct directive *keyword,
351 unsigned char *buf, unsigned char *limit);
352
353static int do_if(cpp_reader * pfile, struct directive *keyword,
354 unsigned char *buf, unsigned char *limit);
355
356static int do_xifdef(cpp_reader * pfile, struct directive *keyword,
357 unsigned char *buf, unsigned char *limit);
358
359static int do_else(cpp_reader * pfile, struct directive *keyword,
360 unsigned char *buf, unsigned char *limit);
361
362static int do_elif(cpp_reader * pfile, struct directive *keyword,
363 unsigned char *buf, unsigned char *limit);
364
365static int do_endif(cpp_reader * pfile, struct directive *keyword,
366 unsigned char *buf, unsigned char *limit);
367
368static int do_assert(cpp_reader * pfile, struct directive *keyword,
369 unsigned char *buf, unsigned char *limit);
370
371static int do_unassert(cpp_reader * pfile, struct directive *keyword,
372 unsigned char *buf, unsigned char *limit);
373
374static int do_warning(cpp_reader * pfile, struct directive *keyword,
375 unsigned char *buf, unsigned char *limit);
376
377struct arglist *reverse_token_list(struct arglist *tokens);
378
379static int parse_name(cpp_reader * pfile, int c);
380
381static void parse_set_mark(struct parse_marker *pmark,
382 cpp_reader * pfile);
383static void parse_clear_mark(struct parse_marker *pmark);
384static void parse_goto_mark(struct parse_marker *pmark,
385 cpp_reader * pfile);
386static void parse_move_mark(struct parse_marker *pmark,
387 cpp_reader * pfile);
388
389struct file_name_list {
390 file_name_list *next;
391 char *fname;
392 /* If the following is nonzero, it is a macro name.
393 * Don't include the file again if that macro is defined. */
394 unsigned char *control_macro;
395 /* If the following is nonzero, it is a C-language system include
396 * directory. */
397 int c_system_include_path;
398 /* Mapping of file names for this directory. */
399 struct file_name_map *name_map;
400 /* Non-zero if name_map is valid. */
401 int got_name_map;
402};
403
404/* If a buffer's dir field is SELF_DIR_DUMMY, it means the file was found
405 * via the same directory as the file that #included it. */
406#define SELF_DIR_DUMMY ((file_name_list*)(~0))
407
408/* #include "file" looks in source file dir, then stack. */
409/* #include <file> just looks in the stack. */
410/* -I directories are added to the end, then the defaults are added. */
411/* The */
412static struct default_include {
413 const char *fname; /* The name of the directory. */
414 int cplusplus; /* Only look here if we're compiling C++. */
415 int cxx_aware; /* Includes in this directory don't need to
416 * be wrapped in extern "C" when compiling
417 * C++. */
418} include_defaults_array[]
419#ifdef INCLUDE_DEFAULTS
420 = INCLUDE_DEFAULTS;
421
422#else
423 =
424{
425 /* Pick up GNU C++ specific include files. */
426 {
427 GPLUSPLUS_INCLUDE_DIR, 1, 1}
428 ,
429#ifdef CROSS_COMPILE
430 /* This is the dir for fixincludes. Put it just before
431 * the files that we fix. */
432 {
433 GCC_INCLUDE_DIR, 0, 0}
434 ,
435 /* For cross-compilation, this dir name is generated
436 * automatically in Makefile.in. */
437 {
438 CROSS_INCLUDE_DIR, 0, 0}
439 ,
440 /* This is another place that the target system's headers might be. */
441 {
442 TOOL_INCLUDE_DIR, 0, 1}
443 ,
444#else /* not CROSS_COMPILE */
445 /* This should be /usr/local/include and should come before
446 * the fixincludes-fixed header files. */
447 {
448 LOCAL_INCLUDE_DIR, 0, 1}
449 ,
450 /* This is here ahead of GCC_INCLUDE_DIR because assert.h goes here.
451 * Likewise, behind LOCAL_INCLUDE_DIR, where glibc puts its assert.h. */
452 {
453 TOOL_INCLUDE_DIR, 0, 1}
454 ,
455 /* This is the dir for fixincludes. Put it just before
456 * the files that we fix. */
457 {
458 GCC_INCLUDE_DIR, 0, 0}
459 ,
460 /* Some systems have an extra dir of include files. */
461#ifdef SYSTEM_INCLUDE_DIR
462 {
463 SYSTEM_INCLUDE_DIR, 0, 0}
464 ,
465#endif
466 {
467 STANDARD_INCLUDE_DIR, 0, 0}
468 ,
469#endif /* not CROSS_COMPILE */
470 {
471 0, 0, 0}
472};
473
474#endif /* no INCLUDE_DEFAULTS */
475
476/* Here is the actual list of #-directives, most-often-used first.
477 * The initialize_builtins function assumes #define is the very first. */
478
479static struct directive directive_table[] = {
480 {6, do_define, "define", T_DEFINE, 0, 1, 0},
481 {5, do_xifdef, "ifdef", T_IFDEF, 1, 0, 0},
482 {6, do_xifdef, "ifndef", T_IFNDEF, 1, 0, 0},
483 {7, do_include, "include", T_INCLUDE, 1, 0, 0},
484 {12, do_include, "include_next", T_INCLUDE_NEXT, 1, 0, 0},
485 {6, do_include, "import", T_IMPORT, 1, 0, 0},
486 {5, do_endif, "endif", T_ENDIF, 1, 0, 0},
487 {4, do_else, "else", T_ELSE, 1, 0, 0},
488 {2, do_if, "if", T_IF, 1, 0, 0},
489 {4, do_elif, "elif", T_ELIF, 1, 0, 0},
490 {5, do_undef, "undef", T_UNDEF, 0, 0, 0},
491 {5, do_error, "error", T_ERROR, 0, 0, 0},
492 {7, do_warning, "warning", T_WARNING, 0, 0, 0},
493 {6, do_pragma, "pragma", T_PRAGMA, 0, 0, 1},
494 {4, do_line, "line", T_LINE, 1, 0, 0},
495 {5, do_ident, "ident", T_IDENT, 1, 0, 1},
496#ifdef SCCS_DIRECTIVE
497 {4, do_sccs, "sccs", T_SCCS, 0, 0, 0},
498#endif
499 {6, do_assert, "assert", T_ASSERT, 1, 0, 0},
500 {8, do_unassert, "unassert", T_UNASSERT, 1, 0, 0},
501 {-1, 0, "", T_UNUSED, 0, 0, 0},
502};
503
504/* table to tell if char can be part of a C identifier. */
505unsigned char is_idchar[256];
506
507/* table to tell if char can be first char of a c identifier. */
508unsigned char is_idstart[256];
509
510/* table to tell if c is horizontal space. */
511unsigned char is_hor_space[256];
512
513/* table to tell if c is horizontal or vertical space. */
514static unsigned char is_space[256];
515
516/* Initialize syntactic classifications of characters. */
517
518static void
519initialize_char_syntax(struct cpp_options *opts)
520{
521 int i;
522
523 /*
524 * Set up is_idchar and is_idstart tables. These should be
525 * faster than saying (is_alpha (c) || c == '_'), etc.
526 * Set up these things before calling any routines tthat
527 * refer to them.
528 */
529 for (i = 'a'; i <= 'z'; i++)
530 {
531 is_idchar[i - 'a' + 'A'] = 1;
532 is_idchar[i] = 1;
533 is_idstart[i - 'a' + 'A'] = 1;
534 is_idstart[i] = 1;
535 }
536 for (i = '0'; i <= '9'; i++)
537 is_idchar[i] = 1;
538 is_idchar[(unsigned char)'_'] = 1;
539 is_idstart[(unsigned char)'_'] = 1;
540 is_idchar[(unsigned char)'$'] = opts->dollars_in_ident;
541 is_idstart[(unsigned char)'$'] = opts->dollars_in_ident;
542
543 /* horizontal space table */
544 is_hor_space[(unsigned char)' '] = 1;
545 is_hor_space[(unsigned char)'\t'] = 1;
546 is_hor_space[(unsigned char)'\v'] = 1;
547 is_hor_space[(unsigned char)'\f'] = 1;
548 is_hor_space[(unsigned char)'\r'] = 1;
549
550 is_space[(unsigned char)' '] = 1;
551 is_space[(unsigned char)'\t'] = 1;
552 is_space[(unsigned char)'\v'] = 1;
553 is_space[(unsigned char)'\f'] = 1;
554 is_space[(unsigned char)'\n'] = 1;
555 is_space[(unsigned char)'\r'] = 1;
556}
557
558/* Place into PFILE a quoted string representing the string SRC.
559 * Caller must reserve enough space in pfile->token_buffer. */
560static void
561quote_string(cpp_reader * pfile, const char *src)
562{
563 unsigned char c;
564
565 CPP_PUTC_Q(pfile, '\"');
566 for (;;)
567 switch ((c = *src++))
568 {
569 default:
570 if (isprint(c))
571 CPP_PUTC_Q(pfile, c);
572 else
573 {
574 sprintf((char *)CPP_PWRITTEN(pfile), "\\%03o", c);
575 CPP_ADJUST_WRITTEN(pfile, 4);
576 }
577 break;
578
579 case '\"':
580 case '\\':
581 CPP_PUTC_Q(pfile, '\\');
582 CPP_PUTC_Q(pfile, c);
583 break;
584
585 case '\0':
586 CPP_PUTC_Q(pfile, '\"');
587 CPP_NUL_TERMINATE_Q(pfile);
588 return;
589 }
590}
591
592/* Make sure PFILE->token_buffer will hold at least N more chars. */
593
594void
595cpp_grow_buffer(cpp_reader * pfile, long n)
596{
597 long old_written = CPP_WRITTEN(pfile);
598
599 pfile->token_buffer_size = n + 2 * pfile->token_buffer_size;
600 pfile->token_buffer =
601 (unsigned char *)xrealloc(pfile->token_buffer, pfile->token_buffer_size);
602 CPP_SET_WRITTEN(pfile, old_written);
603}
604
605/*
606 * process a given definition string, for initialization
607 * If STR is just an identifier, define it with value 1.
608 * If STR has anything after the identifier, then it should
609 * be identifier=definition.
610 */
611
612void
613cpp_define(cpp_reader * pfile, unsigned char *str)
614{
615 unsigned char *buf, *p;
616
617 buf = str;
618 p = str;
619 if (!is_idstart[*p])
620 {
621 cpp_error(pfile, "malformed option `-D %s'", str);
622 return;
623 }
624 while (is_idchar[*++p])
625 ;
626 if (*p == 0)
627 {
628 buf = (unsigned char *)alloca(p - buf + 4);
629 strcpy((char *)buf, (const char *)str);
630 strcat((char *)buf, " 1");
631 }
632 else if (*p != '=')
633 {
634 cpp_error(pfile, "malformed option `-D %s'", str);
635 return;
636 }
637 else
638 {
639 unsigned char *q;
640
641 /* Copy the entire option so we can modify it. */
642 buf = (unsigned char *)alloca(2 * strlen((char *)str) + 1);
643 strncpy((char *)buf, (const char *)str, p - str);
644 /* Change the = to a space. */
645 buf[p - str] = ' ';
646 /* Scan for any backslash-newline and remove it. */
647 p++;
648 q = &buf[p - str];
649 while (*p)
650 {
651 if (*p == '\\' && p[1] == '\n')
652 p += 2;
653 else
654 *q++ = *p++;
655 }
656 *q = 0;
657 }
658
659 do_define(pfile, NULL, buf, buf + strlen((char *)buf));
660}
661
662/* Process the string STR as if it appeared as the body of a #assert.
663 * OPTION is the option name for which STR was the argument. */
664
665static void
666make_assertion(cpp_reader * pfile, const char *option, const char *str)
667{
668 unsigned char *buf, *p, *q;
669
670 /* Copy the entire option so we can modify it. */
671 buf = (unsigned char *)alloca(strlen((char *)str) + 1);
672 strcpy((char *)buf, (const char *)str);
673 /* Scan for any backslash-newline and remove it. */
674 p = q = buf;
675 while (*p)
676 {
677 *q++ = *p++;
678 }
679 *q = 0;
680
681 p = buf;
682 if (!is_idstart[*p])
683 {
684 cpp_error(pfile, "malformed option `%s %s'", option, str);
685 return;
686 }
687 while (is_idchar[*++p])
688 ;
689 while (*p == ' ' || *p == '\t')
690 p++;
691 if (!(*p == 0 || *p == '('))
692 {
693 cpp_error(pfile, "malformed option `%s %s'", option, str);
694 return;
695 }
696 cpp_push_buffer(pfile, buf, strlen((char *)buf));
697 do_assert(pfile, NULL, NULL, NULL);
698 cpp_pop_buffer(pfile);
699}
700
701/* Append a chain of `file_name_list's
702 * to the end of the main include chain.
703 * FIRST is the beginning of the chain to append, and LAST is the end. */
704
705static void
706append_include_chain(cpp_reader * pfile, file_name_list * first,
707 file_name_list * last)
708{
709 struct cpp_options *opts = CPP_OPTIONS(pfile);
710 file_name_list *dir;
711
712 if (!first || !last)
713 return;
714
715 if (!opts->include)
716 opts->include = first;
717 else
718 opts->last_include->next = first;
719
720 if (!opts->first_bracket_include)
721 opts->first_bracket_include = first;
722
723 for (dir = first;; dir = dir->next)
724 {
725 int len = strlen(dir->fname) + INCLUDE_LEN_FUDGE;
726
727 if (len > pfile->max_include_len)
728 pfile->max_include_len = len;
729 if (dir == last)
730 break;
731 }
732
733 last->next = NULL;
734 opts->last_include = last;
735}
736
737/* Add output to `deps_buffer' for the -M switch.
738 * STRING points to the text to be output.
739 * SPACER is ':' for targets, ' ' for dependencies, zero for text
740 * to be inserted literally. */
741
742static void
743deps_output(cpp_reader * pfile, const char *string, int spacer)
744{
745 int size = strlen(string);
746
747 if (size == 0)
748 return;
749
750#ifndef MAX_OUTPUT_COLUMNS
751#define MAX_OUTPUT_COLUMNS 72
752#endif
753 if (spacer
754 && pfile->deps_column > 0
755 && (pfile->deps_column + size) > MAX_OUTPUT_COLUMNS)
756 {
757 deps_output(pfile, " \\\n ", 0);
758 pfile->deps_column = 0;
759 }
760 if (pfile->deps_size + size + 8 > pfile->deps_allocated_size)
761 {
762 pfile->deps_allocated_size = (pfile->deps_size + size + 50) * 2;
763 pfile->deps_buffer = (char *)xrealloc(pfile->deps_buffer,
764 pfile->deps_allocated_size);
765 }
766 if (spacer == ' ' && pfile->deps_column > 0)
767 pfile->deps_buffer[pfile->deps_size++] = ' ';
768 memcpy(&pfile->deps_buffer[pfile->deps_size], string, size);
769 pfile->deps_size += size;
770 pfile->deps_column += size;
771 if (spacer == ':')
772 pfile->deps_buffer[pfile->deps_size++] = ':';
773 pfile->deps_buffer[pfile->deps_size] = 0;
774}
775
776/* Given a colon-separated list of file names PATH,
777 * add all the names to the search path for include files. */
778
779static void
780path_include(cpp_reader * pfile, char *path)
781{
782 char *p;
783
784 p = path;
785
786 if (*p)
787 while (1)
788 {
789 char *q = p;
790 char *name;
791 file_name_list *dirtmp;
792
793 /* Find the end of this name. */
794 while (*q != 0 && *q != PATH_SEPARATOR)
795 q++;
796 if (p == q)
797 {
798 /* An empty name in the path stands for the current directory. */
799 name = (char *)xmalloc(2);
800 name[0] = '.';
801 name[1] = 0;
802 }
803 else
804 {
805 /* Otherwise use the directory that is named. */
806 name = (char *)xmalloc(q - p + 1);
807 memcpy(name, p, q - p);
808 name[q - p] = 0;
809 }
810
811 dirtmp = (file_name_list *) xmalloc(sizeof(file_name_list));
812
813 dirtmp->next = 0; /* New one goes on the end */
814 dirtmp->control_macro = 0;
815 dirtmp->c_system_include_path = 0;
816 dirtmp->fname = name;
817 dirtmp->got_name_map = 0;
818 append_include_chain(pfile, dirtmp, dirtmp);
819
820 /* Advance past this name. */
821 p = q;
822 if (*p == 0)
823 break;
824 /* Skip the colon. */
825 p++;
826 }
827}
828
829void
830init_parse_options(struct cpp_options *opts)
831{
832 memset((char *)opts, 0, sizeof *opts);
833 opts->in_fname = NULL;
834 opts->out_fname = NULL;
835
836 /* Initialize is_idchar to allow $. */
837 opts->dollars_in_ident = 1;
838 initialize_char_syntax(opts);
839 opts->dollars_in_ident = DOLLARS_IN_IDENTIFIERS > 0;
840
841 opts->no_line_commands = 0;
842 opts->no_trigraphs = 1;
843 opts->put_out_comments = 0;
844 opts->print_include_names = 0;
845 opts->dump_macros = dump_none;
846 opts->no_output = 0;
847 opts->cplusplus = 0;
848 opts->cplusplus_comments = 1;
849
850 opts->verbose = 0;
851 opts->objc = 0;
852 opts->lang_asm = 0;
853 opts->for_lint = 0;
854 opts->chill = 0;
855 opts->pedantic_errors = 0;
856 opts->inhibit_warnings = 0;
857 opts->warn_comments = 0;
858 opts->warn_import = 1;
859 opts->warnings_are_errors = 0;
860}
861
862static enum cpp_token
863null_underflow(cpp_reader * pfile __UNUSED__)
864{
865 return CPP_EOF;
866}
867
868static int
869null_cleanup(cpp_buffer * pbuf __UNUSED__, cpp_reader * pfile __UNUSED__)
870{
871 return 0;
872}
873
874static int
875macro_cleanup(cpp_buffer * pbuf, cpp_reader * pfile __UNUSED__)
876{
877 HASHNODE *macro = (HASHNODE *) pbuf->data;
878
879 if (macro->type == T_DISABLED)
880 macro->type = T_MACRO;
881 if (macro->type != T_MACRO || pbuf->buf != macro->value.defn->expansion)
882 free(pbuf->buf);
883 return 0;
884}
885
886static int
887file_cleanup(cpp_buffer * pbuf, cpp_reader * pfile __UNUSED__)
888{
889 if (pbuf->buf)
890 {
891 free(pbuf->buf);
892 pbuf->buf = 0;
893 }
894 return 0;
895}
896
897/* Assuming we have read '/'.
898 * If this is the start of a comment (followed by '*' or '/'),
899 * skip to the end of the comment, and return ' '.
900 * Return EOF if we reached the end of file before the end of the comment.
901 * If not the start of a comment, return '/'. */
902
903static int
904skip_comment(cpp_reader * pfile, long *linep)
905{
906 int c = 0;
907
908 while (PEEKC() == '\\' && PEEKN(1) == '\n')
909 {
910 if (linep)
911 (*linep)++;
912 FORWARD(2);
913 }
914 if (PEEKC() == '*')
915 {
916 FORWARD(1);
917 for (;;)
918 {
919 int prev_c = c;
920
921 c = GETC();
922 if (c == EOF)
923 return EOF;
924 while (c == '\\' && PEEKC() == '\n')
925 {
926 if (linep)
927 (*linep)++;
928 FORWARD(1), c = GETC();
929 }
930 if (prev_c == '*' && c == '/')
931 return ' ';
932 if (c == '\n' && linep)
933 (*linep)++;
934 }
935 }
936 else if (PEEKC() == '/' && CPP_OPTIONS(pfile)->cplusplus_comments)
937 {
938 FORWARD(1);
939 for (;;)
940 {
941 c = GETC();
942 if (c == EOF)
943 return ' '; /* Allow // to be terminated by EOF. */
944 while (c == '\\' && PEEKC() == '\n')
945 {
946 FORWARD(1);
947 c = GETC();
948 if (linep)
949 (*linep)++;
950 }
951 if (c == '\n')
952 {
953 /* Don't consider final '\n' to be part of comment. */
954 FORWARD(-1);
955 return ' ';
956 }
957 }
958 }
959 else
960 return '/';
961}
962
963/* Skip whitespace \-newline and comments. Does not macro-expand. */
964void
965cpp_skip_hspace(cpp_reader * pfile)
966{
967 while (1)
968 {
969 int c = PEEKC();
970
971 if (c == EOF)
972 return; /* FIXME */
973 if (is_hor_space[c])
974 {
975 if ((c == '\f' || c == '\v') && CPP_PEDANTIC(pfile))
976 cpp_pedwarn(pfile, "%s in preprocessing directive",
977 c == '\f' ? "formfeed" : "vertical tab");
978 FORWARD(1);
979 }
980 else if (c == '/')
981 {
982 FORWARD(1);
983 c = skip_comment(pfile, NULL);
984 if (c == '/')
985 FORWARD(-1);
986 if (c == EOF || c == '/')
987 return;
988 }
989 else if (c == '\\' && PEEKN(1) == '\n')
990 {
991 FORWARD(2);
992 }
993 else if (c == '@' && CPP_BUFFER(pfile)->has_escapes
994 && is_hor_space[PEEKN(1)])
995 {
996 FORWARD(1);
997 }
998 else
999 return;
1000 }
1001}
1002
1003/* Read the rest of the current line.
1004 * The line is appended to PFILE's output buffer. */
1005
1006static void
1007copy_rest_of_line(cpp_reader * pfile)
1008{
1009 struct cpp_options *opts = CPP_OPTIONS(pfile);
1010
1011 for (;;)
1012 {
1013 int c = GETC();
1014 int nextc;
1015
1016 switch (c)
1017 {
1018 case EOF:
1019 goto end_directive;
1020 case '\\':
1021 if (PEEKC() == '\n')
1022 {
1023 FORWARD(1);
1024 continue;
1025 }
1026 case '\'':
1027 case '\"':
1028 goto scan_directive_token;
1029 break;
1030 case '/':
1031 nextc = PEEKC();
1032 if (nextc == '*' || (opts->cplusplus_comments && nextc == '*'))
1033 goto scan_directive_token;
1034 break;
1035 case '\f':
1036 case '\v':
1037 if (CPP_PEDANTIC(pfile))
1038 cpp_pedwarn(pfile, "%s in preprocessing directive",
1039 c == '\f' ? "formfeed" : "vertical tab");
1040 break;
1041
1042 case '\n':
1043 FORWARD(-1);
1044 goto end_directive;
1045 scan_directive_token:
1046 FORWARD(-1);
1047 cpp_get_token(pfile);
1048 continue;
1049 }
1050 CPP_PUTC(pfile, c);
1051 }
1052 end_directive:;
1053 CPP_NUL_TERMINATE(pfile);
1054}
1055
1056void
1057skip_rest_of_line(cpp_reader * pfile)
1058{
1059 long old = CPP_WRITTEN(pfile);
1060
1061 copy_rest_of_line(pfile);
1062 CPP_SET_WRITTEN(pfile, old);
1063}
1064
1065/* Handle a possible # directive.
1066 * '#' has already been read. */
1067
1068static int
1069handle_directive(cpp_reader * pfile)
1070{
1071 int c;
1072 struct directive *kt;
1073 int ident_length;
1074 long after_ident = 0;
1075 unsigned char *ident, *line_end;
1076 long old_written = CPP_WRITTEN(pfile);
1077
1078 cpp_skip_hspace(pfile);
1079
1080 c = PEEKC();
1081 if (c >= '0' && c <= '9')
1082 {
1083 /* Handle # followed by a line number. */
1084 if (CPP_PEDANTIC(pfile))
1085 cpp_pedwarn(pfile, "`#' followed by integer");
1086 do_line(pfile, NULL, NULL, NULL);
1087 goto done_a_directive;
1088 }
1089 /* Now find the directive name. */
1090 CPP_PUTC(pfile, '#');
1091 parse_name(pfile, GETC());
1092 ident = pfile->token_buffer + old_written + 1;
1093 ident_length = CPP_PWRITTEN(pfile) - ident;
1094 if (ident_length == 0 && PEEKC() == '\n')
1095 {
1096 /* A line of just `#' becomes blank. */
1097 goto done_a_directive;
1098 }
1099 /*
1100 * Decode the keyword and call the appropriate expansion
1101 * routine, after moving the input pointer up to the next line.
1102 */
1103 for (kt = directive_table;; kt++)
1104 {
1105 if (kt->length <= 0)
1106 goto not_a_directive;
1107 if (kt->length == ident_length
1108 && !strncmp(kt->name, (const char *)ident, ident_length))
1109 break;
1110 }
1111
1112 if (!kt->command_reads_line)
1113 {
1114 /* Nonzero means do not delete comments within the directive.
1115 * #define needs this when -traditional. */
1116 int comments = 0;
1117 int save_put_out_comments =
1118 CPP_OPTIONS(pfile)->put_out_comments;
1119
1120 CPP_OPTIONS(pfile)->put_out_comments = comments;
1121 after_ident = CPP_WRITTEN(pfile);
1122 copy_rest_of_line(pfile);
1123 CPP_OPTIONS(pfile)->put_out_comments = save_put_out_comments;
1124 }
1125 /* For #pragma and #define, we may want to pass through the directive.
1126 * Other directives may create output, but we don't want the directive
1127 * itself out, so we pop it now. For example #include may write a #line
1128 * command (see comment in do_include), and conditionals may emit
1129 * #failed ... #endfailed stuff. But note that popping the buffer
1130 * means the parameters to kt->func may point after pfile->limit
1131 * so these parameters are invalid as soon as something gets appended
1132 * to the token_buffer. */
1133
1134 line_end = CPP_PWRITTEN(pfile);
1135 if (!kt->pass_thru && kt->type != T_DEFINE)
1136 CPP_SET_WRITTEN(pfile, old_written);
1137
1138 (*kt->func) (pfile, kt, pfile->token_buffer + after_ident, line_end);
1139 if (kt->pass_thru
1140 || (kt->type == T_DEFINE
1141 && CPP_OPTIONS(pfile)->dump_macros == dump_definitions))
1142 {
1143 /* Just leave the entire #define in the output stack. */
1144 }
1145 else if (kt->type == T_DEFINE
1146 && CPP_OPTIONS(pfile)->dump_macros == dump_names)
1147 {
1148 unsigned char *p = pfile->token_buffer + old_written + 7; /* Skip "#define". */
1149
1150 SKIP_WHITE_SPACE(p);
1151 while (is_idchar[*p])
1152 p++;
1153 pfile->limit = p;
1154 CPP_PUTC(pfile, '\n');
1155 }
1156 else if (kt->type == T_DEFINE)
1157 CPP_SET_WRITTEN(pfile, old_written);
1158 done_a_directive:
1159 return 1;
1160
1161 not_a_directive:
1162 return 0;
1163}
1164
1165/* Pass a directive through to the output file.
1166 * BUF points to the contents of the directive, as a contiguous string.
1167 * LIMIT points to the first character past the end of the directive.
1168 * KEYWORD is the keyword-table entry for the directive. */
1169
1170static void
1171pass_thru_directive(char *buf, char *limit, cpp_reader * pfile,
1172 struct directive *keyword)
1173{
1174 unsigned keyword_length = keyword->length;
1175
1176 CPP_RESERVE(pfile, 1 + keyword_length + (limit - buf));
1177 CPP_PUTC_Q(pfile, '#');
1178 CPP_PUTS_Q(pfile, keyword->name, keyword_length);
1179 if (limit != buf && buf[0] != ' ')
1180 CPP_PUTC_Q(pfile, ' ');
1181 CPP_PUTS_Q(pfile, buf, limit - buf);
1182}
1183
1184/* The arglist structure is built by do_define to tell
1185 * collect_definition where the argument names begin. That
1186 * is, for a define like "#define f(x,y,z) foo+x-bar*y", the arglist
1187 * would contain pointers to the strings x, y, and z.
1188 * Collect_definition would then build a DEFINITION node,
1189 * with reflist nodes pointing to the places x, y, and z had
1190 * appeared. So the arglist is just convenience data passed
1191 * between these two routines. It is not kept around after
1192 * the current #define has been processed and entered into the
1193 * hash table. */
1194
1195struct arglist {
1196 struct arglist *next;
1197 char *name;
1198 int length;
1199 int argno;
1200 char rest_args;
1201};
1202
1203/* Read a replacement list for a macro with parameters.
1204 * Build the DEFINITION structure.
1205 * Reads characters of text starting at BUF until END.
1206 * ARGLIST specifies the formal parameters to look for
1207 * in the text of the definition; NARGS is the number of args
1208 * in that list, or -1 for a macro name that wants no argument list.
1209 * MACRONAME is the macro name itself (so we can avoid recursive expansion)
1210 * and NAMELEN is its length in characters.
1211 *
1212 * Note that comments, backslash-newlines, and leading white space
1213 * have already been deleted from the argument. */
1214
1215static DEFINITION *
1216collect_expansion(cpp_reader * pfile, unsigned char *buf, unsigned char *limit,
1217 int nargs, struct arglist *arglist)
1218{
1219 DEFINITION *defn;
1220 unsigned char *p, *lastp, *exp_p;
1221 reflist *endpat = NULL;
1222
1223 /* Pointer to first nonspace after last ## seen. */
1224 unsigned char *concat = 0;
1225
1226 /* Pointer to first nonspace after last single-# seen. */
1227 unsigned char *stringify = 0;
1228 int maxsize;
1229 int expected_delimiter = '\0';
1230
1231 /* Scan thru the replacement list, ignoring comments and quoted
1232 * strings, picking up on the macro calls. It does a linear search
1233 * thru the arg list on every potential symbol. Profiling might say
1234 * that something smarter should happen. */
1235
1236 if (limit < buf)
1237 abort();
1238
1239 /* Find the beginning of the trailing whitespace. */
1240 p = buf;
1241 while (p < limit && is_space[limit[-1]])
1242 limit--;
1243
1244 /* Allocate space for the text in the macro definition.
1245 * Leading and trailing whitespace chars need 2 bytes each.
1246 * Each other input char may or may not need 1 byte,
1247 * so this is an upper bound. The extra 5 are for invented
1248 * leading and trailing newline-marker and final null. */
1249 maxsize = (sizeof(DEFINITION) + (limit - p) + 5);
1250 /* Occurrences of '@' get doubled, so allocate extra space for them. */
1251 while (p < limit)
1252 if (*p++ == '@')
1253 maxsize++;
1254 defn = (DEFINITION *) xcalloc(1, maxsize);
1255
1256 defn->nargs = nargs;
1257 exp_p = defn->expansion = (unsigned char *)defn + sizeof(DEFINITION);
1258 lastp = exp_p;
1259
1260 p = buf;
1261
1262 /* Add one initial space escape-marker to prevent accidental
1263 * token-pasting (often removed by macroexpand). */
1264 *exp_p++ = '@';
1265 *exp_p++ = ' ';
1266
1267 if (limit - p >= 2 && p[0] == '#' && p[1] == '#')
1268 {
1269 cpp_error(pfile, "`##' at start of macro definition");
1270 p += 2;
1271 }
1272 /* Process the main body of the definition. */
1273 while (p < limit)
1274 {
1275 int skipped_arg = 0;
1276 unsigned char c = *p++;
1277
1278 *exp_p++ = c;
1279
1280 switch (c)
1281 {
1282 case '\'':
1283 case '\"':
1284 if (expected_delimiter != '\0')
1285 {
1286 if (c == expected_delimiter)
1287 expected_delimiter = '\0';
1288 }
1289 else
1290 expected_delimiter = c;
1291 break;
1292
1293 case '\\':
1294 if (p < limit && expected_delimiter)
1295 {
1296 /* In a string, backslash goes through
1297 * and makes next char ordinary. */
1298 *exp_p++ = *p++;
1299 }
1300 break;
1301
1302 case '@':
1303 /* An '@' in a string or character constant stands for itself,
1304 * and does not need to be escaped. */
1305 if (!expected_delimiter)
1306 *exp_p++ = c;
1307 break;
1308
1309 case '#':
1310 /* # is ordinary inside a string. */
1311 if (expected_delimiter)
1312 break;
1313 if (p < limit && *p == '#')
1314 {
1315 /* ##: concatenate preceding and following tokens. */
1316 /* Take out the first #, discard preceding whitespace. */
1317 exp_p--;
1318 while (exp_p > lastp && is_hor_space[exp_p[-1]])
1319 --exp_p;
1320 /* Skip the second #. */
1321 p++;
1322 /* Discard following whitespace. */
1323 SKIP_WHITE_SPACE(p);
1324 concat = p;
1325 if (p == limit)
1326 cpp_error(pfile, "`##' at end of macro definition");
1327 }
1328 else if (nargs >= 0)
1329 {
1330 /* Single #: stringify following argument ref.
1331 * Don't leave the # in the expansion. */
1332 exp_p--;
1333 SKIP_WHITE_SPACE(p);
1334 if (p == limit || !is_idstart[*p])
1335 cpp_error(pfile,
1336 "`#' operator is not followed by a macro argument name");
1337 else
1338 stringify = p;
1339 }
1340 break;
1341 }
1342
1343 /* Handle the start of a symbol. */
1344 if (is_idchar[c] && nargs > 0)
1345 {
1346 unsigned char *id_beg = p - 1;
1347 int id_len;
1348
1349 --exp_p;
1350 while (p != limit && is_idchar[*p])
1351 p++;
1352 id_len = p - id_beg;
1353
1354 if (is_idstart[c])
1355 {
1356 struct arglist *arg;
1357
1358 for (arg = arglist; arg; arg = arg->next)
1359 {
1360 reflist *tpat;
1361
1362 if (arg->name[0] == c
1363 && arg->length == id_len
1364 && strncmp((const char *)arg->name,
1365 (const char *)id_beg, id_len) == 0)
1366 {
1367 if (expected_delimiter
1368 && CPP_OPTIONS(pfile)->warn_stringify)
1369 {
1370 cpp_warning(pfile,
1371 "macro arg `%.*s' would be stringified with -traditional.",
1372 id_len, arg->name);
1373 }
1374 /* If ANSI, don't actually substitute inside a string. */
1375 if (expected_delimiter)
1376 break;
1377 /* make a pat node for this arg and append it to the end of
1378 * the pat list */
1379 tpat = (reflist *) xmalloc(sizeof(reflist));
1380
1381 tpat->next = NULL;
1382 tpat->raw_before = concat == id_beg;
1383 tpat->raw_after = 0;
1384 tpat->rest_args = arg->rest_args;
1385 tpat->stringify = (stringify == id_beg);
1386
1387 if (!endpat)
1388 defn->pattern = tpat;
1389 else
1390 endpat->next = tpat;
1391 endpat = tpat;
1392
1393 tpat->argno = arg->argno;
1394 tpat->nchars = exp_p - lastp;
1395 {
1396 unsigned char *p1 = p;
1397
1398 SKIP_WHITE_SPACE(p1);
1399 if (p1 + 2 <= limit && p1[0] == '#'
1400 && p1[1] == '#')
1401 tpat->raw_after = 1;
1402 }
1403 lastp = exp_p; /* place to start copying from next time */
1404 skipped_arg = 1;
1405 break;
1406 }
1407 }
1408 }
1409 /* If this was not a macro arg, copy it into the expansion. */
1410 if (!skipped_arg)
1411 {
1412 unsigned char *lim1 = p;
1413
1414 p = id_beg;
1415 while (p != lim1)
1416 *exp_p++ = *p++;
1417 if (stringify == id_beg)
1418 cpp_error(pfile,
1419 "`#' operator should be followed by a macro argument name");
1420 }
1421 }
1422 }
1423
1424 if (expected_delimiter == 0)
1425 {
1426 /* If ANSI, put in a "@ " marker to prevent token pasting.
1427 * But not if "inside a string" (which in ANSI mode
1428 * happens only for -D option). */
1429 *exp_p++ = '@';
1430 *exp_p++ = ' ';
1431 }
1432 *exp_p = '\0';
1433
1434 defn->length = exp_p - defn->expansion;
1435
1436 /* Crash now if we overrun the allocated size. */
1437 if (defn->length + 1 > maxsize)
1438 abort();
1439
1440 return defn;
1441}
1442
1443/*
1444 * special extension string that can be added to the last macro argument to
1445 * allow it to absorb the "rest" of the arguments when expanded. Ex:
1446 * #define wow(a, b...) process (b, a, b)
1447 * { wow (1, 2, 3); } -> { process (2, 3, 1, 2, 3); }
1448 * { wow (one, two); } -> { process (two, one, two); }
1449 * if this "rest_arg" is used with the concat token '##' and if it is not
1450 * supplied then the token attached to with ## will not be outputted. Ex:
1451 * #define wow (a, b...) process (b ## , a, ## b)
1452 * { wow (1, 2); } -> { process (2, 1, 2); }
1453 * { wow (one); } -> { process (one); {
1454 */
1455static char rest_extension[] = "...";
1456
1457#define REST_EXTENSION_LENGTH (sizeof (rest_extension) - 1)
1458
1459/* Create a DEFINITION node from a #define directive. Arguments are
1460 * as for do_define. */
1461static void
1462create_definition(MACRODEF * mdef, unsigned char *buf, unsigned char *limit,
1463 cpp_reader * pfile, int predefinition)
1464{
1465 unsigned char *bp; /* temp ptr into input buffer */
1466 unsigned char *symname; /* remember where symbol name starts */
1467 int sym_length; /* and how long it is */
1468 int rest_args = 0;
1469 long line, col;
1470 const char *file =
1471 CPP_BUFFER(pfile) ? CPP_BUFFER(pfile)->nominal_fname : "";
1472 DEFINITION *defn;
1473 int arglengths = 0; /* Accumulate lengths of arg names
1474 * plus number of args. */
1475
1476 cpp_buf_line_and_col(CPP_BUFFER(pfile), &line, &col);
1477
1478 bp = buf;
1479
1480 while (is_hor_space[*bp])
1481 bp++;
1482
1483 symname = bp; /* remember where it starts */
1484
1485 sym_length = check_macro_name(pfile, bp, "macro");
1486 bp += sym_length;
1487
1488 /* Lossage will occur if identifiers or control keywords are broken
1489 * across lines using backslash. This is not the right place to take
1490 * care of that. */
1491
1492 if (*bp == '(')
1493 {
1494 struct arglist *arg_ptrs = NULL;
1495 int argno = 0;
1496
1497 bp++; /* skip '(' */
1498 SKIP_WHITE_SPACE(bp);
1499
1500 /* Loop over macro argument names. */
1501 while (*bp != ')')
1502 {
1503 struct arglist *temp;
1504
1505 temp = (struct arglist *)alloca(sizeof(struct arglist));
1506
1507 temp->name = (char *)bp;
1508 temp->next = arg_ptrs;
1509 temp->argno = argno++;
1510 temp->rest_args = 0;
1511 arg_ptrs = temp;
1512
1513 if (rest_args)
1514 cpp_pedwarn(pfile, "another parameter follows `%s'",
1515 rest_extension);
1516
1517 if (!is_idstart[*bp])
1518 cpp_pedwarn(pfile, "invalid character in macro parameter name");
1519
1520 /* Find the end of the arg name. */
1521 while (is_idchar[*bp])
1522 {
1523 bp++;
1524 /* do we have a "special" rest-args extension here? */
1525 if ((unsigned)(limit - bp) > REST_EXTENSION_LENGTH &&
1526 strncmp(rest_extension, (const char *)bp,
1527 REST_EXTENSION_LENGTH) == 0)
1528 {
1529 rest_args = 1;
1530 temp->rest_args = 1;
1531 break;
1532 }
1533 }
1534 temp->length = (char *)bp - temp->name;
1535 if (rest_args == 1)
1536 bp += REST_EXTENSION_LENGTH;
1537 arglengths += temp->length + 2;
1538 SKIP_WHITE_SPACE(bp);
1539 if (temp->length == 0 || (*bp != ',' && *bp != ')'))
1540 {
1541 cpp_error(pfile,
1542 "badly punctuated parameter list in `#define'");
1543 goto nope;
1544 }
1545 if (*bp == ',')
1546 {
1547 bp++;
1548 SKIP_WHITE_SPACE(bp);
1549 }
1550 if (bp >= limit)
1551 {
1552 cpp_error(pfile, "unterminated parameter list in `#define'");
1553 goto nope;
1554 }
1555 {
1556 struct arglist *otemp;
1557
1558 for (otemp = temp->next; otemp; otemp = otemp->next)
1559 if (temp->length == otemp->length &&
1560 strncmp((const char *)temp->name,
1561 (const char *)otemp->name, temp->length) == 0)
1562 {
1563 char *name;
1564
1565 name = (char *)alloca(temp->length + 1);
1566 strncpy(name, (const char *)temp->name, temp->length);
1567 name[temp->length] = '\0';
1568 cpp_error(pfile,
1569 "duplicate argument name `%s' in `#define'",
1570 name);
1571 goto nope;
1572 }
1573 }
1574 }
1575
1576 ++bp; /* skip paren */
1577 SKIP_WHITE_SPACE(bp);
1578 /* now everything from bp before limit is the definition. */
1579 defn = collect_expansion(pfile, bp, limit, argno, arg_ptrs);
1580 defn->rest_args = rest_args;
1581
1582 /* Now set defn->args.argnames to the result of concatenating
1583 * the argument names in reverse order
1584 * with comma-space between them. */
1585 defn->args.argnames = (unsigned char *)xmalloc(arglengths + 1);
1586 {
1587 struct arglist *temp;
1588 int i = 0;
1589
1590 for (temp = arg_ptrs; temp; temp = temp->next)
1591 {
1592 memcpy(&defn->args.argnames[i], temp->name, temp->length);
1593 i += temp->length;
1594 if (temp->next)
1595 {
1596 defn->args.argnames[i++] = ',';
1597 defn->args.argnames[i++] = ' ';
1598 }
1599 }
1600 defn->args.argnames[i] = 0;
1601 }
1602 }
1603 else
1604 {
1605 /* Simple expansion or empty definition. */
1606
1607 if (bp < limit)
1608 {
1609 if (is_hor_space[*bp])
1610 {
1611 bp++;
1612 SKIP_WHITE_SPACE(bp);
1613 }
1614 else
1615 {
1616 switch (*bp)
1617 {
1618 case '!':
1619 case '"':
1620 case '#':
1621 case '%':
1622 case '&':
1623 case '\'':
1624 case ')':
1625 case '*':
1626 case '+':
1627 case ',':
1628 case '-':
1629 case '.':
1630 case '/':
1631 case ':':
1632 case ';':
1633 case '<':
1634 case '=':
1635 case '>':
1636 case '?':
1637 case '[':
1638 case '\\':
1639 case ']':
1640 case '^':
1641 case '{':
1642 case '|':
1643 case '}':
1644 case '~':
1645 cpp_warning(pfile,
1646 "missing white space after `#define %.*s'",
1647 sym_length, symname);
1648 break;
1649
1650 default:
1651 cpp_pedwarn(pfile,
1652 "missing white space after `#define %.*s'",
1653 sym_length, symname);
1654 break;
1655 }
1656 }
1657 }
1658 /* now everything from bp before limit is the definition. */
1659 defn = collect_expansion(pfile, bp, limit, -1, NULL);
1660 defn->args.argnames = (unsigned char *)"";
1661 }
1662
1663 defn->line = line;
1664 defn->file = file;
1665
1666 /* OP is null if this is a predefinition */
1667 defn->predefined = predefinition;
1668 mdef->defn = defn;
1669 mdef->symnam = (char *)symname;
1670 mdef->symlen = sym_length;
1671
1672 return;
1673
1674 nope:
1675 mdef->defn = 0;
1676}
1677
1678/* Check a purported macro name SYMNAME, and yield its length.
1679 * USAGE is the kind of name this is intended for. */
1680
1681static int
1682check_macro_name(cpp_reader * pfile, unsigned char *symname, const char *usage)
1683{
1684 unsigned char *p;
1685 int sym_length;
1686
1687 for (p = symname; is_idchar[*p]; p++)
1688 ;
1689 sym_length = p - symname;
1690 if (sym_length == 0)
1691 {
1692 cpp_error(pfile, "invalid %s name", usage);
1693 }
1694 else if (!is_idstart[*symname])
1695 {
1696 unsigned char *msg; /* what pain... */
1697
1698 msg = (unsigned char *)alloca(sym_length + 1);
1699 memcpy(msg, symname, sym_length);
1700 msg[sym_length] = 0;
1701 cpp_error(pfile, "invalid %s name `%s'", usage, msg);
1702 }
1703 else
1704 {
1705 if (!strncmp((const char *)symname, "defined", 7) && sym_length == 7)
1706 cpp_error(pfile, "invalid %s name `defined'", usage);
1707 }
1708 return sym_length;
1709}
1710
1711/*
1712 * return zero if two DEFINITIONs are isomorphic
1713 */
1714static int
1715compare_defs(DEFINITION * d1, DEFINITION * d2)
1716{
1717 reflist *a1, *a2;
1718 unsigned char *p1 = d1->expansion;
1719 unsigned char *p2 = d2->expansion;
1720 int first = 1;
1721
1722 if (d1->nargs != d2->nargs)
1723 return 1;
1724 if (strcmp((char *)d1->args.argnames, (char *)d2->args.argnames))
1725 return 1;
1726 for (a1 = d1->pattern, a2 = d2->pattern; a1 && a2;
1727 a1 = a1->next, a2 = a2->next)
1728 {
1729 if (!
1730 ((a1->nchars == a2->nchars
1731 && !strncmp((const char *)p1, (const char *)p2, a1->nchars))
1732 || !comp_def_part(first, p1, a1->nchars, p2, a2->nchars, 0))
1733 || a1->argno != a2->argno || a1->stringify != a2->stringify
1734 || a1->raw_before != a2->raw_before
1735 || a1->raw_after != a2->raw_after)
1736 return 1;
1737 first = 0;
1738 p1 += a1->nchars;
1739 p2 += a2->nchars;
1740 }
1741 if (a1 != a2)
1742 return 1;
1743 if (comp_def_part(first, p1, d1->length - (p1 - d1->expansion),
1744 p2, d2->length - (p2 - d2->expansion), 1))
1745 return 1;
1746 return 0;
1747}
1748
1749/* Return 1 if two parts of two macro definitions are effectively different.
1750 * One of the parts starts at BEG1 and has LEN1 chars;
1751 * the other has LEN2 chars at BEG2.
1752 * Any sequence of whitespace matches any other sequence of whitespace.
1753 * FIRST means these parts are the first of a macro definition;
1754 * so ignore leading whitespace entirely.
1755 * LAST means these parts are the last of a macro definition;
1756 * so ignore trailing whitespace entirely. */
1757
1758static int
1759comp_def_part(int first, unsigned char *beg1, int len1,
1760 unsigned char *beg2, int len2, int last)
1761{
1762 unsigned char *end1 = beg1 + len1;
1763 unsigned char *end2 = beg2 + len2;
1764
1765 if (first)
1766 {
1767 while (beg1 != end1 && is_space[*beg1])
1768 beg1++;
1769 while (beg2 != end2 && is_space[*beg2])
1770 beg2++;
1771 }
1772 if (last)
1773 {
1774 while (beg1 != end1 && is_space[end1[-1]])
1775 end1--;
1776 while (beg2 != end2 && is_space[end2[-1]])
1777 end2--;
1778 }
1779 while (beg1 != end1 && beg2 != end2)
1780 {
1781 if (is_space[*beg1] && is_space[*beg2])
1782 {
1783 while (beg1 != end1 && is_space[*beg1])
1784 beg1++;
1785 while (beg2 != end2 && is_space[*beg2])
1786 beg2++;
1787 }
1788 else if (*beg1 == *beg2)
1789 {
1790 beg1++;
1791 beg2++;
1792 }
1793 else
1794 break;
1795 }
1796 return (beg1 != end1) || (beg2 != end2);
1797}
1798
1799/* Process a #define command.
1800 * BUF points to the contents of the #define command, as a contiguous string.
1801 * LIMIT points to the first character past the end of the definition.
1802 * KEYWORD is the keyword-table entry for #define,
1803 * or NULL for a "predefined" macro. */
1804
1805static int
1806do_define(cpp_reader * pfile, struct directive *keyword,
1807 unsigned char *buf, unsigned char *limit)
1808{
1809 int hashcode;
1810 MACRODEF mdef;
1811 HASHNODE *hp;
1812
1813 create_definition(&mdef, buf, limit, pfile, !keyword);
1814 if (!mdef.defn)
1815 return 1;
1816
1817 hashcode = hashf(mdef.symnam, mdef.symlen, HASHSIZE);
1818
1819 if ((hp = cpp_lookup(mdef.symnam, mdef.symlen, hashcode)))
1820 {
1821 int ok = 0;
1822
1823 /* Redefining a precompiled key is ok. */
1824 if (hp->type == T_PCSTRING)
1825 ok = 1;
1826 /* Redefining a macro is ok if the definitions are the same. */
1827 else if (hp->type == T_MACRO)
1828 ok = !compare_defs(mdef.defn, hp->value.defn);
1829 /* Redefining a constant is ok with -D. */
1830 else if (hp->type == T_CONST)
1831 ok = !CPP_OPTIONS(pfile)->done_initializing;
1832 /* Print the warning if it's not ok. */
1833 if (!ok)
1834 {
1835 char *msg; /* what pain... */
1836
1837 /* If we are passing through #define and #undef directives, do
1838 * that for this re-definition now. */
1839 if (CPP_OPTIONS(pfile)->debug_output && keyword)
1840 pass_thru_directive((char *)buf, (char *)limit, pfile, keyword);
1841
1842 msg = (char *)alloca(mdef.symlen + 22);
1843 *msg = '`';
1844 memcpy(msg + 1, mdef.symnam, mdef.symlen);
1845 strcpy((msg + mdef.symlen + 1), "' redefined");
1846 cpp_pedwarn(pfile, msg);
1847 if (hp->type == T_MACRO)
1848 cpp_pedwarn_with_file_and_line(pfile, hp->value.defn->file,
1849 hp->value.defn->line,
1850 "this is the location of the previous definition",
1851 NULL, NULL, NULL);
1852 }
1853 /* Replace the old definition. */
1854 hp->type = T_MACRO;
1855 hp->value.defn = mdef.defn;
1856 }
1857 else
1858 {
1859 /* If we are passing through #define and #undef directives, do
1860 * that for this new definition now. */
1861 if (CPP_OPTIONS(pfile)->debug_output && keyword)
1862 pass_thru_directive((char *)buf, (char *)limit, pfile, keyword);
1863 install(mdef.symnam, mdef.symlen, T_MACRO, 0,
1864 (char *)mdef.defn, hashcode);
1865 }
1866
1867 return 0;
1868}
1869
1870/* This structure represents one parsed argument in a macro call.
1871 * `raw' points to the argument text as written (`raw_length' is its length).
1872 * `expanded' points to the argument's macro-expansion
1873 * (its length is `expand_length').
1874 * `stringified_length' is the length the argument would have
1875 * if stringified.
1876 * `use_count' is the number of times this macro arg is substituted
1877 * into the macro. If the actual use count exceeds 10,
1878 * the value stored is 10. */
1879
1880/* raw and expanded are relative to ARG_BASE */
1881#define ARG_BASE ((pfile)->token_buffer)
1882
1883struct argdata {
1884 /* Strings relative to pfile->token_buffer */
1885 long raw, expanded, stringified;
1886 int raw_length, expand_length;
1887 int stringified_length;
1888 char newlines;
1889 char use_count;
1890};
1891
1892cpp_buffer *
1893cpp_push_buffer(cpp_reader * pfile, unsigned char *buffer, long length)
1894{
1895#ifdef STATIC_BUFFERS
1896 cpp_buffer *buf = CPP_BUFFER(pfile);
1897
1898 if (buf == pfile->buffer_stack)
1899 cpp_fatal("macro or `#include' recursion too deep");
1900 buf--;
1901 memset((char *)buf, 0, sizeof(cpp_buffer));
1902 CPP_BUFFER(pfile) = buf;
1903#else
1904 cpp_buffer *buf = (cpp_buffer *) xmalloc(sizeof(cpp_buffer));
1905
1906 memset((char *)buf, 0, sizeof(cpp_buffer));
1907 CPP_PREV_BUFFER(buf) = CPP_BUFFER(pfile);
1908 CPP_BUFFER(pfile) = buf;
1909#endif
1910 buf->if_stack = pfile->if_stack;
1911 buf->cleanup = null_cleanup;
1912 buf->underflow = null_underflow;
1913 buf->buf = buf->cur = buffer;
1914 buf->alimit = buf->rlimit = buffer + length;
1915
1916 return buf;
1917}
1918
1919static cpp_buffer *
1920cpp_pop_buffer(cpp_reader * pfile)
1921{
1922 cpp_buffer *buf = CPP_BUFFER(pfile);
1923
1924#ifdef STATIC_BUFFERS
1925 (*buf->cleanup) (buf, pfile);
1926 return ++CPP_BUFFER(pfile);
1927#else
1928 cpp_buffer *next_buf = CPP_PREV_BUFFER(buf);
1929
1930 (*buf->cleanup) (buf, pfile);
1931 CPP_BUFFER(pfile) = next_buf;
1932 free(buf);
1933 return next_buf;
1934#endif
1935}
1936
1937/* Scan until CPP_BUFFER (PFILE) is exhausted into PFILE->token_buffer.
1938 * Pop the buffer when done. */
1939
1940static void
1941cpp_scan_buffer(cpp_reader * pfile)
1942{
1943 cpp_buffer *buffer = CPP_BUFFER(pfile);
1944
1945 for (;;)
1946 {
1947 enum cpp_token token = cpp_get_token(pfile);
1948
1949 if (token == CPP_EOF) /* Should not happen ... */
1950 break;
1951 if (token == CPP_POP && CPP_BUFFER(pfile) == buffer)
1952 {
1953 cpp_pop_buffer(pfile);
1954 break;
1955 }
1956 }
1957}
1958
1959/*
1960 * Rescan a string (which may have escape marks) into pfile's buffer.
1961 * Place the result in pfile->token_buffer.
1962 *
1963 * The input is copied before it is scanned, so it is safe to pass
1964 * it something from the token_buffer that will get overwritten
1965 * (because it follows CPP_WRITTEN). This is used by do_include.
1966 */
1967
1968static void
1969cpp_expand_to_buffer(cpp_reader * pfile, unsigned char *buf, int length)
1970{
1971 cpp_buffer *ip;
1972 unsigned char *limit = buf + length;
1973 unsigned char *buf1;
1974
1975 if (length < 0)
1976 abort();
1977
1978 /* Set up the input on the input stack. */
1979
1980 buf1 = (unsigned char *)alloca(length + 1);
1981 {
1982 unsigned char *p1 = buf;
1983 unsigned char *p2 = buf1;
1984 int in_string = 0;
1985
1986#if 0 /* old behavior */
1987 while (p1 != limit) *p2++ = *p1++;
1988#else /* new one - handle \ escapes if not in string */
1989 while (p1 != limit)
1990 {
1991 if (!in_string)
1992 {
1993 if (*p1 == '"') in_string = 1;
1994 if (*p1 == '\\')
1995 {
1996 p1++;
1997 if (p1 != limit) *p2++ = *p1++;
1998 }
1999 else
2000 *p2++ = *p1++;
2001 }
2002 else
2003 {
2004 if ((*p1 == '"') && (p1 > buf) && (p1[-1] != '\\'))
2005 in_string = 0;
2006 *p2++ = *p1++;
2007 }
2008 }
2009#endif
2010 *p2 = 0;
2011 length = p2 - buf1;
2012 }
2013
2014 ip = cpp_push_buffer(pfile, buf1, length);
2015 ip->has_escapes = 1;
2016
2017 /* Scan the input, create the output. */
2018 cpp_scan_buffer(pfile);
2019
2020 CPP_NUL_TERMINATE(pfile);
2021}
2022
2023static void
2024adjust_position(unsigned char *buf, unsigned char *limit, long *linep,
2025 long *colp)
2026{
2027 while (buf < limit)
2028 {
2029 unsigned char ch = *buf++;
2030
2031 if (ch == '\n')
2032 (*linep)++, (*colp) = 1;
2033 else
2034 (*colp)++;
2035 }
2036}
2037
2038/* Move line_base forward, updating lineno and colno. */
2039
2040static void
2041update_position(cpp_buffer * pbuf)
2042{
2043 unsigned char *old_pos = pbuf->buf + pbuf->line_base;
2044 unsigned char *new_pos = pbuf->cur;
2045 struct parse_marker *mark;
2046
2047 for (mark = pbuf->marks; mark; mark = mark->next)
2048 {
2049 if (pbuf->buf + mark->position < new_pos)
2050 new_pos = pbuf->buf + mark->position;
2051 }
2052 pbuf->line_base += new_pos - old_pos;
2053 adjust_position(old_pos, new_pos, &pbuf->lineno, &pbuf->colno);
2054}
2055
2056void
2057cpp_buf_line_and_col(cpp_buffer * pbuf, long *linep, long *colp)
2058{
2059 long dummy;
2060
2061 if (!colp)
2062 colp = &dummy;
2063 if (pbuf)
2064 {
2065 *linep = pbuf->lineno;
2066 *colp = pbuf->colno;
2067 adjust_position(pbuf->buf + pbuf->line_base, pbuf->cur, linep, colp);
2068 }
2069 else
2070 {
2071 *linep = 0;
2072 *colp = 0;
2073 }
2074}
2075
2076/* Return the cpp_buffer that corresponds to a file (not a macro). */
2077
2078cpp_buffer *
2079cpp_file_buffer(cpp_reader * pfile)
2080{
2081 cpp_buffer *ip = CPP_BUFFER(pfile);
2082
2083 for (; ip != CPP_NULL_BUFFER(pfile); ip = CPP_PREV_BUFFER(ip))
2084 if (ip->fname)
2085 return ip;
2086 return NULL;
2087}
2088
2089static long
2090count_newlines(unsigned char *buf, unsigned char *limit)
2091{
2092 long count = 0;
2093
2094 while (buf < limit)
2095 {
2096 unsigned char ch = *buf++;
2097
2098 if (ch == '\n')
2099 count++;
2100 }
2101 return count;
2102}
2103
2104/*
2105 * write out a #line command, for instance, after an #include file.
2106 * If CONDITIONAL is nonzero, we can omit the #line if it would
2107 * appear to be a no-op, and we can output a few newlines instead
2108 * if we want to increase the line number by a small amount.
2109 * FILE_CHANGE says whether we are entering a file, leaving, or neither.
2110 */
2111
2112static void
2113output_line_command(cpp_reader * pfile, int conditional,
2114 enum file_change_code file_change)
2115{
2116 long line, col;
2117 cpp_buffer *ip = CPP_BUFFER(pfile);
2118
2119 if (CPP_OPTIONS(pfile)->no_line_commands
2120 || !ip->fname || CPP_OPTIONS(pfile)->no_output)
2121 {
2122 return;
2123 }
2124 update_position(ip);
2125 line = CPP_BUFFER(pfile)->lineno;
2126 col = CPP_BUFFER(pfile)->colno;
2127 adjust_position(CPP_LINE_BASE(ip), ip->cur, &line, &col);
2128
2129 if (conditional)
2130 {
2131 if (line == pfile->lineno)
2132 return;
2133
2134 /* If the inherited line number is a little too small,
2135 * output some newlines instead of a #line command. */
2136 if (line > pfile->lineno && line < pfile->lineno + 8)
2137 {
2138 CPP_RESERVE(pfile, 20);
2139 while (line > pfile->lineno)
2140 {
2141 CPP_PUTC_Q(pfile, '\n');
2142 pfile->lineno++;
2143 }
2144 return;
2145 }
2146 }
2147
2148 CPP_RESERVE(pfile, 4 * strlen(ip->nominal_fname) + 50);
2149 {
2150 static char sharp_line[] = "#line ";
2151
2152 CPP_PUTS_Q(pfile, sharp_line, sizeof(sharp_line) - 1);
2153 }
2154
2155 sprintf((char *)CPP_PWRITTEN(pfile), "%d ", (int)line);
2156 CPP_ADJUST_WRITTEN(pfile, strlen((char *)CPP_PWRITTEN(pfile)));
2157
2158 quote_string(pfile, ip->nominal_fname);
2159 if (file_change != same_file)
2160 {
2161 CPP_PUTC_Q(pfile, ' ');
2162 CPP_PUTC_Q(pfile, file_change == enter_file ? '1' : '2');
2163 }
2164 /* Tell cc1 if following text comes from a system header file. */
2165 if (ip->system_header_p)
2166 {
2167 CPP_PUTC_Q(pfile, ' ');
2168 CPP_PUTC_Q(pfile, '3');
2169 }
2170#ifndef NO_IMPLICIT_EXTERN_C
2171 /* Tell cc1plus if following text should be treated as C. */
2172 if (ip->system_header_p == 2 && CPP_OPTIONS(pfile)->cplusplus)
2173 {
2174 CPP_PUTC_Q(pfile, ' ');
2175 CPP_PUTC_Q(pfile, '4');
2176 }
2177#endif
2178 CPP_PUTC_Q(pfile, '\n');
2179 pfile->lineno = line;
2180}
2181
2182/*
2183 * Parse a macro argument and append the info on PFILE's token_buffer.
2184 * REST_ARGS means to absorb the rest of the args.
2185 * Return nonzero to indicate a syntax error.
2186 */
2187
2188static enum cpp_token
2189macarg(cpp_reader * pfile, int rest_args)
2190{
2191 int paren = 0;
2192 enum cpp_token token;
2193 char save_put_out_comments =
2194 CPP_OPTIONS(pfile)->put_out_comments;
2195
2196 CPP_OPTIONS(pfile)->put_out_comments = 0;
2197
2198 token = CPP_OTHER;
2199 /* Try to parse as much of the argument as exists at this
2200 * input stack level. */
2201 pfile->no_macro_expand++;
2202 for (;;)
2203 {
2204 token = cpp_get_token(pfile);
2205 switch (token)
2206 {
2207 case CPP_EOF:
2208 goto done;
2209 case CPP_POP:
2210 /* If we've hit end of file, it's an error (reported by caller).
2211 * Ditto if it's the end of cpp_expand_to_buffer text.
2212 * If we've hit end of macro, just continue. */
2213 if (!CPP_IS_MACRO_BUFFER(CPP_BUFFER(pfile)))
2214 goto done;
2215 break;
2216 case CPP_LPAREN:
2217 paren++;
2218 break;
2219 case CPP_RPAREN:
2220 if (--paren < 0)
2221 goto found;
2222 break;
2223 case CPP_COMMA:
2224 /* if we've returned to lowest level and
2225 * we aren't absorbing all args */
2226 if (paren == 0 && rest_args == 0)
2227 goto found;
2228 break;
2229 found:
2230 /* Remove ',' or ')' from argument buffer. */
2231 CPP_ADJUST_WRITTEN(pfile, -1);
2232 goto done;
2233 default:;
2234 }
2235 }
2236
2237 done:
2238 CPP_OPTIONS(pfile)->put_out_comments = save_put_out_comments;
2239 pfile->no_macro_expand--;
2240
2241 return token;
2242}
2243
2244/* Turn newlines to spaces in the string of length LENGTH at START,
2245 * except inside of string constants.
2246 * The string is copied into itself with its beginning staying fixed. */
2247
2248static int
2249change_newlines(unsigned char *start, int length)
2250{
2251 unsigned char *ibp;
2252 unsigned char *obp;
2253 unsigned char *limit;
2254 int c;
2255
2256 ibp = start;
2257 limit = start + length;
2258 obp = start;
2259
2260 while (ibp < limit)
2261 {
2262 *obp++ = c = *ibp++;
2263 switch (c)
2264 {
2265
2266 case '\'':
2267 case '\"':
2268 /* Notice and skip strings, so that we don't delete newlines in them. */
2269 {
2270 int quotec = c;
2271
2272 while (ibp < limit)
2273 {
2274 *obp++ = c = *ibp++;
2275 if (c == quotec)
2276 break;
2277 if (c == '\n' && quotec == '\'')
2278 break;
2279 }
2280 }
2281 break;
2282 }
2283 }
2284
2285 return obp - start;
2286}
2287
2288static struct tm *
2289timestamp(cpp_reader * pfile)
2290{
2291 if (!pfile->timebuf)
2292 {
2293 time_t t = time((time_t *) 0);
2294
2295 pfile->timebuf = localtime(&t);
2296 }
2297 return pfile->timebuf;
2298}
2299
2300static const char *monthnames[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
2301 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
2302};
2303
2304/*
2305 * expand things like __FILE__. Place the expansion into the output
2306 * buffer *without* rescanning.
2307 */
2308
2309static void
2310special_symbol(HASHNODE * hp, cpp_reader * pfile)
2311{
2312 const char *buf;
2313 char *bufx;
2314 int len;
2315 int true_indepth;
2316 cpp_buffer *ip = NULL;
2317 struct tm *timebuf;
2318
2319 int paren = 0; /* For special `defined' keyword */
2320
2321 for (ip = CPP_BUFFER(pfile);; ip = CPP_PREV_BUFFER(ip))
2322 {
2323 if (!ip)
2324 {
2325 cpp_error(pfile, "cccp error: not in any file?!");
2326 return; /* the show must go on */
2327 }
2328 if (ip->fname)
2329 break;
2330 }
2331
2332 switch (hp->type)
2333 {
2334 case T_FILE:
2335 case T_BASE_FILE:
2336 {
2337 const char *string;
2338
2339 if (hp->type == T_BASE_FILE)
2340 {
2341 while (CPP_PREV_BUFFER(ip))
2342 ip = CPP_PREV_BUFFER(ip);
2343 }
2344 string = ip->nominal_fname;
2345
2346 if (!string)
2347 string = "";
2348 CPP_RESERVE(pfile, 3 + 4 * strlen(string));
2349 quote_string(pfile, string);
2350 return;
2351 }
2352
2353 case T_INCLUDE_LEVEL:
2354 true_indepth = 0;
2355 for (ip = CPP_BUFFER(pfile); ip; ip = CPP_PREV_BUFFER(ip))
2356 if (ip->fname)
2357 true_indepth++;
2358
2359 bufx = (char *)alloca(8); /* Eight bytes ought to be more than enough */
2360 sprintf(bufx, "%d", true_indepth - 1);
2361 buf = bufx;
2362 break;
2363
2364 case T_VERSION:
2365 bufx = (char *)alloca(3 + strlen(version_string));
2366 sprintf(bufx, "\"%s\"", version_string);
2367 buf = bufx;
2368 break;
2369
2370#ifndef NO_BUILTIN_SIZE_TYPE
2371 case T_SIZE_TYPE:
2372 buf = SIZE_TYPE;
2373 break;
2374#endif
2375
2376#ifndef NO_BUILTIN_PTRDIFF_TYPE
2377 case T_PTRDIFF_TYPE:
2378 buf = PTRDIFF_TYPE;
2379 break;
2380#endif
2381
2382 case T_WCHAR_TYPE:
2383 buf = CPP_WCHAR_TYPE(pfile);
2384 break;
2385
2386 case T_USER_LABEL_PREFIX_TYPE:
2387 buf = USER_LABEL_PREFIX;
2388 break;
2389
2390 case T_REGISTER_PREFIX_TYPE:
2391 buf = REGISTER_PREFIX;
2392 break;
2393
2394 case T_CONST:
2395 bufx = (char *)alloca(4 * sizeof(int));
2396 sprintf(bufx, "%d", hp->value.ival);
2397 buf = bufx;
2398 break;
2399
2400 case T_SPECLINE:
2401 {
2402 long line = ip->lineno;
2403 long col = ip->colno;
2404
2405 adjust_position(CPP_LINE_BASE(ip), ip->cur, &line, &col);
2406
2407 bufx = (char *)alloca(10);
2408 sprintf(bufx, "%d", (int)line);
2409 buf = bufx;
2410 }
2411 break;
2412
2413 case T_DATE:
2414 case T_TIME:
2415 bufx = (char *)alloca(20);
2416 timebuf = timestamp(pfile);
2417 if (hp->type == T_DATE)
2418 sprintf(bufx, "\"%s %2d %4d\"", monthnames[timebuf->tm_mon],
2419 timebuf->tm_mday, timebuf->tm_year + 1900);
2420 else
2421 sprintf(bufx, "\"%02d:%02d:%02d\"", timebuf->tm_hour,
2422 timebuf->tm_min, timebuf->tm_sec);
2423 buf = bufx;
2424 break;
2425
2426 case T_SPEC_DEFINED:
2427 buf = " 0 "; /* Assume symbol is not defined */
2428 ip = CPP_BUFFER(pfile);
2429 SKIP_WHITE_SPACE(ip->cur);
2430 if (*ip->cur == '(')
2431 {
2432 paren++;
2433 ip->cur++; /* Skip over the paren */
2434 SKIP_WHITE_SPACE(ip->cur);
2435 }
2436 if (!is_idstart[*ip->cur])
2437 goto oops;
2438 if ((hp = cpp_lookup((const char *)ip->cur, -1, -1)))
2439 {
2440 buf = " 1 ";
2441 }
2442 while (is_idchar[*ip->cur])
2443 ++ip->cur;
2444 SKIP_WHITE_SPACE(ip->cur);
2445 if (paren)
2446 {
2447 if (*ip->cur != ')')
2448 goto oops;
2449 ++ip->cur;
2450 }
2451 break;
2452
2453 oops:
2454
2455 cpp_error(pfile, "`defined' without an identifier");
2456 break;
2457
2458 default:
2459 cpp_error(pfile, "cccp error: invalid special hash type"); /* time for gdb */
2460 abort();
2461 }
2462 len = strlen(buf);
2463 CPP_RESERVE(pfile, len + 1);
2464 CPP_PUTS_Q(pfile, buf, len);
2465 CPP_NUL_TERMINATE_Q(pfile);
2466
2467 return;
2468}
2469
2470/* Initialize the built-in macros. */
2471
2472static void
2473initialize_builtins(cpp_reader * pfile)
2474{
2475 install("__LINE__", -1, T_SPECLINE, 0, 0, -1);
2476 install("__DATE__", -1, T_DATE, 0, 0, -1);
2477 install("__FILE__", -1, T_FILE, 0, 0, -1);
2478 install("__BASE_FILE__", -1, T_BASE_FILE, 0, 0, -1);
2479 install("__INCLUDE_LEVEL__", -1, T_INCLUDE_LEVEL, 0, 0, -1);
2480 install("__VERSION__", -1, T_VERSION, 0, 0, -1);
2481#ifndef NO_BUILTIN_SIZE_TYPE
2482 install("__SIZE_TYPE__", -1, T_SIZE_TYPE, 0, 0, -1);
2483#endif
2484#ifndef NO_BUILTIN_PTRDIFF_TYPE
2485 install("__PTRDIFF_TYPE__ ", -1, T_PTRDIFF_TYPE, 0, 0, -1);
2486#endif
2487 install("__WCHAR_TYPE__", -1, T_WCHAR_TYPE, 0, 0, -1);
2488 install("__USER_LABEL_PREFIX__", -1, T_USER_LABEL_PREFIX_TYPE, 0, 0, -1);
2489 install("__REGISTER_PREFIX__", -1, T_REGISTER_PREFIX_TYPE, 0, 0, -1);
2490 install("__TIME__", -1, T_TIME, 0, 0, -1);
2491 install("__STDC__", -1, T_CONST, STDC_VALUE, 0, -1);
2492 if (CPP_OPTIONS(pfile)->objc)
2493 install("__OBJC__", -1, T_CONST, 1, 0, -1);
2494/* This is supplied using a -D by the compiler driver
2495 * so that it is present only when truly compiling with GNU C. */
2496/* install ("__GNUC__", -1, T_CONST, 2, 0, -1); */
2497
2498 if (CPP_OPTIONS(pfile)->debug_output)
2499 {
2500 char directive[2048];
2501 struct directive *dp = &directive_table[0];
2502 struct tm *timebuf = timestamp(pfile);
2503 cpp_buffer *pbuffer = CPP_BUFFER(pfile);
2504
2505 while (CPP_PREV_BUFFER(pbuffer))
2506 pbuffer = CPP_PREV_BUFFER(pbuffer);
2507 sprintf(directive, " __BASE_FILE__ \"%s\"\n", pbuffer->nominal_fname);
2508 output_line_command(pfile, 0, same_file);
2509 pass_thru_directive(directive, &directive[strlen(directive)], pfile,
2510 dp);
2511
2512 sprintf(directive, " __VERSION__ \"%s\"\n", version_string);
2513 output_line_command(pfile, 0, same_file);
2514 pass_thru_directive(directive, &directive[strlen(directive)], pfile,
2515 dp);
2516
2517#ifndef NO_BUILTIN_SIZE_TYPE
2518 sprintf(directive, " __SIZE_TYPE__ %s\n", SIZE_TYPE);
2519 output_line_command(pfile, 0, same_file);
2520 pass_thru_directive(directive, &directive[strlen(directive)], pfile,
2521 dp);
2522#endif
2523
2524#ifndef NO_BUILTIN_PTRDIFF_TYPE
2525 sprintf(directive, " __PTRDIFF_TYPE__ %s\n", PTRDIFF_TYPE);
2526 output_line_command(pfile, 0, same_file);
2527 pass_thru_directive(directive, &directive[strlen(directive)], pfile,
2528 dp);
2529#endif
2530
2531 sprintf(directive, " __WCHAR_TYPE__ %s\n", CPP_WCHAR_TYPE(pfile));
2532 output_line_command(pfile, 0, same_file);
2533 pass_thru_directive(directive, &directive[strlen(directive)], pfile,
2534 dp);
2535
2536 sprintf(directive, " __DATE__ \"%s %2d %4d\"\n",
2537 monthnames[timebuf->tm_mon],
2538 timebuf->tm_mday, timebuf->tm_year + 1900);
2539 output_line_command(pfile, 0, same_file);
2540 pass_thru_directive(directive, &directive[strlen(directive)], pfile,
2541 dp);
2542
2543 sprintf(directive, " __TIME__ \"%02d:%02d:%02d\"\n",
2544 timebuf->tm_hour, timebuf->tm_min, timebuf->tm_sec);
2545 output_line_command(pfile, 0, same_file);
2546 pass_thru_directive(directive, &directive[strlen(directive)], pfile,
2547 dp);
2548
2549 sprintf(directive, " __STDC__ 1");
2550 output_line_command(pfile, 0, same_file);
2551 pass_thru_directive(directive, &directive[strlen(directive)],
2552 pfile, dp);
2553 }
2554}
2555
2556/* Return 1 iff a token ending in C1 followed directly by a token C2
2557 * could cause mis-tokenization. */
2558
2559static int
2560unsafe_chars(int c1, int c2)
2561{
2562// printf("unsafe %c %c ...", c1, c2);
2563 switch (c1)
2564 {
2565 case '+':
2566 case '-':
2567 case '.':
2568// printf(" no0\n");
2569 return 0;
2570 case '0':
2571 case '1':
2572 case '2':
2573 case '3':
2574 case '4':
2575 case '5':
2576 case '6':
2577 case '7':
2578 case '8':
2579 case '9':
2580 case 'e':
2581 case 'E':
2582 if (c2 == '-' || c2 == '+')
2583 {
2584// printf(" yes2\n");
2585 return 1; /* could extend a pre-processing number */
2586 }
2587 goto letter;
2588 case 'L':
2589 if (c2 == '\'' || c2 == '\"')
2590 {
2591// printf(" yes3\n");
2592 return 1; /* Could turn into L"xxx" or L'xxx'. */
2593 }
2594 goto letter;
2595 letter:
2596 case '_':
2597 case 'a':
2598 case 'b':
2599 case 'c':
2600 case 'd':
2601 case 'f':
2602 case 'g':
2603 case 'h':
2604 case 'i':
2605 case 'j':
2606 case 'k':
2607 case 'l':
2608 case 'm':
2609 case 'n':
2610 case 'o':
2611 case 'p':
2612 case 'q':
2613 case 'r':
2614 case 's':
2615 case 't':
2616 case 'u':
2617 case 'v':
2618 case 'w':
2619 case 'x':
2620 case 'y':
2621 case 'z':
2622 case 'A':
2623 case 'B':
2624 case 'C':
2625 case 'D':
2626 case 'F':
2627 case 'G':
2628 case 'H':
2629 case 'I':
2630 case 'J':
2631 case 'K':
2632 case 'M':
2633 case 'N':
2634 case 'O':
2635 case 'P':
2636 case 'Q':
2637 case 'R':
2638 case 'S':
2639 case 'T':
2640 case 'U':
2641 case 'V':
2642 case 'W':
2643 case 'X':
2644 case 'Y':
2645 case 'Z':
2646 /* We're in the middle of either a name or a pre-processing number. */
2647 if (is_idchar[c2] || c2 == '.')
2648 {
2649// printf(" yes4 %i %i\n", is_idchar[c2], c2 == '.');
2650 return 1;
2651 }
2652 else
2653 {
2654// printf(" no5\n");
2655 return 0;
2656 }
2657 case '<':
2658 case '>':
2659 case '!':
2660 case '%':
2661 case '#':
2662 case ':':
2663 case '^':
2664 case '&':
2665 case '|':
2666 case '*':
2667 case '/':
2668 case '=':
2669 if (c2 == c1 || c2 == '=')
2670 {
2671// printf(" yes6\n");
2672 return 1;
2673 }
2674 else
2675 {
2676// printf(" no7\n");
2677 return 0;
2678 }
2679 }
2680// printf(" no8\n");
2681 return 0;
2682}
2683
2684/* Expand a macro call.
2685 * HP points to the symbol that is the macro being called.
2686 * Put the result of expansion onto the input stack
2687 * so that subsequent input by our caller will use it.
2688 *
2689 * If macro wants arguments, caller has already verified that
2690 * an argument list follows; arguments come from the input stack. */
2691
2692static void
2693macroexpand(cpp_reader * pfile, HASHNODE * hp)
2694{
2695 int nargs;
2696 DEFINITION *defn = hp->value.defn;
2697 unsigned char *xbuf;
2698 long start_line, start_column;
2699 int xbuf_len;
2700 struct argdata *args;
2701 long old_written = CPP_WRITTEN(pfile);
2702
2703 int rest_args, rest_zero;
2704 int i;
2705
2706 pfile->output_escapes++;
2707 cpp_buf_line_and_col(cpp_file_buffer(pfile), &start_line, &start_column);
2708
2709 rest_zero = 0;
2710 args = NULL;
2711 nargs = defn->nargs;
2712
2713 if (nargs >= 0)
2714 {
2715 enum cpp_token token;
2716
2717 token = CPP_OTHER;
2718
2719 args = (struct argdata *)alloca((nargs + 1) * sizeof(struct argdata));
2720
2721 for (i = 0; i < nargs; i++)
2722 {
2723 args[i].raw = args[i].expanded = 0;
2724 args[i].raw_length = 0;
2725 args[i].expand_length = args[i].stringified_length = -1;
2726 args[i].use_count = 0;
2727 }
2728
2729 /* Parse all the macro args that are supplied. I counts them.
2730 * The first NARGS args are stored in ARGS.
2731 * The rest are discarded. If rest_args is set then we assume
2732 * macarg absorbed the rest of the args. */
2733 i = 0;
2734 rest_args = 0;
2735 rest_args = 0;
2736 FORWARD(1); /* Discard the open-parenthesis before the first arg. */
2737 do
2738 {
2739 if (rest_args)
2740 continue;
2741 if (i < nargs || (nargs == 0 && i == 0))
2742 {
2743 unsigned char *bp;
2744
2745 /* if we are working on last arg which absorbs rest of args... */
2746 if (i == nargs - 1 && defn->rest_args)
2747 rest_args = 1;
2748 args[i].raw = CPP_WRITTEN(pfile);
2749 token = macarg(pfile, rest_args);
2750 args[i].raw_length = CPP_WRITTEN(pfile) - args[i].raw;
2751 args[i].newlines = 0; /* FIXME */
2752 bp = ARG_BASE + args[i].raw;
2753 while (is_space[(unsigned char)(*bp)]) { bp++; }
2754 args[i].raw_length -= bp - (ARG_BASE + args[i].raw);
2755 args[i].raw = bp - ARG_BASE;
2756 if (args[i].raw_length > 0)
2757 {
2758 bp = ARG_BASE + args[i].raw + args[i].raw_length - 1;
2759 while (is_space[(unsigned char)(*bp)])
2760 {
2761 bp--;
2762 args[i].raw_length--;
2763 if (args[i].raw_length < 1) break;
2764 }
2765 }
2766 }
2767 else
2768 token = macarg(pfile, 0);
2769 if (token == CPP_EOF || token == CPP_POP)
2770 {
2771 cpp_error_with_line(pfile, start_line, start_column,
2772 "unterminated macro call");
2773 return;
2774 }
2775 i++;
2776 }
2777 while (token == CPP_COMMA);
2778
2779 /* If we got one arg but it was just whitespace, call that 0 args. */
2780 if (i == 1)
2781 {
2782 unsigned char *bp = ARG_BASE + args[0].raw;
2783 unsigned char *lim = bp + args[0].raw_length;
2784
2785 /* cpp.texi says for foo ( ) we provide one argument.
2786 * However, if foo wants just 0 arguments, treat this as 0. */
2787 if (nargs == 0)
2788 while (bp != lim && is_space[*bp])
2789 bp++;
2790 if (bp == lim)
2791 i = 0;
2792 }
2793 /* Don't output an error message if we have already output one for
2794 * a parse error above. */
2795 if (nargs == 0 && i > 0)
2796 {
2797 cpp_error(pfile, "arguments given to macro `%s'", hp->name);
2798 }
2799 else if (i < nargs)
2800 {
2801 if (i == nargs - 1 && defn->rest_args)
2802 rest_zero = 1;
2803 else if (i == 0)
2804 cpp_error(pfile, "macro `%s' used without args", hp->name);
2805 else if (i == 1)
2806 cpp_error(pfile, "macro `%s' used with just one arg", hp->name);
2807 else
2808 cpp_error(pfile, "macro `%s' used with only %d args",
2809 hp->name, i);
2810 }
2811 else if (i > nargs)
2812 {
2813 cpp_error(pfile,
2814 "macro `%s' used with too many (%d) args", hp->name, i);
2815 }
2816 }
2817 /* If macro wants zero args, we parsed the arglist for checking only.
2818 * Read directly from the macro definition. */
2819 if (nargs <= 0)
2820 {
2821 xbuf = defn->expansion;
2822 xbuf_len = defn->length;
2823 }
2824 else
2825 {
2826 unsigned char *exp = defn->expansion;
2827 int offset; /* offset in expansion,
2828 * copied a piece at a time */
2829 int totlen; /* total amount of exp buffer filled so far */
2830 reflist *ap, *last_ap;
2831
2832 /* Macro really takes args. Compute the expansion of this call. */
2833
2834 /* Compute length in characters of the macro's expansion.
2835 * Also count number of times each arg is used. */
2836 xbuf_len = defn->length;
2837 for (ap = defn->pattern; ap; ap = ap->next)
2838 {
2839 if (ap->stringify)
2840 {
2841 struct argdata *arg = &args[ap->argno];
2842
2843 /* Stringify it it hasn't already been */
2844 if (arg->stringified_length < 0)
2845 {
2846 int arglen = arg->raw_length;
2847 int escaped = 0;
2848 int in_string = 0;
2849 int c;
2850
2851 /* Initially need_space is -1. Otherwise, 1 means the
2852 * previous character was a space, but we suppressed it;
2853 * 0 means the previous character was a non-space. */
2854 int need_space = -1;
2855
2856 i = 0;
2857 arg->stringified = CPP_WRITTEN(pfile);
2858 CPP_PUTC(pfile, '\"'); /* insert beginning quote */
2859 for (; i < arglen; i++)
2860 {
2861 c = (ARG_BASE + arg->raw)[i];
2862
2863 if (!in_string)
2864 {
2865 /* Internal sequences of whitespace are replaced by
2866 * one space except within an string or char token. */
2867 if (is_space[c])
2868 {
2869 if (CPP_WRITTEN(pfile) > arg->stringified
2870 && (CPP_PWRITTEN(pfile))[-1] == '@')
2871 {
2872 /* "@ " escape markers are removed */
2873 CPP_ADJUST_WRITTEN(pfile, -1);
2874 continue;
2875 }
2876 if (need_space == 0)
2877 need_space = 1;
2878 continue;
2879 }
2880 else if (need_space > 0)
2881 CPP_PUTC(pfile, ' ');
2882 need_space = 0;
2883 }
2884 if (escaped)
2885 escaped = 0;
2886 else
2887 {
2888 if (c == '\\')
2889 escaped = 1;
2890 if (in_string)
2891 {
2892 if (c == in_string)
2893 in_string = 0;
2894 }
2895 else if (c == '\"' || c == '\'')
2896 in_string = c;
2897 }
2898
2899 /* Escape these chars */
2900 if (c == '\"' || (in_string && c == '\\'))
2901 CPP_PUTC(pfile, '\\');
2902 if (isprint(c))
2903 CPP_PUTC(pfile, c);
2904 else
2905 {
2906 CPP_RESERVE(pfile, 4);
2907 sprintf((char *)CPP_PWRITTEN(pfile), "\\%03o",
2908 (unsigned int)c);
2909 CPP_ADJUST_WRITTEN(pfile, 4);
2910 }
2911 }
2912 CPP_PUTC(pfile, '\"'); /* insert ending quote */
2913 arg->stringified_length
2914 = CPP_WRITTEN(pfile) - arg->stringified;
2915 }
2916 xbuf_len += args[ap->argno].stringified_length;
2917 }
2918 else if (ap->raw_before || ap->raw_after)
2919 {
2920 /* Add 4 for two newline-space markers to prevent
2921 * token concatenation. */
2922 xbuf_len += args[ap->argno].raw_length + 4;
2923 }
2924 else
2925 {
2926 /* We have an ordinary (expanded) occurrence of the arg.
2927 * So compute its expansion, if we have not already. */
2928 if (args[ap->argno].expand_length < 0)
2929 {
2930 args[ap->argno].expanded = CPP_WRITTEN(pfile);
2931 cpp_expand_to_buffer(pfile,
2932 ARG_BASE + args[ap->argno].raw,
2933 args[ap->argno].raw_length);
2934
2935 args[ap->argno].expand_length
2936 = CPP_WRITTEN(pfile) - args[ap->argno].expanded;
2937 }
2938 /* Add 4 for two newline-space markers to prevent
2939 * token concatenation. */
2940 xbuf_len += args[ap->argno].expand_length + 4;
2941 }
2942 if (args[ap->argno].use_count < 10)
2943 args[ap->argno].use_count++;
2944 }
2945
2946 xbuf = (unsigned char *)xmalloc(xbuf_len + 1);
2947
2948 /* Generate in XBUF the complete expansion
2949 * with arguments substituted in.
2950 * TOTLEN is the total size generated so far.
2951 * OFFSET is the index in the definition
2952 * of where we are copying from. */
2953 offset = totlen = 0;
2954 for (last_ap = NULL, ap = defn->pattern; ap;
2955 last_ap = ap, ap = ap->next)
2956 {
2957 struct argdata *arg = &args[ap->argno];
2958 int count_before = totlen;
2959
2960 /* Add chars to XBUF. */
2961 for (i = 0; i < ap->nchars; i++, offset++)
2962 xbuf[totlen++] = exp[offset];
2963
2964 /* If followed by an empty rest arg with concatenation,
2965 * delete the last run of nonwhite chars. */
2966 if (rest_zero && totlen > count_before
2967 && ((ap->rest_args && ap->raw_before)
2968 || (last_ap && last_ap->rest_args && last_ap->raw_after)))
2969 {
2970 /* Delete final whitespace. */
2971 while (totlen > count_before && is_space[xbuf[totlen - 1]])
2972 totlen--;
2973
2974 /* Delete the nonwhites before them. */
2975 while (totlen > count_before && !is_space[xbuf[totlen - 1]])
2976 totlen--;
2977 }
2978 if (ap->stringify != 0)
2979 {
2980 memcpy(xbuf + totlen, ARG_BASE + arg->stringified,
2981 arg->stringified_length);
2982 totlen += arg->stringified_length;
2983 }
2984 else if (ap->raw_before || ap->raw_after)
2985 {
2986 unsigned char *p1 = ARG_BASE + arg->raw;
2987 unsigned char *l1 = p1 + arg->raw_length;
2988
2989 if (ap->raw_before)
2990 {
2991 while (p1 != l1 && is_space[*p1])
2992 p1++;
2993 while (p1 != l1 && is_idchar[*p1])
2994 xbuf[totlen++] = *p1++;
2995 }
2996 if (ap->raw_after)
2997 {
2998 /* Arg is concatenated after: delete trailing whitespace,
2999 * whitespace markers, and no-reexpansion markers. */
3000 while (p1 != l1)
3001 {
3002 if (is_space[l1[-1]])
3003 l1--;
3004 else if (l1[-1] == '-')
3005 {
3006 unsigned char *p2 = l1 - 1;
3007
3008 /* If a `-' is preceded by an odd number of newlines then it
3009 * and the last newline are a no-reexpansion marker. */
3010 while (p2 != p1 && p2[-1] == '\n')
3011 p2--;
3012 if ((l1 - 1 - p2) & 1)
3013 {
3014 l1 -= 2;
3015 }
3016 else
3017 break;
3018 }
3019 else
3020 break;
3021 }
3022 }
3023 memcpy(xbuf + totlen, p1, l1 - p1);
3024 totlen += l1 - p1;
3025 }
3026 else
3027 {
3028 unsigned char *expanded = ARG_BASE + arg->expanded;
3029
3030 if (!ap->raw_before && totlen > 0 && arg->expand_length
3031 && unsafe_chars(xbuf[totlen - 1], expanded[0]))
3032 {
3033 xbuf[totlen++] = '@';
3034 xbuf[totlen++] = ' ';
3035 }
3036 memcpy(xbuf + totlen, expanded, arg->expand_length);
3037 totlen += arg->expand_length;
3038
3039 if (!ap->raw_after && totlen > 0 && offset < defn->length
3040 && unsafe_chars(xbuf[totlen - 1], exp[offset]))
3041 {
3042 xbuf[totlen++] = '@';
3043 xbuf[totlen++] = ' ';
3044 }
3045 /* If a macro argument with newlines is used multiple times,
3046 * then only expand the newlines once. This avoids creating
3047 * output lines which don't correspond to any input line,
3048 * which confuses gdb and gcov. */
3049 if (arg->use_count > 1 && arg->newlines > 0)
3050 {
3051 /* Don't bother doing change_newlines for subsequent
3052 * uses of arg. */
3053 arg->use_count = 1;
3054 arg->expand_length
3055 = change_newlines(expanded, arg->expand_length);
3056 }
3057 }
3058
3059 if (totlen > xbuf_len)
3060 abort();
3061 }
3062 /* if there is anything left of the definition
3063 * after handling the arg list, copy that in too. */
3064
3065 for (i = offset; i < defn->length; i++)
3066 {
3067 /* if we've reached the end of the macro */
3068 if (exp[i] == ')')
3069 rest_zero = 0;
3070 if (!(rest_zero && last_ap && last_ap->rest_args
3071 && last_ap->raw_after))
3072 xbuf[totlen++] = exp[i];
3073 }
3074
3075 xbuf[totlen] = 0;
3076 xbuf_len = totlen;
3077 }
3078
3079 pfile->output_escapes--;
3080
3081 /* Now put the expansion on the input stack
3082 * so our caller will commence reading from it. */
3083 push_macro_expansion(pfile, xbuf, xbuf_len, hp);
3084 CPP_BUFFER(pfile)->has_escapes = 1;
3085
3086 /* Pop the space we've used in the token_buffer for argument expansion. */
3087 CPP_SET_WRITTEN(pfile, old_written);
3088
3089 /* Recursive macro use sometimes works traditionally.
3090 * #define foo(x,y) bar (x (y,0), y)
3091 * foo (foo, baz) */
3092
3093 hp->type = T_DISABLED;
3094}
3095
3096static void
3097push_macro_expansion(cpp_reader * pfile, unsigned char *xbuf, int xbuf_len,
3098 HASHNODE * hp)
3099{
3100 cpp_buffer *mbuf = cpp_push_buffer(pfile, xbuf, xbuf_len);
3101
3102 mbuf->cleanup = macro_cleanup;
3103 mbuf->data = hp;
3104
3105 /* The first chars of the expansion should be a "@ " added by
3106 * collect_expansion. This is to prevent accidental token-pasting
3107 * between the text preceding the macro invocation, and the macro
3108 * expansion text.
3109 *
3110 * We would like to avoid adding unneeded spaces (for the sake of
3111 * tools that use cpp, such as imake). In some common cases we can
3112 * tell that it is safe to omit the space.
3113 *
3114 * The character before the macro invocation cannot have been an
3115 * idchar (or else it would have been pasted with the idchars of
3116 * the macro name). Therefore, if the first non-space character
3117 * of the expansion is an idchar, we do not need the extra space
3118 * to prevent token pasting.
3119 *
3120 * Also, we don't need the extra space if the first char is '(',
3121 * or some other (less common) characters. */
3122
3123 if (xbuf[0] == '@' && xbuf[1] == ' '
3124 && (is_idchar[xbuf[2]] || xbuf[2] == '(' || xbuf[2] == '\''
3125 || xbuf[2] == '\"'))
3126 mbuf->cur += 2;
3127}
3128
3129/* Like cpp_get_token, except that it does not read past end-of-line.
3130 * Also, horizontal space is skipped, and macros are popped. */
3131
3132static enum cpp_token
3133get_directive_token(cpp_reader * pfile)
3134{
3135 for (;;)
3136 {
3137 long old_written = CPP_WRITTEN(pfile);
3138 enum cpp_token token;
3139
3140 cpp_skip_hspace(pfile);
3141 if (PEEKC() == '\n')
3142 return CPP_VSPACE;
3143 token = cpp_get_token(pfile);
3144 switch (token)
3145 {
3146 case CPP_POP:
3147 if (!CPP_IS_MACRO_BUFFER(CPP_BUFFER(pfile)))
3148 return token;
3149 /* ... else fall though ... */
3150 case CPP_HSPACE:
3151 case CPP_COMMENT:
3152 CPP_SET_WRITTEN(pfile, old_written);
3153 break;
3154 default:
3155 return token;
3156 }
3157 }
3158}
3159
3160/* Handle #include and #import.
3161 * This function expects to see "fname" or <fname> on the input.
3162 *
3163 * The input is normally in part of the output_buffer following
3164 * CPP_WRITTEN, and will get overwritten by output_line_command.
3165 * I.e. in input file specification has been popped by handle_directive.
3166 * This is safe. */
3167
3168static int
3169do_include(cpp_reader * pfile, struct directive *keyword,
3170 unsigned char *unused1 __UNUSED__, unsigned char *unused2 __UNUSED__)
3171{
3172 int importing = (keyword->type == T_IMPORT);
3173 int skip_dirs = (keyword->type == T_INCLUDE_NEXT);
3174 char *fname; /* Dynamically allocated fname buffer */
3175 unsigned char *fbeg, *fend; /* Beginning and end of fname */
3176 enum cpp_token token;
3177
3178 /* Chain of dirs to search */
3179 file_name_list *search_start = CPP_OPTIONS(pfile)->include;
3180 file_name_list dsp[1]; /* First in chain, if #include "..." */
3181 file_name_list *searchptr = 0;
3182 long old_written = CPP_WRITTEN(pfile);
3183 int flen;
3184 int f; /* file number */
3185 int angle_brackets = 0; /* 0 for "...", 1 for <...> */
3186
3187 f = -1; /* JF we iz paranoid! */
3188
3189 if (importing && CPP_OPTIONS(pfile)->warn_import
3190 && !CPP_OPTIONS(pfile)->inhibit_warnings
3191 && !CPP_BUFFER(pfile)->system_header_p && !pfile->import_warning)
3192 {
3193 pfile->import_warning = 1;
3194 cpp_warning(pfile, "using `#import' is not recommended");
3195 fprintf(stderr,
3196 "The fact that a certain header file need not be processed more than once\n");
3197 fprintf(stderr,
3198 "should be indicated in the header file, not where it is used.\n");
3199 fprintf(stderr,
3200 "The best way to do this is with a conditional of this form:\n\n");
3201 fprintf(stderr, " #ifndef _FOO_H_INCLUDED\n");
3202 fprintf(stderr, " #define _FOO_H_INCLUDED\n");
3203 fprintf(stderr, " ... <real contents of file> ...\n");
3204 fprintf(stderr, " #endif /* Not _FOO_H_INCLUDED */\n\n");
3205 fprintf(stderr, "Then users can use `#include' any number of times.\n");
3206 fprintf(stderr,
3207 "GNU C automatically avoids processing the file more than once\n");
3208 fprintf(stderr, "when it is equipped with such a conditional.\n");
3209 }
3210 pfile->parsing_include_directive++;
3211 token = get_directive_token(pfile);
3212 pfile->parsing_include_directive--;
3213
3214 if (token == CPP_STRING)
3215 {
3216 /* FIXME - check no trailing garbage */
3217 fbeg = pfile->token_buffer + old_written + 1;
3218 fend = CPP_PWRITTEN(pfile) - 1;
3219 if (fbeg[-1] == '<')
3220 {
3221 angle_brackets = 1;
3222 /* If -I-, start with the first -I dir after the -I-. */
3223 if (CPP_OPTIONS(pfile)->first_bracket_include)
3224 search_start = CPP_OPTIONS(pfile)->first_bracket_include;
3225 }
3226 /* If -I- was specified, don't search current dir, only spec'd ones. */
3227 else if (!CPP_OPTIONS(pfile)->ignore_srcdir)
3228 {
3229 cpp_buffer *fp;
3230
3231 /* We have "filename". Figure out directory this source
3232 * file is coming from and put it on the front of the list. */
3233
3234 for (fp = CPP_BUFFER(pfile); fp; fp = CPP_PREV_BUFFER(fp))
3235 {
3236 int n;
3237 const char *ep, *nam;
3238
3239 if ((nam = fp->nominal_fname))
3240 {
3241 /* Found a named file. Figure out dir of the file,
3242 * and put it in front of the search list. */
3243 dsp[0].next = search_start;
3244 search_start = dsp;
3245#ifndef VMS
3246 ep = strrchr(nam, '/');
3247#else /* VMS */
3248 ep = strrchr(nam, ']');
3249 if (!ep)
3250 ep = strrchr(nam, '>');
3251 if (!ep)
3252 ep = strrchr(nam, ':');
3253 if (ep)
3254 ep++;
3255#endif /* VMS */
3256 if (ep)
3257 {
3258 n = ep - nam;
3259 dsp[0].fname = (char *)alloca(n + 1);
3260 strncpy(dsp[0].fname, nam, n);
3261 dsp[0].fname[n] = '\0';
3262 if (n + INCLUDE_LEN_FUDGE > pfile->max_include_len)
3263 pfile->max_include_len = n + INCLUDE_LEN_FUDGE;
3264 }
3265 else
3266 {
3267 dsp[0].fname = 0; /* Current directory */
3268 }
3269 dsp[0].got_name_map = 0;
3270 break;
3271 }
3272 }
3273 }
3274 }
3275 else
3276 {
3277 cpp_error(pfile,
3278 "`#%s' expects \"FILENAME\" or <FILENAME>", keyword->name);
3279 CPP_SET_WRITTEN(pfile, old_written);
3280 skip_rest_of_line(pfile);
3281 return 0;
3282 }
3283
3284 *fend = 0;
3285
3286 token = get_directive_token(pfile);
3287 if (token != CPP_VSPACE)
3288 {
3289 cpp_error(pfile, "junk at end of `#include'");
3290 while (token != CPP_VSPACE && token != CPP_EOF && token != CPP_POP)
3291 token = get_directive_token(pfile);
3292 }
3293 /* For #include_next, skip in the search path
3294 * past the dir in which the containing file was found. */
3295 if (skip_dirs)
3296 {
3297 cpp_buffer *fp;
3298
3299 for (fp = CPP_BUFFER(pfile); fp; fp = CPP_PREV_BUFFER(fp))
3300 if (fp->fname)
3301 {
3302 /* fp->dir is null if the containing file was specified with
3303 * an absolute file name. In that case, don't skip anything. */
3304 if (fp->dir == SELF_DIR_DUMMY)
3305 search_start = CPP_OPTIONS(pfile)->include;
3306 else if (fp->dir)
3307 search_start = fp->dir->next;
3308 break;
3309 }
3310 }
3311 CPP_SET_WRITTEN(pfile, old_written);
3312
3313 flen = fend - fbeg;
3314
3315 if (flen == 0)
3316 {
3317 cpp_error(pfile, "empty file name in `#%s'", keyword->name);
3318 return 0;
3319 }
3320 /* Allocate this permanently, because it gets stored in the definitions
3321 * of macros. */
3322 fname = (char *)xmalloc(pfile->max_include_len + flen + 4);
3323 /* + 2 above for slash and terminating null. */
3324 /* + 2 added for '.h' on VMS (to support '#include filename') */
3325
3326 /* If specified file name is absolute, just open it. */
3327
3328#ifndef __EMX__
3329 if (*fbeg == '/')
3330#else
3331 if (_fnisabs(fbeg))
3332#endif
3333 {
3334 strncpy(fname, (const char *)fbeg, flen);
3335 fname[flen] = 0;
3336 if (redundant_include_p(pfile, fname))
3337 return 0;
3338 if (importing)
3339 f = lookup_import(pfile, fname, NULL);
3340 else
3341 f = open_include_file(pfile, fname, NULL);
3342 if (f == -2)
3343 return 0; /* Already included this file */
3344 }
3345 else
3346 {
3347 /* Search directory path, trying to open the file.
3348 * Copy each filename tried into FNAME. */
3349
3350 for (searchptr = search_start; searchptr; searchptr = searchptr->next)
3351 {
3352 if (searchptr->fname)
3353 {
3354 /* The empty string in a search path is ignored.
3355 * This makes it possible to turn off entirely
3356 * a standard piece of the list. */
3357 if (searchptr->fname[0] == 0)
3358 continue;
3359 strcpy(fname, searchptr->fname);
3360 strcat(fname, "/");
3361 fname[strlen(fname) + flen] = 0;
3362 }
3363 else
3364 {
3365 fname[0] = 0;
3366 }
3367 strncat(fname, (const char *)fbeg, flen);
3368#ifdef VMS
3369 /* Change this 1/2 Unix 1/2 VMS file specification into a
3370 * full VMS file specification */
3371 if (searchptr->fname && (searchptr->fname[0] != 0))
3372 {
3373 /* Fix up the filename */
3374 hack_vms_include_specification(fname);
3375 }
3376 else
3377 {
3378 /* This is a normal VMS filespec, so use it unchanged. */
3379 strncpy(fname, fbeg, flen);
3380 fname[flen] = 0;
3381 /* if it's '#include filename', add the missing .h */
3382 if (!strchr(fname, '.'))
3383 {
3384 strcat(fname, ".h");
3385 }
3386 }
3387#endif /* VMS */
3388 /* ??? There are currently 3 separate mechanisms for avoiding processing
3389 * of redundant include files: #import, #pragma once, and
3390 * redundant_include_p. It would be nice if they were unified. */
3391 if (redundant_include_p(pfile, fname))
3392 return 0;
3393 if (importing)
3394 f = lookup_import(pfile, fname, searchptr);
3395 else
3396 f = open_include_file(pfile, fname, searchptr);
3397 if (f == -2)
3398 return 0; /* Already included this file */
3399#ifdef EACCES
3400 else if (f == -1 && errno == EACCES)
3401 cpp_warning(pfile, "Header file %s exists, but is not readable",
3402 fname);
3403#endif
3404 if (f >= 0)
3405 break;
3406 }
3407 }
3408
3409 if (f < 0)
3410 {
3411 /* A file that was not found. */
3412 strncpy(fname, (const char *)fbeg, flen);
3413 fname[flen] = 0;
3414 /* If generating dependencies and -MG was specified, we assume missing
3415 * files are leaf files, living in the same directory as the source file
3416 * or other similar place; these missing files may be generated from
3417 * other files and may not exist yet (eg: y.tab.h). */
3418
3419 if (CPP_OPTIONS(pfile)->print_deps_missing_files
3420 && CPP_PRINT_DEPS(pfile)
3421 > (angle_brackets || (pfile->system_include_depth > 0)))
3422 {
3423 /* If it was requested as a system header file,
3424 * then assume it belongs in the first place to look for such. */
3425 if (angle_brackets)
3426 {
3427 for (searchptr = search_start; searchptr;
3428 searchptr = searchptr->next)
3429 {
3430 if (searchptr->fname)
3431 {
3432 char *p;
3433
3434 if (searchptr->fname[0] == 0)
3435 continue;
3436 p = (char *)alloca(strlen(searchptr->fname)
3437 + strlen(fname) + 2);
3438 strcpy(p, searchptr->fname);
3439 strcat(p, "/");
3440 strcat(p, fname);
3441 deps_output(pfile, p, ' ');
3442 break;
3443 }
3444 }
3445 }
3446 else
3447 {
3448 /* Otherwise, omit the directory, as if the file existed
3449 * in the directory with the source. */
3450 deps_output(pfile, fname, ' ');
3451 }
3452 }
3453 /* If -M was specified, and this header file won't be added to the
3454 * dependency list, then don't count this as an error, because we can
3455 * still produce correct output. Otherwise, we can't produce correct
3456 * output, because there may be dependencies we need inside the missing
3457 * file, and we don't know what directory this missing file exists in. */
3458 else if (CPP_PRINT_DEPS(pfile)
3459 && (CPP_PRINT_DEPS(pfile)
3460 <= (angle_brackets || (pfile->system_include_depth > 0))))
3461 cpp_warning(pfile, "No include path in which to find %s", fname);
3462 else if (search_start)
3463 cpp_error_from_errno(pfile, fname);
3464 else
3465 cpp_error(pfile, "No include path in which to find %s", fname);
3466 }
3467 else
3468 {
3469 /* Check to see if this include file is a once-only include file.
3470 * If so, give up. */
3471
3472 file_name_list *ptr;
3473
3474 for (ptr = pfile->dont_repeat_files; ptr; ptr = ptr->next)
3475 {
3476 if (!strcmp(ptr->fname, fname))
3477 {
3478 close(f);
3479 return 0; /* This file was once'd. */
3480 }
3481 }
3482
3483 for (ptr = pfile->all_include_files; ptr; ptr = ptr->next)
3484 {
3485 if (!strcmp(ptr->fname, fname))
3486 break; /* This file was included before. */
3487 }
3488
3489 if (!ptr)
3490 {
3491 /* This is the first time for this file. */
3492 /* Add it to list of files included. */
3493
3494 ptr = (file_name_list *) xmalloc(sizeof(file_name_list));
3495
3496 ptr->control_macro = 0;
3497 ptr->c_system_include_path = 0;
3498 ptr->next = pfile->all_include_files;
3499 pfile->all_include_files = ptr;
3500 ptr->fname = savestring(fname);
3501 ptr->got_name_map = 0;
3502
3503 /* For -M, add this file to the dependencies. */
3504 if (CPP_PRINT_DEPS(pfile)
3505 > (angle_brackets || (pfile->system_include_depth > 0)))
3506 deps_output(pfile, fname, ' ');
3507 }
3508 /* Handle -H option. */
3509 if (CPP_OPTIONS(pfile)->print_include_names)
3510 {
3511 cpp_buffer *buf = CPP_BUFFER(pfile);
3512
3513 while ((buf = CPP_PREV_BUFFER(buf)))
3514 putc('.', stderr);
3515 fprintf(stderr, "%s\n", fname);
3516 }
3517 if (angle_brackets)
3518 pfile->system_include_depth++;
3519
3520 /* Actually process the file. */
3521
3522 /* Record file on "seen" list for #import. */
3523 add_import(pfile, f, fname);
3524
3525 /* Actually process the file */
3526 cpp_push_buffer(pfile, NULL, 0);
3527 if (finclude(pfile, f, fname, is_system_include(pfile, fname),
3528 searchptr != dsp ? searchptr : SELF_DIR_DUMMY))
3529 {
3530 output_line_command(pfile, 0, enter_file);
3531 pfile->only_seen_white = 2;
3532 }
3533 if (angle_brackets)
3534 pfile->system_include_depth--;
3535 }
3536 return 0;
3537}
3538
3539/* Return nonzero if there is no need to include file NAME
3540 * because it has already been included and it contains a conditional
3541 * to make a repeated include do nothing. */
3542
3543static int
3544redundant_include_p(cpp_reader * pfile, char *name)
3545{
3546 file_name_list *l = pfile->all_include_files;
3547
3548 for (; l; l = l->next)
3549 if (!strcmp(name, l->fname)
3550 && l->control_macro
3551 && cpp_lookup((const char *)l->control_macro, -1, -1))
3552 return 1;
3553 return 0;
3554}
3555
3556/* Return nonzero if the given FILENAME is an absolute pathname which
3557 * designates a file within one of the known "system" include file
3558 * directories. We assume here that if the given FILENAME looks like
3559 * it is the name of a file which resides either directly in a "system"
3560 * include file directory, or within any subdirectory thereof, then the
3561 * given file must be a "system" include file. This function tells us
3562 * if we should suppress pedantic errors/warnings for the given FILENAME.
3563 *
3564 * The value is 2 if the file is a C-language system header file
3565 * for which C++ should (on most systems) assume `extern "C"'. */
3566
3567static int
3568is_system_include(cpp_reader * pfile, char *filename)
3569{
3570 file_name_list *searchptr;
3571
3572 for (searchptr = CPP_OPTIONS(pfile)->first_system_include; searchptr;
3573 searchptr = searchptr->next)
3574 if (searchptr->fname)
3575 {
3576 char *sys_dir = searchptr->fname;
3577 unsigned length = strlen(sys_dir);
3578
3579 if (!strncmp(sys_dir, filename, length) && filename[length] == '/')
3580 {
3581 if (searchptr->c_system_include_path)
3582 return 2;
3583 else
3584 return 1;
3585 }
3586 }
3587 return 0;
3588}
3589
3590/*
3591 * Install a name in the assertion hash table.
3592 *
3593 * If LEN is >= 0, it is the length of the name.
3594 * Otherwise, compute the length by scanning the entire name.
3595 *
3596 * If HASH is >= 0, it is the precomputed hash code.
3597 * Otherwise, compute the hash code.
3598 */
3599static ASSERTION_HASHNODE *
3600assertion_install(cpp_reader * pfile, const char *name, int len, int hash)
3601{
3602 ASSERTION_HASHNODE *hp;
3603 int i, bucket;
3604
3605 i = sizeof(ASSERTION_HASHNODE) + len + 1;
3606 hp = (ASSERTION_HASHNODE *) xmalloc(i);
3607 bucket = hash;
3608 hp->bucket_hdr = &pfile->assertion_hashtab[bucket];
3609 hp->next = pfile->assertion_hashtab[bucket];
3610 pfile->assertion_hashtab[bucket] = hp;
3611 hp->prev = NULL;
3612 if (hp->next)
3613 hp->next->prev = hp;
3614 hp->length = len;
3615 hp->value = 0;
3616 hp->name = ((char *)hp) + sizeof(ASSERTION_HASHNODE);
3617 memcpy(hp->name, name, len);
3618 hp->name[len] = 0;
3619 return hp;
3620}
3621/*
3622 * find the most recent hash node for name name (ending with first
3623 * non-identifier char) installed by install
3624 *
3625 * If LEN is >= 0, it is the length of the name.
3626 * Otherwise, compute the length by scanning the entire name.
3627 *
3628 * If HASH is >= 0, it is the precomputed hash code.
3629 * Otherwise, compute the hash code.
3630 */
3631
3632static ASSERTION_HASHNODE *
3633assertion_lookup(cpp_reader * pfile, const char *name, int len, int hash)
3634{
3635 ASSERTION_HASHNODE *bucket;
3636
3637 bucket = pfile->assertion_hashtab[hash];
3638 while (bucket)
3639 {
3640 if (bucket->length == len && strncmp(bucket->name, name, len) == 0)
3641 return bucket;
3642 bucket = bucket->next;
3643 }
3644 return NULL;
3645}
3646
3647static void
3648delete_assertion(ASSERTION_HASHNODE * hp)
3649{
3650 struct tokenlist_list *tail;
3651
3652 if (hp->prev)
3653 hp->prev->next = hp->next;
3654 if (hp->next)
3655 hp->next->prev = hp->prev;
3656
3657 for (tail = hp->value; tail;)
3658 {
3659 struct tokenlist_list *next = tail->next;
3660
3661 free_token_list(tail->tokens);
3662 free(tail);
3663 tail = next;
3664 }
3665
3666 /* make sure that the bucket chain header that
3667 * the deleted guy was on points to the right thing afterwards. */
3668 if (hp == *hp->bucket_hdr)
3669 *hp->bucket_hdr = hp->next;
3670
3671 free(hp);
3672}
3673
3674/* Convert a character string literal into a nul-terminated string.
3675 * The input string is [IN ... LIMIT).
3676 * The result is placed in RESULT. RESULT can be the same as IN.
3677 * The value returned in the end of the string written to RESULT,
3678 * or NULL on error. */
3679
3680static char *
3681convert_string(cpp_reader * pfile, char *result, char *in, char *limit,
3682 int handle_escapes)
3683{
3684 unsigned char c;
3685
3686 c = *in++;
3687 if (c != '\"')
3688 return NULL;
3689 while (in < limit)
3690 {
3691 c = *in++;
3692
3693 switch (c)
3694 {
3695 case '\0':
3696 return NULL;
3697 case '\"':
3698 limit = in;
3699 break;
3700 case '\\':
3701 if (handle_escapes)
3702 {
3703 char *bpc = in;
3704 int i =
3705 (unsigned char)cpp_parse_escape(pfile, &bpc);
3706
3707 in = bpc;
3708 if (i >= 0)
3709 *result++ = (unsigned char)c;
3710 break;
3711 }
3712 /* else fall through */
3713 default:
3714 *result++ = c;
3715 }
3716 }
3717 *result = 0;
3718 return result;
3719}
3720
3721/*
3722 * interpret #line command. Remembers previously seen fnames
3723 * in its very own hash table.
3724 */
3725#define FNAME_HASHSIZE 37
3726
3727static int
3728do_line(cpp_reader * pfile, struct directive *keyword __UNUSED__,
3729 unsigned char *unused1 __UNUSED__, unsigned char *unused2 __UNUSED__)
3730{
3731 cpp_buffer *ip = CPP_BUFFER(pfile);
3732 int new_lineno;
3733 long old_written = CPP_WRITTEN(pfile);
3734 enum file_change_code file_change = same_file;
3735 enum cpp_token token;
3736
3737 token = get_directive_token(pfile);
3738
3739 if (token != CPP_NUMBER || !isdigit(pfile->token_buffer[old_written]))
3740 {
3741 cpp_error(pfile, "invalid format `#line' command");
3742 goto bad_line_directive;
3743 }
3744 /* The Newline at the end of this line remains to be processed.
3745 * To put the next line at the specified line number,
3746 * we must store a line number now that is one less. */
3747 new_lineno = atoi((char *)(pfile->token_buffer + old_written)) - 1;
3748 CPP_SET_WRITTEN(pfile, old_written);
3749
3750 /* NEW_LINENO is one less than the actual line number here. */
3751 if (CPP_PEDANTIC(pfile) && new_lineno < 0)
3752 cpp_pedwarn(pfile, "line number out of range in `#line' command");
3753
3754 token = get_directive_token(pfile);
3755
3756 if (token == CPP_STRING)
3757 {
3758 char *fname = (char *)pfile->token_buffer + old_written;
3759 char *end_name;
3760 static HASHNODE *fname_table[FNAME_HASHSIZE];
3761 HASHNODE *hp, **hash_bucket;
3762 unsigned char *p;
3763 long num_start;
3764 int fname_length;
3765
3766 /* Turn the file name, which is a character string literal,
3767 * into a null-terminated string. Do this in place. */
3768 end_name =
3769 convert_string(pfile, fname, fname, (char *)CPP_PWRITTEN(pfile), 1);
3770 if (!end_name)
3771 {
3772 cpp_error(pfile, "invalid format `#line' command");
3773 goto bad_line_directive;
3774 }
3775 fname_length = end_name - fname;
3776
3777 num_start = CPP_WRITTEN(pfile);
3778 token = get_directive_token(pfile);
3779 if (token != CPP_VSPACE && token != CPP_EOF && token != CPP_POP)
3780 {
3781 p = pfile->token_buffer + num_start;
3782 if (CPP_PEDANTIC(pfile))
3783 cpp_pedwarn(pfile, "garbage at end of `#line' command");
3784
3785 if (token != CPP_NUMBER || *p < '0' || *p > '4' || p[1] != '\0')
3786 {
3787 cpp_error(pfile, "invalid format `#line' command");
3788 goto bad_line_directive;
3789 }
3790 if (*p == '1')
3791 file_change = enter_file;
3792 else if (*p == 2)
3793 file_change = leave_file;
3794 else if (*p == 3)
3795 ip->system_header_p = 1;
3796 else /* if (*p == 4) */
3797 ip->system_header_p = 2;
3798
3799 CPP_SET_WRITTEN(pfile, num_start);
3800 token = get_directive_token(pfile);
3801 p = pfile->token_buffer + num_start;
3802 if (token == CPP_NUMBER && p[1] == '\0'
3803 && (*p == '3' || *p == '4'))
3804 {
3805 ip->system_header_p = *p == 3 ? 1 : 2;
3806 token = get_directive_token(pfile);
3807 }
3808 if (token != CPP_VSPACE)
3809 {
3810 cpp_error(pfile, "invalid format `#line' command");
3811 goto bad_line_directive;
3812 }
3813 }
3814 hash_bucket = &fname_table[hashf(fname, fname_length, FNAME_HASHSIZE)];
3815 for (hp = *hash_bucket; hp; hp = hp->next)
3816 if (hp->length == fname_length &&
3817 strncmp(hp->value.cpval, fname, fname_length) == 0)
3818 {
3819 ip->nominal_fname = hp->value.cpval;
3820 break;
3821 }
3822 if (!hp)
3823 {
3824 /* Didn't find it; cons up a new one. */
3825 hp = (HASHNODE *) xcalloc(1, sizeof(HASHNODE) + fname_length + 1);
3826 hp->next = *hash_bucket;
3827 *hash_bucket = hp;
3828
3829 hp->length = fname_length;
3830 ip->nominal_fname = hp->value.cpval =
3831 ((char *)hp) + sizeof(HASHNODE);
3832 memcpy(hp->value.cpval, fname, fname_length);
3833 }
3834 }
3835 else if (token != CPP_VSPACE && token != CPP_EOF)
3836 {
3837 cpp_error(pfile, "invalid format `#line' command");
3838 goto bad_line_directive;
3839 }
3840 ip->lineno = new_lineno;
3841 bad_line_directive:
3842 skip_rest_of_line(pfile);
3843 CPP_SET_WRITTEN(pfile, old_written);
3844 output_line_command(pfile, 0, file_change);
3845 return 0;
3846}
3847
3848/*
3849 * remove the definition of a symbol from the symbol table.
3850 * according to un*x /lib/cpp, it is not an error to undef
3851 * something that has no definitions, so it isn't one here either.
3852 */
3853
3854static int
3855do_undef(cpp_reader * pfile, struct directive *keyword, unsigned char *buf,
3856 unsigned char *limit)
3857{
3858 int sym_length;
3859 HASHNODE *hp;
3860 unsigned char *orig_buf = buf;
3861
3862 SKIP_WHITE_SPACE(buf);
3863 sym_length = check_macro_name(pfile, buf, "macro");
3864
3865 while ((hp = cpp_lookup((const char *)buf, sym_length, -1)))
3866 {
3867 /* If we are generating additional info for debugging (with -g) we
3868 * need to pass through all effective #undef commands. */
3869 if (CPP_OPTIONS(pfile)->debug_output && keyword)
3870 pass_thru_directive((char *)orig_buf, (char *)limit, pfile, keyword);
3871 if (hp->type != T_MACRO)
3872 cpp_warning(pfile, "undefining `%s'", hp->name);
3873 delete_macro(hp);
3874 }
3875
3876 if (CPP_PEDANTIC(pfile))
3877 {
3878 buf += sym_length;
3879 SKIP_WHITE_SPACE(buf);
3880 if (buf != limit)
3881 cpp_pedwarn(pfile, "garbage after `#undef' directive");
3882 }
3883 return 0;
3884}
3885
3886/*
3887 * Report an error detected by the program we are processing.
3888 * Use the text of the line in the error message.
3889 * (We use error because it prints the filename & line#.)
3890 */
3891
3892static int
3893do_error(cpp_reader * pfile, struct directive *keyword __UNUSED__,
3894 unsigned char *buf, unsigned char *limit)
3895{
3896 int length = limit - buf;
3897 unsigned char *copy = (unsigned char *)xmalloc(length + 1);
3898
3899 memcpy(copy, buf, length);
3900 copy[length] = 0;
3901 SKIP_WHITE_SPACE(copy);
3902 cpp_error(pfile, "#error %s", copy);
3903 return 0;
3904}
3905
3906/*
3907 * Report a warning detected by the program we are processing.
3908 * Use the text of the line in the warning message, then continue.
3909 * (We use error because it prints the filename & line#.)
3910 */
3911
3912static int
3913do_warning(cpp_reader * pfile, struct directive *keyword __UNUSED__,
3914 unsigned char *buf, unsigned char *limit)
3915{
3916 int length = limit - buf;
3917 unsigned char *copy = (unsigned char *)xmalloc(length + 1);
3918
3919 memcpy(copy, buf, length);
3920 copy[length] = 0;
3921 SKIP_WHITE_SPACE(copy);
3922 cpp_warning(pfile, "#warning %s", copy);
3923 return 0;
3924}
3925
3926/* Remember the name of the current file being read from so that we can
3927 * avoid ever including it again. */
3928
3929static int
3930do_once(cpp_reader * pfile)
3931{
3932 cpp_buffer *ip = NULL;
3933 file_name_list *new_;
3934
3935 for (ip = CPP_BUFFER(pfile);; ip = CPP_PREV_BUFFER(ip))
3936 {
3937 if (!ip)
3938 return 0;
3939 if (ip->fname)
3940 break;
3941 }
3942
3943 new_ = (file_name_list *) xmalloc(sizeof(file_name_list));
3944
3945 new_->next = pfile->dont_repeat_files;
3946 pfile->dont_repeat_files = new_;
3947 new_->fname = savestring(ip->fname);
3948 new_->control_macro = 0;
3949 new_->got_name_map = 0;
3950 new_->c_system_include_path = 0;
3951
3952 return 0;
3953}
3954
3955/* #ident has already been copied to the output file, so just ignore it. */
3956
3957static int
3958do_ident(cpp_reader * pfile, struct directive *keyword __UNUSED__,
3959 unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__)
3960{
3961/* long old_written = CPP_WRITTEN (pfile); */
3962
3963 /* Allow #ident in system headers, since that's not user's fault. */
3964 if (CPP_PEDANTIC(pfile) && !CPP_BUFFER(pfile)->system_header_p)
3965 cpp_pedwarn(pfile, "ANSI C does not allow `#ident'");
3966
3967 /* Leave rest of line to be read by later calls to cpp_get_token. */
3968
3969 return 0;
3970}
3971
3972/* #pragma and its argument line have already been copied to the output file.
3973 * Just check for some recognized pragmas that need validation here. */
3974
3975static int
3976do_pragma(cpp_reader * pfile, struct directive *keyword __UNUSED__,
3977 unsigned char *buf, unsigned char *limit __UNUSED__)
3978{
3979 while (*buf == ' ' || *buf == '\t')
3980 buf++;
3981
3982 if (!strncmp((const char *)buf, "once", 4))
3983 {
3984 /* Allow #pragma once in system headers, since that's not the user's
3985 * fault. */
3986 if (!CPP_BUFFER(pfile)->system_header_p)
3987 cpp_warning(pfile, "`#pragma once' is obsolete");
3988 do_once(pfile);
3989 }
3990 if (!strncmp((const char *)buf, "implementation", 14))
3991 {
3992 /* Be quiet about `#pragma implementation' for a file only if it hasn't
3993 * been included yet. */
3994 file_name_list *ptr;
3995 char *p = (char *)buf + 14, *fname, *inc_fname;
3996 int fname_len;
3997
3998 SKIP_WHITE_SPACE(p);
3999 if (*p == '\n' || *p != '\"')
4000 return 0;
4001
4002 fname = p + 1;
4003 p = strchr(fname, '\"');
4004 fname_len = (p) ? (int)(p - fname) : (int)strlen(fname);
4005
4006 for (ptr = pfile->all_include_files; ptr; ptr = ptr->next)
4007 {
4008 inc_fname = strrchr(ptr->fname, '/');
4009 inc_fname = inc_fname ? inc_fname + 1 : (char *)ptr->fname;
4010 if (inc_fname && !strncmp(inc_fname, fname, fname_len))
4011 cpp_warning(pfile,
4012 "`#pragma implementation' for `%s' appears after file is included",
4013 fname);
4014 }
4015 }
4016 return 0;
4017}
4018
4019/* Just ignore #sccs, on systems where we define it at all. */
4020
4021/*
4022 * handle #if command by
4023 * 1) inserting special `defined' keyword into the hash table
4024 * that gets turned into 0 or 1 by special_symbol (thus,
4025 * if the luser has a symbol called `defined' already, it won't
4026 * work inside the #if command)
4027 * 2) rescan the input into a temporary output buffer
4028 * 3) pass the output buffer to the yacc parser and collect a value
4029 * 4) clean up the mess left from steps 1 and 2.
4030 * 5) call conditional_skip to skip til the next #endif (etc.),
4031 * or not, depending on the value from step 3.
4032 */
4033
4034static int
4035do_if(cpp_reader * pfile, struct directive *keyword __UNUSED__,
4036 unsigned char *buf, unsigned char *limit)
4037{
4038 HOST_WIDE_INT value = eval_if_expression(pfile, buf, limit - buf);
4039
4040 conditional_skip(pfile, value == 0, T_IF, NULL);
4041 return 0;
4042}
4043
4044/*
4045 * handle a #elif directive by not changing if_stack either.
4046 * see the comment above do_else.
4047 */
4048
4049static int
4050do_elif(cpp_reader * pfile, struct directive *keyword __UNUSED__,
4051 unsigned char *buf, unsigned char *limit)
4052{
4053 if (pfile->if_stack == CPP_BUFFER(pfile)->if_stack)
4054 {
4055 cpp_error(pfile, "`#elif' not within a conditional");
4056 return 0;
4057 }
4058 else
4059 {
4060 if (pfile->if_stack->type != T_IF && pfile->if_stack->type != T_ELIF)
4061 {
4062 cpp_error(pfile, "`#elif' after `#else'");
4063 if (pfile->if_stack->fname
4064 && CPP_BUFFER(pfile)->fname
4065 && strcmp(pfile->if_stack->fname,
4066 CPP_BUFFER(pfile)->nominal_fname) != 0)
4067 fprintf(stderr, ", file %s", pfile->if_stack->fname);
4068 fprintf(stderr, ")\n");
4069 }
4070 pfile->if_stack->type = T_ELIF;
4071 }
4072
4073 if (pfile->if_stack->if_succeeded)
4074 skip_if_group(pfile, 0);
4075 else
4076 {
4077 HOST_WIDE_INT value = eval_if_expression(pfile, buf, limit - buf);
4078
4079 if (value == 0)
4080 skip_if_group(pfile, 0);
4081 else
4082 {
4083 ++pfile->if_stack->if_succeeded; /* continue processing input */
4084 output_line_command(pfile, 1, same_file);
4085 }
4086 }
4087 return 0;
4088}
4089
4090/*
4091 * evaluate a #if expression in BUF, of length LENGTH,
4092 * then parse the result as a C expression and return the value as an int.
4093 */
4094static HOST_WIDE_INT
4095eval_if_expression(cpp_reader * pfile, unsigned char *buf __UNUSED__,
4096 int length __UNUSED__)
4097{
4098 HASHNODE *save_defined;
4099 HOST_WIDE_INT value;
4100 long old_written = CPP_WRITTEN(pfile);
4101
4102 save_defined = install("defined", -1, T_SPEC_DEFINED, 0, 0, -1);
4103 pfile->pcp_inside_if = 1;
4104
4105 value = cpp_parse_expr(pfile);
4106 pfile->pcp_inside_if = 0;
4107 delete_macro(save_defined); /* clean up special symbol */
4108
4109 CPP_SET_WRITTEN(pfile, old_written); /* Pop */
4110
4111 return value;
4112}
4113
4114/*
4115 * routine to handle ifdef/ifndef. Try to look up the symbol,
4116 * then do or don't skip to the #endif/#else/#elif depending
4117 * on what directive is actually being processed.
4118 */
4119
4120static int
4121do_xifdef(cpp_reader * pfile, struct directive *keyword,
4122 unsigned char *unused1 __UNUSED__, unsigned char *unused2 __UNUSED__)
4123{
4124 int skip;
4125 cpp_buffer *ip = CPP_BUFFER(pfile);
4126 char *ident;
4127 int ident_length;
4128 enum cpp_token token;
4129 int start_of_file = 0;
4130 unsigned char *control_macro = 0;
4131 int old_written = CPP_WRITTEN(pfile);
4132 int c;
4133
4134 /* Detect a #ifndef at start of file (not counting comments). */
4135 if (ip->fname != 0 && keyword->type == T_IFNDEF)
4136 start_of_file = pfile->only_seen_white == 2;
4137
4138 pfile->no_macro_expand++;
4139 token = get_directive_token(pfile);
4140 pfile->no_macro_expand--;
4141
4142 ident = (char *)pfile->token_buffer + old_written;
4143 ident_length = CPP_WRITTEN(pfile) - old_written;
4144 CPP_SET_WRITTEN(pfile, old_written); /* Pop */
4145
4146 if (token == CPP_VSPACE || token == CPP_POP || token == CPP_EOF)
4147 {
4148 skip = (keyword->type == T_IFDEF);
4149 cpp_pedwarn(pfile, "`#%s' with no argument", keyword->name);
4150 }
4151 else if (token == CPP_NAME)
4152 {
4153 HASHNODE *hp = cpp_lookup(ident, ident_length, -1);
4154
4155 skip = (!hp) ^ (keyword->type == T_IFNDEF);
4156 if (start_of_file && !skip)
4157 {
4158 control_macro = (unsigned char *)xmalloc(ident_length + 1);
4159 memcpy(control_macro, ident, ident_length + 1);
4160 }
4161 }
4162 else
4163 {
4164 skip = (keyword->type == T_IFDEF);
4165 cpp_error(pfile, "`#%s' with invalid argument", keyword->name);
4166 }
4167
4168 cpp_skip_hspace(pfile);
4169 c = PEEKC();
4170 if (c != EOF && c != '\n')
4171 cpp_pedwarn(pfile, "garbage at end of `#%s' argument",
4172 keyword->name);
4173 skip_rest_of_line(pfile);
4174
4175 conditional_skip(pfile, skip, T_IF, control_macro);
4176 return 0;
4177}
4178
4179/* Push TYPE on stack; then, if SKIP is nonzero, skip ahead.
4180 * If this is a #ifndef starting at the beginning of a file,
4181 * CONTROL_MACRO is the macro name tested by the #ifndef.
4182 * Otherwise, CONTROL_MACRO is 0. */
4183
4184static void
4185conditional_skip(cpp_reader * pfile, int skip, enum node_type type,
4186 unsigned char *control_macro)
4187{
4188 IF_STACK_FRAME *temp;
4189
4190 temp = (IF_STACK_FRAME *) xcalloc(1, sizeof(IF_STACK_FRAME));
4191 temp->fname = CPP_BUFFER(pfile)->nominal_fname;
4192 temp->next = pfile->if_stack;
4193 temp->control_macro = control_macro;
4194 pfile->if_stack = temp;
4195
4196 pfile->if_stack->type = type;
4197
4198 if (skip != 0)
4199 {
4200 skip_if_group(pfile, 0);
4201 return;
4202 }
4203 else
4204 {
4205 ++pfile->if_stack->if_succeeded;
4206 output_line_command(pfile, 1, same_file);
4207 }
4208}
4209
4210/*
4211 * skip to #endif, #else, or #elif. adjust line numbers, etc.
4212 * leaves input ptr at the sharp sign found.
4213 * If ANY is nonzero, return at next directive of any sort.
4214 */
4215
4216static void
4217skip_if_group(cpp_reader * pfile, int any)
4218{
4219 int c;
4220 struct directive *kt;
4221 IF_STACK_FRAME *save_if_stack = pfile->if_stack; /* don't pop past here */
4222
4223 int ident_length;
4224 char *ident;
4225 struct parse_marker line_start_mark;
4226
4227 parse_set_mark(&line_start_mark, pfile);
4228
4229 if (CPP_OPTIONS(pfile)->output_conditionals)
4230 {
4231 static char failed[] = "#failed\n";
4232
4233 CPP_PUTS(pfile, failed, sizeof(failed) - 1);
4234 pfile->lineno++;
4235 output_line_command(pfile, 1, same_file);
4236 }
4237 beg_of_line:
4238 if (CPP_OPTIONS(pfile)->output_conditionals)
4239 {
4240 cpp_buffer *pbuf = CPP_BUFFER(pfile);
4241 unsigned char *start_line = pbuf->buf + line_start_mark.position;
4242
4243 CPP_PUTS(pfile, start_line, pbuf->cur - start_line);
4244 }
4245 parse_move_mark(&line_start_mark, pfile);
4246 cpp_skip_hspace(pfile);
4247 c = GETC();
4248 if (c == '#')
4249 {
4250 int old_written = CPP_WRITTEN(pfile);
4251
4252 cpp_skip_hspace(pfile);
4253
4254 parse_name(pfile, GETC());
4255 ident_length = CPP_WRITTEN(pfile) - old_written;
4256 ident = (char *)pfile->token_buffer + old_written;
4257 pfile->limit = (unsigned char *)ident;
4258
4259 for (kt = directive_table; kt->length >= 0; kt++)
4260 {
4261 IF_STACK_FRAME *temp;
4262
4263 if (ident_length == kt->length
4264 && strncmp(ident, kt->name, kt->length) == 0)
4265 {
4266 /* If we are asked to return on next directive, do so now. */
4267 if (any)
4268 goto done;
4269
4270 switch (kt->type)
4271 {
4272 case T_IF:
4273 case T_IFDEF:
4274 case T_IFNDEF:
4275 temp
4276 =
4277 (IF_STACK_FRAME *) xcalloc(1, sizeof(IF_STACK_FRAME));
4278 temp->next = pfile->if_stack;
4279 pfile->if_stack = temp;
4280 temp->fname = CPP_BUFFER(pfile)->nominal_fname;
4281 temp->type = kt->type;
4282 break;
4283 case T_ELSE:
4284 case T_ENDIF:
4285 if (CPP_PEDANTIC(pfile)
4286 && pfile->if_stack != save_if_stack)
4287 validate_else(pfile,
4288 kt->type ==
4289 T_ELSE ? "#else" : "#endif");
4290 case T_ELIF:
4291 if (pfile->if_stack == CPP_BUFFER(pfile)->if_stack)
4292 {
4293 cpp_error(pfile,
4294 "`#%s' not within a conditional",
4295 kt->name);
4296 break;
4297 }
4298 else if (pfile->if_stack == save_if_stack)
4299 goto done; /* found what we came for */
4300
4301 if (kt->type != T_ENDIF)
4302 {
4303 if (pfile->if_stack->type == T_ELSE)
4304 cpp_error(pfile,
4305 "`#else' or `#elif' after `#else'");
4306 pfile->if_stack->type = kt->type;
4307 break;
4308 }
4309 temp = pfile->if_stack;
4310 pfile->if_stack = temp->next;
4311 free(temp);
4312 break;
4313 default:;
4314 }
4315 break;
4316 }
4317 /* Don't let erroneous code go by. */
4318 if (kt->length < 0 && !CPP_OPTIONS(pfile)->lang_asm
4319 && CPP_PEDANTIC(pfile))
4320 cpp_pedwarn(pfile, "invalid preprocessor directive name");
4321 }
4322 c = GETC();
4323 }
4324 /* We're in the middle of a line. Skip the rest of it. */
4325 for (;;)
4326 {
4327 switch (c)
4328 {
4329 long old;
4330
4331 case EOF:
4332 goto done;
4333 case '/': /* possible comment */
4334 c = skip_comment(pfile, NULL);
4335 if (c == EOF)
4336 goto done;
4337 break;
4338 case '\"':
4339 case '\'':
4340 FORWARD(-1);
4341 old = CPP_WRITTEN(pfile);
4342 cpp_get_token(pfile);
4343 CPP_SET_WRITTEN(pfile, old);
4344 break;
4345 case '\\':
4346 /* Char after backslash loses its special meaning. */
4347 if (PEEKC() == '\n')
4348 FORWARD(1);
4349 break;
4350 case '\n':
4351 goto beg_of_line;
4352 break;
4353 }
4354 c = GETC();
4355 }
4356 done:
4357 if (CPP_OPTIONS(pfile)->output_conditionals)
4358 {
4359 static char end_failed[] = "#endfailed\n";
4360
4361 CPP_PUTS(pfile, end_failed, sizeof(end_failed) - 1);
4362 pfile->lineno++;
4363 }
4364 pfile->only_seen_white = 1;
4365 parse_goto_mark(&line_start_mark, pfile);
4366 parse_clear_mark(&line_start_mark);
4367}
4368
4369/*
4370 * handle a #else directive. Do this by just continuing processing
4371 * without changing if_stack ; this is so that the error message
4372 * for missing #endif's etc. will point to the original #if. It
4373 * is possible that something different would be better.
4374 */
4375
4376static int
4377do_else(cpp_reader * pfile, struct directive *keyword __UNUSED__,
4378 unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__)
4379{
4380 cpp_buffer *ip = CPP_BUFFER(pfile);
4381
4382 if (CPP_PEDANTIC(pfile))
4383 validate_else(pfile, "#else");
4384 skip_rest_of_line(pfile);
4385
4386 if (pfile->if_stack == CPP_BUFFER(pfile)->if_stack)
4387 {
4388 cpp_error(pfile, "`#else' not within a conditional");
4389 return 0;
4390 }
4391 else
4392 {
4393 /* #ifndef can't have its special treatment for containing the whole file
4394 * if it has a #else clause. */
4395 pfile->if_stack->control_macro = 0;
4396
4397 if (pfile->if_stack->type != T_IF && pfile->if_stack->type != T_ELIF)
4398 {
4399 cpp_error(pfile, "`#else' after `#else'");
4400 fprintf(stderr, " (matches line %d", pfile->if_stack->lineno);
4401 if (strcmp(pfile->if_stack->fname, ip->nominal_fname) != 0)
4402 fprintf(stderr, ", file %s", pfile->if_stack->fname);
4403 fprintf(stderr, ")\n");
4404 }
4405 pfile->if_stack->type = T_ELSE;
4406 }
4407
4408 if (pfile->if_stack->if_succeeded)
4409 skip_if_group(pfile, 0);
4410 else
4411 {
4412 ++pfile->if_stack->if_succeeded; /* continue processing input */
4413 output_line_command(pfile, 1, same_file);
4414 }
4415 return 0;
4416}
4417
4418/*
4419 * unstack after #endif command
4420 */
4421
4422static int
4423do_endif(cpp_reader * pfile, struct directive *keyword __UNUSED__,
4424 unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__)
4425{
4426 if (CPP_PEDANTIC(pfile))
4427 validate_else(pfile, "#endif");
4428 skip_rest_of_line(pfile);
4429
4430 if (pfile->if_stack == CPP_BUFFER(pfile)->if_stack)
4431 {
4432 cpp_error(pfile, "unbalanced `#endif'");
4433 }
4434 else
4435 {
4436 IF_STACK_FRAME *temp = pfile->if_stack;
4437
4438 pfile->if_stack = temp->next;
4439 if (temp->control_macro)
4440 {
4441 /* This #endif matched a #ifndef at the start of the file.
4442 * See if it is at the end of the file. */
4443 struct parse_marker start_mark;
4444 int c;
4445
4446 parse_set_mark(&start_mark, pfile);
4447
4448 for (;;)
4449 {
4450 cpp_skip_hspace(pfile);
4451 c = GETC();
4452 if (c != '\n')
4453 break;
4454 }
4455 parse_goto_mark(&start_mark, pfile);
4456 parse_clear_mark(&start_mark);
4457
4458 if (c == EOF)
4459 {
4460 /* If we get here, this #endif ends a #ifndef
4461 * that contains all of the file (aside from whitespace).
4462 * Arrange not to include the file again
4463 * if the macro that was tested is defined.
4464 *
4465 * Do not do this for the top-level file in a -include or any
4466 * file in a -imacros. */
4467 {
4468 file_name_list *ifile = pfile->all_include_files;
4469
4470 for (; ifile; ifile = ifile->next)
4471 {
4472 if (!strcmp(ifile->fname, CPP_BUFFER(pfile)->fname))
4473 {
4474 ifile->control_macro = temp->control_macro;
4475 break;
4476 }
4477 }
4478 }
4479 }
4480 }
4481 free(temp);
4482 output_line_command(pfile, 1, same_file);
4483 }
4484 return 0;
4485}
4486
4487/* When an #else or #endif is found while skipping failed conditional,
4488 * if -pedantic was specified, this is called to warn about text after
4489 * the command name. P points to the first char after the command name. */
4490
4491static void
4492validate_else(cpp_reader * pfile, const char *directive)
4493{
4494 int c;
4495
4496 cpp_skip_hspace(pfile);
4497 c = PEEKC();
4498 if (c != EOF && c != '\n')
4499 cpp_pedwarn(pfile,
4500 "text following `%s' violates ANSI standard", directive);
4501}
4502
4503/* Get the next token, and add it to the text in pfile->token_buffer.
4504 * Return the kind of token we got. */
4505
4506enum cpp_token
4507cpp_get_token(cpp_reader * pfile)
4508{
4509 int c, c2, c3;
4510 long old_written = 0;
4511 long start_line = 0, start_column = 0;
4512 enum cpp_token token;
4513 struct cpp_options *opts = CPP_OPTIONS(pfile);
4514
4515 CPP_BUFFER(pfile)->prev = CPP_BUFFER(pfile)->cur;
4516 get_next:
4517 c = GETC();
4518 if (c == EOF)
4519 {
4520 handle_eof:
4521 if (CPP_BUFFER(pfile)->seen_eof)
4522 {
4523 if (cpp_pop_buffer(pfile) != CPP_NULL_BUFFER(pfile))
4524 goto get_next;
4525 else
4526 return CPP_EOF;
4527 }
4528 else
4529 {
4530 cpp_buffer *next_buf = CPP_PREV_BUFFER(CPP_BUFFER(pfile));
4531
4532 CPP_BUFFER(pfile)->seen_eof = 1;
4533 if (CPP_BUFFER(pfile)->nominal_fname && next_buf)
4534 {
4535 /* We're about to return from an #include file.
4536 * Emit #line information now (as part of the CPP_POP) result.
4537 * But the #line refers to the file we will pop to. */
4538 cpp_buffer *cur_buffer = CPP_BUFFER(pfile);
4539
4540 CPP_BUFFER(pfile) = next_buf;
4541 pfile->input_stack_listing_current = 0;
4542 output_line_command(pfile, 0, leave_file);
4543 CPP_BUFFER(pfile) = cur_buffer;
4544 }
4545 return CPP_POP;
4546 }
4547 }
4548 else
4549 {
4550 switch (c)
4551 {
4552 long newlines;
4553 struct parse_marker start_mark;
4554
4555 case '/':
4556 if (PEEKC() == '=')
4557 goto op2;
4558 if (opts->put_out_comments)
4559 parse_set_mark(&start_mark, pfile);
4560 newlines = 0;
4561 cpp_buf_line_and_col(cpp_file_buffer(pfile),
4562 &start_line, &start_column);
4563 c = skip_comment(pfile, &newlines);
4564 if (opts->put_out_comments && (c == '/' || c == EOF))
4565 parse_clear_mark(&start_mark);
4566 if (c == '/')
4567 goto randomchar;
4568 if (c == EOF)
4569 {
4570 cpp_error_with_line(pfile, start_line, start_column,
4571 "unterminated comment");
4572 goto handle_eof;
4573 }
4574 c = '/'; /* Initial letter of comment. */
4575 return_comment:
4576 /* Comments are equivalent to spaces.
4577 * For -traditional, a comment is equivalent to nothing. */
4578 if (opts->put_out_comments)
4579 {
4580 cpp_buffer *pbuf = CPP_BUFFER(pfile);
4581 unsigned char *start = pbuf->buf + start_mark.position;
4582 int len = pbuf->cur - start;
4583
4584 CPP_RESERVE(pfile, 1 + len);
4585 CPP_PUTC_Q(pfile, c);
4586 CPP_PUTS_Q(pfile, start, len);
4587 pfile->lineno += newlines;
4588 parse_clear_mark(&start_mark);
4589 return CPP_COMMENT;
4590 }
4591 else if (newlines > 0)
4592 {
4593 output_line_command(pfile, 0, same_file);
4594 CPP_RESERVE(pfile, 1);
4595 CPP_PUTC_Q(pfile, ' ');
4596 return CPP_VSPACE;
4597 }
4598 else
4599 {
4600 CPP_RESERVE(pfile, 1);
4601 CPP_PUTC_Q(pfile, ' ');
4602 return CPP_HSPACE;
4603 }
4604
4605 case '#':
4606 if (!pfile->only_seen_white)
4607 goto randomchar;
4608 if (handle_directive(pfile))
4609 return CPP_DIRECTIVE;
4610 pfile->only_seen_white = 0;
4611 return CPP_OTHER;
4612
4613 case '\"':
4614 case '\'':
4615 /* A single quoted string is treated like a double -- some
4616 * programs (e.g., troff) are perverse this way */
4617 cpp_buf_line_and_col(cpp_file_buffer(pfile),
4618 &start_line, &start_column);
4619 old_written = CPP_WRITTEN(pfile);
4620 string:
4621 CPP_PUTC(pfile, c);
4622 while (1)
4623 {
4624 int cc = GETC();
4625
4626 if (cc == EOF)
4627 {
4628 if (CPP_IS_MACRO_BUFFER(CPP_BUFFER(pfile)))
4629 {
4630 /* try harder: this string crosses a macro expansion
4631 * boundary. This can happen naturally if -traditional.
4632 * Otherwise, only -D can make a macro with an unmatched
4633 * quote. */
4634 cpp_buffer *next_buf
4635 = CPP_PREV_BUFFER(CPP_BUFFER(pfile));
4636
4637 (*CPP_BUFFER(pfile)->cleanup)
4638 (CPP_BUFFER(pfile), pfile);
4639 CPP_BUFFER(pfile) = next_buf;
4640 continue;
4641 }
4642 cpp_error_with_line(pfile, start_line, start_column,
4643 "unterminated string or character constant");
4644 if (pfile->multiline_string_line != start_line
4645 && pfile->multiline_string_line != 0)
4646 cpp_error_with_line(pfile,
4647 pfile->multiline_string_line,
4648 -1,
4649 "possible real start of unterminated constant");
4650 pfile->multiline_string_line = 0;
4651 break;
4652 }
4653 CPP_PUTC(pfile, cc);
4654 switch (cc)
4655 {
4656 case '\n':
4657 /* Traditionally, end of line ends a string constant with
4658 * no error. So exit the loop and record the new line. */
4659 if (c == '\'')
4660 {
4661 cpp_error_with_line(pfile, start_line, start_column,
4662 "unterminated character constant");
4663 goto while2end;
4664 }
4665 if (CPP_PEDANTIC(pfile)
4666 && pfile->multiline_string_line == 0)
4667 {
4668 cpp_pedwarn_with_line(pfile, start_line,
4669 start_column,
4670 "string constant runs past end of line");
4671 }
4672 if (pfile->multiline_string_line == 0)
4673 pfile->multiline_string_line = start_line;
4674 break;
4675
4676 case '\\':
4677 cc = GETC();
4678 if (cc == '\n')
4679 {
4680 /* Backslash newline is replaced by nothing at all. */
4681 CPP_ADJUST_WRITTEN(pfile, -1);
4682 pfile->lineno++;
4683 }
4684 else
4685 {
4686 /* ANSI stupidly requires that in \\ the second \
4687 * is *not* prevented from combining with a newline. */
4688 NEWLINE_FIX1(cc);
4689 if (cc != EOF)
4690 CPP_PUTC(pfile, cc);
4691 }
4692 break;
4693
4694 case '\"':
4695 case '\'':
4696 if (cc == c)
4697 goto while2end;
4698 break;
4699 }
4700 }
4701 while2end:
4702 pfile->lineno += count_newlines(pfile->token_buffer + old_written,
4703 CPP_PWRITTEN(pfile));
4704 pfile->only_seen_white = 0;
4705 return c == '\'' ? CPP_CHAR : CPP_STRING;
4706
4707 case '$':
4708 if (!opts->dollars_in_ident)
4709 goto randomchar;
4710 goto letter;
4711
4712 case ':':
4713 if (opts->cplusplus && PEEKC() == ':')
4714 goto op2;
4715 goto randomchar;
4716
4717 case '&':
4718 case '+':
4719 case '|':
4720 NEWLINE_FIX;
4721 c2 = PEEKC();
4722 if (c2 == c || c2 == '=')
4723 goto op2;
4724 goto randomchar;
4725
4726 case '*':
4727 case '!':
4728 case '%':
4729 case '=':
4730 case '^':
4731 NEWLINE_FIX;
4732 if (PEEKC() == '=')
4733 goto op2;
4734 goto randomchar;
4735
4736 case '-':
4737 NEWLINE_FIX;
4738 c2 = PEEKC();
4739 if (c2 == '-' && opts->chill)
4740 {
4741 /* Chill style comment */
4742 if (opts->put_out_comments)
4743 parse_set_mark(&start_mark, pfile);
4744 FORWARD(1); /* Skip second '-'. */
4745 for (;;)
4746 {
4747 c = GETC();
4748 if (c == EOF)
4749 break;
4750 if (c == '\n')
4751 {
4752 /* Don't consider final '\n' to be part of comment. */
4753 FORWARD(-1);
4754 break;
4755 }
4756 }
4757 c = '-';
4758 goto return_comment;
4759 }
4760 if (c2 == '-' || c2 == '=' || c2 == '>')
4761 goto op2;
4762 goto randomchar;
4763
4764 case '<':
4765 if (pfile->parsing_include_directive)
4766 {
4767 for (;;)
4768 {
4769 CPP_PUTC(pfile, c);
4770 if (c == '>')
4771 break;
4772 c = GETC();
4773 NEWLINE_FIX1(c);
4774 if (c == '\n' || c == EOF)
4775 {
4776 cpp_error(pfile,
4777 "missing '>' in `#include <FILENAME>'");
4778 break;
4779 }
4780 }
4781 return CPP_STRING;
4782 }
4783 /* else fall through */
4784 case '>':
4785 NEWLINE_FIX;
4786 c2 = PEEKC();
4787 if (c2 == '=')
4788 goto op2;
4789 if (c2 != c)
4790 goto randomchar;
4791 FORWARD(1);
4792 CPP_RESERVE(pfile, 4);
4793 CPP_PUTC(pfile, c);
4794 CPP_PUTC(pfile, c2);
4795 NEWLINE_FIX;
4796 c3 = PEEKC();
4797 if (c3 == '=')
4798 CPP_PUTC_Q(pfile, GETC());
4799 CPP_NUL_TERMINATE_Q(pfile);
4800 pfile->only_seen_white = 0;
4801 return CPP_OTHER;
4802
4803 case '@':
4804 if (CPP_BUFFER(pfile)->has_escapes)
4805 {
4806 c = GETC();
4807 // fix macro expansions starting with - losing the -
4808 if (c == '-')
4809 {
4810 CPP_PUTS(pfile, "-", 1);
4811 return CPP_OTHER;
4812 }
4813 // fix macro expansions starting with - losing the +
4814 else if (c == '+')
4815 {
4816 CPP_PUTS(pfile, "+", 1);
4817 return CPP_OTHER;
4818 }
4819 // fix macro expansions starting with - losing the .
4820 else if (c == '.')
4821 {
4822 CPP_PUTS(pfile, ".", 1);
4823 return CPP_OTHER;
4824 }
4825 else if (is_space[c])
4826 {
4827 CPP_RESERVE(pfile, 1);
4828 if (pfile->output_escapes)
4829 CPP_PUTC_Q(pfile, '@');
4830 return CPP_HSPACE;
4831 }
4832 }
4833 if (pfile->output_escapes)
4834 {
4835 CPP_PUTS(pfile, "@@", 2);
4836 return CPP_OTHER;
4837 }
4838 goto randomchar;
4839
4840 case '.':
4841 NEWLINE_FIX;
4842 c2 = PEEKC();
4843 if (isdigit(c2))
4844 {
4845 CPP_RESERVE(pfile, 2);
4846 CPP_PUTC_Q(pfile, '.');
4847 c = GETC();
4848 goto number;
4849 }
4850 /* FIXME - misses the case "..\\\n." */
4851 if (c2 == '.' && PEEKN(1) == '.')
4852 {
4853 CPP_RESERVE(pfile, 4);
4854 CPP_PUTC_Q(pfile, '.');
4855 CPP_PUTC_Q(pfile, '.');
4856 CPP_PUTC_Q(pfile, '.');
4857 FORWARD(2);
4858 CPP_NUL_TERMINATE_Q(pfile);
4859 pfile->only_seen_white = 0;
4860 return CPP_3DOTS;
4861 }
4862 goto randomchar;
4863
4864 op2:
4865 token = CPP_OTHER;
4866 pfile->only_seen_white = 0;
4867 op2any:
4868 CPP_RESERVE(pfile, 3);
4869 CPP_PUTC_Q(pfile, c);
4870 CPP_PUTC_Q(pfile, GETC());
4871 CPP_NUL_TERMINATE_Q(pfile);
4872 return token;
4873
4874 case 'L':
4875 NEWLINE_FIX;
4876 c2 = PEEKC();
4877 if ((c2 == '\'' || c2 == '\"'))
4878 {
4879 CPP_PUTC(pfile, c);
4880 c = GETC();
4881 goto string;
4882 }
4883 goto letter;
4884
4885 case '0':
4886 case '1':
4887 case '2':
4888 case '3':
4889 case '4':
4890 case '5':
4891 case '6':
4892 case '7':
4893 case '8':
4894 case '9':
4895 number:
4896 c2 = '.';
4897 for (;;)
4898 {
4899 CPP_RESERVE(pfile, 2);
4900 CPP_PUTC_Q(pfile, c);
4901 NEWLINE_FIX;
4902 c = PEEKC();
4903 if (c == EOF)
4904 break;
4905 if (!is_idchar[c] && c != '.'
4906 && ((c2 != 'e' && c2 != 'E') || (c != '+' && c != '-')))
4907 break;
4908 FORWARD(1);
4909 c2 = c;
4910 }
4911 CPP_NUL_TERMINATE_Q(pfile);
4912 pfile->only_seen_white = 0;
4913 return CPP_NUMBER;
4914 case 'b':
4915 case 'c':
4916 case 'd':
4917 case 'h':
4918 case 'o':
4919 case 'B':
4920 case 'C':
4921 case 'D':
4922 case 'H':
4923 case 'O':
4924 if (opts->chill && PEEKC() == '\'')
4925 {
4926 pfile->only_seen_white = 0;
4927 CPP_RESERVE(pfile, 2);
4928 CPP_PUTC_Q(pfile, c);
4929 CPP_PUTC_Q(pfile, '\'');
4930 FORWARD(1);
4931 for (;;)
4932 {
4933 c = GETC();
4934 if (c == EOF)
4935 goto chill_number_eof;
4936 if (!is_idchar[c])
4937 {
4938 if (c == '\\' && PEEKC() == '\n')
4939 {
4940 FORWARD(2);
4941 continue;
4942 }
4943 break;
4944 }
4945 CPP_PUTC(pfile, c);
4946 }
4947 if (c == '\'')
4948 {
4949 CPP_RESERVE(pfile, 2);
4950 CPP_PUTC_Q(pfile, c);
4951 CPP_NUL_TERMINATE_Q(pfile);
4952 return CPP_STRING;
4953 }
4954 else
4955 {
4956 FORWARD(-1);
4957 chill_number_eof:
4958 CPP_NUL_TERMINATE(pfile);
4959 return CPP_NUMBER;
4960 }
4961 }
4962 else
4963 goto letter;
4964 case '_':
4965 case 'a':
4966 case 'e':
4967 case 'f':
4968 case 'g':
4969 case 'i':
4970 case 'j':
4971 case 'k':
4972 case 'l':
4973 case 'm':
4974 case 'n':
4975 case 'p':
4976 case 'q':
4977 case 'r':
4978 case 's':
4979 case 't':
4980 case 'u':
4981 case 'v':
4982 case 'w':
4983 case 'x':
4984 case 'y':
4985 case 'z':
4986 case 'A':
4987 case 'E':
4988 case 'F':
4989 case 'G':
4990 case 'I':
4991 case 'J':
4992 case 'K':
4993 case 'M':
4994 case 'N':
4995 case 'P':
4996 case 'Q':
4997 case 'R':
4998 case 'S':
4999 case 'T':
5000 case 'U':
5001 case 'V':
5002 case 'W':
5003 case 'X':
5004 case 'Y':
5005 case 'Z':
5006 letter:
5007 {
5008 HASHNODE *hp;
5009 char *ident;
5010 int before_name_written = CPP_WRITTEN(pfile);
5011 int ident_len;
5012
5013 parse_name(pfile, c);
5014 pfile->only_seen_white = 0;
5015 if (pfile->no_macro_expand)
5016 return CPP_NAME;
5017 ident = (char *)pfile->token_buffer + before_name_written;
5018 ident_len = CPP_PWRITTEN(pfile) - (unsigned char *)ident;
5019 hp = cpp_lookup(ident, ident_len, -1);
5020 if (!hp)
5021 return CPP_NAME;
5022 if (hp->type == T_DISABLED)
5023 {
5024 if (pfile->output_escapes)
5025 { /* Return "@-IDENT", followed by '\0'. */
5026 int i;
5027
5028 CPP_RESERVE(pfile, 3);
5029 ident =
5030 (char *)pfile->token_buffer + before_name_written;
5031 CPP_ADJUST_WRITTEN(pfile, 2);
5032 for (i = ident_len; i >= 0; i--)
5033 ident[i + 2] = ident[i];
5034 ident[0] = '@';
5035 ident[1] = '-';
5036 }
5037 return CPP_NAME;
5038 }
5039 /* If macro wants an arglist, verify that a '(' follows.
5040 * first skip all whitespace, copying it to the output
5041 * after the macro name. Then, if there is no '(',
5042 * decide this is not a macro call and leave things that way. */
5043 if (hp->type == T_MACRO && hp->value.defn->nargs >= 0)
5044 {
5045 struct parse_marker macro_mark;
5046 int is_macro_call;
5047
5048 while (CPP_IS_MACRO_BUFFER(CPP_BUFFER(pfile)))
5049 {
5050 cpp_buffer *next_buf;
5051
5052 cpp_skip_hspace(pfile);
5053 if (PEEKC() != EOF)
5054 break;
5055 next_buf = CPP_PREV_BUFFER(CPP_BUFFER(pfile));
5056 (*CPP_BUFFER(pfile)->cleanup) (CPP_BUFFER(pfile),
5057 pfile);
5058 CPP_BUFFER(pfile) = next_buf;
5059 }
5060 parse_set_mark(&macro_mark, pfile);
5061 for (;;)
5062 {
5063 cpp_skip_hspace(pfile);
5064 c = PEEKC();
5065 is_macro_call = c == '(';
5066 if (c != '\n')
5067 break;
5068 FORWARD(1);
5069 }
5070 if (!is_macro_call)
5071 parse_goto_mark(&macro_mark, pfile);
5072 parse_clear_mark(&macro_mark);
5073 if (!is_macro_call)
5074 return CPP_NAME;
5075 }
5076 /* This is now known to be a macro call. */
5077
5078 /* it might not actually be a macro. */
5079 if (hp->type != T_MACRO)
5080 {
5081 int xbuf_len;
5082 unsigned char *xbuf;
5083
5084 CPP_SET_WRITTEN(pfile, before_name_written);
5085 special_symbol(hp, pfile);
5086 xbuf_len = CPP_WRITTEN(pfile) - before_name_written;
5087 xbuf = (unsigned char *)xmalloc(xbuf_len + 1);
5088 CPP_SET_WRITTEN(pfile, before_name_written);
5089 memcpy(xbuf, CPP_PWRITTEN(pfile), xbuf_len + 1);
5090 push_macro_expansion(pfile, xbuf, xbuf_len, hp);
5091 }
5092 else
5093 {
5094 /* Expand the macro, reading arguments as needed,
5095 * and push the expansion on the input stack. */
5096 macroexpand(pfile, hp);
5097 CPP_SET_WRITTEN(pfile, before_name_written);
5098 }
5099
5100 /* An extra "@ " is added to the end of a macro expansion
5101 * to prevent accidental token pasting. We prefer to avoid
5102 * unneeded extra spaces (for the sake of cpp-using tools like
5103 * imake). Here we remove the space if it is safe to do so. */
5104 if (pfile->buffer->rlimit - pfile->buffer->cur >= 3
5105 && pfile->buffer->rlimit[-2] == '@'
5106 && pfile->buffer->rlimit[-1] == ' ')
5107 {
5108 int c1 = pfile->buffer->rlimit[-3];
5109
5110 c2 = CPP_BUF_PEEK(CPP_PREV_BUFFER(CPP_BUFFER(pfile)));
5111
5112 if (c2 == EOF || !unsafe_chars(c1, c2))
5113 pfile->buffer->rlimit -= 2;
5114 }
5115 }
5116 goto get_next;
5117
5118 case ' ':
5119 case '\t':
5120 case '\v':
5121 case '\r':
5122 for (;;)
5123 {
5124 CPP_PUTC(pfile, c);
5125 c = PEEKC();
5126 if (c == EOF || !is_hor_space[c])
5127 break;
5128 FORWARD(1);
5129 }
5130 return CPP_HSPACE;
5131
5132 case '\\':
5133 c2 = PEEKC();
5134 if (c2 != '\n')
5135 goto randomchar;
5136 token = CPP_HSPACE;
5137 goto op2any;
5138
5139 case '\n':
5140 CPP_PUTC(pfile, c);
5141 if (pfile->only_seen_white == 0)
5142 pfile->only_seen_white = 1;
5143 pfile->lineno++;
5144 output_line_command(pfile, 1, same_file);
5145 return CPP_VSPACE;
5146
5147 case '(':
5148 token = CPP_LPAREN;
5149 goto char1;
5150 case ')':
5151 token = CPP_RPAREN;
5152 goto char1;
5153 case '{':
5154 token = CPP_LBRACE;
5155 goto char1;
5156 case '}':
5157 token = CPP_RBRACE;
5158 goto char1;
5159 case ',':
5160 token = CPP_COMMA;
5161 goto char1;
5162 case ';':
5163 token = CPP_SEMICOLON;
5164 goto char1;
5165
5166 randomchar:
5167 default:
5168 token = CPP_OTHER;
5169 char1:
5170 pfile->only_seen_white = 0;
5171 CPP_PUTC(pfile, c);
5172 return token;
5173 }
5174 }
5175}
5176
5177#if 0 /* Unused */
5178/* Like cpp_get_token, but skip spaces and comments. */
5179enum cpp_token
5180cpp_get_non_space_token(cpp_reader * pfile)
5181{
5182 int old_written = CPP_WRITTEN(pfile);
5183
5184 for (;;)
5185 {
5186 enum cpp_token token = cpp_get_token(pfile);
5187
5188 if (token != CPP_COMMENT && token != CPP_POP
5189 && token != CPP_HSPACE && token != CPP_VSPACE)
5190 return token;
5191 CPP_SET_WRITTEN(pfile, old_written);
5192 }
5193}
5194#endif
5195
5196/* Parse an identifier starting with C. */
5197
5198int
5199parse_name(cpp_reader * pfile, int c)
5200{
5201 for (;;)
5202 {
5203 if (!is_idchar[c])
5204 {
5205 if (c == '\\' && PEEKC() == '\n')
5206 {
5207 FORWARD(2);
5208 continue;
5209 }
5210 FORWARD(-1);
5211 break;
5212 }
5213 CPP_RESERVE(pfile, 2); /* One more for final NUL. */
5214 CPP_PUTC_Q(pfile, c);
5215 c = GETC();
5216 if (c == EOF)
5217 break;
5218 }
5219 CPP_NUL_TERMINATE_Q(pfile);
5220 return 1;
5221}
5222
5223/* Maintain and search list of included files, for #import. */
5224
5225/* Hash a file name for import_hash_table. */
5226
5227static int
5228import_hash(char *f)
5229{
5230 int val = 0;
5231
5232 while (*f)
5233 val += *f++;
5234 return (val % IMPORT_HASH_SIZE);
5235}
5236
5237/* Search for file FILENAME in import_hash_table.
5238 * Return -2 if found, either a matching name or a matching inode.
5239 * Otherwise, open the file and return a file descriptor if successful
5240 * or -1 if unsuccessful. */
5241
5242static int
5243lookup_import(cpp_reader * pfile, char *filename, file_name_list * searchptr)
5244{
5245 struct import_file *i;
5246 int h;
5247 int hashval;
5248 struct stat sb;
5249 int fd;
5250
5251 hashval = import_hash(filename);
5252
5253 /* Attempt to find file in list of already included files */
5254 i = pfile->import_hash_table[hashval];
5255
5256 while (i)
5257 {
5258 if (!strcmp(filename, i->name))
5259 return -2; /* return found */
5260 i = i->next;
5261 }
5262 /* Open it and try a match on inode/dev */
5263 fd = open_include_file(pfile, filename, searchptr);
5264 if (fd < 0)
5265 return fd;
5266 fstat(fd, &sb);
5267 for (h = 0; h < IMPORT_HASH_SIZE; h++)
5268 {
5269 i = pfile->import_hash_table[h];
5270 while (i)
5271 {
5272 /* Compare the inode and the device.
5273 * Supposedly on some systems the inode is not a scalar. */
5274 if (!memcmp
5275 ((char *)&i->inode, (char *)&sb.st_ino, sizeof(sb.st_ino))
5276 && i->dev == sb.st_dev)
5277 {
5278 close(fd);
5279 return -2; /* return found */
5280 }
5281 i = i->next;
5282 }
5283 }
5284 return fd; /* Not found, return open file */
5285}
5286
5287/* Add the file FNAME, open on descriptor FD, to import_hash_table. */
5288
5289static void
5290add_import(cpp_reader * pfile, int fd, char *fname)
5291{
5292 struct import_file *i;
5293 int hashval;
5294 struct stat sb;
5295
5296 hashval = import_hash(fname);
5297 fstat(fd, &sb);
5298 i = (struct import_file *)xmalloc(sizeof(struct import_file));
5299
5300 i->name = (char *)xmalloc(strlen(fname) + 1);
5301 strcpy(i->name, fname);
5302 memcpy((char *)&i->inode, (char *)&sb.st_ino, sizeof(sb.st_ino));
5303 i->dev = sb.st_dev;
5304 i->next = pfile->import_hash_table[hashval];
5305 pfile->import_hash_table[hashval] = i;
5306}
5307
5308/* The file_name_map structure holds a mapping of file names for a
5309 * particular directory. This mapping is read from the file named
5310 * FILE_NAME_MAP_FILE in that directory. Such a file can be used to
5311 * map filenames on a file system with severe filename restrictions,
5312 * such as DOS. The format of the file name map file is just a series
5313 * of lines with two tokens on each line. The first token is the name
5314 * to map, and the second token is the actual name to use. */
5315
5316struct file_name_map {
5317 struct file_name_map *map_next;
5318 char *map_from;
5319 char *map_to;
5320};
5321
5322#if USE_FILE_NAME_MAPS
5323
5324#define FILE_NAME_MAP_FILE "header.gcc"
5325
5326/* Read a space delimited string of unlimited length from a stdio
5327 * file. */
5328
5329static char *
5330read_filename_string(int ch, FILE * f)
5331{
5332 char *alloc, *set;
5333 int len;
5334
5335 len = 20;
5336 set = alloc = (char *)xmalloc(len + 1);
5337 if (!is_space[ch])
5338 {
5339 *set++ = ch;
5340 while ((ch = getc(f)) != EOF && !is_space[ch])
5341 {
5342 if (set - alloc == len)
5343 {
5344 len *= 2;
5345 alloc = (char *)xrealloc(alloc, len + 1);
5346 set = alloc + len / 2;
5347 }
5348 *set++ = ch;
5349 }
5350 }
5351 *set = '\0';
5352 ungetc(ch, f);
5353 return alloc;
5354}
5355
5356/* This structure holds a linked list of file name maps, one per directory. */
5357struct file_name_map_list {
5358 struct file_name_map_list *map_list_next;
5359 char *map_list_name;
5360 struct file_name_map *map_list_map;
5361};
5362
5363/* Read the file name map file for DIRNAME. */
5364
5365static struct file_name_map *
5366read_name_map(cpp_reader * pfile, const char *dirname)
5367{
5368 struct file_name_map_list *map_list_ptr;
5369 char *name;
5370 FILE *f;
5371
5372 for (map_list_ptr = CPP_OPTIONS(pfile)->map_list; map_list_ptr;
5373 map_list_ptr = map_list_ptr->map_list_next)
5374 if (!strcmp(map_list_ptr->map_list_name, dirname))
5375 return map_list_ptr->map_list_map;
5376
5377 map_list_ptr =
5378 ((struct file_name_map_list *)xmalloc(sizeof(struct file_name_map_list)));
5379
5380 map_list_ptr->map_list_name = savestring(dirname);
5381 map_list_ptr->map_list_map = NULL;
5382
5383 name = (char *)alloca(strlen(dirname) + strlen(FILE_NAME_MAP_FILE) + 2);
5384 strcpy(name, dirname);
5385 if (*dirname)
5386 strcat(name, "/");
5387 strcat(name, FILE_NAME_MAP_FILE);
5388#ifndef __EMX__
5389 f = fopen(name, "rb");
5390#else
5391 f = fopen(name, "rtb");
5392#endif
5393 if (!f)
5394 map_list_ptr->map_list_map = NULL;
5395 else
5396 {
5397 int ch;
5398 int dirlen = strlen(dirname);
5399
5400 while ((ch = getc(f)) != EOF)
5401 {
5402 char *from, *to;
5403 struct file_name_map *ptr;
5404
5405 if (is_space[ch])
5406 continue;
5407 from = read_filename_string(ch, f);
5408 while ((ch = getc(f)) != EOF && is_hor_space[ch]);
5409 to = read_filename_string(ch, f);
5410
5411 ptr =
5412 ((struct file_name_map *)xmalloc(sizeof(struct file_name_map)));
5413
5414 ptr->map_from = from;
5415
5416 /* Make the real filename absolute. */
5417 if (*to == '/')
5418 ptr->map_to = to;
5419 else
5420 {
5421 ptr->map_to = (char *)xmalloc(dirlen + strlen(to) + 2);
5422 strcpy(ptr->map_to, dirname);
5423 ptr->map_to[dirlen] = '/';
5424 strcpy(ptr->map_to + dirlen + 1, to);
5425 free(to);
5426 }
5427
5428 ptr->map_next = map_list_ptr->map_list_map;
5429 map_list_ptr->map_list_map = ptr;
5430
5431 while ((ch = getc(f)) != '\n')
5432 if (ch == EOF)
5433 break;
5434 }
5435 fclose(f);
5436 }
5437
5438 map_list_ptr->map_list_next = CPP_OPTIONS(pfile)->map_list;
5439 CPP_OPTIONS(pfile)->map_list = map_list_ptr;
5440
5441 return map_list_ptr->map_list_map;
5442}
5443
5444/* Try to open include file FILENAME. SEARCHPTR is the directory
5445 * being tried from the include file search path. This function maps
5446 * filenames on file systems based on information read by
5447 * read_name_map. */
5448
5449static int
5450open_include_file(cpp_reader * pfile, char *filename,
5451 file_name_list * searchptr)
5452{
5453 struct file_name_map *map;
5454 const char *from;
5455 const char *p, *dir;
5456
5457 if (searchptr && !searchptr->got_name_map)
5458 {
5459 searchptr->name_map = read_name_map(pfile,
5460 searchptr->fname
5461 ? searchptr->fname : ".");
5462 searchptr->got_name_map = 1;
5463 }
5464 /* First check the mapping for the directory we are using. */
5465 if (searchptr && searchptr->name_map)
5466 {
5467 from = filename;
5468 if (searchptr->fname)
5469 from += strlen(searchptr->fname) + 1;
5470 for (map = searchptr->name_map; map; map = map->map_next)
5471 {
5472 if (!strcmp(map->map_from, from))
5473 {
5474 /* Found a match. */
5475 return open(map->map_to, O_RDONLY | O_BINARY, 0666);
5476 }
5477 }
5478 }
5479 /* Try to find a mapping file for the particular directory we are
5480 * looking in. Thus #include <sys/types.h> will look up sys/types.h
5481 * in /usr/include/header.gcc and look up types.h in
5482 * /usr/include/sys/header.gcc. */
5483 p = strrchr(filename, '/');
5484 if (!p)
5485 p = filename;
5486 if (searchptr
5487 && searchptr->fname
5488 && strlen(searchptr->fname) == (unsigned)(p - filename)
5489 && !strncmp(searchptr->fname, filename, p - filename))
5490 {
5491 /* FILENAME is in SEARCHPTR, which we've already checked. */
5492 return open(filename, O_RDONLY | O_BINARY, 0666);
5493 }
5494 if (p == filename)
5495 {
5496 dir = ".";
5497 from = filename;
5498 }
5499 else
5500 {
5501 char *s;
5502
5503 s = (char *)alloca(p - filename + 1);
5504 memcpy(s, filename, p - filename);
5505 s[p - filename] = '\0';
5506 from = p + 1;
5507 dir = s;
5508 }
5509 for (map = read_name_map(pfile, dir); map; map = map->map_next)
5510 if (!strcmp(map->map_from, from))
5511 return open(map->map_to, O_RDONLY | O_BINARY, 0666);
5512
5513 return open(filename, O_RDONLY | O_BINARY, 0666);
5514}
5515
5516#else
5517
5518static int
5519open_include_file(cpp_reader * pfile __UNUSED__, char *filename,
5520 file_name_list * searchptr __UNUSED__)
5521{
5522 return open(filename, O_RDONLY | O_BINARY, 0666);
5523}
5524
5525#endif /* USE_FILE_NAME_MAPS */
5526
5527static int
5528dos2unix(cpp_buffer *fp, int length)
5529{
5530 unsigned char *tbuf;
5531 int nlen = 0, i;
5532
5533 tbuf = xmalloc(length + 4);
5534 if (!tbuf) return length;
5535 for (i = 0; i < length; i++)
5536 {
5537 if ((fp->buf[i] == '\r') &&
5538 (fp->buf[i + 1] == '\n'))
5539 {
5540 // skip \r in \r\n
5541 continue;
5542 }
5543 tbuf[nlen] = fp->buf[i];
5544 nlen++;
5545 }
5546 tbuf[nlen] = 0;
5547
5548 free(fp->buf);
5549 fp->buf = tbuf;
5550 return nlen;
5551}
5552
5553/* Process the contents of include file FNAME, already open on descriptor F,
5554 * with output to OP.
5555 * SYSTEM_HEADER_P is 1 if this file resides in any one of the known
5556 * "system" include directories (as decided by the `is_system_include'
5557 * function above).
5558 * DIRPTR is the link in the dir path through which this file was found,
5559 * or 0 if the file name was absolute or via the current directory.
5560 * Return 1 on success, 0 on failure.
5561 *
5562 * The caller is responsible for the cpp_push_buffer. */
5563
5564static int
5565finclude(cpp_reader * pfile, int f, const char *fname, int system_header_p,
5566 file_name_list * dirptr)
5567{
5568 int st_mode;
5569 long st_size;
5570 long i;
5571 int length;
5572 cpp_buffer *fp; /* For input stack frame */
5573
5574 if (file_size_and_mode(f, &st_mode, &st_size) < 0)
5575 {
5576 cpp_perror_with_name(pfile, fname);
5577 close(f);
5578 cpp_pop_buffer(pfile);
5579 return 0;
5580 }
5581 fp = CPP_BUFFER(pfile);
5582 fp->nominal_fname = fp->fname = fname;
5583 fp->dir = dirptr;
5584 fp->system_header_p = system_header_p;
5585 fp->lineno = 1;
5586 fp->colno = 1;
5587 fp->cleanup = file_cleanup;
5588
5589 if (S_ISREG(st_mode))
5590 {
5591 fp->buf = (unsigned char *)xmalloc(st_size + 2);
5592 /* Read the file contents, knowing that st_size is an upper bound
5593 * on the number of bytes we can read. */
5594 length = safe_read(f, (char *)fp->buf, st_size);
5595 length = dos2unix(fp, length);
5596
5597 fp->alimit = fp->buf + st_size + 2;
5598 fp->cur = fp->buf;
5599 fp->rlimit = fp->buf + length;
5600 if (length < 0)
5601 goto nope;
5602 }
5603 else if (S_ISDIR(st_mode))
5604 {
5605 cpp_error(pfile, "directory `%s' specified in #include", fname);
5606 close(f);
5607 return 0;
5608 }
5609 else
5610 {
5611 /* Cannot count its file size before reading.
5612 * First read the entire file into heap and
5613 * copy them into buffer on stack. */
5614
5615 int bsize = 2000;
5616
5617 st_size = 0;
5618 fp->buf = (unsigned char *)xmalloc(bsize + 2);
5619
5620 for (;;)
5621 {
5622 i = safe_read(f, (char *)(fp->buf + st_size), bsize - st_size);
5623 if (i < 0)
5624 goto nope; /* error! */
5625 st_size += i;
5626 if (st_size != bsize)
5627 break; /* End of file */
5628 bsize *= 2;
5629 fp->buf = (unsigned char *)xrealloc(fp->buf, bsize + 2);
5630 }
5631 length = st_size;
5632 length = dos2unix(fp, length);
5633 }
5634
5635 if ((length > 0 && fp->buf[length - 1] != '\n')
5636 /* Backslash-newline at end is not good enough. */
5637 || (length > 1 && fp->buf[length - 2] == '\\'))
5638 {
5639 fp->buf[length++] = '\n';
5640 }
5641 fp->buf[length] = '\0';
5642
5643 fp->rlimit = fp->buf + length;
5644
5645 /* Close descriptor now, so nesting does not use lots of descriptors. */
5646 close(f);
5647
5648 /* Must do this before calling trigraph_pcp, so that the correct file name
5649 * will be printed in warning messages. */
5650
5651 pfile->input_stack_listing_current = 0;
5652
5653 return 1;
5654
5655 nope:
5656
5657 cpp_perror_with_name(pfile, fname);
5658 close(f);
5659 free(fp->buf);
5660 return 1;
5661}
5662
5663int
5664push_parse_file(cpp_reader * pfile, const char *fname)
5665{
5666 struct cpp_options *opts = CPP_OPTIONS(pfile);
5667 struct cpp_pending *pend;
5668 char *p;
5669 int f;
5670 cpp_buffer *fp;
5671
5672 /* The code looks at the defaults through this pointer, rather than through
5673 * the constant structure above. This pointer gets changed if an environment
5674 * variable specifies other defaults. */
5675 struct default_include *include_defaults = include_defaults_array;
5676
5677 /* Add dirs from CPATH after dirs from -I. */
5678 /* There seems to be confusion about what CPATH should do,
5679 * so for the moment it is not documented. */
5680 /* Some people say that CPATH should replace the standard include dirs,
5681 * but that seems pointless: it comes before them, so it overrides them
5682 * anyway. */
5683 p = (char *)getenv("CPATH");
5684 if (p && !opts->no_standard_includes)
5685 path_include(pfile, p);
5686
5687 /* Now that dollars_in_ident is known, initialize is_idchar. */
5688 initialize_char_syntax(opts);
5689
5690 /* Do partial setup of input buffer for the sake of generating
5691 * early #line directives (when -g is in effect). */
5692 fp = cpp_push_buffer(pfile, NULL, 0);
5693 if (!opts->in_fname)
5694 opts->in_fname = "";
5695 fp->nominal_fname = fp->fname = opts->in_fname;
5696 fp->lineno = 0;
5697
5698 /* Install __LINE__, etc. Must follow initialize_char_syntax
5699 * and option processing. */
5700 initialize_builtins(pfile);
5701
5702 /* Do standard #defines and assertions
5703 * that identify system and machine type. */
5704
5705 if (!opts->inhibit_predefs)
5706 {
5707 p = (char *)alloca(strlen(predefs) + 1);
5708
5709 strcpy(p, predefs);
5710 while (*p)
5711 {
5712 char *q;
5713
5714 while (*p == ' ' || *p == '\t')
5715 p++;
5716 /* Handle -D options. */
5717 if (p[0] == '-' && p[1] == 'D')
5718 {
5719 q = &p[2];
5720 while (*p && *p != ' ' && *p != '\t')
5721 p++;
5722 if (*p != 0)
5723 *p++ = 0;
5724 if (opts->debug_output)
5725 output_line_command(pfile, 0, same_file);
5726 cpp_define(pfile, (unsigned char *)q);
5727 while (*p == ' ' || *p == '\t')
5728 p++;
5729 }
5730 else if (p[0] == '-' && p[1] == 'A')
5731 {
5732 /* Handle -A options (assertions). */
5733 char *assertion;
5734 char *past_name;
5735 char *value;
5736 char *past_value;
5737 char *termination;
5738 int save_char;
5739
5740 assertion = &p[2];
5741 past_name = assertion;
5742 /* Locate end of name. */
5743 while (*past_name && *past_name != ' '
5744 && *past_name != '\t' && *past_name != '(')
5745 past_name++;
5746 /* Locate `(' at start of value. */
5747 value = past_name;
5748 while (*value && (*value == ' ' || *value == '\t'))
5749 value++;
5750 if (*value++ != '(')
5751 abort();
5752 while (*value && (*value == ' ' || *value == '\t'))
5753 value++;
5754 past_value = value;
5755 /* Locate end of value. */
5756 while (*past_value && *past_value != ' '
5757 && *past_value != '\t' && *past_value != ')')
5758 past_value++;
5759 termination = past_value;
5760 while (*termination
5761 && (*termination == ' ' || *termination == '\t'))
5762 termination++;
5763 if (*termination++ != ')')
5764 abort();
5765 if (*termination && *termination != ' '
5766 && *termination != '\t')
5767 abort();
5768 /* Temporarily null-terminate the value. */
5769 save_char = *termination;
5770 *termination = '\0';
5771 /* Install the assertion. */
5772 make_assertion(pfile, "-A", assertion);
5773 *termination = (char)save_char;
5774 p = termination;
5775 while (*p == ' ' || *p == '\t')
5776 p++;
5777 }
5778 else
5779 {
5780 abort();
5781 }
5782 }
5783 }
5784 /* Now handle the command line options. */
5785
5786 /* Do -U's, -D's and -A's in the order they were seen. */
5787 /* First reverse the list. */
5788 opts->pending = nreverse_pending(opts->pending);
5789
5790 for (pend = opts->pending; pend; pend = pend->next)
5791 {
5792 if (pend->cmd && pend->cmd[0] == '-')
5793 {
5794 switch (pend->cmd[1])
5795 {
5796 case 'U':
5797 if (opts->debug_output)
5798 output_line_command(pfile, 0, same_file);
5799 do_undef(pfile, NULL, (unsigned char *)pend->arg,
5800 (unsigned char *)pend->arg + strlen(pend->arg));
5801 break;
5802 case 'D':
5803 if (opts->debug_output)
5804 output_line_command(pfile, 0, same_file);
5805 cpp_define(pfile, (unsigned char *)pend->arg);
5806 break;
5807 case 'A':
5808 make_assertion(pfile, "-A", pend->arg);
5809 break;
5810 }
5811 }
5812 }
5813
5814 opts->done_initializing = 1;
5815
5816 { /* read the appropriate environment variable and if it exists
5817 * replace include_defaults with the listed path. */
5818 char *epath = 0;
5819
5820 switch ((opts->objc << 1) + opts->cplusplus)
5821 {
5822 case 0:
5823 epath = getenv("C_INCLUDE_PATH");
5824 break;
5825 case 1:
5826 epath = getenv("CPLUS_INCLUDE_PATH");
5827 break;
5828 case 2:
5829 epath = getenv("OBJC_INCLUDE_PATH");
5830 break;
5831 case 3:
5832 epath = getenv("OBJCPLUS_INCLUDE_PATH");
5833 break;
5834 }
5835 /* If the environment var for this language is set,
5836 * add to the default list of include directories. */
5837 if (epath)
5838 {
5839 char *nstore = (char *)alloca(strlen(epath) + 2);
5840 int num_dirs;
5841 char *startp, *endp;
5842
5843 for (num_dirs = 1, startp = epath; *startp; startp++)
5844 if (*startp == PATH_SEPARATOR)
5845 num_dirs++;
5846 include_defaults
5847 = (struct default_include *)xmalloc((num_dirs
5848 *
5849 sizeof(struct
5850 default_include)) +
5851 sizeof
5852 (include_defaults_array));
5853
5854 startp = endp = epath;
5855 num_dirs = 0;
5856 while (1)
5857 {
5858 /* Handle cases like c:/usr/lib:d:/gcc/lib */
5859 if ((*endp == PATH_SEPARATOR) || *endp == 0)
5860 {
5861 strncpy(nstore, startp, endp - startp);
5862 if (endp == startp)
5863 strcpy(nstore, ".");
5864 else
5865 nstore[endp - startp] = '\0';
5866
5867 include_defaults[num_dirs].fname = savestring(nstore);
5868 include_defaults[num_dirs].cplusplus = opts->cplusplus;
5869 include_defaults[num_dirs].cxx_aware = 1;
5870 num_dirs++;
5871 if (*endp == '\0')
5872 break;
5873 endp = startp = endp + 1;
5874 }
5875 else
5876 endp++;
5877 }
5878 /* Put the usual defaults back in at the end. */
5879 memcpy((char *)&include_defaults[num_dirs],
5880 (char *)include_defaults_array,
5881 sizeof(include_defaults_array));
5882 }
5883 }
5884
5885 append_include_chain(pfile, opts->before_system, opts->last_before_system);
5886 opts->first_system_include = opts->before_system;
5887
5888 /* Unless -fnostdinc,
5889 * tack on the standard include file dirs to the specified list */
5890 if (!opts->no_standard_includes)
5891 {
5892 struct default_include *di = include_defaults;
5893 char *specd_prefix = opts->include_prefix;
5894 char *default_prefix = savestring(GCC_INCLUDE_DIR);
5895 int default_len = 0;
5896
5897 /* Remove the `include' from /usr/local/lib/gcc.../include. */
5898 if (!strcmp(default_prefix + strlen(default_prefix) - 8, "/include"))
5899 {
5900 default_len = strlen(default_prefix) - 7;
5901 default_prefix[default_len] = 0;
5902 }
5903 /* Search "translated" versions of GNU directories.
5904 * These have /usr/local/lib/gcc... replaced by specd_prefix. */
5905 if (specd_prefix && default_len != 0)
5906 for (di = include_defaults; di->fname; di++)
5907 {
5908 /* Some standard dirs are only for C++. */
5909 if (!di->cplusplus
5910 || (opts->cplusplus
5911 && !opts->no_standard_cplusplus_includes))
5912 {
5913 /* Does this dir start with the prefix? */
5914 if (!strncmp(di->fname, default_prefix, default_len))
5915 {
5916 /* Yes; change prefix and add to search list. */
5917 file_name_list *new_
5918 =
5919 (file_name_list *) xmalloc(sizeof(file_name_list));
5920 int this_len =
5921 strlen(specd_prefix) + strlen(di->fname) -
5922 default_len;
5923 char *str =
5924 (char *)xmalloc(this_len + 1);
5925
5926 strcpy(str, specd_prefix);
5927 strcat(str, di->fname + default_len);
5928 new_->fname = str;
5929 new_->control_macro = 0;
5930 new_->c_system_include_path = !di->cxx_aware;
5931 new_->got_name_map = 0;
5932 append_include_chain(pfile, new_, new_);
5933 if (!opts->first_system_include)
5934 opts->first_system_include = new_;
5935 }
5936 }
5937 }
5938 /* Search ordinary names for GNU include directories. */
5939 for (di = include_defaults; di->fname; di++)
5940 {
5941 /* Some standard dirs are only for C++. */
5942 if (!di->cplusplus
5943 || (opts->cplusplus && !opts->no_standard_cplusplus_includes))
5944 {
5945 file_name_list *new_
5946 = (file_name_list *) xmalloc(sizeof(file_name_list));
5947
5948 new_->control_macro = 0;
5949 new_->c_system_include_path = !di->cxx_aware;
5950 new_->fname = (char *)di->fname;
5951 new_->got_name_map = 0;
5952 append_include_chain(pfile, new_, new_);
5953 if (!opts->first_system_include)
5954 opts->first_system_include = new_;
5955 }
5956 }
5957 }
5958 /* Tack the after_include chain at the end of the include chain. */
5959 append_include_chain(pfile, opts->after_include, opts->last_after_include);
5960 if (!opts->first_system_include)
5961 opts->first_system_include = opts->after_include;
5962
5963 /* With -v, print the list of dirs to search. */
5964 if (opts->verbose)
5965 {
5966 file_name_list *fl;
5967
5968 fprintf(stderr, "#include \"...\" search starts here:\n");
5969 for (fl = opts->include; fl; fl = fl->next)
5970 {
5971 if (fl == opts->first_bracket_include)
5972 fprintf(stderr, "#include <...> search starts here:\n");
5973 fprintf(stderr, " %s\n", fl->fname);
5974 }
5975 fprintf(stderr, "End of search list.\n");
5976 }
5977 /* Scan the -imacros files before the main input.
5978 * Much like #including them, but with no_output set
5979 * so that only their macro definitions matter. */
5980
5981 opts->no_output++;
5982 pfile->no_record_file++;
5983 for (pend = opts->pending; pend; pend = pend->next)
5984 {
5985 if (pend->cmd && strcmp(pend->cmd, "-imacros") == 0)
5986 {
5987 int fd = open(pend->arg, O_RDONLY | O_BINARY, 0666);
5988
5989 if (fd < 0)
5990 {
5991 cpp_perror_with_name(pfile, pend->arg);
5992 return FATAL_EXIT_CODE;
5993 }
5994 cpp_push_buffer(pfile, NULL, 0);
5995 finclude(pfile, fd, pend->arg, 0, NULL);
5996 cpp_scan_buffer(pfile);
5997 }
5998 }
5999 opts->no_output--;
6000 pfile->no_record_file--;
6001
6002 /* Copy the entire contents of the main input file into
6003 * the stacked input buffer previously allocated for it. */
6004 if (!fname || *fname == 0)
6005 {
6006 fname = "";
6007 f = 0;
6008 }
6009 else if ((f = open(fname, O_RDONLY | O_BINARY, 0666)) < 0)
6010 cpp_pfatal_with_name(pfile, fname);
6011
6012 /* -MG doesn't select the form of output and must be specified with one of
6013 * -M or -MM. -MG doesn't make sense with -MD or -MMD since they don't
6014 * inhibit compilation. */
6015 if (opts->print_deps_missing_files
6016 && (opts->print_deps == 0 || !opts->no_output))
6017 cpp_fatal("-MG must be specified with one of -M or -MM");
6018
6019 /* Either of two environment variables can specify output of deps.
6020 * Its value is either "OUTPUT_FILE" or "OUTPUT_FILE DEPS_TARGET",
6021 * where OUTPUT_FILE is the file to write deps info to
6022 * and DEPS_TARGET is the target to mention in the deps. */
6023
6024 if (opts->print_deps == 0
6025 && (getenv("SUNPRO_DEPENDENCIES") != 0
6026 || getenv("DEPENDENCIES_OUTPUT") != 0))
6027 {
6028 char *spec = getenv("DEPENDENCIES_OUTPUT");
6029 char *s;
6030 char *output_file;
6031
6032 if (!spec)
6033 {
6034 spec = getenv("SUNPRO_DEPENDENCIES");
6035 opts->print_deps = 2;
6036 }
6037 else
6038 opts->print_deps = 1;
6039
6040 s = spec;
6041 /* Find the space before the DEPS_TARGET, if there is one. */
6042 /* This should use index. (mrs) */
6043 while (*s != 0 && *s != ' ')
6044 s++;
6045 if (*s != 0)
6046 {
6047 opts->deps_target = s + 1;
6048 output_file = (char *)xmalloc(s - spec + 1);
6049 memcpy(output_file, spec, s - spec);
6050 output_file[s - spec] = 0;
6051 }
6052 else
6053 {
6054 opts->deps_target = 0;
6055 output_file = spec;
6056 }
6057
6058 opts->deps_file = output_file;
6059 opts->print_deps_append = 1;
6060 }
6061 /* For -M, print the expected object file name
6062 * as the target of this Make-rule. */
6063 if (opts->print_deps)
6064 {
6065 pfile->deps_allocated_size = 200;
6066 pfile->deps_buffer = (char *)xmalloc(pfile->deps_allocated_size);
6067 pfile->deps_buffer[0] = 0;
6068 pfile->deps_size = 0;
6069 pfile->deps_column = 0;
6070
6071 if (opts->deps_target)
6072 deps_output(pfile, opts->deps_target, ':');
6073 else if (*opts->in_fname == 0)
6074 deps_output(pfile, "-", ':');
6075 else
6076 {
6077 char *q;
6078 int len;
6079
6080 /* Discard all directory prefixes from filename. */
6081 if ((q = (char *)strrchr(opts->in_fname, '/'))
6082#ifdef DIR_SEPARATOR
6083 && (q = strrchr(opts->in_fname, DIR_SEPARATOR))
6084#endif
6085 )
6086 ++q;
6087 else
6088 q = (char *)opts->in_fname;
6089
6090 /* Copy remainder to mungable area. */
6091 p = (char *)alloca(strlen(q) + 8);
6092 strcpy(p, q);
6093
6094 /* Output P, but remove known suffixes. */
6095 len = strlen(p);
6096 q = p + len;
6097 if (len >= 2 && p[len - 2] == '.' && strchr("cCsSm", p[len - 1]))
6098 q = p + (len - 2);
6099 else if (len >= 3
6100 && p[len - 3] == '.'
6101 && p[len - 2] == 'c' && p[len - 1] == 'c')
6102 q = p + (len - 3);
6103 else if (len >= 4
6104 && p[len - 4] == '.'
6105 && p[len - 3] == 'c'
6106 && p[len - 2] == 'x' && p[len - 1] == 'x')
6107 q = p + (len - 4);
6108 else if (len >= 4
6109 && p[len - 4] == '.'
6110 && p[len - 3] == 'c'
6111 && p[len - 2] == 'p' && p[len - 1] == 'p')
6112 q = p + (len - 4);
6113
6114 /* Supply our own suffix. */
6115 strcpy(q, ".o");
6116
6117 deps_output(pfile, p, ':');
6118 deps_output(pfile, opts->in_fname, ' ');
6119 }
6120 }
6121
6122 /* Scan the -include files before the main input.
6123 * We push these in reverse order, so that the first one is handled first. */
6124
6125 pfile->no_record_file++;
6126 opts->pending = nreverse_pending(opts->pending);
6127 for (pend = opts->pending; pend; pend = pend->next)
6128 {
6129 if (pend->cmd && strcmp(pend->cmd, "-include") == 0)
6130 {
6131 int fd = open(pend->arg, O_RDONLY | O_BINARY, 0666);
6132
6133 if (fd < 0)
6134 {
6135 cpp_perror_with_name(pfile, pend->arg);
6136 return FATAL_EXIT_CODE;
6137 }
6138 cpp_push_buffer(pfile, NULL, 0);
6139 finclude(pfile, fd, pend->arg, 0, NULL);
6140 }
6141 }
6142 pfile->no_record_file--;
6143
6144 /* Free the pending list. */
6145 for (pend = opts->pending; pend;)
6146 {
6147 struct cpp_pending *next = pend->next;
6148
6149 free(pend);
6150 pend = next;
6151 }
6152 opts->pending = NULL;
6153
6154 if (finclude(pfile, f, fname, 0, NULL))
6155 output_line_command(pfile, 0, same_file);
6156 return SUCCESS_EXIT_CODE;
6157}
6158
6159void
6160init_parse_file(cpp_reader * pfile)
6161{
6162 memset((char *)pfile, 0, sizeof(cpp_reader));
6163 pfile->get_token = cpp_get_token;
6164
6165 pfile->token_buffer_size = 200;
6166 pfile->token_buffer = (unsigned char *)xmalloc(pfile->token_buffer_size);
6167 CPP_SET_WRITTEN(pfile, 0);
6168
6169 pfile->system_include_depth = 0;
6170 pfile->dont_repeat_files = 0;
6171 pfile->all_include_files = 0;
6172 pfile->max_include_len = 0;
6173 pfile->timebuf = NULL;
6174 pfile->only_seen_white = 1;
6175 pfile->buffer = CPP_NULL_BUFFER(pfile);
6176}
6177
6178static struct cpp_pending *
6179nreverse_pending(struct cpp_pending *list)
6180{
6181 struct cpp_pending *prev = 0, *next, *pend;
6182
6183 for (pend = list; pend; pend = next)
6184 {
6185 next = pend->next;
6186 pend->next = prev;
6187 prev = pend;
6188 }
6189 return prev;
6190}
6191
6192static void
6193push_pending(cpp_reader * pfile, const char *cmd, const char *arg)
6194{
6195 struct cpp_pending *pend
6196 = (struct cpp_pending *)xmalloc(sizeof(struct cpp_pending));
6197
6198 pend->cmd = cmd;
6199 pend->arg = arg;
6200 pend->next = CPP_OPTIONS(pfile)->pending;
6201 CPP_OPTIONS(pfile)->pending = pend;
6202}
6203
6204/* Handle command-line options in (argc, argv).
6205 * Can be called multiple times, to handle multiple sets of options.
6206 * Returns if an unrecognized option is seen.
6207 * Returns number of handled arguments. */
6208
6209int
6210cpp_handle_options(cpp_reader * pfile, int argc, char **argv)
6211{
6212 int i;
6213 struct cpp_options *opts = CPP_OPTIONS(pfile);
6214
6215 for (i = 0; i < argc; i++)
6216 {
6217 if (argv[i][0] != '-')
6218 {
6219 if (opts->out_fname)
6220 cpp_fatal("Usage: %s [switches] input output", argv[0]);
6221 else if (opts->in_fname)
6222 opts->out_fname = argv[i];
6223 else
6224 opts->in_fname = argv[i];
6225 }
6226 else
6227 {
6228 switch (argv[i][1])
6229 {
6230
6231 case 'i':
6232 if (!strcmp(argv[i], "-include")
6233 || !strcmp(argv[i], "-imacros"))
6234 {
6235 if (i + 1 == argc)
6236 cpp_fatal("Filename missing after `%s' option",
6237 argv[i]);
6238 else
6239 push_pending(pfile, argv[i], argv[i + 1]), i++;
6240 }
6241 if (!strcmp(argv[i], "-iprefix"))
6242 {
6243 if (i + 1 == argc)
6244 cpp_fatal("Filename missing after `-iprefix' option");
6245 else
6246 opts->include_prefix = argv[++i];
6247 }
6248 if (!strcmp(argv[i], "-ifoutput"))
6249 {
6250 opts->output_conditionals = 1;
6251 }
6252 if (!strcmp(argv[i], "-isystem"))
6253 {
6254 file_name_list *dirtmp;
6255
6256 if (i + 1 == argc)
6257 cpp_fatal("Filename missing after `-isystem' option");
6258
6259 dirtmp =
6260 (file_name_list *) xmalloc(sizeof(file_name_list));
6261
6262 dirtmp->next = 0;
6263 dirtmp->control_macro = 0;
6264 dirtmp->c_system_include_path = 1;
6265 dirtmp->fname = (char *)xmalloc(strlen(argv[i + 1]) + 1);
6266 strcpy(dirtmp->fname, argv[++i]);
6267 dirtmp->got_name_map = 0;
6268
6269 if (!opts->before_system)
6270 opts->before_system = dirtmp;
6271 else
6272 opts->last_before_system->next = dirtmp;
6273 opts->last_before_system = dirtmp; /* Tail follows the last one */
6274 }
6275 /* Add directory to end of path for includes,
6276 * with the default prefix at the front of its name. */
6277 if (!strcmp(argv[i], "-iwithprefix"))
6278 {
6279 file_name_list *dirtmp;
6280 char *prefix;
6281
6282 if (opts->include_prefix)
6283 prefix = opts->include_prefix;
6284 else
6285 {
6286 prefix = savestring(GCC_INCLUDE_DIR);
6287 /* Remove the `include' from /usr/local/lib/gcc.../include. */
6288 if (!strcmp
6289 (prefix + strlen(prefix) - 8, "/include"))
6290 prefix[strlen(prefix) - 7] = 0;
6291 }
6292
6293 dirtmp =
6294 (file_name_list *) xmalloc(sizeof(file_name_list));
6295
6296 dirtmp->next = 0; /* New one goes on the end */
6297 dirtmp->control_macro = 0;
6298 dirtmp->c_system_include_path = 0;
6299 if (i + 1 == argc)
6300 cpp_fatal
6301 ("Directory name missing after `-iwithprefix' option");
6302
6303 dirtmp->fname = (char *)xmalloc(strlen(argv[i + 1])
6304 + strlen(prefix) + 1);
6305 strcpy(dirtmp->fname, prefix);
6306 strcat(dirtmp->fname, argv[++i]);
6307 dirtmp->got_name_map = 0;
6308
6309 if (!opts->after_include)
6310 opts->after_include = dirtmp;
6311 else
6312 opts->last_after_include->next = dirtmp;
6313 opts->last_after_include = dirtmp; /* Tail follows the last one */
6314 }
6315 /* Add directory to main path for includes,
6316 * with the default prefix at the front of its name. */
6317 if (!strcmp(argv[i], "-iwithprefixbefore"))
6318 {
6319 file_name_list *dirtmp;
6320 char *prefix;
6321
6322 if (opts->include_prefix)
6323 prefix = opts->include_prefix;
6324 else
6325 {
6326 prefix = savestring(GCC_INCLUDE_DIR);
6327 /* Remove the `include' from /usr/local/lib/gcc.../include. */
6328 if (!strcmp
6329 (prefix + strlen(prefix) - 8, "/include"))
6330 prefix[strlen(prefix) - 7] = 0;
6331 }
6332
6333 dirtmp =
6334 (file_name_list *) xmalloc(sizeof(file_name_list));
6335
6336 dirtmp->next = 0; /* New one goes on the end */
6337 dirtmp->control_macro = 0;
6338 dirtmp->c_system_include_path = 0;
6339 if (i + 1 == argc)
6340 cpp_fatal
6341 ("Directory name missing after `-iwithprefixbefore' option");
6342
6343 dirtmp->fname = (char *)xmalloc(strlen(argv[i + 1])
6344 + strlen(prefix) + 1);
6345 strcpy(dirtmp->fname, prefix);
6346 strcat(dirtmp->fname, argv[++i]);
6347 dirtmp->got_name_map = 0;
6348
6349 append_include_chain(pfile, dirtmp, dirtmp);
6350 }
6351 /* Add directory to end of path for includes. */
6352 if (!strcmp(argv[i], "-idirafter"))
6353 {
6354 file_name_list *dirtmp;
6355
6356 dirtmp =
6357 (file_name_list *) xmalloc(sizeof(file_name_list));
6358
6359 dirtmp->next = 0; /* New one goes on the end */
6360 dirtmp->control_macro = 0;
6361 dirtmp->c_system_include_path = 0;
6362 if (i + 1 == argc)
6363 cpp_fatal
6364 ("Directory name missing after `-idirafter' option");
6365 else
6366 dirtmp->fname = argv[++i];
6367 dirtmp->got_name_map = 0;
6368
6369 if (!opts->after_include)
6370 opts->after_include = dirtmp;
6371 else
6372 opts->last_after_include->next = dirtmp;
6373 opts->last_after_include = dirtmp; /* Tail follows the last one */
6374 }
6375 break;
6376
6377 case 'o':
6378 if (opts->out_fname)
6379 cpp_fatal("Output filename specified twice");
6380 if (i + 1 == argc)
6381 cpp_fatal("Filename missing after -o option");
6382 opts->out_fname = argv[++i];
6383 if (!strcmp(opts->out_fname, "-"))
6384 opts->out_fname = "";
6385 break;
6386
6387 case 'p':
6388 if (!strcmp(argv[i], "-pedantic"))
6389 CPP_PEDANTIC(pfile) = 1;
6390 else if (!strcmp(argv[i], "-pedantic-errors"))
6391 {
6392 CPP_PEDANTIC(pfile) = 1;
6393 opts->pedantic_errors = 1;
6394 }
6395 break;
6396
6397 case 't':
6398 if (!strcmp(argv[i], "-trigraphs"))
6399 {
6400 if (!opts->chill)
6401 opts->no_trigraphs = 0;
6402 }
6403 break;
6404
6405 case 'l':
6406 if (!strcmp(argv[i], "-lang-c"))
6407 opts->cplusplus = 0, opts->cplusplus_comments =
6408 0, opts->objc = 0;
6409 if (!strcmp(argv[i], "-lang-c++"))
6410 opts->cplusplus = 1, opts->cplusplus_comments =
6411 1, opts->objc = 0;
6412 if (!strcmp(argv[i], "-lang-c-c++-comments"))
6413 opts->cplusplus = 0, opts->cplusplus_comments =
6414 1, opts->objc = 0;
6415 if (!strcmp(argv[i], "-lang-objc"))
6416 opts->objc = 1, opts->cplusplus =
6417 0, opts->cplusplus_comments = 1;
6418 if (!strcmp(argv[i], "-lang-objc++"))
6419 opts->objc = 1, opts->cplusplus =
6420 1, opts->cplusplus_comments = 1;
6421 if (!strcmp(argv[i], "-lang-asm"))
6422 opts->lang_asm = 1;
6423 if (!strcmp(argv[i], "-lint"))
6424 opts->for_lint = 1;
6425 if (!strcmp(argv[i], "-lang-chill"))
6426 opts->objc = 0, opts->cplusplus = 0, opts->chill = 1,
6427 opts->traditional = 1, opts->no_trigraphs = 1;
6428 break;
6429
6430 case '+':
6431 opts->cplusplus = 1, opts->cplusplus_comments = 1;
6432 break;
6433
6434 case 'w':
6435 opts->inhibit_warnings = 1;
6436 break;
6437
6438 case 'W':
6439 if (!strcmp(argv[i], "-Wtrigraphs"))
6440 opts->warn_trigraphs = 1;
6441 else if (!strcmp(argv[i], "-Wno-trigraphs"))
6442 opts->warn_trigraphs = 0;
6443 else if (!strcmp(argv[i], "-Wcomment"))
6444 opts->warn_comments = 1;
6445 else if (!strcmp(argv[i], "-Wno-comment"))
6446 opts->warn_comments = 0;
6447 else if (!strcmp(argv[i], "-Wcomments"))
6448 opts->warn_comments = 1;
6449 else if (!strcmp(argv[i], "-Wno-comments"))
6450 opts->warn_comments = 0;
6451 else if (!strcmp(argv[i], "-Wtraditional"))
6452 opts->warn_stringify = 1;
6453 else if (!strcmp(argv[i], "-Wno-traditional"))
6454 opts->warn_stringify = 0;
6455 else if (!strcmp(argv[i], "-Wimport"))
6456 opts->warn_import = 1;
6457 else if (!strcmp(argv[i], "-Wno-import"))
6458 opts->warn_import = 0;
6459 else if (!strcmp(argv[i], "-Werror"))
6460 opts->warnings_are_errors = 1;
6461 else if (!strcmp(argv[i], "-Wno-error"))
6462 opts->warnings_are_errors = 0;
6463 else if (!strcmp(argv[i], "-Wall"))
6464 {
6465 opts->warn_trigraphs = 1;
6466 opts->warn_comments = 1;
6467 }
6468 break;
6469
6470 case 'M':
6471 /* The style of the choices here is a bit mixed.
6472 * The chosen scheme is a hybrid of keeping all options in one string
6473 * and specifying each option in a separate argument:
6474 * -M|-MM|-MD file|-MMD file [-MG]. An alternative is:
6475 * -M|-MM|-MD file|-MMD file|-MG|-MMG; or more concisely:
6476 * -M[M][G][D file]. This is awkward to handle in specs, and is not
6477 * as extensible. */
6478 /* ??? -MG must be specified in addition to one of -M or -MM.
6479 * This can be relaxed in the future without breaking anything.
6480 * The converse isn't true. */
6481
6482 /* -MG isn't valid with -MD or -MMD. This is checked for later. */
6483 if (!strcmp(argv[i], "-MG"))
6484 {
6485 opts->print_deps_missing_files = 1;
6486 break;
6487 }
6488 if (!strcmp(argv[i], "-M"))
6489 opts->print_deps = 2;
6490 else if (!strcmp(argv[i], "-MM"))
6491 opts->print_deps = 1;
6492 else if (!strcmp(argv[i], "-MD"))
6493 opts->print_deps = 2;
6494 else if (!strcmp(argv[i], "-MMD"))
6495 opts->print_deps = 1;
6496 /* For -MD and -MMD options, write deps on file named by next arg. */
6497 if (!strcmp(argv[i], "-MD") || !strcmp(argv[i], "-MMD"))
6498 {
6499 if (i + 1 == argc)
6500 cpp_fatal("Filename missing after %s option",
6501 argv[i]);
6502 opts->deps_file = argv[++i];
6503 }
6504 else
6505 {
6506 /* For -M and -MM, write deps on standard output
6507 * and suppress the usual output. */
6508 opts->no_output = 1;
6509 }
6510 break;
6511
6512 case 'd':
6513 {
6514 char *p = argv[i] + 2;
6515 char c;
6516
6517 while ((c = *p++) != 0)
6518 {
6519 /* Arg to -d specifies what parts of macros to dump */
6520 switch (c)
6521 {
6522 case 'M':
6523 opts->dump_macros = dump_only;
6524 opts->no_output = 1;
6525 break;
6526 case 'N':
6527 opts->dump_macros = dump_names;
6528 break;
6529 case 'D':
6530 opts->dump_macros = dump_definitions;
6531 break;
6532 }
6533 }
6534 }
6535 break;
6536
6537 case 'g':
6538 if (argv[i][2] == '3')
6539 opts->debug_output = 1;
6540 break;
6541
6542 case 'v':
6543 fprintf(stderr, "GNU CPP version %s", version_string);
6544#ifdef TARGET_VERSION
6545 TARGET_VERSION;
6546#endif
6547 fprintf(stderr, "\n");
6548 opts->verbose = 1;
6549 break;
6550
6551 case 'H':
6552 opts->print_include_names = 1;
6553 break;
6554
6555 case 'D':
6556 if (argv[i][2] != 0)
6557 push_pending(pfile, "-D", argv[i] + 2);
6558 else if (i + 1 == argc)
6559 cpp_fatal("Macro name missing after -D option");
6560 else
6561 i++, push_pending(pfile, "-D", argv[i]);
6562 break;
6563
6564 case 'A':
6565 {
6566 char *p = NULL;
6567
6568 if (argv[i][2] != 0)
6569 p = argv[i] + 2;
6570 else if (i + 1 == argc)
6571 cpp_fatal("Assertion missing after -A option");
6572 else
6573 p = argv[++i];
6574
6575 if (!strcmp(p, "-"))
6576 {
6577 struct cpp_pending **ptr;
6578
6579 /* -A- eliminates all predefined macros and assertions.
6580 * Let's include also any that were specified earlier
6581 * on the command line. That way we can get rid of any
6582 * that were passed automatically in from GCC. */
6583
6584 opts->inhibit_predefs = 1;
6585 for (ptr = &opts->pending; *ptr;)
6586 {
6587 struct cpp_pending *pend = *ptr;
6588
6589 if (pend->cmd && pend->cmd[0] == '-'
6590 && (pend->cmd[1] == 'D'
6591 || pend->cmd[1] == 'A'))
6592 {
6593 *ptr = pend->next;
6594 free(pend);
6595 }
6596 else
6597 ptr = &pend->next;
6598 }
6599 }
6600 else
6601 {
6602 push_pending(pfile, "-A", p);
6603 }
6604 }
6605 break;
6606
6607 case 'U': /* JF #undef something */
6608 if (argv[i][2] != 0)
6609 push_pending(pfile, "-U", argv[i] + 2);
6610 else if (i + 1 == argc)
6611 cpp_fatal("Macro name missing after -U option");
6612 else
6613 push_pending(pfile, "-U", argv[i + 1]), i++;
6614 break;
6615
6616 case 'C':
6617 opts->put_out_comments = 1;
6618 break;
6619
6620 case 'E': /* -E comes from cc -E; ignore it. */
6621 break;
6622
6623 case 'P':
6624 opts->no_line_commands = 1;
6625 break;
6626
6627 case '$': /* Don't include $ in identifiers. */
6628 opts->dollars_in_ident = 0;
6629 break;
6630
6631 case 'I': /* Add directory to path for includes. */
6632 {
6633 file_name_list *dirtmp;
6634
6635 if (!CPP_OPTIONS(pfile)->ignore_srcdir
6636 && !strcmp(argv[i] + 2, "-"))
6637 {
6638 CPP_OPTIONS(pfile)->ignore_srcdir = 1;
6639 /* Don't use any preceding -I directories for #include <...>. */
6640 CPP_OPTIONS(pfile)->first_bracket_include = 0;
6641 }
6642 else
6643 {
6644 dirtmp =
6645 (file_name_list *) xmalloc(sizeof(file_name_list));
6646
6647 dirtmp->next = 0; /* New one goes on the end */
6648 dirtmp->control_macro = 0;
6649 dirtmp->c_system_include_path = 0;
6650 if (argv[i][2] != 0)
6651 dirtmp->fname = argv[i] + 2;
6652 else if (i + 1 == argc)
6653 cpp_fatal
6654 ("Directory name missing after -I option");
6655 else
6656 dirtmp->fname = argv[++i];
6657 dirtmp->got_name_map = 0;
6658 append_include_chain(pfile, dirtmp, dirtmp);
6659 }
6660 }
6661 break;
6662
6663 case 'n':
6664 if (!strcmp(argv[i], "-nostdinc"))
6665 /* -nostdinc causes no default include directories.
6666 * You must specify all include-file directories with -I. */
6667 opts->no_standard_includes = 1;
6668 else if (!strcmp(argv[i], "-nostdinc++"))
6669 /* -nostdinc++ causes no default C++-specific include directories. */
6670 opts->no_standard_cplusplus_includes = 1;
6671 break;
6672
6673 case 'u':
6674 /* Sun compiler passes undocumented switch "-undef".
6675 * Let's assume it means to inhibit the predefined symbols. */
6676 opts->inhibit_predefs = 1;
6677 break;
6678
6679 case '\0': /* JF handle '-' as file name meaning stdin or stdout */
6680 if (!opts->in_fname)
6681 {
6682 opts->in_fname = "";
6683 break;
6684 }
6685 else if (!opts->out_fname)
6686 {
6687 opts->out_fname = "";
6688 break;
6689 } /* else fall through into error */
6690 default:
6691 return i;
6692 }
6693 }
6694 }
6695 return i;
6696}
6697
6698void
6699cpp_finish(cpp_reader * pfile)
6700{
6701 struct cpp_options *opts = CPP_OPTIONS(pfile);
6702
6703 if (opts->print_deps)
6704 {
6705 /* Stream on which to print the dependency information. */
6706 FILE *deps_stream;
6707
6708 /* Don't actually write the deps file if compilation has failed. */
6709 if (pfile->errors == 0)
6710 {
6711 const char *deps_mode =
6712 opts->print_deps_append ? "ab" : "wb";
6713
6714 if (!opts->deps_file)
6715 deps_stream = stdout;
6716 else if (!(deps_stream = fopen(opts->deps_file, deps_mode)))
6717 cpp_pfatal_with_name(pfile, opts->deps_file);
6718 fputs(pfile->deps_buffer, deps_stream);
6719 putc('\n', deps_stream);
6720 if (opts->deps_file)
6721 {
6722 if (ferror(deps_stream) || fclose(deps_stream) != 0)
6723 cpp_fatal("I/O error on output");
6724 }
6725 }
6726 }
6727}
6728
6729static int
6730do_assert(cpp_reader * pfile, struct directive *keyword __UNUSED__,
6731 unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__)
6732{
6733 long symstart; /* remember where symbol name starts */
6734 int c;
6735 int sym_length; /* and how long it is */
6736 struct arglist *tokens = NULL;
6737
6738 if (CPP_PEDANTIC(pfile) && CPP_OPTIONS(pfile)->done_initializing
6739 && !CPP_BUFFER(pfile)->system_header_p)
6740 cpp_pedwarn(pfile, "ANSI C does not allow `#assert'");
6741
6742 cpp_skip_hspace(pfile);
6743 symstart = CPP_WRITTEN(pfile); /* remember where it starts */
6744 parse_name(pfile, GETC());
6745 sym_length = check_macro_name(pfile, pfile->token_buffer + symstart,
6746 "assertion");
6747
6748 cpp_skip_hspace(pfile);
6749 if (PEEKC() != '(')
6750 {
6751 cpp_error(pfile, "missing token-sequence in `#assert'");
6752 goto error;
6753 }
6754 {
6755 int error_flag = 0;
6756
6757 tokens = read_token_list(pfile, &error_flag);
6758 if (error_flag)
6759 goto error;
6760 if (!tokens)
6761 {
6762 cpp_error(pfile, "empty token-sequence in `#assert'");
6763 goto error;
6764 }
6765 cpp_skip_hspace(pfile);
6766 c = PEEKC();
6767 if (c != EOF && c != '\n')
6768 cpp_pedwarn(pfile, "junk at end of `#assert'");
6769 skip_rest_of_line(pfile);
6770 }
6771
6772 /* If this name isn't already an assertion name, make it one.
6773 * Error if it was already in use in some other way. */
6774
6775 {
6776 ASSERTION_HASHNODE *hp;
6777 const char *symname = (char *)pfile->token_buffer + symstart;
6778 int hashcode =
6779 hashf(symname, sym_length, ASSERTION_HASHSIZE);
6780 struct tokenlist_list *value =
6781 (struct tokenlist_list *)xmalloc(sizeof(struct tokenlist_list));
6782
6783 hp = assertion_lookup(pfile, symname, sym_length, hashcode);
6784 if (!hp)
6785 {
6786 if (sym_length == 7 && !strncmp(symname, "defined", sym_length))
6787 cpp_error(pfile, "`defined' redefined as assertion");
6788 hp = assertion_install(pfile, symname, sym_length, hashcode);
6789 }
6790 /* Add the spec'd token-sequence to the list of such. */
6791 value->tokens = tokens;
6792 value->next = hp->value;
6793 hp->value = value;
6794 }
6795 CPP_SET_WRITTEN(pfile, symstart); /* Pop */
6796 return 0;
6797 error:
6798 CPP_SET_WRITTEN(pfile, symstart); /* Pop */
6799 skip_rest_of_line(pfile);
6800 return 1;
6801}
6802
6803static int
6804do_unassert(cpp_reader * pfile, struct directive *keyword __UNUSED__,
6805 unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__)
6806{
6807 long symstart; /* remember where symbol name starts */
6808 int sym_length; /* and how long it is */
6809 int c;
6810
6811 struct arglist *tokens = NULL;
6812 int tokens_specified = 0;
6813
6814 if (CPP_PEDANTIC(pfile) && CPP_OPTIONS(pfile)->done_initializing
6815 && !CPP_BUFFER(pfile)->system_header_p)
6816 cpp_pedwarn(pfile, "ANSI C does not allow `#unassert'");
6817
6818 cpp_skip_hspace(pfile);
6819
6820 symstart = CPP_WRITTEN(pfile); /* remember where it starts */
6821 parse_name(pfile, GETC());
6822 sym_length = check_macro_name(pfile, pfile->token_buffer + symstart,
6823 "assertion");
6824
6825 cpp_skip_hspace(pfile);
6826 if (PEEKC() == '(')
6827 {
6828 int error_flag = 0;
6829
6830 tokens = read_token_list(pfile, &error_flag);
6831 if (error_flag)
6832 goto error;
6833 if (!tokens)
6834 {
6835 cpp_error(pfile, "empty token list in `#unassert'");
6836 goto error;
6837 }
6838 tokens_specified = 1;
6839 }
6840 cpp_skip_hspace(pfile);
6841 c = PEEKC();
6842 if (c != EOF && c != '\n')
6843 cpp_error(pfile, "junk at end of `#unassert'");
6844 skip_rest_of_line(pfile);
6845
6846 {
6847 ASSERTION_HASHNODE *hp;
6848 const char *symname = (char *)pfile->token_buffer + symstart;
6849 int hashcode =
6850 hashf(symname, sym_length, ASSERTION_HASHSIZE);
6851 struct tokenlist_list *tail, *prev;
6852
6853 hp = assertion_lookup(pfile, symname, sym_length, hashcode);
6854 if (!hp)
6855 return 1;
6856
6857 /* If no token list was specified, then eliminate this assertion
6858 * entirely. */
6859 if (!tokens_specified)
6860 delete_assertion(hp);
6861 else
6862 {
6863 /* If a list of tokens was given, then delete any matching list. */
6864
6865 tail = hp->value;
6866 prev = 0;
6867 while (tail)
6868 {
6869 struct tokenlist_list *next = tail->next;
6870
6871 if (compare_token_lists(tail->tokens, tokens))
6872 {
6873 if (prev)
6874 prev->next = next;
6875 else
6876 hp->value = tail->next;
6877 free_token_list(tail->tokens);
6878 free(tail);
6879 }
6880 else
6881 {
6882 prev = tail;
6883 }
6884 tail = next;
6885 }
6886 }
6887 }
6888
6889 CPP_SET_WRITTEN(pfile, symstart); /* Pop */
6890 return 0;
6891 error:
6892 CPP_SET_WRITTEN(pfile, symstart); /* Pop */
6893 skip_rest_of_line(pfile);
6894 return 1;
6895}
6896
6897/* Test whether there is an assertion named NAME
6898 * and optionally whether it has an asserted token list TOKENS.
6899 * NAME is not null terminated; its length is SYM_LENGTH.
6900 * If TOKENS_SPECIFIED is 0, then don't check for any token list. */
6901
6902static int
6903check_assertion(cpp_reader * pfile, const char *name, int sym_length,
6904 int tokens_specified, struct arglist *tokens)
6905{
6906 ASSERTION_HASHNODE *hp;
6907 int hashcode = hashf(name, sym_length, ASSERTION_HASHSIZE);
6908
6909 if (CPP_PEDANTIC(pfile) && !CPP_BUFFER(pfile)->system_header_p)
6910 cpp_pedwarn(pfile, "ANSI C does not allow testing assertions");
6911
6912 hp = assertion_lookup(pfile, name, sym_length, hashcode);
6913 if (!hp)
6914 /* It is not an assertion; just return false. */
6915 return 0;
6916
6917 /* If no token list was specified, then value is 1. */
6918 if (!tokens_specified)
6919 return 1;
6920
6921 {
6922 struct tokenlist_list *tail;
6923
6924 tail = hp->value;
6925
6926 /* If a list of tokens was given,
6927 * then succeed if the assertion records a matching list. */
6928
6929 while (tail)
6930 {
6931 if (compare_token_lists(tail->tokens, tokens))
6932 return 1;
6933 tail = tail->next;
6934 }
6935
6936 /* Fail if the assertion has no matching list. */
6937 return 0;
6938 }
6939}
6940
6941/* Compare two lists of tokens for equality including order of tokens. */
6942
6943static int
6944compare_token_lists(struct arglist *l1, struct arglist *l2)
6945{
6946 while (l1 && l2)
6947 {
6948 if (l1->length != l2->length)
6949 return 0;
6950 if (strncmp(l1->name, l2->name, l1->length))
6951 return 0;
6952 l1 = l1->next;
6953 l2 = l2->next;
6954 }
6955
6956 /* Succeed if both lists end at the same time. */
6957 return l1 == l2;
6958}
6959
6960struct arglist *
6961reverse_token_list(struct arglist *tokens)
6962{
6963 struct arglist *prev = 0, *cur, *next;
6964
6965 for (cur = tokens; cur; cur = next)
6966 {
6967 next = cur->next;
6968 cur->next = prev;
6969 prev = cur;
6970 }
6971 return prev;
6972}
6973
6974/* Read a space-separated list of tokens ending in a close parenthesis.
6975 * Return a list of strings, in the order they were written.
6976 * (In case of error, return 0 and store -1 in *ERROR_FLAG.) */
6977
6978static struct arglist *
6979read_token_list(cpp_reader * pfile, int *error_flag)
6980{
6981 struct arglist *token_ptrs = 0;
6982 int depth = 1;
6983 int length;
6984
6985 *error_flag = 0;
6986 FORWARD(1); /* Skip '(' */
6987
6988 /* Loop over the assertion value tokens. */
6989 while (depth > 0)
6990 {
6991 struct arglist *temp;
6992 long name_written = CPP_WRITTEN(pfile);
6993 int c;
6994
6995 cpp_skip_hspace(pfile);
6996
6997 c = GETC();
6998
6999 /* Find the end of the token. */
7000 if (c == '(')
7001 {
7002 CPP_PUTC(pfile, c);
7003 depth++;
7004 }
7005 else if (c == ')')
7006 {
7007 depth--;
7008 if (depth == 0)
7009 break;
7010 CPP_PUTC(pfile, c);
7011 }
7012 else if (c == '"' || c == '\'')
7013 {
7014 FORWARD(-1);
7015 cpp_get_token(pfile);
7016 }
7017 else if (c == '\n')
7018 break;
7019 else
7020 {
7021 while (c != EOF && !is_space[c] && c != '(' && c != ')'
7022 && c != '"' && c != '\'')
7023 {
7024 CPP_PUTC(pfile, c);
7025 c = GETC();
7026 }
7027 if (c != EOF)
7028 FORWARD(-1);
7029 }
7030
7031 length = CPP_WRITTEN(pfile) - name_written;
7032 temp = (struct arglist *)xmalloc(sizeof(struct arglist) + length + 1);
7033
7034 temp->name = (char *)(temp + 1);
7035 memcpy(temp->name, (char *)(pfile->token_buffer + name_written),
7036 length);
7037 temp->name[length] = 0;
7038 temp->next = token_ptrs;
7039 token_ptrs = temp;
7040 temp->length = length;
7041
7042 CPP_ADJUST_WRITTEN(pfile, -length); /* pop */
7043
7044 if (c == EOF || c == '\n')
7045 { /* FIXME */
7046 cpp_error(pfile,
7047 "unterminated token sequence following `#' operator");
7048 return 0;
7049 }
7050 }
7051
7052 /* We accumulated the names in reverse order.
7053 * Now reverse them to get the proper order. */
7054 return reverse_token_list(token_ptrs);
7055}
7056
7057static void
7058free_token_list(struct arglist *tokens)
7059{
7060 while (tokens)
7061 {
7062 struct arglist *next = tokens->next;
7063
7064 free(tokens->name);
7065 free(tokens);
7066 tokens = next;
7067 }
7068}
7069
7070/* Get the file-mode and data size of the file open on FD
7071 * and store them in *MODE_POINTER and *SIZE_POINTER. */
7072
7073static int
7074file_size_and_mode(int fd, int *mode_pointer, long int *size_pointer)
7075{
7076 struct stat sbuf;
7077
7078 if (fstat(fd, &sbuf) < 0)
7079 return (-1);
7080 if (mode_pointer)
7081 *mode_pointer = sbuf.st_mode;
7082 if (size_pointer)
7083 *size_pointer = sbuf.st_size;
7084 return 0;
7085}
7086
7087/* Read LEN bytes at PTR from descriptor DESC, for file FILENAME,
7088 * retrying if necessary. Return a negative value if an error occurs,
7089 * otherwise return the actual number of bytes read,
7090 * which must be LEN unless end-of-file was reached. */
7091
7092static int
7093safe_read(int desc, char *ptr, int len)
7094{
7095 int left = len;
7096
7097 while (left > 0)
7098 {
7099 int nchars = read(desc, ptr, left);
7100
7101 if (nchars < 0)
7102 {
7103#ifdef EINTR
7104 if (errno == EINTR)
7105 continue;
7106#endif
7107 return nchars;
7108 }
7109 if (nchars == 0)
7110 break;
7111 ptr += nchars;
7112 left -= nchars;
7113 }
7114 return len - left;
7115}
7116
7117static char *
7118savestring(const char *input)
7119{
7120 unsigned size = strlen(input);
7121 char *output = (char *)xmalloc(size + 1);
7122
7123 strcpy(output, input);
7124 return output;
7125}
7126
7127/* Initialize PMARK to remember the current position of PFILE. */
7128void
7129parse_set_mark(struct parse_marker *pmark, cpp_reader * pfile)
7130{
7131 cpp_buffer *pbuf = CPP_BUFFER(pfile);
7132
7133 pmark->next = pbuf->marks;
7134 pbuf->marks = pmark;
7135 pmark->buf = pbuf;
7136 pmark->position = pbuf->cur - pbuf->buf;
7137}
7138
7139/* Cleanup PMARK - we no longer need it. */
7140static void
7141parse_clear_mark(struct parse_marker *pmark)
7142{
7143 struct parse_marker **pp = &pmark->buf->marks;
7144
7145 for (;; pp = &(*pp)->next)
7146 {
7147 if (!*pp)
7148 cpp_fatal("internal error", "in parse_set_mark");
7149 if (*pp == pmark)
7150 break;
7151 }
7152 *pp = pmark->next;
7153}
7154
7155/* Backup the current position of PFILE to that saved in PMARK. */
7156
7157static void
7158parse_goto_mark(struct parse_marker *pmark, cpp_reader * pfile)
7159{
7160 cpp_buffer *pbuf = CPP_BUFFER(pfile);
7161
7162 if (pbuf != pmark->buf)
7163 cpp_fatal("internal error %s", "parse_goto_mark");
7164 pbuf->cur = pbuf->buf + pmark->position;
7165}
7166
7167/* Reset PMARK to point to the current position of PFILE. (Same
7168 * as parse_clear_mark (PMARK), parse_set_mark (PMARK, PFILE) but faster. */
7169
7170static void
7171parse_move_mark(struct parse_marker *pmark, cpp_reader * pfile)
7172{
7173 cpp_buffer *pbuf = CPP_BUFFER(pfile);
7174
7175 if (pbuf != pmark->buf)
7176 cpp_fatal("internal error %s", "parse_move_mark");
7177 pmark->position = pbuf->cur - pbuf->buf;
7178}
7179
7180int
7181cpp_read_check_assertion(cpp_reader * pfile)
7182{
7183 int name_start = CPP_WRITTEN(pfile);
7184 int name_length, name_written;
7185 int result;
7186
7187 FORWARD(1); /* Skip '#' */
7188 cpp_skip_hspace(pfile);
7189 parse_name(pfile, GETC());
7190 name_written = CPP_WRITTEN(pfile);
7191 name_length = name_written - name_start;
7192 cpp_skip_hspace(pfile);
7193 if (CPP_BUF_PEEK(CPP_BUFFER(pfile)) == '(')
7194 {
7195 int error_flag;
7196 struct arglist *token_ptrs = read_token_list(pfile, &error_flag);
7197
7198 result = check_assertion(pfile,
7199 (char *)pfile->token_buffer + name_start,
7200 name_length, 1, token_ptrs);
7201 }
7202 else
7203 result = check_assertion(pfile,
7204 (char *)pfile->token_buffer + name_start,
7205 name_length, 0, NULL);
7206 CPP_ADJUST_WRITTEN(pfile, -name_length); /* pop */
7207 return result;
7208}
7209
7210static void
7211cpp_print_file_and_line(cpp_reader * pfile)
7212{
7213 cpp_buffer *ip = cpp_file_buffer(pfile);
7214
7215 if (ip)
7216 {
7217 long line, col;
7218
7219 cpp_buf_line_and_col(ip, &line, &col);
7220 cpp_file_line_for_message(pfile, ip->nominal_fname,
7221 line, pfile->show_column ? col : -1);
7222 }
7223}
7224
7225static void
7226cpp_error_v(cpp_reader * pfile, const char *msg, va_list args)
7227{
7228 cpp_print_containing_files(pfile);
7229 cpp_print_file_and_line(pfile);
7230 cpp_message_v(pfile, 1, msg, args);
7231}
7232
7233void
7234cpp_error(cpp_reader * pfile, const char *msg, ...)
7235{
7236 va_list args;
7237
7238 va_start(args, msg);
7239
7240 cpp_error_v(pfile, msg, args);
7241
7242 va_end(args);
7243}
7244
7245/* Print error message but don't count it. */
7246
7247static void
7248cpp_warning_v(cpp_reader * pfile, const char *msg, va_list args)
7249{
7250 if (CPP_OPTIONS(pfile)->inhibit_warnings)
7251 return;
7252
7253 if (CPP_OPTIONS(pfile)->warnings_are_errors)
7254 pfile->errors++;
7255
7256 cpp_print_containing_files(pfile);
7257 cpp_print_file_and_line(pfile);
7258 cpp_message_v(pfile, 0, msg, args);
7259}
7260
7261void
7262cpp_warning(cpp_reader * pfile, const char *msg, ...)
7263{
7264 va_list args;
7265
7266 va_start(args, msg);
7267
7268 cpp_warning_v(pfile, msg, args);
7269
7270 va_end(args);
7271}
7272
7273/* Print an error message and maybe count it. */
7274
7275void
7276cpp_pedwarn(cpp_reader * pfile, const char *msg, ...)
7277{
7278 va_list args;
7279
7280 va_start(args, msg);
7281
7282 if (CPP_OPTIONS(pfile)->pedantic_errors)
7283 cpp_error_v(pfile, msg, args);
7284 else
7285 cpp_warning_v(pfile, msg, args);
7286
7287 va_end(args);
7288}
7289
7290static void
7291cpp_error_with_line(cpp_reader * pfile, int line, int column, const char *msg)
7292{
7293 cpp_buffer *ip = cpp_file_buffer(pfile);
7294
7295 cpp_print_containing_files(pfile);
7296
7297 if (ip)
7298 cpp_file_line_for_message(pfile, ip->nominal_fname, line, column);
7299
7300 cpp_message(pfile, 1, msg, NULL, NULL, NULL);
7301}
7302
7303static void
7304cpp_warning_with_line(cpp_reader * pfile, int line, int column, const char *msg)
7305{
7306 cpp_buffer *ip;
7307
7308 if (CPP_OPTIONS(pfile)->inhibit_warnings)
7309 return;
7310
7311 if (CPP_OPTIONS(pfile)->warnings_are_errors)
7312 pfile->errors++;
7313
7314 cpp_print_containing_files(pfile);
7315
7316 ip = cpp_file_buffer(pfile);
7317
7318 if (ip)
7319 cpp_file_line_for_message(pfile, ip->nominal_fname, line, column);
7320
7321 cpp_message(pfile, 0, msg, NULL, NULL, NULL);
7322}
7323
7324static void
7325cpp_pedwarn_with_line(cpp_reader * pfile, int line, int column, const char *msg)
7326{
7327 if (CPP_OPTIONS(pfile)->pedantic_errors)
7328 cpp_error_with_line(pfile, column, line, msg);
7329 else
7330 cpp_warning_with_line(pfile, line, column, msg);
7331}
7332
7333/* Report a warning (or an error if pedantic_errors)
7334 * giving specified file name and line number, not current. */
7335
7336void
7337cpp_pedwarn_with_file_and_line(cpp_reader * pfile,
7338 const char *file, int line,
7339 const char *msg, const char *arg1,
7340 const char *arg2, const char *arg3)
7341{
7342 if (!CPP_OPTIONS(pfile)->pedantic_errors
7343 && CPP_OPTIONS(pfile)->inhibit_warnings)
7344 return;
7345 if (file)
7346 cpp_file_line_for_message(pfile, file, line, -1);
7347 cpp_message(pfile, CPP_OPTIONS(pfile)->pedantic_errors,
7348 msg, arg1, arg2, arg3);
7349}
7350
7351/* This defines "errno" properly for VMS, and gives us EACCES. */
7352#include <errno.h>
7353#ifndef errno
7354extern int errno;
7355
7356#endif
7357
7358#ifndef HAVE_STRERROR
7359extern int sys_nerr;
7360
7361#if defined(bsd4_4)
7362extern const char *const sys_errlist[];
7363
7364#else
7365extern char *sys_errlist[];
7366
7367#endif
7368#endif /* HAVE_STRERROR */
7369
7370/*
7371 * my_strerror - return the descriptive text associated with an `errno' code.
7372 */
7373
7374static const char *
7375my_strerror(int errnum)
7376{
7377 const char *result;
7378
7379#ifndef HAVE_STRERROR
7380 result = ((errnum < sys_nerr) ? sys_errlist[errnum] : 0);
7381#else
7382 result = strerror(errnum);
7383#endif
7384
7385 if (!result)
7386 result = "undocumented I/O error";
7387
7388 return result;
7389}
7390
7391/* Error including a message from `errno'. */
7392
7393static void
7394cpp_error_from_errno(cpp_reader * pfile, const char *name)
7395{
7396 cpp_buffer *ip = cpp_file_buffer(pfile);
7397
7398 cpp_print_containing_files(pfile);
7399
7400 if (ip)
7401 cpp_file_line_for_message(pfile, ip->nominal_fname, ip->lineno, -1);
7402
7403 cpp_message(pfile, 1, "%s: %s", name, my_strerror(errno), NULL);
7404}
7405
7406void
7407cpp_perror_with_name(cpp_reader * pfile, const char *name)
7408{
7409 cpp_message(pfile, 1, "%s: %s: %s", progname, name, my_strerror(errno));
7410}
7411
7412/* TODO:
7413 * No pre-compiled header file support.
7414 *
7415 * Possibly different enum token codes for each C/C++ token.
7416 *
7417 * Should clean up remaining directives to that do_XXX functions
7418 * only take two arguments and all have command_reads_line.
7419 *
7420 * Find and cleanup remaining uses of static variables,
7421 *
7422 * Support for trigraphs.
7423 *
7424 * Support -dM flag (dump_all_macros).
7425 *
7426 * Support for_lint flag.
7427 */
diff --git a/libraries/edje/src/bin/epp/cpplib.h b/libraries/edje/src/bin/epp/cpplib.h
deleted file mode 100644
index 5653dd2..0000000
--- a/libraries/edje/src/bin/epp/cpplib.h
+++ /dev/null
@@ -1,641 +0,0 @@
1/* Definitions for CPP library.
2 Copyright (C) 1995 Free Software Foundation, Inc.
3 Written by Per Bothner, 1994-95.
4
5This program is free software; you can redistribute it and/or modify it
6under the terms of the GNU General Public License as published by the
7Free Software Foundation; either version 2, or (at your option) any
8later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 In other words, you are welcome to use, share and improve this program.
20 You are forbidden to forbid anyone else to use, share and improve
21 what you give them. Help stamp out software-hoarding! */
22
23#include <stdarg.h>
24#include <sys/types.h>
25#include <sys/stat.h>
26
27#ifndef HOST_BITS_PER_WIDE_INT
28
29#if HOST_BITS_PER_LONG > HOST_BITS_PER_INT
30#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
31#define HOST_WIDE_INT long
32#else
33#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT
34#define HOST_WIDE_INT int
35#endif
36
37#endif
38
39#define STATIC_BUFFERS
40
41typedef struct cpp_reader cpp_reader;
42typedef struct cpp_buffer cpp_buffer;
43typedef struct cpp_options cpp_options;
44
45enum cpp_token {
46 CPP_EOF = -1,
47 CPP_OTHER = 0,
48 CPP_COMMENT = 1,
49 CPP_HSPACE,
50 CPP_VSPACE, /* newlines and #line directives */
51 CPP_NAME,
52 CPP_NUMBER,
53 CPP_CHAR,
54 CPP_STRING,
55 CPP_DIRECTIVE,
56 CPP_LPAREN, /* "(" */
57 CPP_RPAREN, /* ")" */
58 CPP_LBRACE, /* "{" */
59 CPP_RBRACE, /* "}" */
60 CPP_COMMA, /* "," */
61 CPP_SEMICOLON, /* ";" */
62 CPP_3DOTS, /* "..." */
63 /* POP_TOKEN is returned when we've popped a cpp_buffer. */
64 CPP_POP
65};
66
67typedef enum cpp_token (*parse_underflow_t) (cpp_reader *);
68typedef int (*parse_cleanup_t) (cpp_buffer *, cpp_reader *);
69
70/* A parse_marker indicates a previous position,
71 which we can backtrack to. */
72
73struct parse_marker {
74 cpp_buffer *buf;
75 struct parse_marker *next;
76 int position;
77};
78
79extern int cpp_handle_options(cpp_reader * pfile, int, char **);
80extern enum cpp_token cpp_get_token(cpp_reader * pfile);
81extern void cpp_skip_hspace(cpp_reader * pfile);
82
83/* Maintain and search list of included files, for #import. */
84
85#define IMPORT_HASH_SIZE 31
86
87struct import_file {
88 char *name;
89 ino_t inode;
90 dev_t dev;
91 struct import_file *next;
92};
93
94/* If we have a huge buffer, may need to cache more recent counts */
95#define CPP_LINE_BASE(BUF) ((BUF)->buf + (BUF)->line_base)
96
97enum dump_type {
98 dump_none = 0, dump_only, dump_names, dump_definitions
99};
100
101struct cpp_buffer {
102 unsigned char *buf;
103 unsigned char *cur;
104 unsigned char *rlimit; /* end of valid data */
105 unsigned char *alimit; /* end of allocated buffer */
106 unsigned char *prev; /* start of current token */
107
108 const char *fname;
109 /* Filename specified with #line command. */
110 const char *nominal_fname;
111
112 /* Record where in the search path this file was found.
113 * For #include_next. */
114 struct file_name_list *dir;
115
116 long line_base;
117 long lineno; /* Line number at CPP_LINE_BASE. */
118 long colno; /* Column number at CPP_LINE_BASE. */
119#ifndef STATIC_BUFFERS
120 cpp_buffer *chain;
121#endif
122 parse_underflow_t underflow;
123 parse_cleanup_t cleanup;
124 void *data;
125 struct parse_marker *marks;
126 /* Value of if_stack at start of this file.
127 * Used to prohibit unmatched #endif (etc) in an include file. */
128 struct if_stack *if_stack;
129
130 /* True if this is a header file included using <FILENAME>. */
131 char system_header_p;
132 char seen_eof;
133
134 /* True if buffer contains escape sequences.
135 * Currently there are are only two kind:
136 * "@-" means following identifier should not be macro-expanded.
137 * "@ " means a token-separator. This turns into " " in final output
138 * if not stringizing and needed to separate tokens; otherwise nothing.
139 * "@@" means a normal '@'.
140 * (An '@' inside a string stands for itself and is never an escape.) */
141 char has_escapes;
142};
143
144struct cpp_pending; /* Forward declaration - for C++. */
145struct file_name_map_list;
146
147typedef struct assertion_hashnode ASSERTION_HASHNODE;
148
149#define ASSERTION_HASHSIZE 37
150
151#ifdef STATIC_BUFFERS
152/* Maximum nesting of cpp_buffers. We use a static limit, partly for
153 efficiency, and partly to limit runaway recursion. */
154#define CPP_STACK_MAX 200
155#endif
156
157struct cpp_reader {
158 unsigned char *limit;
159 parse_underflow_t get_token;
160 cpp_buffer *buffer;
161#ifdef STATIC_BUFFERS
162 cpp_buffer buffer_stack[CPP_STACK_MAX];
163#endif
164
165 int errors; /* Error counter for exit code */
166 void *data;
167
168 unsigned char *token_buffer;
169 int token_buffer_size;
170
171 /* Line where a newline was first seen in a string constant. */
172 int multiline_string_line;
173
174 /* Current depth in #include directives that use <...>. */
175 int system_include_depth;
176
177 /* List of included files that contained #pragma once. */
178 struct file_name_list *dont_repeat_files;
179
180 /* List of other included files.
181 * If ->control_macro if nonzero, the file had a #ifndef
182 * around the entire contents, and ->control_macro gives the macro name. */
183 struct file_name_list *all_include_files;
184
185 /* Current maximum length of directory names in the search path
186 * for include files. (Altered as we get more of them.) */
187 int max_include_len;
188
189 /* Hash table of files already included with #include or #import. */
190 struct import_file *import_hash_table[IMPORT_HASH_SIZE];
191
192 struct if_stack *if_stack;
193
194 /* Nonzero means we are inside an IF during a -pcp run. In this mode
195 * macro expansion is done, and preconditions are output for all macro
196 * uses requiring them. */
197 char pcp_inside_if;
198
199 /* Nonzero means we have printed (while error reporting) a list of
200 * containing files that matches the current status. */
201 char input_stack_listing_current;
202
203 /* If non-zero, macros are not expanded. */
204 char no_macro_expand;
205
206 /* Print column number in error messages. */
207 char show_column;
208
209 /* We're printed a warning recommending against using #import. */
210 char import_warning;
211
212 /* If true, character between '<' and '>' are a single (string) token. */
213 char parsing_include_directive;
214
215 /* True if escape sequences (as described for has_escapes in
216 * parse_buffer) should be emitted. */
217 char output_escapes;
218
219 /* 0: Have seen non-white-space on this line.
220 * 1: Only seen white space so far on this line.
221 * 2: Only seen white space so far in this file. */
222 char only_seen_white;
223
224 /* Nonzero means this file was included with a -imacros or -include
225 * command line and should not be recorded as an include file. */
226
227 int no_record_file;
228
229 long lineno;
230
231 struct tm *timebuf;
232
233 ASSERTION_HASHNODE *assertion_hashtab[ASSERTION_HASHSIZE];
234
235 /* Buffer of -M output. */
236 char *deps_buffer;
237
238 /* Number of bytes allocated in above. */
239 int deps_allocated_size;
240
241 /* Number of bytes used. */
242 int deps_size;
243
244 /* Number of bytes since the last newline. */
245 int deps_column;
246};
247
248#define CPP_BUF_PEEK(BUFFER) \
249 ((BUFFER)->cur < (BUFFER)->rlimit ? *(BUFFER)->cur : EOF)
250#define CPP_BUF_GET(BUFFER) \
251 ((BUFFER)->cur < (BUFFER)->rlimit ? *(BUFFER)->cur++ : EOF)
252#define CPP_FORWARD(BUFFER, N) ((BUFFER)->cur += (N))
253
254/* Number of characters currently in PFILE's output buffer. */
255#define CPP_WRITTEN(PFILE) ((PFILE)->limit - (PFILE)->token_buffer)
256#define CPP_PWRITTEN(PFILE) ((PFILE)->limit)
257
258/* Make sure PFILE->token_buffer has space for at least N more characters. */
259#define CPP_RESERVE(PFILE, N) \
260 ((unsigned int)(CPP_WRITTEN (PFILE) + N) > (unsigned int) (PFILE)->token_buffer_size \
261 && (cpp_grow_buffer (PFILE, N), 0))
262
263/* Append string STR (of length N) to PFILE's output buffer.
264 Assume there is enough space. */
265#define CPP_PUTS_Q(PFILE, STR, N) \
266 do { memcpy ((PFILE)->limit, STR, (N)); (PFILE)->limit += (N); } while(0)
267/* Append string STR (of length N) to PFILE's output buffer. Make space. */
268#define CPP_PUTS(PFILE, STR, N) \
269 do { CPP_RESERVE(PFILE, N); CPP_PUTS_Q(PFILE, STR,N); } while(0)
270/* Append character CH to PFILE's output buffer. Assume sufficient space. */
271#define CPP_PUTC_Q(PFILE, CH) (*(PFILE)->limit++ = (CH))
272/* Append character CH to PFILE's output buffer. Make space if need be. */
273#define CPP_PUTC(PFILE, CH) \
274 do { CPP_RESERVE (PFILE, 1); CPP_PUTC_Q (PFILE, CH); } while(0)
275/* Make sure PFILE->limit is followed by '\0'. */
276#define CPP_NUL_TERMINATE_Q(PFILE) (*(PFILE)->limit = 0)
277#define CPP_NUL_TERMINATE(PFILE) \
278 do { CPP_RESERVE(PFILE, 1); *(PFILE)->limit = 0; } while(0)
279#define CPP_ADJUST_WRITTEN(PFILE,DELTA) ((PFILE)->limit += (DELTA))
280#define CPP_SET_WRITTEN(PFILE,N) ((PFILE)->limit = (PFILE)->token_buffer + (N))
281
282#define CPP_OPTIONS(PFILE) ((cpp_options*)(PFILE)->data)
283#define CPP_BUFFER(PFILE) ((PFILE)->buffer)
284#ifdef STATIC_BUFFERS
285#define CPP_PREV_BUFFER(BUFFER) ((BUFFER)+1)
286#define CPP_NULL_BUFFER(PFILE) (&(PFILE)->buffer_stack[CPP_STACK_MAX])
287#else
288#define CPP_PREV_BUFFER(BUFFER) ((BUFFER)->chain)
289#define CPP_NULL_BUFFER(PFILE) ((cpp_buffer*)0)
290#endif
291
292/* Pointed to by parse_file::data. */
293struct cpp_options {
294 const char *in_fname;
295
296 /* Name of output file, for error messages. */
297 const char *out_fname;
298
299 struct file_name_map_list *map_list;
300
301 /* Non-0 means -v, so print the full set of include dirs. */
302 char verbose;
303
304 /* Nonzero means use extra default include directories for C++. */
305
306 char cplusplus;
307
308 /* Nonzero means handle cplusplus style comments */
309
310 char cplusplus_comments;
311
312 /* Nonzero means handle #import, for objective C. */
313
314 char objc;
315
316 /* Nonzero means this is an assembly file, and allow
317 * unknown directives, which could be comments. */
318
319 int lang_asm;
320
321 /* Nonzero means turn NOTREACHED into #pragma NOTREACHED etc */
322
323 char for_lint;
324
325 /* Nonzero means handle CHILL comment syntax
326 * and output CHILL string delimiter for __DATE___ etc. */
327
328 char chill;
329
330 /* Nonzero means copy comments into the output file. */
331
332 char put_out_comments;
333
334 /* Nonzero means don't process the ANSI trigraph sequences. */
335
336 char no_trigraphs;
337
338 /* Nonzero means print the names of included files rather than
339 * the preprocessed output. 1 means just the #include "...",
340 * 2 means #include <...> as well. */
341
342 char print_deps;
343
344 /* Nonzero if missing .h files in -M output are assumed to be generated
345 * files and not errors. */
346
347 char print_deps_missing_files;
348
349 /* If true, fopen (deps_file, "a") else fopen (deps_file, "w"). */
350 char print_deps_append;
351
352 /* Nonzero means print names of header files (-H). */
353
354 char print_include_names;
355
356 /* Nonzero means try to make failure to fit ANSI C an error. */
357
358 char pedantic_errors;
359
360 /* Nonzero means don't print warning messages. -w. */
361
362 char inhibit_warnings;
363
364 /* Nonzero means warn if slash-star appears in a comment. */
365
366 char warn_comments;
367
368 /* Nonzero means warn if there are any trigraphs. */
369
370 char warn_trigraphs;
371
372 /* Nonzero means warn if #import is used. */
373
374 char warn_import;
375
376 /* Nonzero means warn if a macro argument is (or would be)
377 * stringified with -traditional. */
378
379 char warn_stringify;
380
381 /* Nonzero means turn warnings into errors. */
382
383 char warnings_are_errors;
384
385 /* Nonzero causes output not to be done,
386 * but directives such as #define that have side effects
387 * are still obeyed. */
388
389 char no_output;
390
391 /* Nonzero means don't output line number information. */
392
393 char no_line_commands;
394
395/* Nonzero means output the text in failing conditionals,
396 inside #failed ... #endfailed. */
397
398 char output_conditionals;
399
400 /* Nonzero means -I- has been seen,
401 * so don't look for #include "foo" the source-file directory. */
402 char ignore_srcdir;
403
404/* Zero means dollar signs are punctuation.
405 -$ stores 0; -traditional may store 1. Default is 1 for VMS, 0 otherwise.
406 This must be 0 for correct processing of this ANSI C program:
407 #define foo(a) #a
408 #define lose(b) foo (b)
409 #define test$
410 lose (test) */
411 char dollars_in_ident;
412#ifndef DOLLARS_IN_IDENTIFIERS
413#define DOLLARS_IN_IDENTIFIERS 1
414#endif
415
416 /* Nonzero means try to imitate old fashioned non-ANSI preprocessor. */
417 char traditional;
418
419 /* Nonzero means give all the error messages the ANSI standard requires. */
420 char pedantic;
421
422 char done_initializing;
423
424 struct file_name_list *include; /* First dir to search */
425 /* First dir to search for <file> */
426 /* This is the first element to use for #include <...>.
427 * If it is 0, use the entire chain for such includes. */
428 struct file_name_list *first_bracket_include;
429 /* This is the first element in the chain that corresponds to
430 * a directory of system header files. */
431 struct file_name_list *first_system_include;
432 struct file_name_list *last_include; /* Last in chain */
433
434 /* Chain of include directories to put at the end of the other chain. */
435 struct file_name_list *after_include;
436 struct file_name_list *last_after_include; /* Last in chain */
437
438 /* Chain to put at the start of the system include files. */
439 struct file_name_list *before_system;
440 struct file_name_list *last_before_system; /* Last in chain */
441
442 /* Directory prefix that should replace `/usr' in the standard
443 * include file directories. */
444 char *include_prefix;
445
446 char inhibit_predefs;
447 char no_standard_includes;
448 char no_standard_cplusplus_includes;
449
450/* dump_only means inhibit output of the preprocessed text
451 and instead output the definitions of all user-defined
452 macros in a form suitable for use as input to cccp.
453 dump_names means pass #define and the macro name through to output.
454 dump_definitions means pass the whole definition (plus #define) through
455*/
456
457 enum dump_type dump_macros;
458
459/* Nonzero means pass all #define and #undef directives which we actually
460 process through to the output stream. This feature is used primarily
461 to allow cc1 to record the #defines and #undefs for the sake of
462 debuggers which understand about preprocessor macros, but it may
463 also be useful with -E to figure out how symbols are defined, and
464 where they are defined. */
465 int debug_output;
466
467 /* Pending -D, -U and -A options, in reverse order. */
468 struct cpp_pending *pending;
469
470 /* File name which deps are being written to.
471 * This is 0 if deps are being written to stdout. */
472 char *deps_file;
473
474 /* Target-name to write with the dependency information. */
475 char *deps_target;
476};
477
478#define CPP_TRADITIONAL(PFILE) (CPP_OPTIONS(PFILE)-> traditional)
479#define CPP_PEDANTIC(PFILE) (CPP_OPTIONS (PFILE)->pedantic)
480#define CPP_PRINT_DEPS(PFILE) (CPP_OPTIONS (PFILE)->print_deps)
481
482/* Name under which this program was invoked. */
483
484extern char *progname;
485
486/* The structure of a node in the hash table. The hash table
487 has entries for all tokens defined by #define commands (type T_MACRO),
488 plus some special tokens like __LINE__ (these each have their own
489 type, and the appropriate code is run when that type of node is seen.
490 It does not contain control words like "#define", which are recognized
491 by a separate piece of code. */
492
493/* different flavors of hash nodes --- also used in keyword table */
494enum node_type {
495 T_DEFINE = 1, /* the `#define' keyword */
496 T_INCLUDE, /* the `#include' keyword */
497 T_INCLUDE_NEXT, /* the `#include_next' keyword */
498 T_IMPORT, /* the `#import' keyword */
499 T_IFDEF, /* the `#ifdef' keyword */
500 T_IFNDEF, /* the `#ifndef' keyword */
501 T_IF, /* the `#if' keyword */
502 T_ELSE, /* `#else' */
503 T_PRAGMA, /* `#pragma' */
504 T_ELIF, /* `#elif' */
505 T_UNDEF, /* `#undef' */
506 T_LINE, /* `#line' */
507 T_ERROR, /* `#error' */
508 T_WARNING, /* `#warning' */
509 T_ENDIF, /* `#endif' */
510 T_SCCS, /* `#sccs', used on system V. */
511 T_IDENT, /* `#ident', used on system V. */
512 T_ASSERT, /* `#assert', taken from system V. */
513 T_UNASSERT, /* `#unassert', taken from system V. */
514 T_SPECLINE, /* special symbol `__LINE__' */
515 T_DATE, /* `__DATE__' */
516 T_FILE, /* `__FILE__' */
517 T_BASE_FILE, /* `__BASE_FILE__' */
518 T_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */
519 T_VERSION, /* `__VERSION__' */
520 T_SIZE_TYPE, /* `__SIZE_TYPE__' */
521 T_PTRDIFF_TYPE, /* `__PTRDIFF_TYPE__' */
522 T_WCHAR_TYPE, /* `__WCHAR_TYPE__' */
523 T_USER_LABEL_PREFIX_TYPE, /* `__USER_LABEL_PREFIX__' */
524 T_REGISTER_PREFIX_TYPE, /* `__REGISTER_PREFIX__' */
525 T_TIME, /* `__TIME__' */
526 T_CONST, /* Constant value, used by `__STDC__' */
527 T_MACRO, /* macro defined by `#define' */
528 T_DISABLED, /* macro temporarily turned off for rescan */
529 T_SPEC_DEFINED, /* special `defined' macro for use in #if statements */
530 T_PCSTRING, /* precompiled string (hashval is KEYDEF *) */
531 T_UNUSED /* Used for something not defined. */
532};
533
534/* Structure allocated for every #define. For a simple replacement
535 such as
536 #define foo bar ,
537 nargs = -1, the `pattern' list is null, and the expansion is just
538 the replacement text. Nargs = 0 means a functionlike macro with no args,
539 e.g.,
540 #define getchar() getc (stdin) .
541 When there are args, the expansion is the replacement text with the
542 args squashed out, and the reflist is a list describing how to
543 build the output from the input: e.g., "3 chars, then the 1st arg,
544 then 9 chars, then the 3rd arg, then 0 chars, then the 2nd arg".
545 The chars here come from the expansion. Whatever is left of the
546 expansion after the last arg-occurrence is copied after that arg.
547 Note that the reflist can be arbitrarily long---
548 its length depends on the number of times the arguments appear in
549 the replacement text, not how many args there are. Example:
550 #define f(x) x+x+x+x+x+x+x would have replacement text "++++++" and
551 pattern list
552 { (0, 1), (1, 1), (1, 1), ..., (1, 1), NULL }
553 where (x, y) means (nchars, argno). */
554
555typedef struct reflist reflist;
556struct reflist {
557 reflist *next;
558 char stringify; /* nonzero if this arg was preceded by a
559 * # operator. */
560 char raw_before; /* Nonzero if a ## operator before arg. */
561 char raw_after; /* Nonzero if a ## operator after arg. */
562 char rest_args; /* Nonzero if this arg. absorbs the rest */
563 int nchars; /* Number of literal chars to copy before
564 * this arg occurrence. */
565 int argno; /* Number of arg to substitute (origin-0) */
566};
567
568typedef struct definition DEFINITION;
569struct definition {
570 int nargs;
571 int length; /* length of expansion string */
572 int predefined; /* True if the macro was builtin or */
573 /* came from the command line */
574 unsigned char *expansion;
575 int line; /* Line number of definition */
576 const char *file; /* File of definition */
577 char rest_args; /* Nonzero if last arg. absorbs the rest */
578 reflist *pattern;
579 union {
580 /* Names of macro args, concatenated in reverse order
581 * with comma-space between them.
582 * The only use of this is that we warn on redefinition
583 * if this differs between the old and new definitions. */
584 unsigned char *argnames;
585 } args;
586};
587
588extern unsigned char is_idchar[256];
589
590/* Stack of conditionals currently in progress
591 (including both successful and failing conditionals). */
592
593struct if_stack {
594 struct if_stack *next; /* for chaining to the next stack frame */
595 const char *fname; /* copied from input when frame is made */
596 int lineno; /* similarly */
597 int if_succeeded; /* true if a leg of this if-group
598 * has been passed through rescan */
599 unsigned char *control_macro; /* For #ifndef at start of file,
600 * this is the macro name tested. */
601 enum node_type type; /* type of last directive seen in this group */
602};
603typedef struct if_stack IF_STACK_FRAME;
604
605extern void cpp_buf_line_and_col(cpp_buffer *, long *, long *);
606extern cpp_buffer *cpp_file_buffer(cpp_reader *);
607extern void cpp_define(cpp_reader *, unsigned char *);
608
609extern void cpp_error(cpp_reader * pfile, const char *msg, ...);
610extern void cpp_warning(cpp_reader * pfile, const char *msg, ...);
611extern void cpp_pedwarn(cpp_reader * pfile, const char *msg, ...);
612extern void cpp_fatal(const char *msg, ...);
613extern void cpp_file_line_for_message(cpp_reader * pfile,
614 const char *filename, int line,
615 int column);
616extern void cpp_perror_with_name(cpp_reader * pfile, const char *name);
617extern void cpp_pfatal_with_name(cpp_reader * pfile, const char *name);
618extern void cpp_message(cpp_reader * pfile, int is_error,
619 const char *msg, ...);
620extern void cpp_message_v(cpp_reader * pfile, int is_error,
621 const char *msg, va_list args);
622
623extern void cpp_grow_buffer(cpp_reader * pfile, long n);
624extern int cpp_parse_escape(cpp_reader * pfile, char **string_ptr);
625
626void cpp_print_containing_files(cpp_reader * pfile);
627HOST_WIDE_INT cpp_parse_expr(cpp_reader * pfile);
628void skip_rest_of_line(cpp_reader * pfile);
629void init_parse_file(cpp_reader * pfile);
630void init_parse_options(struct cpp_options *opts);
631int push_parse_file(cpp_reader * pfile, const char *fname);
632void cpp_finish(cpp_reader * pfile);
633int cpp_read_check_assertion(cpp_reader * pfile);
634
635void *xmalloc(unsigned size);
636void *xrealloc(void *old, unsigned size);
637void *xcalloc(unsigned number, unsigned size);
638
639#ifdef __EMX__
640#define PATH_SEPARATOR ';'
641#endif
diff --git a/libraries/edje/src/bin/epp/cppmain.c b/libraries/edje/src/bin/epp/cppmain.c
deleted file mode 100644
index ea0a0b2..0000000
--- a/libraries/edje/src/bin/epp/cppmain.c
+++ /dev/null
@@ -1,147 +0,0 @@
1/* CPP main program, using CPP Library.
2 * Copyright (C) 1995 Free Software Foundation, Inc.
3 * Written by Per Bothner, 1994-95.
4 * Copyright (C) 2003-2011 Kim Woelders
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 * In other words, you are welcome to use, share and improve this program.
21 * You are forbidden to forbid anyone else to use, share and improve
22 * what you give them. Help stamp out software-hoarding! */
23
24#ifdef HAVE_CONFIG_H
25# include <config.h>
26#endif
27
28#include <stdio.h>
29#include <string.h>
30#include <stdlib.h>
31
32#include "cpplib.h"
33
34#define EPP_DEBUG 0
35
36cpp_reader parse_in;
37cpp_options options;
38
39int
40main(int argc, char **argv)
41{
42 char *p;
43 int i;
44 int argi = 1; /* Next argument to handle. */
45 struct cpp_options *opts = &options;
46 enum cpp_token kind;
47#if EPP_DEBUG
48 int got_text = 0;
49#endif
50
51 p = argv[0] + strlen(argv[0]);
52#ifndef __EMX__
53 while (p != argv[0] && p[-1] != '/')
54#else
55 while (p != argv[0] && p[-1] != '/' && p[-1] != '\\')
56#endif
57 --p;
58 progname = p;
59
60 init_parse_file(&parse_in);
61 parse_in.data = opts;
62
63 init_parse_options(opts);
64
65 argi += cpp_handle_options(&parse_in, argc - argi, argv + argi);
66 if (argi < argc)
67 cpp_fatal("Invalid option `%s'", argv[argi]);
68 parse_in.show_column = 1;
69
70 i = push_parse_file(&parse_in, opts->in_fname);
71 if (i != SUCCESS_EXIT_CODE)
72 return i;
73
74 /* Now that we know the input file is valid, open the output. */
75
76 if (!opts->out_fname || !strcmp(opts->out_fname, ""))
77 opts->out_fname = "stdout";
78 else if (!freopen(opts->out_fname, "w", stdout))
79 cpp_pfatal_with_name(&parse_in, opts->out_fname);
80
81 for (i = 0;; i++)
82 {
83 kind = cpp_get_token(&parse_in);
84#if EPP_DEBUG
85 fprintf(stderr, "%03d: kind=%d len=%d out=%d text=%d\n", i,
86 kind, CPP_WRITTEN(&parse_in), !opts->no_output, got_text);
87#endif
88 switch (kind)
89 {
90 case CPP_EOF:
91 goto done;
92
93 case CPP_HSPACE:
94 continue;
95
96 case CPP_VSPACE:
97 break;
98
99 default:
100 case CPP_OTHER:
101 case CPP_NAME:
102 case CPP_NUMBER:
103 case CPP_CHAR:
104 case CPP_STRING:
105 case CPP_LPAREN:
106 case CPP_RPAREN:
107 case CPP_LBRACE:
108 case CPP_RBRACE:
109 case CPP_COMMA:
110 case CPP_SEMICOLON:
111 case CPP_3DOTS:
112#if EPP_DEBUG
113 got_text = 1;
114#endif
115 continue;
116
117 case CPP_COMMENT:
118 case CPP_DIRECTIVE:
119 case CPP_POP:
120 continue;
121 }
122#if EPP_DEBUG
123 fprintf(stderr, "'");
124 fwrite(parse_in.token_buffer, 1, CPP_WRITTEN(&parse_in), stderr);
125 fprintf(stderr, "'\n");
126#endif
127 if (!opts->no_output)
128 {
129 size_t n;
130
131 n = CPP_WRITTEN(&parse_in);
132 if (fwrite(parse_in.token_buffer, 1, n, stdout) != n)
133 exit(FATAL_EXIT_CODE);
134 }
135 parse_in.limit = parse_in.token_buffer;
136#if EPP_DEBUG
137 got_text = 0;
138#endif
139 }
140
141 done:
142 cpp_finish(&parse_in);
143
144 if (parse_in.errors)
145 exit(FATAL_EXIT_CODE);
146 exit(SUCCESS_EXIT_CODE);
147}