From: Anas Nashif Date: Sat, 22 Dec 2012 00:28:06 +0000 (-0800) Subject: Imported Upstream version 1.7.4 X-Git-Tag: upstream/1.7.4^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Fedje.git;a=commitdiff_plain;h=9be7965675ad90b54877ad78607e0aac9aefd77e Imported Upstream version 1.7.4 --- diff --git a/AUTHORS b/AUTHORS index 62ee3da..7430ce0 100644 --- a/AUTHORS +++ b/AUTHORS @@ -30,3 +30,4 @@ Michael Bouchaud (yoz) WooHyun Jung (woohyun) Guilherme Silveira Robert David +Bluezery diff --git a/ChangeLog b/ChangeLog index a6b39a9..93d80d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -619,3 +619,35 @@ * 1.7.3 release +2012-12-05 Tae-Hwan Kim (Bluezery) + + * Fix inheriting groups with programs that have after programs where + after programs are duplicated in the list. + +2012-12-13 Doug Newgard + + * Enforce compilation with Lua 5.1 only. + +2012-12-17 Vincent Torri + + * Add XML output to doc + * Add installation rule for doc + +2012-12-18 WooHyun Jung + + * Before cursor is moved by mouse_down, imf_context_reset should be called with current cursor position. + +2012-12-20 David Seikel (onefang) + + * Lua: Backport from 76883 in trunk, and revert 80791 - Lua 5.2 support added. + +2012-12-20 Tom Hacohen (TAsn) + + * Backport from 78587 in trunk. + Edje entry: Fix update of cursor with IMF and user_insert. + Was missing, now cursor updates like it should. + +2012-12-21 Luis Felipe Strano Moraes + + * 1.7.4 release + diff --git a/Makefile.am b/Makefile.am index 01415b9..58ebb3b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,7 +46,7 @@ README pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = edje.pc -.PHONY: doc coverage +.PHONY: doc install-doc coverage # Documentation @@ -54,6 +54,10 @@ doc: @echo "entering doc/" make -C doc doc +install-doc: + @echo "entering doc/" + make -C doc install-doc + # Unit tests if EFL_ENABLE_TESTS diff --git a/Makefile.in b/Makefile.in index b831f00..caec6f9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -960,7 +960,7 @@ uninstall-am: uninstall-binSCRIPTS uninstall-pkgconfigDATA uninstall-pkgconfigDATA -.PHONY: doc coverage +.PHONY: doc install-doc coverage # Documentation @@ -968,6 +968,10 @@ doc: @echo "entering doc/" make -C doc doc +install-doc: + @echo "entering doc/" + make -C doc install-doc + # Unit tests @EFL_ENABLE_TESTS_TRUE@check-local: diff --git a/NEWS b/NEWS index ce26384..e38a12b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,14 @@ +Edje 1.7.4 + +Changes since Edje 1.7.3: +------------------------- + +Fixes: + * Lua 5.2 support added, still works fine with 5.1. + * Before cursor is moved by mouse_down, imf_context_reset should be called with current cursor position. + * Backport from 78587 in trunk. + * Fix inheriting groups with programs that have after programs where after programs are duplicated in the list. + Edje 1.7.3 Changes since Edje 1.7.2: @@ -5,6 +16,7 @@ Changes since Edje 1.7.2: Fixes: * fix compilation on Solaris 11 + * fix duplicate after programs in group inheritance. Changes since Edje 1.7.1: ------------------------- diff --git a/README b/README index f57cfd3..a007bb7 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Edje 1.7.0 +Edje 1.7.4 ****************************************************************************** diff --git a/configure b/configure index 2f039c0..a9f4e2c 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for edje 1.7.3. +# Generated by GNU Autoconf 2.68 for edje 1.7.4. # # Report bugs to . # @@ -570,8 +570,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='edje' PACKAGE_TARNAME='edje' -PACKAGE_VERSION='1.7.3' -PACKAGE_STRING='edje 1.7.3' +PACKAGE_VERSION='1.7.4' +PACKAGE_STRING='edje 1.7.4' PACKAGE_BUGREPORT='enlightenment-devel@lists.sourceforge.net' PACKAGE_URL='' @@ -1472,7 +1472,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures edje 1.7.3 to adapt to many kinds of systems. +\`configure' configures edje 1.7.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1542,7 +1542,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of edje 1.7.3:";; + short | recursive ) echo "Configuration of edje 1.7.4:";; esac cat <<\_ACEOF @@ -1745,7 +1745,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -edje configure 1.7.3 +edje configure 1.7.4 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2168,7 +2168,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by edje $as_me 1.7.3, which was +It was created by edje $as_me 1.7.4, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2992,7 +2992,7 @@ fi # Define the identity of the package. PACKAGE='edje' - VERSION='1.7.3' + VERSION='1.7.4' cat >>confdefs.h <<_ACEOF @@ -11963,7 +11963,7 @@ _ACEOF cat >>confdefs.h <<_ACEOF -#define VMIC 3 +#define VMIC 4 _ACEOF @@ -11971,7 +11971,7 @@ cat >>confdefs.h <<_ACEOF #define VREV 0 _ACEOF -version_info="8:3:7" +version_info="8:4:7" release_info="" @@ -18453,7 +18453,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by edje $as_me 1.7.3, which was +This file was extended by edje $as_me 1.7.4, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18519,7 +18519,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -edje config.status 1.7.3 +edje config.status 1.7.4 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" @@ -20338,6 +20338,9 @@ echo " EDJE_PROGRAM_CACHE...: $want_edje_program_cache" echo " EDJE_CALC_CACHE......: $want_edje_calc_cache" echo " Fixed point..........: $want_fixed_point" echo " Documentation........: ${build_doc}" +if test "x${build_doc}" = "xyes" ; then +echo " Installation.......: make install-doc" +fi echo " Tests................: ${enable_tests}" echo " Coverage.............: ${enable_coverage}" echo " Examples.............: install:${install_examples} build:${build_examples}" diff --git a/configure.ac b/configure.ac index 7d254d7..2a2db17 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--## m4_define([v_maj], [1]) m4_define([v_min], [7]) -m4_define([v_mic], [3]) +m4_define([v_mic], [4]) m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v '\(export\|Unversioned directory\)' || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n'])) m4_if(v_rev, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))]) ##-- When released, remove the dnl on the below line @@ -624,6 +624,9 @@ echo " EDJE_PROGRAM_CACHE...: $want_edje_program_cache" echo " EDJE_CALC_CACHE......: $want_edje_calc_cache" echo " Fixed point..........: $want_fixed_point" echo " Documentation........: ${build_doc}" +if test "x${build_doc}" = "xyes" ; then +echo " Installation.......: make install-doc" +fi echo " Tests................: ${enable_tests}" echo " Coverage.............: ${enable_coverage}" echo " Examples.............: install:${install_examples} build:${build_examples}" diff --git a/doc/Doxyfile b/doc/Doxyfile index 8766ea3..d82800a 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -1152,7 +1152,7 @@ MAN_LINKS = YES # generate an XML file that captures the structure of # the code including all documentation. -GENERATE_XML = NO +GENERATE_XML = YES # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 5cd36f2..7a644b1 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -1152,7 +1152,7 @@ MAN_LINKS = YES # generate an XML file that captures the structure of # the code including all documentation. -GENERATE_XML = NO +GENERATE_XML = YES # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be diff --git a/doc/Makefile.am b/doc/Makefile.am index b00aa03..6d32133 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,7 +1,7 @@ MAINTAINERCLEANFILES = Makefile.in -.PHONY: doc +.PHONY: doc install-doc PACKAGE_DOCNAME = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-doc @@ -10,13 +10,15 @@ if EFL_BUILD_DOC doc-clean: rm -rf html/ latex/ man/ xml/ $(top_builddir)/$(PACKAGE_DOCNAME).tar* -doc: all doc-clean +doc-build: all $(efl_doxygen) - cp $(srcdir)/img/* html/ - cp $(srcdir)/img/* latex/ + cp img/* html/ + cp img/* latex/ + +doc: doc-build rm -rf $(PACKAGE_DOCNAME).tar* mkdir -p $(PACKAGE_DOCNAME)/doc - cp -R html/ latex/ man/ $(PACKAGE_DOCNAME)/doc + cp -R html/ latex/ man/ xml/ $(PACKAGE_DOCNAME)/doc tar cf $(PACKAGE_DOCNAME).tar $(PACKAGE_DOCNAME)/ bzip2 -9 $(PACKAGE_DOCNAME).tar rm -rf $(PACKAGE_DOCNAME)/ @@ -24,11 +26,20 @@ doc: all doc-clean clean-local: doc-clean +install-doc: doc-build + install -d $(docdir) + cp -R html latex man xml $(docdir) + +uninstall-local: + rm -rf $(docdir)/html $(docdir)/latex $(docdir)/man $(docdir)/xml + else doc: @echo "Documentation not built. Run ./configure --help" +install-doc: doc + endif EXTRA_DIST = Doxyfile e.css foot.html head.html $(wildcard img/*.*) \ diff --git a/doc/Makefile.in b/doc/Makefile.in index 7533756..b1fd361 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -367,6 +367,7 @@ maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +@EFL_BUILD_DOC_FALSE@uninstall-local: @EFL_BUILD_DOC_FALSE@clean-local: clean: clean-am @@ -432,7 +433,7 @@ ps: ps-am ps-am: -uninstall-am: +uninstall-am: uninstall-local .MAKE: install-am install-strip @@ -446,21 +447,23 @@ uninstall-am: install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - uninstall uninstall-am + uninstall uninstall-am uninstall-local -.PHONY: doc +.PHONY: doc install-doc @EFL_BUILD_DOC_TRUE@doc-clean: @EFL_BUILD_DOC_TRUE@ rm -rf html/ latex/ man/ xml/ $(top_builddir)/$(PACKAGE_DOCNAME).tar* -@EFL_BUILD_DOC_TRUE@doc: all doc-clean +@EFL_BUILD_DOC_TRUE@doc-build: all @EFL_BUILD_DOC_TRUE@ $(efl_doxygen) -@EFL_BUILD_DOC_TRUE@ cp $(srcdir)/img/* html/ -@EFL_BUILD_DOC_TRUE@ cp $(srcdir)/img/* latex/ +@EFL_BUILD_DOC_TRUE@ cp img/* html/ +@EFL_BUILD_DOC_TRUE@ cp img/* latex/ + +@EFL_BUILD_DOC_TRUE@doc: doc-build @EFL_BUILD_DOC_TRUE@ rm -rf $(PACKAGE_DOCNAME).tar* @EFL_BUILD_DOC_TRUE@ mkdir -p $(PACKAGE_DOCNAME)/doc -@EFL_BUILD_DOC_TRUE@ cp -R html/ latex/ man/ $(PACKAGE_DOCNAME)/doc +@EFL_BUILD_DOC_TRUE@ cp -R html/ latex/ man/ xml/ $(PACKAGE_DOCNAME)/doc @EFL_BUILD_DOC_TRUE@ tar cf $(PACKAGE_DOCNAME).tar $(PACKAGE_DOCNAME)/ @EFL_BUILD_DOC_TRUE@ bzip2 -9 $(PACKAGE_DOCNAME).tar @EFL_BUILD_DOC_TRUE@ rm -rf $(PACKAGE_DOCNAME)/ @@ -468,9 +471,18 @@ uninstall-am: @EFL_BUILD_DOC_TRUE@clean-local: doc-clean +@EFL_BUILD_DOC_TRUE@install-doc: doc-build +@EFL_BUILD_DOC_TRUE@ install -d $(docdir) +@EFL_BUILD_DOC_TRUE@ cp -R html latex man xml $(docdir) + +@EFL_BUILD_DOC_TRUE@uninstall-local: +@EFL_BUILD_DOC_TRUE@ rm -rf $(docdir)/html $(docdir)/latex $(docdir)/man $(docdir)/xml + @EFL_BUILD_DOC_FALSE@doc: @EFL_BUILD_DOC_FALSE@ @echo "Documentation not built. Run ./configure --help" +@EFL_BUILD_DOC_FALSE@install-doc: doc + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/edje.pc.in b/edje.pc.in index 88110e9..325c688 100644 --- a/edje.pc.in +++ b/edje.pc.in @@ -1,3 +1,4 @@ +PACKAGE_TARNAME=@PACKAGE_TARNAME@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ @@ -7,6 +8,7 @@ datarootdir=@datarootdir@ datadir=@datadir@/edje vmaj=@VMAJ@ multisense=@want_multisense@ +docdir=@docdir@ Name: edje Description: Enlightened graphical design and layout engine. diff --git a/edje.spec b/edje.spec index 6d78480..b435289 100644 --- a/edje.spec +++ b/edje.spec @@ -4,7 +4,7 @@ Summary: Complex Graphical Design/Layout Engine Name: edje -Version: 1.7.3 +Version: 1.7.4 Release: %{_rel} License: BSD Group: System Environment/Libraries diff --git a/src/bin/edje_cc_handlers.c b/src/bin/edje_cc_handlers.c index f7fce79..9dd2cac 100644 --- a/src/bin/edje_cc_handlers.c +++ b/src/bin/edje_cc_handlers.c @@ -1089,9 +1089,11 @@ _edje_program_copy(Edje_Program *ep, Edje_Program *ep2) EINA_LIST_FOREACH(ep2->after, l, pa2) { - pa = mem_alloc(SZ(Edje_Program_After)); + name = (char*) (pa2 + 1); + pa = mem_alloc(SZ(Edje_Program_After) + strlen(name) + 1); ep->after = eina_list_append(ep->after, pa); - + copy = (char*) (pa + 1); + memcpy(copy, name, strlen(name) + 1); data_queue_copied_program_lookup(pc, &(pa2->id), &(pa->id)); } @@ -7934,14 +7936,27 @@ st_collections_group_programs_program_after(void) ep = current_program; { Edje_Program_After *pa; + Edje_Program_After *pa2; + Eina_List *l; char *name; + char *copy; name = parse_str(0); - pa = mem_alloc(SZ(Edje_Program_After)); + EINA_LIST_FOREACH(ep->after, l, pa2) + { + if (!strcmp(name, (char*) (pa2 + 1))) + { + free(name); + return; + } + } + + pa = mem_alloc(SZ(Edje_Program_After) + strlen(name) + 1); pa->id = -1; ep->after = eina_list_append(ep->after, pa); - + copy = (char*)(pa + 1); + memcpy(copy, name, strlen(name) + 1); data_queue_program_lookup(pc, name, &(pa->id)); free(name); } diff --git a/src/bin/edje_cc_out.c b/src/bin/edje_cc_out.c index 3850e13..bf2ddcd 100644 --- a/src/bin/edje_cc_out.c +++ b/src/bin/edje_cc_out.c @@ -1643,7 +1643,9 @@ reorder_parts(void) if (ep2->reorder.linked_prev) ERR("Unable to insert two or more parts in same part \"%s\".", pc->parts[j]->name); - k = j - 1; + /* Need it to be able to insert an element before the first */ + if (j == 0) k = 0; + else k = j - 1; found = EINA_TRUE; ep2->reorder.linked_prev += ep->reorder.linked_prev + 1; ep->reorder.before = (Edje_Part_Parser *)pc->parts[j]; @@ -1692,10 +1694,10 @@ reorder_parts(void) } if (i > k) { - for (j = i - ep->reorder.linked_prev - 1 ; j >= k ; j--) + for (j = i - ep->reorder.linked_prev ; j > k; j--) { - pc->parts[j + amount] = pc->parts[j]; - pc->parts[j + amount]->id = j + amount; + pc->parts[j + amount - 1] = pc->parts[j - 1]; + pc->parts[j + amount - 1]->id = j + amount - 1; } for (j = 0 ; j < amount ; j++) { diff --git a/src/examples/lua_script.edc b/src/examples/lua_script.edc index 23c2926..6365ec4 100644 --- a/src/examples/lua_script.edc +++ b/src/examples/lua_script.edc @@ -67,7 +67,7 @@ collections { d = edje.size(); D.clip:geom(10, 10, d.w - 20, d.h - 20); c = D.clip:clipees(); - for i=1,table.getn(c),1 do + for i=1,#c,1 do d = c[i]:geom(); print("lua::" .. i .. " geom = " .. d.x .. "," .. d.y .. " " .. d.w .. "x" .. d.h); end diff --git a/src/lib/edje_entry.c b/src/lib/edje_entry.c index 3307e34..31fc569 100644 --- a/src/lib/edje_entry.c +++ b/src/lib/edje_entry.c @@ -1738,7 +1738,7 @@ _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS Evas_Textblock_Cursor *tc = NULL; Eina_Bool dosel = EINA_FALSE; Eina_Bool shift; - if (!rp) return; + if ((!rp) || (!ev)) return; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; en = rp->entry_data; if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) || @@ -1758,6 +1758,8 @@ _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS } #endif + _edje_entry_imf_context_reset(rp); + shift = evas_key_modifier_is_set(ev->modifiers, "Shift"); en->select_mod_start = EINA_FALSE; en->select_mod_end = EINA_FALSE; @@ -1966,7 +1968,7 @@ _edje_part_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED Entry *en; Evas_Coord x, y, w, h; Evas_Textblock_Cursor *tc; - if (ev->button != 1) return; + if ((!ev) || (ev->button != 1)) return; if (!rp) return; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK) return; @@ -2075,7 +2077,7 @@ _edje_part_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS Entry *en; Evas_Coord x, y, w, h; Evas_Textblock_Cursor *tc; - if (!rp) return; + if (!rp || (!ev)) return; en = rp->entry_data; if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) || (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE)) @@ -2169,6 +2171,7 @@ static void _evas_focus_in_cb(void *data, Evas *e, __UNUSED__ void *event_info) { Edje *ed = (Edje *)data; + if (!ed) return; if (evas_focus_get(e) == ed->obj) { @@ -2180,6 +2183,7 @@ static void _evas_focus_out_cb(void *data, Evas *e, __UNUSED__ void *event_info) { Edje *ed = (Edje *)data; + if (!ed) return; if (evas_focus_get(e) == ed->obj) { @@ -2208,7 +2212,7 @@ _edje_entry_init(Edje *ed) void _edje_entry_shutdown(Edje *ed) { - if (!ed->has_entries) + if ((!ed) || (!ed->has_entries)) return; if (!ed->entries_inited) return; @@ -2721,6 +2725,9 @@ _edje_entry_user_insert(Edje_Real_Part *rp, const char *text) _edje_emit_full(rp->edje, "entry,changed,user", rp->part->name, info, _free_entry_change_info); _edje_emit(rp->edje, "cursor,changed", rp->part->name); + + _edje_entry_imf_cursor_info_set(en); + _edje_entry_real_part_configure(rp); } void @@ -3429,6 +3436,9 @@ _edje_entry_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx __UNUSED__, v info, _free_entry_change_info); _edje_emit(ed, "cursor,changed", rp->part->name); } + + _edje_entry_imf_cursor_info_set(en); + _edje_entry_real_part_configure(rp); } static void diff --git a/src/lib/edje_lua2.c b/src/lib/edje_lua2.c index 32fb2e1..d48b450 100644 --- a/src/lib/edje_lua2.c +++ b/src/lib/edje_lua2.c @@ -985,7 +985,11 @@ _elua_messagesend(lua_State *L) // Stack usage [-2, +2, ev] plus [-2, +2] for e int i, n; const char *str; luaL_checktype(L, 3, LUA_TTABLE); // Stack usage [-0, +0, v] +#if LUA_VERSION_NUM >= 502 + n = lua_rawlen(L, 3); // Stack usage [-0, +0, -] +#else n = lua_objlen(L, 3); // Stack usage [-0, +0, -] +#endif emsg = alloca(sizeof(Edje_Message_String_Set) + ((n - 1) * sizeof(char *))); emsg->count = n; for (i = 1; i <= n; i ++) @@ -1003,7 +1007,11 @@ _elua_messagesend(lua_State *L) // Stack usage [-2, +2, ev] plus [-2, +2] for e Edje_Message_Int_Set *emsg; int i, n; luaL_checktype(L, 3, LUA_TTABLE); // Stack usage [-0, +0, v] +#if LUA_VERSION_NUM >= 502 + n = lua_rawlen(L, 3); // Stack usage [-0, +0, -] +#else n = lua_objlen(L, 3); // Stack usage [-0, +0, -] +#endif emsg = alloca(sizeof(Edje_Message_Int_Set) + ((n - 1) * sizeof(int))); emsg->count = n; for (i = 1; i <= n; i ++) @@ -1020,7 +1028,11 @@ _elua_messagesend(lua_State *L) // Stack usage [-2, +2, ev] plus [-2, +2] for e Edje_Message_Float_Set *emsg; int i, n; luaL_checktype(L, 3, LUA_TTABLE); // Stack usage [-0, +0, v] +#if LUA_VERSION_NUM >= 502 + n = lua_rawlen(L, 3); // Stack usage [-0, +0, -] +#else n = lua_objlen(L, 3); // Stack usage [-0, +0, -] +#endif emsg = alloca(sizeof(Edje_Message_Float_Set) + ((n - 1) * sizeof(double))); emsg->count = n; for (i = 1; i <= n; i ++) @@ -1057,7 +1069,11 @@ _elua_messagesend(lua_State *L) // Stack usage [-2, +2, ev] plus [-2, +2] for e const char *str = luaL_checkstring(L, 3); // Stack usage [-0, +0, v] if (!str) return 0; luaL_checktype(L, 4, LUA_TTABLE); // Stack usage [-0, +0, v] +#if LUA_VERSION_NUM >= 502 + n = lua_rawlen(L, 4); // Stack usage [-0, +0, -] +#else n = lua_objlen(L, 4); // Stack usage [-0, +0, -] +#endif emsg = alloca(sizeof(Edje_Message_String_Int_Set) + ((n - 1) * sizeof(int))); emsg->str = (char *)str; emsg->count = n; @@ -1077,7 +1093,11 @@ _elua_messagesend(lua_State *L) // Stack usage [-2, +2, ev] plus [-2, +2] for e const char *str = luaL_checkstring(L, 3); // Stack usage [-0, +0, v] if (!str) return 0; luaL_checktype(L, 4, LUA_TTABLE); // Stack usage [-0, +0, v] +#if LUA_VERSION_NUM >= 502 + n = lua_rawlen(L, 4); // Stack usage [-0, +0, -] +#else n = lua_objlen(L, 4); +#endif emsg = alloca(sizeof(Edje_Message_String_Float_Set) + ((n - 1) * sizeof(double))); emsg->str = (char *)str; emsg->count = n; @@ -3734,26 +3754,43 @@ _elua_bogan_protect(lua_State *L) // Stack usage [-3, +3, m] { lua_pushnil(L); // Stack usage [-0, +1, -] luaL_newmetatable(L, "bogan"); // Stack usage [-0, +1, m] +#if LUA_VERSION_NUM >= 502 + luaL_setfuncs(L, _elua_bogan_funcs, 0); // Stack usage [-0, +0, e] +#else luaL_register(L, 0, _elua_bogan_funcs); // Stack usage [-1, +1, m] +#endif lua_setmetatable(L, -2); // Stack usage [-1, +0, -] lua_pop(L, 1); // Stack usage [-1, +0, -] } //--------------------------------------------------------------------------// +// TODO - All the register / setfuncs and rlelated stuff around here should be reviewed. Works fine for 5.1, probably works fine for 5.2, but maybe there's a better way? It may also need to change if we start using LuaJIT. + // Brain dead inheritance thingy, built for speed. Kinda. Part 1. static void _elua_add_functions(lua_State *L, const char *api, const luaL_Reg *funcs, const char *meta, const char *parent, const char *base) // Stack usage [-3, +5, m] if inheriting [-6, +11, em] { // Create an api table, fill it full of the methods. +#if LUA_VERSION_NUM >= 502 + lua_newtable(L); // Stack usage [-0, +1, e] + lua_pushvalue(L, -1); // Stack usage [-0, +1, -] + lua_setglobal(L, api); // Stack usage [-1, +0, e] + luaL_setfuncs(L, funcs, 0); // Stack usage [-0, +0, e] +#else luaL_register(L, api, funcs); // Stack usage [-0, +1, m] +#endif // Set the api metatable to the bogan metatable. luaL_getmetatable(L, "bogan"); // Stack usage [-0, +1, -] lua_setmetatable(L, -2); // Stack usage [-1, +0, -] // Creat a meta metatable. luaL_newmetatable(L, meta); // Stack usage [-0, +1, m] // Put the gc functions in the metatable. +#if LUA_VERSION_NUM >= 502 + luaL_setfuncs(L, _elua_edje_gc_funcs, 0); // Stack usage [-0, +0, e] +#else luaL_register(L, 0, _elua_edje_gc_funcs); // Stack usage [-1, +1, m] +#endif // Create an __index entry in the metatable, make it point to the api table. lua_pushliteral(L, "__index"); // Stack usage [-0, +1, m] lua_pushvalue(L, -3); // Stack usage [-0, +1, -] @@ -3821,14 +3858,29 @@ _elua_init(void) for (l = _elua_libs; l->func; l++) // Currently * 4 { +#if LUA_VERSION_NUM >= 502 + luaL_requiref(L, l->name, l->func, 1); // Stack usage [-0, +1, e] +#else lua_pushcfunction(L, l->func); // Stack usage [-0, +1, m] lua_pushstring(L, l->name); // Stack usage [-0, +1, m] lua_call(L, 1, 0); // Stack usage [-2, +0, e] +#endif } +#if LUA_VERSION_NUM >= 502 + lua_newtable(L); // Stack usage [-0, +1, e] + lua_pushvalue(L, -1); // Stack usage [-0, +1, -] + lua_setglobal(L, _elua_edje_api); // Stack usage [-1, +0, e] + luaL_setfuncs(L, _elua_edje_funcs, 0); // Stack usage [-0, +0, e] +#else luaL_register(L, _elua_edje_api, _elua_edje_funcs); // Stack usage [-0, +1, m] +#endif luaL_newmetatable(L, _elua_edje_meta); // Stack usage [-0, +1, m] +#if LUA_VERSION_NUM >= 502 + luaL_setfuncs(L, _elua_edje_gc_funcs, 0); // Stack usage [-0, +0, e] +#else luaL_register(L, 0, _elua_edje_gc_funcs); // Stack usage [-1, +1, m] +#endif _elua_add_functions(L, _elua_evas_api, _elua_evas_funcs, _elua_evas_meta, NULL, NULL); // Stack usage [-3, +5, m] @@ -3873,18 +3925,33 @@ _edje_lua2_script_init(Edje *ed) // Stack usage for (l = _elua_libs; l->func; l++) // Currently * 4 { +#if LUA_VERSION_NUM >= 502 + luaL_requiref(L, l->name, l->func, 1); // Stack usage [-0, +1, e] +#else lua_pushcfunction(L, l->func); // Stack usage [-0, +1, m] lua_pushstring(L, l->name); // Stack usage [-0, +1, m] lua_call(L, 1, 0); // Stack usage [-2, +0, m] +#endif } _elua_bogan_protect(L); // Stack usage [+3, -3, m] +#if LUA_VERSION_NUM >= 502 + lua_newtable(L); // Stack usage [-0, +1, e] + lua_pushvalue(L, -1); // Stack usage [-0, +1, -] + lua_setglobal(L, _elua_edje_api); // Stack usage [-1, +0, e] + luaL_setfuncs(L, _elua_edje_funcs, 0); // Stack usage [-0, +0, e] +#else luaL_register(L, _elua_edje_api, _elua_edje_funcs); // Stack usage [-0, +1, m] +#endif luaL_getmetatable(L, "bogan"); // Stack usage [-0, +1, -] lua_setmetatable(L, -2); // Stack usage [-1, +0, -] luaL_newmetatable(L, _elua_edje_meta); // Stack usage [-0, +1, m] +#if LUA_VERSION_NUM >= 502 + luaL_setfuncs(L, _elua_edje_gc_funcs, 0); // Stack usage [-0, +0, e] +#else luaL_register(L, 0, _elua_edje_gc_funcs); // Stack usage [-1, +1, m] +#endif lua_pop(L, 2); // Stack usage [-n, +0, -]