gplugin/gplugin

dee481b2b4ee
flow: Promoted 'trunk' (0dcd20dd5e76) to 'feature/gjs-cc'.
  • +1 -1
    .hgignore
  • +25 -24
    CMakeLists.txt
  • +29 -1
    ChangeLog
  • +28 -0
    HACKING.OSX
  • +51 -0
    cmake/Modules/FindLibTcc.cmake
  • +6 -1
    cmake/Modules/help2man.cmake
  • +9 -7
    gplugin-gtk/CMakeLists.txt
  • +35 -36
    gplugin/CMakeLists.txt
  • +35 -21
    gplugin/gplugin-manager.c
  • +2 -2
    gplugin/gplugin-native-loader.c
  • +19 -1
    gplugin/tests/CMakeLists.txt
  • +46 -3
    gplugin/tests/test-signals.c
  • +60 -0
    gplugin/tests/test-unresolved-symbol.c
  • +1 -0
    gplugin/tests/unresolved-symbol/CMakeLists.txt
  • +41 -0
    gplugin/tests/unresolved-symbol/unresolved-symbol.c
  • +4 -1
    lua/CMakeLists.txt
  • +29 -1
    lua/gplugin-lua-test-lgi.c
  • +2 -2
    lua/tests/CMakeLists.txt
  • +1 -0
    packaging/CMakeLists.txt
  • +36 -0
    packaging/debian/changelog
  • +3 -26
    packaging/debian/control
  • +0 -1
    packaging/debian/copyright
  • +2 -2
    packaging/debian/gir1.2-gplugin-0.0.install
  • +3 -3
    packaging/debian/libgplugin-dev.install
  • +0 -1
    packaging/debian/libgplugin-gtk-bin.install
  • +3 -3
    packaging/debian/libgplugin-gtk-dev.install
  • +2 -2
    packaging/debian/libgplugin-gtk0.install
  • +0 -1
    packaging/debian/libgplugin-gtk0.postinst
  • +0 -1
    packaging/debian/libgplugin-gtk0.postrm
  • +0 -13
    packaging/debian/libgplugin-gtk0.symbols
  • +2 -2
    packaging/debian/libgplugin-lua.install
  • +2 -2
    packaging/debian/libgplugin-python.install
  • +2 -2
    packaging/debian/libgplugin0.install
  • +0 -1
    packaging/debian/libgplugin0.postinst
  • +0 -1
    packaging/debian/libgplugin0.postrm
  • +0 -79
    packaging/debian/libgplugin0.symbols
  • +0 -9
    packaging/debian/rules
  • +245 -0
    packaging/gplugin.spec.in
  • +2 -0
    python/CMakeLists.txt
  • +39 -0
    tcc/CMakeLists.txt
  • +67 -0
    tcc/gplugin-tcc-core.c
  • +203 -0
    tcc/gplugin-tcc-loader.c
  • +59 -0
    tcc/gplugin-tcc-loader.h
  • +183 -0
    tcc/gplugin-tcc-plugin.c
  • +62 -0
    tcc/gplugin-tcc-plugin.h
  • +52 -0
    tcc/tests/CMakeLists.txt
  • +55 -0
    tcc/tests/plugins/basic-plugin.c
  • +49 -0
    tcc/tests/plugins/dependent.c
  • +42 -0
    tcc/tests/plugins/load-exception.c
  • +43 -0
    tcc/tests/plugins/load-failed.c
  • +43 -0
    tcc/tests/plugins/unload-failed.c
  • +31 -0
    tcc/tests/test-tcc-loader.c
  • +0 -565
    tools/glib-mkenums
  • --- a/.hgignore Tue Sep 29 22:45:21 2015 -0500
    +++ b/.hgignore Tue Aug 23 12:08:22 2016 -0500
    @@ -14,4 +14,4 @@
    ^packaging\/debian\/files$
    ^obj-x86_64-linux-gnu\/
    ^debian\/?$
    -
    +.+\.sublime-workspace
    --- a/CMakeLists.txt Tue Sep 29 22:45:21 2015 -0500
    +++ b/CMakeLists.txt Tue Aug 23 12:08:22 2016 -0500
    @@ -17,6 +17,9 @@
    # don't force target names to match a pattern
    cmake_policy(SET CMP0037 OLD)
    +
    + # enable MACOSX_RPATH
    + cmake_policy(SET CMP0042 NEW)
    endif(${CMAKE_VERSION} VERSION_GREATER "3.0.0")
    ###############################################################################
    @@ -25,8 +28,8 @@
    project(gplugin)
    set(GPLUGIN_MAJOR_VERSION 0)
    -set(GPLUGIN_MINOR_VERSION 0)
    -set(GPLUGIN_MICRO_VERSION 23)
    +set(GPLUGIN_MINOR_VERSION 28)
    +set(GPLUGIN_MICRO_VERSION 0)
    set(GPLUGIN_EXTRA_VERSION dev)
    set(GPLUGIN_VERSION ${GPLUGIN_MAJOR_VERSION}.${GPLUGIN_MINOR_VERSION}.${GPLUGIN_MICRO_VERSION}${GPLUGIN_EXTRA_VERSION})
    @@ -55,6 +58,12 @@
    "On"
    )
    +option(
    + BUILD_HELP2MAN
    + "Whether or not to build man pages from --help output"
    + "on"
    +)
    +
    ###############################################################################
    # Dependencies
    ###############################################################################
    @@ -95,29 +104,18 @@
    include(GNUInstallDirs)
    include(FindPkgConfig)
    include(PkgConfigVariable)
    -include(help2man)
    -
    -set(REQ_GLIB_VER 2.20.0)
    -pkg_check_modules(GLIB REQUIRED
    - glib-2.0>=${REQ_GLIB_VER}
    - gobject-2.0>=${REQ_GLIB_VER}
    -)
    +if(BUILD_HELP2MAN)
    + include(help2man)
    +endif(BUILD_HELP2MAN)
    +
    +pkg_check_modules(GLIB REQUIRED glib-2.0>=2.34.0 gobject-2.0)
    # we separate gmodule out so our test aren't linked to it
    -pkg_check_modules(GMODULE REQUIRED
    - gmodule-2.0>=${REQ_GLIB_VER}
    -)
    +pkg_check_modules(GMODULE REQUIRED gmodule-2.0)
    pkg_config_variable(glib-2.0 glib_genmarshal GLIB_GENMARSHAL)
    -
    -if(${GLIB_gobject-2.0_VERSION} LESS 2.32.0)
    - set(GLIB_MKENUMS ${CMAKE_SOURCE_DIR}/tools/glib-mkenums
    - CACHE FILEPATH "glib-mkenums executable"
    - )
    -else(${GLIB_gobject-2.0_VERSION} LESS 2.32.0)
    - pkg_config_variable(glib-2.0 glib_mkenums GLIB_MKENUMS)
    -endif(${GLIB_gobject-2.0_VERSION} LESS 2.32.0)
    +pkg_config_variable(glib-2.0 glib_mkenums GLIB_MKENUMS)
    if(TESTING_ENABLED)
    find_program(GTESTER
    @@ -150,6 +148,7 @@
    add_definitions(
    -std=c99
    -g -g3
    + -O2
    -DPREFIX="${CMAKE_INSTALL_PREFIX}"
    -DLIBDIR="${CMAKE_INSTALL_LIBDIR}"
    -DGPLUGIN_WEBSITE="http://bitbucket.org/gplugin/main"
    @@ -160,16 +159,16 @@
    )
    # check if we're using gcc
    -if(CMAKE_COMPILER_IS_GNUCC)
    +if(CMAKE_COMPILER_IS_GNUCC OR APPLE)
    add_definitions(
    -DGPLUGIN_UNUSED=__attribute__\(\(unused\)\)
    -ggdb
    )
    -else(CMAKE_COMPILER_IS_GNUCC)
    +else(CMAKE_COMPILER_IS_GNUCC OR APPLE)
    add_definitions(
    - -DGPLUGIN_UNUSED=""
    + -DGPLUGIN_UNUSED=
    )
    -endif(CMAKE_COMPILER_IS_GNUCC)
    +endif(CMAKE_COMPILER_IS_GNUCC OR APPLE)
    include_directories(
    ${CMAKE_SOURCE_DIR}
    @@ -189,6 +188,7 @@
    ###############################################################################
    add_subdirectory(gplugin)
    add_subdirectory(gplugin-gtk)
    +add_subdirectory(packaging)
    add_subdirectory(plugins)
    add_subdirectory(po)
    @@ -196,6 +196,7 @@
    add_subdirectory(lua)
    add_subdirectory(perl)
    add_subdirectory(python)
    +add_subdirectory(tcc)
    ###############################################################################
    # Install stuff
    --- a/ChangeLog Tue Sep 29 22:45:21 2015 -0500
    +++ b/ChangeLog Tue Aug 23 12:08:22 2016 -0500
    @@ -1,4 +1,32 @@
    -0.0.23:
    +0.28.0:
    + * Fixed building on OSX with homebrew
    + * Added an RPM spec file
    +
    +0.27.0: 2016/04/18
    + * Bumped the glib requirement to 2.34.0
    + * Fix some error reporting with the native loader
    +
    +0.26.0: 2016/03/03
    + * Added a load-failed signal which is emitted when a plugin fails to load
    + * Removed pre glib 2.32.0 code
    +
    +0.25.0: 2016/02/06
    + * Fix a regression where the GIR file did not have a predictable name.
    + * Fix the glib requirement. It was set at 2.20, but we require 2.32.
    +
    +0.24.1: 2016/01/28
    + * Fixed the version numbering finally
    + * Updated the version in CMakeLists.txt
    +
    +0.0.24: 2016/01/28
    + * Really fixed the debian package this time
    + * Made help2man optional
    + * Don't try to build the pot files if NLS is disabled
    +
    +0.0.23: 2016/01/06
    + * Made the moonscript tests option work
    + * Added Debian.md to explain how to use the Debian repository
    + * Install man pages in the correct directory on BSD
    0.0.22: 2015/06/30
    * Made the moonscripts tests not interfer with the lua tests unless they're
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/HACKING.OSX Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,28 @@
    +There are a few notes about building on OSX.
    +
    +First off, building has *ONLY* been tested against homebrew. If you want to
    +support fink or macports, please let me know and I will merge your pull
    +request.
    +
    +Lua
    +===
    +
    +For the Lua loader to work, you need to install lgi from luarocks either
    +systemwide or to a virtual environment created by LuaDist, vert, or something
    +along those lines.
    +
    +When you're building lgi against homebrew you'll have to set the
    +PKG_CONFIG_PATH environment variable since homebrew does not install libffi
    +systemwide. This is easily done via:
    +
    + export PKG_CONFIG_PATH=$(brew --prefix libffi)/lib/pkgconfig
    +
    +and then running "luarocks install lgi"
    +
    +PYTHON
    +======
    +
    +If you're using homebrew, you need to install pygobject3 with
    +
    + brew install pygobject3 --with-python3
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/cmake/Modules/FindLibTcc.cmake Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,51 @@
    +find_path(libtcc_INCLUDE_DIR
    + NAMES libtcc.h
    + PATHS
    + /usr/include
    + /usr/local/include
    +)
    +
    +# find home brew and stash the prefix of tcc if there is one
    +set(BREW_TCC_PREFIX)
    +if(APPLE)
    + find_program(BREW brew)
    + if(BREW)
    + execute_process(
    + COMMAND ${BREW} --prefix tcc
    + OUTPUT_VARIABLE BREW_TCC_PREFIX
    + OUTPUT_STRIP_TRAILING_WHITESPACE
    + )
    +
    + set(BREW_TCC_LIB_DIR ${BREW_TCC_PREFIX}/lib)
    + set(BREW_TCC_INCLUDE_DIR ${BREW_TCC_PREFIX}/include)
    + endif(BREW)
    +endif(APPLE)
    +
    +find_path(LIBTCC_INCLUDE_DIR
    + NAMES libtcc.h
    + PATHS
    + /usr/include
    + /usr/local/include
    + ${BREW_TCC_INCLUDE_DIR}
    +)
    +
    +find_library(LIBTCC_LIBRARIES
    + NAMES libtcc.a
    + PATHS
    + /usr/lib
    + /usr/local/lib
    + /usr/lib/x86_64-linux-gnu
    + /usr/lib/x86_32-linux-gnu
    + ${BREW_TCC_LIB_DIR}
    +)
    +
    +include(CMakeParseArguments)
    +find_package_handle_standard_args(libtcc REQUIRED_VARS LIBTCC_LIBRARIES LIBTCC_INCLUDE_DIR)
    +
    +set(TCC_FOUND ${LIBTCC_FOUND})
    +
    +if(TCC_FOUND)
    + set(TCC_INCLUDE_DIRS ${LIBTCC_INCLUDE_DIR})
    + set(TCC_LIBRARIES ${LIBTCC_LIBRARY})
    +endif(TCC_FOUND)
    +
    --- a/cmake/Modules/help2man.cmake Tue Sep 29 22:45:21 2015 -0500
    +++ b/cmake/Modules/help2man.cmake Tue Aug 23 12:08:22 2016 -0500
    @@ -63,7 +63,12 @@
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    )
    - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_HELP2MAN_OUTPUT} DESTINATION share/man/man${_HELP2MAN_SECTION})
    + set(_HELP2MAN_DIR share/man/)
    + if(CMAKE_SYSTEM_NAME MATCHES .*BSD.*)
    + set(_HELP2MAN_DIR man/)
    + endif(CMAKE_SYSTEM_NAME MATCHES .*BSD.*)
    +
    + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_HELP2MAN_OUTPUT} DESTINATION ${_HELP2MAN_DIR}man${_HELP2MAN_SECTION})
    endfunction(help2man)
    --- a/gplugin-gtk/CMakeLists.txt Tue Sep 29 22:45:21 2015 -0500
    +++ b/gplugin-gtk/CMakeLists.txt Tue Aug 23 12:08:22 2016 -0500
    @@ -130,13 +130,15 @@
    gplugin
    )
    -help2man(
    - TARGET gplugin-gtk-viewer
    - OUTPUT gplugin-gtk-viewer.1
    - SECTION 1
    - NAME "View installed plugins"
    - HELP_OPTION --help-all
    -)
    +if(BUILD_HELP2MAN)
    + help2man(
    + TARGET gplugin-gtk-viewer
    + OUTPUT gplugin-gtk-viewer.1
    + SECTION 1
    + NAME "View installed plugins"
    + HELP_OPTION --help-all
    + )
    +endif(BUILD_HELP2MAN)
    install(TARGETS gplugin-gtk-viewer RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
    --- a/gplugin/CMakeLists.txt Tue Sep 29 22:45:21 2015 -0500
    +++ b/gplugin/CMakeLists.txt Tue Aug 23 12:08:22 2016 -0500
    @@ -182,13 +182,15 @@
    )
    # nls
    -gettextize_pot_file(
    - SORT
    - LANGUAGES C
    - SOURCES ${GPLUGIN_SOURCES} ${GPLUGIN_NATIVE_SOURCES} gplugin-query.c
    - BUILT_SOURCES ${GPLUGIN_PUBLIC_BUILT_SOURCES}
    - FILENAME gplugin.pot
    -)
    +if(NLS)
    + gettextize_pot_file(
    + SORT
    + LANGUAGES C
    + SOURCES ${GPLUGIN_SOURCES} ${GPLUGIN_NATIVE_SOURCES} gplugin-query.c
    + BUILT_SOURCES ${GPLUGIN_PUBLIC_BUILT_SOURCES}
    + FILENAME gplugin.pot
    + )
    +endif(NLS)
    ###############################################################################
    # gplugin-query executable
    @@ -196,13 +198,15 @@
    add_executable(gplugin-query gplugin-query.c)
    target_link_libraries(gplugin-query ${GLIB_LIBRARIES} gplugin)
    -help2man(
    - TARGET gplugin-query
    - OUTPUT gplugin-query.1
    - SECTION 1
    - NAME "Query installed plugins"
    - HELP_OPTION --help-all
    -)
    +if(BUILD_HELP2MAN)
    + help2man(
    + TARGET gplugin-query
    + OUTPUT gplugin-query.1
    + SECTION 1
    + NAME "Query installed plugins"
    + HELP_OPTION --help-all
    + )
    +endif(BUILD_HELP2MAN)
    ###############################################################################
    # loader-tests static library
    @@ -218,30 +222,25 @@
    # GObject Introspection
    ###############################################################################
    if(BUILD_GIR)
    - if(APPLE)
    - message("The GObject Introspection build always fails on OS X, "
    - "skipping")
    - else(APPLE)
    - include(GObjectIntrospection)
    + include(GObjectIntrospection)
    - set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_BINARY_DIR}")
    + set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_BINARY_DIR}")
    - gobject_introspection(
    - FILENAME GPlugin-${GPLUGIN_MAJOR_VERSION}.${GPLUGIN_MINOR_VERSION}.gir
    - PACKAGES glib-2.0 gmodule-2.0 gobject-2.0
    - LIBRARY gplugin
    - QUIET
    - SCANNER_ARGS --add-include-path=${CMAKE_CURRENT_SOURCE_DIR}
    - --include=GModule-2.0 --include=GObject-2.0
    - COMPILER_ARGS --includedir=${CMAKE_CURRENT_SOURCE_DIR}
    - SYMBOL_PREFIXES gplugin
    - SOURCES ${GPLUGIN_SOURCES} ${GPLUGIN_HEADERS}
    - BUILT_SOURCES ${GPLUGIN_PUBLIC_BUILT_SOURCES}
    - ${GPLUGIN_PUBLIC_BUILT_HEADERS}
    - )
    - # For loader plugin tests dependencies
    - set(GPLUGIN_GIR_TARGETS ${GPLUGIN_GIR_TARGETS} PARENT_SCOPE)
    - endif(APPLE)
    + gobject_introspection(
    + FILENAME GPlugin-${GPLUGIN_MAJOR_VERSION}.${GPLUGIN_MINOR_VERSION}.gir
    + PACKAGES glib-2.0 gmodule-2.0 gobject-2.0
    + LIBRARY gplugin
    + QUIET
    + SCANNER_ARGS --add-include-path=${CMAKE_CURRENT_SOURCE_DIR}
    + --include=GModule-2.0 --include=GObject-2.0
    + COMPILER_ARGS --includedir=${CMAKE_CURRENT_SOURCE_DIR}
    + SYMBOL_PREFIXES gplugin
    + SOURCES ${GPLUGIN_SOURCES} ${GPLUGIN_HEADERS}
    + BUILT_SOURCES ${GPLUGIN_PUBLIC_BUILT_SOURCES}
    + ${GPLUGIN_PUBLIC_BUILT_HEADERS}
    + )
    + # For loader plugin tests dependencies
    + set(GPLUGIN_GIR_TARGETS ${GPLUGIN_GIR_TARGETS} PARENT_SCOPE)
    endif(BUILD_GIR)
    ###############################################################################
    --- a/gplugin/gplugin-manager.c Tue Sep 29 22:45:21 2015 -0500
    +++ b/gplugin/gplugin-manager.c Tue Aug 23 12:08:22 2016 -0500
    @@ -37,6 +37,7 @@
    enum {
    SIG_LOADING,
    SIG_LOADED,
    + SIG_LOAD_FAILED,
    SIG_UNLOADING,
    SIG_UNLOADED,
    N_SIGNALS,
    @@ -89,6 +90,7 @@
    GError **error);
    void (*loaded_plugin)(GObject *manager,
    GPluginPlugin *plugin);
    + void (*load_failed)(GObject *manager, GPluginPlugin *plugin);
    gboolean (*unloading_plugin)(GObject *manager,
    GPluginPlugin *plugin,
    GError **error);
    @@ -149,7 +151,7 @@
    *****************************************************************************/
    static void
    gplugin_manager_real_append_path(GPluginManager *manager,
    - const gchar *path)
    + const gchar *path)
    {
    GList *l = NULL;
    @@ -165,7 +167,7 @@
    static void
    gplugin_manager_real_prepend_path(GPluginManager *manager,
    - const gchar *path)
    + const gchar *path)
    {
    GList *l = NULL;
    @@ -181,7 +183,7 @@
    static void
    gplugin_manager_real_remove_path(GPluginManager *manager,
    - const gchar *path)
    + const gchar *path)
    {
    GList *l = NULL, *link = NULL;
    @@ -209,7 +211,7 @@
    static void
    gplugin_manager_real_register_loader(GPluginManager *manager,
    - GType type)
    + GType type)
    {
    GPluginLoader *loader = NULL;
    GPluginLoaderClass *lo_class = NULL;
    @@ -273,7 +275,7 @@
    static void
    gplugin_manager_real_unregister_loader(GPluginManager *manager,
    - GType type)
    + GType type)
    {
    GPluginLoaderClass *klass = NULL;
    GSList *exts = NULL;
    @@ -550,7 +552,7 @@
    static GSList *
    gplugin_manager_real_find_plugins(GPluginManager *manager,
    - const gchar *id)
    + const gchar *id)
    {
    GSList *plugins_list = NULL, *l;
    @@ -767,15 +769,18 @@
    gplugin_plugin_set_state(plugin, (ret) ? GPLUGIN_PLUGIN_STATE_LOADED :
    GPLUGIN_PLUGIN_STATE_LOAD_FAILED);
    - g_signal_emit(manager, signals[SIG_LOADED], 0, plugin);
    + if(ret)
    + g_signal_emit(manager, signals[SIG_LOADED], 0, plugin);
    + else
    + g_signal_emit(manager, signals[SIG_LOAD_FAILED], 0, plugin);
    return ret;
    }
    static gboolean
    gplugin_manager_real_unload_plugin(GPluginManager *manager,
    - GPluginPlugin *plugin,
    - GError **error)
    + GPluginPlugin *plugin,
    + GError **error)
    {
    GPluginLoader *loader = NULL;
    gboolean ret = TRUE;
    @@ -832,16 +837,7 @@
    gplugin_manager_finalize(GObject *obj) {
    GPluginManager *manager = GPLUGIN_MANAGER(obj);
    -#if GLIB_CHECK_VERSION(2,32,0)
    g_queue_free_full(manager->paths, g_free);
    -#else
    - GList *iter = NULL;
    - GSList *l = NULL;
    -
    - for(iter = manager->paths->head; iter; iter = iter->next)
    - g_free(iter->data);
    - g_queue_free(manager->paths);
    -#endif /* GLIB_CHECK_VERSION(2,32,0) */
    /* free all the data in the plugins hash table and destroy it */
    g_hash_table_foreach_remove(manager->plugins,
    @@ -937,10 +933,28 @@
    GPLUGIN_TYPE_PLUGIN);
    /**
    + * GPluginManager::load-failed:
    + * @manager: The #GPluginPluginManager instance.
    + * @plugin: The #GPluginPlugin that failed to load.
    + *
    + * emitted after a plugin fails to load.
    + */
    + signals[SIG_LOAD_FAILED] =
    + g_signal_new("load-failed",
    + G_OBJECT_CLASS_TYPE(manager_class),
    + G_SIGNAL_RUN_LAST,
    + G_STRUCT_OFFSET(GPluginManagerClass, load_failed),
    + NULL,
    + NULL,
    + gplugin_marshal_VOID__OBJECT,
    + G_TYPE_NONE,
    + 1,
    + GPLUGIN_TYPE_PLUGIN);
    +
    + /**
    * GPluginManager::unloading-plugin:
    - * @manager: the #gpluginpluginmanager instance. treat as a #gobject.
    - * @plugin: the #gpluginplugin that's about to be loaded.
    - * @error: return address for a #gerror.
    + * @manager: the #GPluginPluginManager instance. treat as a #GObject.
    + * @plugin: the #GPluginPlugin that's about to be loaded.
    *
    * emitted before a plugin is unloaded.
    *
    --- a/gplugin/gplugin-native-loader.c Tue Sep 29 22:45:21 2015 -0500
    +++ b/gplugin/gplugin-native-loader.c Tue Aug 23 12:08:22 2016 -0500
    @@ -132,7 +132,7 @@
    if(module)
    g_module_close(module);
    - if(error) {
    + if(error && !*error) {
    *error = g_error_new(GPLUGIN_DOMAIN, 0,
    _("the query function did not return a "
    "GPluginPluginInfo instance"));
    @@ -151,7 +151,7 @@
    if(!GPLUGIN_IS_PLUGIN_INFO(info)) {
    g_module_close(module);
    - if(error) {
    + if(error && !*error) {
    *error = g_error_new(GPLUGIN_DOMAIN, 0,
    _("the query function did not return a "
    "GPluginPluginInfo instance"));
    --- a/gplugin/tests/CMakeLists.txt Tue Sep 29 22:45:21 2015 -0500
    +++ b/gplugin/tests/CMakeLists.txt Tue Aug 23 12:08:22 2016 -0500
    @@ -3,7 +3,15 @@
    ###############################################################################
    macro(add_test_plugin plugin)
    add_library(${plugin} MODULE ${plugin}.c)
    - set_target_properties(${plugin} PROPERTIES PREFIX "")
    +
    + if(CMAKE_C_COMPILER_ID MATCHES "Clang")
    + set(LINK_FLAGS "-undefined dynamic_lookup")
    + endif(CMAKE_C_COMPILER_ID MATCHES "Clang")
    +
    + set_target_properties(${plugin} PROPERTIES
    + PREFIX ""
    + LINK_FLAGS "${LINK_FLAGS}"
    + )
    target_link_libraries(${plugin} ${GLIB_LIBRARIES} gplugin)
    endmacro(add_test_plugin)
    @@ -31,6 +39,7 @@
    add_subdirectory(load-on-query-fail)
    add_subdirectory(versioned-dependencies)
    add_subdirectory(bind-local)
    +add_subdirectory(unresolved-symbol)
    ###############################################################################
    # Tests
    @@ -116,6 +125,15 @@
    add_dependencies(test-bind-local bind-local)
    add_definitions(-DTEST_BIND_LOCAL_DIR="${CMAKE_CURRENT_BINARY_DIR}/bind-local/")
    +#######################################
    +# Unresolved Symbol
    +#######################################
    +add_gtest(test-unresolved-symbol)
    +add_dependencies(test-unresolved-symbol unresolved-symbol)
    +add_definitions(
    + -DPLUGIN_DIR="${CMAKE_CURRENT_BINARY_DIR}/unresolved-symbol"
    +)
    +
    ###############################################################################
    # GTester Stuff
    ###############################################################################
    --- a/gplugin/tests/test-signals.c Tue Sep 29 22:45:21 2015 -0500
    +++ b/gplugin/tests/test-signals.c Tue Aug 23 12:08:22 2016 -0500
    @@ -24,6 +24,7 @@
    gboolean loaded;
    gboolean unloading;
    gboolean unloaded;
    + gboolean load_failed;
    } TestGPluginManagerSignalsData;
    /******************************************************************************
    @@ -105,6 +106,16 @@
    return FALSE;
    }
    +static void
    +test_gplugin_manager_signals_load_failed(GPLUGIN_UNUSED GObject *manager,
    + GPLUGIN_UNUSED GPluginPlugin *plugin,
    + gpointer d)
    +{
    + TestGPluginManagerSignalsData *data = (TestGPluginManagerSignalsData *)d;
    +
    + data->load_failed = TRUE;
    +}
    +
    /******************************************************************************
    * Tests
    *****************************************************************************/
    @@ -113,7 +124,7 @@
    GPluginPlugin *plugin = NULL;
    GObject *manager = gplugin_manager_get_instance();
    GError *error = NULL;
    - TestGPluginManagerSignalsData data = { FALSE, FALSE, FALSE, FALSE };
    + TestGPluginManagerSignalsData data = { FALSE, FALSE, FALSE, FALSE, FALSE };
    gulong signals[] = { 0, 0, 0, 0};
    signals[0] =
    @@ -158,7 +169,7 @@
    GPluginPlugin *plugin = NULL;
    GObject *manager = gplugin_manager_get_instance();
    GError *error = NULL;
    - TestGPluginManagerSignalsData data = { FALSE, FALSE, FALSE, FALSE };
    + TestGPluginManagerSignalsData data = { FALSE, FALSE, FALSE, FALSE, FALSE };
    gulong signals[] = { 0, 0, 0, 0};
    signals[0] =
    @@ -200,7 +211,7 @@
    GPluginPlugin *plugin = NULL;
    GObject *manager = gplugin_manager_get_instance();
    GError *error = NULL;
    - TestGPluginManagerSignalsData data = { FALSE, FALSE, FALSE, FALSE };
    + TestGPluginManagerSignalsData data = { FALSE, FALSE, FALSE, FALSE, FALSE };
    gulong signals[] = { 0, 0, 0, 0};
    signals[0] =
    @@ -240,6 +251,36 @@
    g_signal_handler_disconnect(manager, signals[3]);
    }
    +static void
    +test_gplugin_manager_signals_load_failure(void) {
    + GPluginPlugin *plugin = NULL;
    + GObject *manager = gplugin_manager_get_instance();
    + GError *error = NULL;
    + TestGPluginManagerSignalsData data = { FALSE, FALSE, FALSE, FALSE, FALSE };
    + gulong signals[] = { 0, 0, 0, 0, 0};
    +
    + signals[0] =
    + g_signal_connect(manager, "loading-plugin",
    + G_CALLBACK(test_gplugin_manager_signals_normal_loading),
    + &data);
    + signals[1] =
    + g_signal_connect(manager, "load-failed",
    + G_CALLBACK(test_gplugin_manager_signals_load_failed),
    + &data);
    +
    + gplugin_manager_append_path(TEST_DIR);
    + gplugin_manager_refresh();
    +
    + plugin = gplugin_manager_find_plugin("gplugin/native-load-failed");
    + gplugin_manager_load_plugin(plugin, &error);
    + g_assert_error(error, GPLUGIN_DOMAIN, 0);
    + g_assert(data.loading);
    + g_assert(data.load_failed);
    +
    + g_signal_handler_disconnect(manager, signals[0]);
    + g_signal_handler_disconnect(manager, signals[1]);
    +}
    +
    /******************************************************************************
    * Main
    *****************************************************************************/
    @@ -256,6 +297,8 @@
    test_gplugin_manager_signals_loading_stopped);
    g_test_add_func("/manager/signals/unloading-stopped",
    test_gplugin_manager_signals_unloading_stopped);
    + g_test_add_func("/manager/signals/load-failed",
    + test_gplugin_manager_signals_load_failure);
    return g_test_run();
    }
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplugin/tests/test-unresolved-symbol.c Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,60 @@
    +/*
    + * Copyright (C) 2011-2016 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This library is free software; you can redistribute it and/or
    + * modify it under the terms of the GNU Lesser General Public
    + * License as published by the Free Software Foundation; either
    + * version 2 of the License, or (at your option) any later version.
    + *
    + * This library is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    + * Lesser General Public License for more details.
    + *
    + * You should have received a copy of the GNU Lesser General Public
    + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
    + */
    +
    +#include <stdlib.h>
    +
    +#include <gplugin.h>
    +#include <gplugin-native.h>
    +
    +#include <glib.h>
    +
    +/******************************************************************************
    + * Tests
    + *****************************************************************************/
    +
    +static void
    +test_unresolved_symbol(void) {
    + g_test_expect_message(
    + G_LOG_DOMAIN,
    + G_LOG_LEVEL_WARNING,
    + "*some_unresolved_symbol*"
    + );
    +
    + gplugin_manager_remove_paths();
    + gplugin_manager_append_path(PLUGIN_DIR);
    + gplugin_manager_refresh();
    +
    + g_test_assert_expected_messages();
    +}
    +
    +/******************************************************************************
    + * Main
    + *****************************************************************************/
    +gint
    +main(gint argc, gchar **argv) {
    +
    + g_test_init(&argc, &argv, NULL);
    +
    + gplugin_init();
    +
    + /* test the load on query flag */
    + g_test_add_func("/loaders/native/unresolved-symbol",
    + test_unresolved_symbol);
    +
    + return g_test_run();
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplugin/tests/unresolved-symbol/CMakeLists.txt Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,1 @@
    +add_test_plugin(unresolved-symbol)
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gplugin/tests/unresolved-symbol/unresolved-symbol.c Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,41 @@
    +/*
    + * Copyright (C) 2011-2016 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This library is free software; you can redistribute it and/or
    + * modify it under the terms of the GNU Lesser General Public
    + * License as published by the Free Software Foundation; either
    + * version 2 of the License, or (at your option) any later version.
    + *
    + * This library is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    + * Lesser General Public License for more details.
    + *
    + * You should have received a copy of the GNU Lesser General Public
    + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
    + */
    +
    +#include <gplugin.h>
    +#include <gplugin-native.h>
    +
    +G_MODULE_EXPORT GPluginPluginInfo *
    +gplugin_query(GPLUGIN_UNUSED GError **error) {
    + some_unresolved_symbol();
    +
    + return NULL;
    +}
    +
    +G_MODULE_EXPORT gboolean
    +gplugin_load(GPLUGIN_UNUSED GPluginNativePlugin *plugin,
    + GPLUGIN_UNUSED GError **error)
    +{
    + return TRUE;
    +}
    +
    +G_MODULE_EXPORT gboolean
    +gplugin_unload(GPLUGIN_UNUSED GPluginNativePlugin *plugin,
    + GPLUGIN_UNUSED GError **error)
    +{
    + return TRUE;
    +}
    +
    --- a/lua/CMakeLists.txt Tue Sep 29 22:45:21 2015 -0500
    +++ b/lua/CMakeLists.txt Tue Aug 23 12:08:22 2016 -0500
    @@ -20,7 +20,7 @@
    gplugin-lua-plugin.h
    )
    - set(_LUAS "luajit>=2.0.0;lua>=5.1.0;lua5.2>=5.2.0;lua5.1>=5.1.0")
    + set(_LUAS "lua>=5.1.0;lua5.1>=5.1.0;luajit>=2.0.0;lua5.2>=5.2.0")
    foreach(_LUA ${_LUAS})
    if(NOT LUA_FOUND)
    pkg_check_modules(LUA ${_LUA})
    @@ -33,6 +33,8 @@
    include_directories(${LUA_INCLUDE_DIRS})
    + link_directories(${LUA_LIBRARY_DIRS})
    +
    message(STATUS "checking for lua module 'lgi'")
    # compile our lua-lgi test program
    @@ -42,6 +44,7 @@
    CMAKE_FLAGS
    -DINCLUDE_DIRECTORIES:STRING=${LUA_INCLUDE_DIRS}
    -DLINK_LIBRARIES:STRING=${LUA_LIBRARIES}
    + -DLINK_DIRECTORIES:STRING=${LUA_LIBRARY_DIRS}
    OUTPUT_VARIABLE OUTPUT
    COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/gplugin-lua-test-lgi
    )
    --- a/lua/gplugin-lua-test-lgi.c Tue Sep 29 22:45:21 2015 -0500
    +++ b/lua/gplugin-lua-test-lgi.c Tue Aug 23 12:08:22 2016 -0500
    @@ -16,18 +16,46 @@
    */
    #include <stdio.h>
    +#include <string.h>
    #include <lua.h>
    #include <lauxlib.h>
    #include <lualib.h>
    +static void
    +_add_require_path(lua_State *L, const char *path) {
    + const char *pkg_path = NULL;
    + char buff[255];
    +
    + lua_getglobal(L, "package");
    + lua_getfield(L, -1, "path"); // get field "path" from table at top of stack (-1)
    + pkg_path = lua_tostring(L, -1); // grab path string from top of stack
    +
    + memset(buff, 0, sizeof(buff));
    + snprintf(buff, sizeof(buff), "%s;%s", pkg_path, path);
    +
    + lua_pop(L, 1); // pop off the path field
    + lua_pushstring(L, buff); // push the new one
    + lua_setfield(L, -2, "path"); // set the field "path" in table at -2 with value at top of stack
    + lua_pop( L, 1 ); // get rid of package table from top of stack
    +}
    +
    int
    main(int argc, char *argv[]) {
    - lua_State *L = luaL_newstate();
    + lua_State *L = NULL;
    int ret = 0;
    + L = luaL_newstate();
    + if(L == NULL) {
    + return 134;
    + }
    +
    luaL_openlibs(L);
    + /* add some additional paths to package.path */
    + //_add_require_path(L, "/usr/local/lib/luarocks/rocks");
    +
    + /* now try to do the require */
    lua_getglobal(L, "require");
    lua_pushstring(L, "lgi");
    --- a/lua/tests/CMakeLists.txt Tue Sep 29 22:45:21 2015 -0500
    +++ b/lua/tests/CMakeLists.txt Tue Aug 23 12:08:22 2016 -0500
    @@ -24,10 +24,10 @@
    add_lua_gtest(test-lua-loader)
    target_link_libraries(test-lua-loader gplugin-loader-tests)
    -if(${MOONSCRIPT_TESTS})
    +if(MOONSCRIPT_TESTS)
    add_lua_gtest(test-lua-moon-loader)
    target_link_libraries(test-lua-moon-loader gplugin-loader-tests)
    -endif(${MOONSCRIPT_TESTS})
    +endif(MOONSCRIPT_TESTS)
    set(GTESTER_LUA_TESTS "${LUA_TESTS}")
    set(GTESTER_LUA_LOG "test-gplugin-lua.xml")
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/packaging/CMakeLists.txt Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,1 @@
    +configure_file(gplugin.spec.in gplugin.spec @ONLY)
    --- a/packaging/debian/changelog Tue Sep 29 22:45:21 2015 -0500
    +++ b/packaging/debian/changelog Tue Aug 23 12:08:22 2016 -0500
    @@ -1,3 +1,39 @@
    +gplugin (0.27) unstable; urgency=medium
    +
    + * New upstream release, see official changelog
    +
    + -- Gary Kramlich <grim@reaperworld.com> Mon, 18 Apr 2016 22:31:45 -0500
    +
    +gplugin (0.26) unstable; urgency=medium
    +
    + * New upstream release, see official changelog
    +
    + -- Gary Kramlich <grim@reaperworld.com> Mon, 18 Apr 2016 22:31:30 -0500
    +
    +gplugin (0.25) unstable; urgency=medium
    +
    + * New upstream release, see official changelog
    +
    + -- Gary Kramlich <grim@reaperworld.com> Sat, 06 Feb 2016 20:28:53 -0600
    +
    +gplugin (0.24.1) unstable; urgency=medium
    +
    + * New upstream release, see official changelog
    +
    + -- Gary Kramlich <grim@reaperworld.com> Sat, 06 Feb 2016 20:28:47 -0600
    +
    +gplugin (0.0.24) unstable; urgency=medium
    +
    + * New upstream release, see official changelog
    +
    + -- Gary Kramlich <grim@reaperworld.com> Thu, 28 Jan 2016 22:38:05 -0600
    +
    +gplugin (0.0.23) unstable; urgency=medium
    +
    + * New release, see official changelog
    +
    + -- Gary Kramlich <grim@reaperworld.com> Wed, 06 Jan 2016 23:05:37 -0600
    +
    gplugin (0.0.21) unstable; urgency=medium
    * New release, see official changelog
    --- a/packaging/debian/control Tue Sep 29 22:45:21 2015 -0500
    +++ b/packaging/debian/control Tue Aug 23 12:08:22 2016 -0500
    @@ -2,7 +2,8 @@
    Section: libs
    Priority: optional
    Maintainer: Gary Kramlich <grim@reaperworld.com>
    -Build-Depends: debhelper (>=9), cmake, libglib2.0-dev, libgtk-3-dev,
    +Build-Depends: debhelper (>=9), dh-exec,
    + cmake, libglib2.0-dev, libgtk-3-dev,
    xsltproc, gettext, help2man,
    gobject-introspection, libgirepository1.0-dev,
    liblua5.1-0-dev, lua-lgi,
    @@ -23,18 +24,6 @@
    .
    This package contains the main library.
    -Package: libgplugin0-dbg
    -Architecture: any
    -Section: debug
    -Priority: extra
    -Depends: ${misc:Depends}, libgplugin0 (= ${binary:Version})
    -Description: debugging symbols for libgplugin0
    - GPlugin is a GObject based library that implements a reusable plugin system
    - which supports loading plugins in other languages via loaders. It relies
    - heavily on GObjectIntrospection to expose its API to the other languages.
    - .
    - This package contains the debugging symbols for libgplugin0.
    -
    Package: libgplugin-dev
    Architecture: any
    Section: libdevel
    @@ -68,18 +57,6 @@
    .
    This library provides some default GTK+-3 widgets for GPlugin.
    -Package: libgplugin-gtk0-dbg
    -Architecture: any
    -Section: debug
    -Priority: extra
    -Depends: ${misc:Depends}, libgplugin-gtk0 (= ${binary:Version})
    -Description: debugging symbols for libgplugin-gtk0
    - GPlugin is a GObject based library that implements a reusable plugin system
    - which supports loading plugins in other languages via loaders. It relies
    - heavily on GObjectIntrospection to expose its API to the other languages.
    - .
    - This library provides the debugging symbols for libgplugin-gtk0
    -
    Package: libgplugin-gtk-dev
    Architecture: any
    Section: libdevel
    @@ -116,7 +93,7 @@
    Package: libgplugin-lua
    Architecture: any
    -Depends: ${misc:Depends}, ${shlibs:Depends}, libluajit-5.1,
    +Depends: ${misc:Depends}, ${shlibs:Depends}, liblua5.1-0,
    libgplugin0, gir1.2-gplugin-0.0
    Description: GPlugin Lua Loader
    GPlugin is a GObject based library that implements a reusable plugin system
    --- a/packaging/debian/copyright Tue Sep 29 22:45:21 2015 -0500
    +++ b/packaging/debian/copyright Tue Aug 23 12:08:22 2016 -0500
    @@ -23,4 +23,3 @@
    .
    On Debian systems, the complete text of the GNU Lesser General Public LIcense
    can be found in /usr/share/common-licenses/LGPL-3.
    -
    --- a/packaging/debian/gir1.2-gplugin-0.0.install Tue Sep 29 22:45:21 2015 -0500
    +++ b/packaging/debian/gir1.2-gplugin-0.0.install Tue Aug 23 12:08:22 2016 -0500
    @@ -1,3 +1,3 @@
    -usr/lib/*/girepository-1.0/
    +#!/usr/bin/dh-exec
    +usr/lib/${DEB_HOST_MULTIARCH}/girepository-1.0/
    usr/share/gir-1.0/
    -
    --- a/packaging/debian/libgplugin-dev.install Tue Sep 29 22:45:21 2015 -0500
    +++ b/packaging/debian/libgplugin-dev.install Tue Aug 23 12:08:22 2016 -0500
    @@ -1,6 +1,6 @@
    +#!/usr/bin/dh-exec
    usr/include/gplugin-1.0/gplugin
    usr/include/gplugin-1.0/gplugin.h
    usr/include/gplugin-1.0/gplugin-native.h
    -usr/lib/*/libgplugin.so
    -usr/lib/*/pkgconfig/gplugin.pc
    -
    +usr/lib/${DEB_HOST_MULTIARCH}/libgplugin.so
    +usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig/gplugin.pc
    --- a/packaging/debian/libgplugin-gtk-bin.install Tue Sep 29 22:45:21 2015 -0500
    +++ b/packaging/debian/libgplugin-gtk-bin.install Tue Aug 23 12:08:22 2016 -0500
    @@ -1,3 +1,2 @@
    usr/bin/gplugin-gtk-viewer
    usr/share/man/man1/gplugin-gtk-viewer.1
    -
    --- a/packaging/debian/libgplugin-gtk-dev.install Tue Sep 29 22:45:21 2015 -0500
    +++ b/packaging/debian/libgplugin-gtk-dev.install Tue Aug 23 12:08:22 2016 -0500
    @@ -1,5 +1,5 @@
    +#!/usr/bin/dh-exec
    usr/include/gplugin-1.0/gplugin-gtk
    usr/include/gplugin-1.0/gplugin-gtk.h
    -usr/lib/*/libgplugin-gtk.so
    -usr/lib/*/pkgconfig/gplugin-gtk.pc
    -
    +usr/lib/${DEB_HOST_MULTIARCH}/libgplugin-gtk.so
    +usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig/gplugin-gtk.pc
    --- a/packaging/debian/libgplugin-gtk0.install Tue Sep 29 22:45:21 2015 -0500
    +++ b/packaging/debian/libgplugin-gtk0.install Tue Aug 23 12:08:22 2016 -0500
    @@ -1,2 +1,2 @@
    -usr/lib/*/libgplugin-gtk.so.*
    -
    +#!/usr/bin/dh-exec
    +usr/lib/${DEB_HOST_MULTIARCH}/libgplugin-gtk.so.*
    --- a/packaging/debian/libgplugin-gtk0.postinst Tue Sep 29 22:45:21 2015 -0500
    +++ b/packaging/debian/libgplugin-gtk0.postinst Tue Aug 23 12:08:22 2016 -0500
    @@ -9,4 +9,3 @@
    #DEBHELPER#
    exit 0
    -
    --- a/packaging/debian/libgplugin-gtk0.postrm Tue Sep 29 22:45:21 2015 -0500
    +++ b/packaging/debian/libgplugin-gtk0.postrm Tue Aug 23 12:08:22 2016 -0500
    @@ -9,4 +9,3 @@
    #DEBHELPER#
    exit 0
    -
    --- a/packaging/debian/libgplugin-gtk0.symbols Tue Sep 29 22:45:21 2015 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,13 +0,0 @@
    -libgplugin-gtk.so.0 libgplugin-gtk0 #MINVER#
    - gplugin_gtk_get_store_column_types@Base 0.0.17
    - gplugin_gtk_plugin_info_get_plugin@Base 0.0.17
    - gplugin_gtk_plugin_info_get_type@Base 0.0.17
    - gplugin_gtk_plugin_info_new@Base 0.0.17
    - gplugin_gtk_plugin_info_set_plugin@Base 0.0.17
    - gplugin_gtk_store_get_type@Base 0.0.17
    - gplugin_gtk_store_new@Base 0.0.17
    - gplugin_gtk_view_get_show_internal@Base 0.0.17
    - gplugin_gtk_view_get_type@Base 0.0.17
    - gplugin_gtk_view_new@Base 0.0.17
    - gplugin_gtk_view_set_show_internal@Base 0.0.17
    -
    --- a/packaging/debian/libgplugin-lua.install Tue Sep 29 22:45:21 2015 -0500
    +++ b/packaging/debian/libgplugin-lua.install Tue Aug 23 12:08:22 2016 -0500
    @@ -1,2 +1,2 @@
    -usr/lib/*/gplugin/gplugin-lua.so usr/lib/*/gplugin
    -
    +#!/usr/bin/dh-exec
    +usr/lib/${DEB_HOST_MULTIARCH}/gplugin/gplugin-lua.so
    --- a/packaging/debian/libgplugin-python.install Tue Sep 29 22:45:21 2015 -0500
    +++ b/packaging/debian/libgplugin-python.install Tue Aug 23 12:08:22 2016 -0500
    @@ -1,2 +1,2 @@
    -usr/lib/*/gplugin/gplugin-python.so usr/lib/*/gplugin
    -
    +#!/usr/bin/dh-exec
    +usr/lib/${DEB_HOST_MULTIARCH}/gplugin/gplugin-python.so
    --- a/packaging/debian/libgplugin0.install Tue Sep 29 22:45:21 2015 -0500
    +++ b/packaging/debian/libgplugin0.install Tue Aug 23 12:08:22 2016 -0500
    @@ -1,4 +1,4 @@
    -usr/lib/*/libgplugin.so.*
    +#!/usr/bin/dh-exec
    +usr/lib/${DEB_HOST_MULTIARCH}/libgplugin.so.*
    usr/bin/gplugin-query
    usr/share/man/man1/gplugin-query.1
    -
    --- a/packaging/debian/libgplugin0.postinst Tue Sep 29 22:45:21 2015 -0500
    +++ b/packaging/debian/libgplugin0.postinst Tue Aug 23 12:08:22 2016 -0500
    @@ -5,4 +5,3 @@
    #DEBHELPER#
    exit 0
    -
    --- a/packaging/debian/libgplugin0.postrm Tue Sep 29 22:45:21 2015 -0500
    +++ b/packaging/debian/libgplugin0.postrm Tue Aug 23 12:08:22 2016 -0500
    @@ -5,4 +5,3 @@
    #DEBHELPER#
    exit 0
    -
    --- a/packaging/debian/libgplugin0.symbols Tue Sep 29 22:45:21 2015 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,79 +0,0 @@
    -libgplugin.so.0 libgplugin0 #MINVER#
    - dependency_pattern@Base 0.0.17
    - dependency_regex@Base 0.0.17
    - gplugin_boolean_accumulator@Base 0.0.17
    - gplugin_file_tree_entry_free@Base 0.0.17
    - gplugin_file_tree_entry_new@Base 0.0.17
    - gplugin_file_tree_free@Base 0.0.17
    - gplugin_file_tree_new@Base 0.0.17
    - gplugin_get_option_group@Base 0.0.17
    - gplugin_init@Base 0.0.17
    - gplugin_loader_class_get_supported_extensions@Base 0.0.17
    - gplugin_loader_get_type@Base 0.0.17
    - gplugin_loader_load_plugin@Base 0.0.17
    - gplugin_loader_query_plugin@Base 0.0.17
    - gplugin_loader_unload_plugin@Base 0.0.17
    - gplugin_manager_add_app_paths@Base 0.0.17
    - gplugin_manager_add_default_paths@Base 0.0.17
    - gplugin_manager_append_path@Base 0.0.17
    - gplugin_manager_find_plugin@Base 0.0.17
    - gplugin_manager_find_plugins@Base 0.0.17
    - gplugin_manager_free_plugin_list@Base 0.0.17
    - gplugin_manager_get_instance@Base 0.0.17
    - gplugin_manager_get_paths@Base 0.0.17
    - gplugin_manager_get_type@Base 0.0.17
    - gplugin_manager_list_plugins@Base 0.0.17
    - gplugin_manager_load_plugin@Base 0.0.17
    - gplugin_manager_prepend_path@Base 0.0.17
    - gplugin_manager_private_init@Base 0.0.17
    - gplugin_manager_private_uninit@Base 0.0.17
    - gplugin_manager_refresh@Base 0.0.17
    - gplugin_manager_register_loader@Base 0.0.17
    - gplugin_manager_remove_path@Base 0.0.17
    - gplugin_manager_remove_paths@Base 0.0.17
    - gplugin_manager_unload_plugin@Base 0.0.17
    - gplugin_manager_unregister_loader@Base 0.0.17
    - gplugin_marshal_BOOLEAN__OBJECT_POINTER@Base 0.0.17
    - gplugin_marshal_VOID__ENUM_ENUM@Base 0.0.17
    - gplugin_marshal_VOID__INT_INT@Base 0.0.17
    - gplugin_native_loader_get_type@Base 0.0.17
    - gplugin_native_plugin_add_interface@Base 0.0.17
    - gplugin_native_plugin_get_module@Base 0.0.17
    - gplugin_native_plugin_get_type@Base 0.0.17
    - gplugin_native_plugin_register_enum@Base 0.0.17
    - gplugin_native_plugin_register_flags@Base 0.0.17
    - gplugin_native_plugin_register_type@Base 0.0.17
    - gplugin_native_plugin_unuse@Base 0.0.17
    - gplugin_native_plugin_use@Base 0.0.17
    - gplugin_plugin_get_filename@Base 0.0.17
    - gplugin_plugin_get_info@Base 0.0.17
    - gplugin_plugin_get_internal_filename@Base 0.0.17
    - gplugin_plugin_get_loader@Base 0.0.17
    - gplugin_plugin_get_state@Base 0.0.17
    - gplugin_plugin_get_type@Base 0.0.17
    - gplugin_plugin_info_get_abi_version@Base 0.0.17
    - gplugin_plugin_info_get_authors@Base 0.0.17
    - gplugin_plugin_info_get_bind_local@Base 0.0.17
    - gplugin_plugin_info_get_category@Base 0.0.17
    - gplugin_plugin_info_get_dependencies@Base 0.0.17
    - gplugin_plugin_info_get_description@Base 0.0.17
    - gplugin_plugin_info_get_help@Base 0.0.17
    - gplugin_plugin_info_get_icon@Base 0.0.17
    - gplugin_plugin_info_get_id@Base 0.0.17
    - gplugin_plugin_info_get_internal@Base 0.0.17
    - gplugin_plugin_info_get_license_id@Base 0.0.17
    - gplugin_plugin_info_get_license_text@Base 0.0.17
    - gplugin_plugin_info_get_license_url@Base 0.0.17
    - gplugin_plugin_info_get_load_on_query@Base 0.0.17
    - gplugin_plugin_info_get_name@Base 0.0.17
    - gplugin_plugin_info_get_summary@Base 0.0.17
    - gplugin_plugin_info_get_type@Base 0.0.17
    - gplugin_plugin_info_get_version@Base 0.0.17
    - gplugin_plugin_info_get_version_func@Base 0.0.17
    - gplugin_plugin_info_get_website@Base 0.0.17
    - gplugin_plugin_set_state@Base 0.0.17
    - gplugin_plugin_state_get_type@Base 0.0.17
    - gplugin_uninit@Base 0.0.17
    - gplugin_version_compare@Base 0.0.17
    - instance@Base 0.0.17
    - regex@Base 0.0.17
    --- a/packaging/debian/rules Tue Sep 29 22:45:21 2015 -0500
    +++ b/packaging/debian/rules Tue Aug 23 12:08:22 2016 -0500
    @@ -3,12 +3,3 @@
    %:
    dh $@
    -override_dh_makeshlibs:
    - dh_makeshlibs -plibgplugin0
    - dh_makeshlibs -plibgplugin-gtk0
    -
    -override_dh_strip:
    - dh_strip -plibgplugin0 --dbg-package=libgplugin0-dbg
    - dh_strip -plibgplugin-gtk0 --dbg-package=libgplugin-gtk0-dbg
    - dh_strip
    -
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/packaging/gplugin.spec.in Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,245 @@
    +Name: gplugin
    +Version: @GPLUGIN_VERSION@
    +Release: %{?build_number}%{?!build_number:1}
    +License: LGPL-2.0+
    +Summary: A GObject based library that implements a reusable plugin system
    +Url: https://bitbucket.org/rw_grim/gplugin/overview
    +Group: Development/Libraries
    +
    +BuildRequires: cmake >= 2.8
    +BuildRequires: glib2-devel >= 2.20.0
    +BuildRequires: gobject-introspection-devel
    +BuildRequires: gettext
    +BuildRequires: gtk3-devel
    +BuildRequires: help2man
    +BuildRequires: libxslt
    +BuildRequires: lua-devel
    +BuildRequires: lua-lgi
    +BuildRequires: python3-devel
    +BuildRequires: python3-gobject
    +BuildRequires: /usr/lib64/pkgconfig/pygobject-3.0.pc
    +
    +%if 0%{?suse_version} > 0
    +# avoid "directories not owned by a package" error
    +%define notownedhack 1
    +%else
    +%define notownedhack 0
    +%endif
    +
    +
    +%package -n libgplugin0
    +Summary: A GObject based library that implements a reusable plugin system
    +Group: Development/Libraries
    +
    +%package devel
    +Summary: A GObject based library that implements a reusable plugin system
    +Group: Development/Libraries
    +Requires: %{name}%{?_isa} = %{version}-%{release}
    +
    +%package gtk3
    +Summary: A GObject based library that implements a reusable plugin system
    +Group: Development/Libraries
    +
    +%package gtk3-devel
    +Summary: A GObject based library that implements a reusable plugin system
    +Group: Development/Libraries
    +Requires: %{name}-gtk3%{?_isa} = %{version}-%{release}
    +Requires: %{name}-devel%{?_isa} = %{version}-%{release}
    +
    +%package lua
    +Summary: A GObject based library that implements a reusable plugin system
    +Group: Development/Libraries
    +
    +%package python3
    +Summary: A GObject based library that implements a reusable plugin system
    +Group: Development/Libraries
    +
    +
    +%description
    +GPlugin is a GObject based library that implements a reusable plugin system
    +that supports loading plugins in other languages via loaders. GPlugin also
    +implements dependencies among the plugins.
    +
    +It was started due to the infamous "Plugin Problem" for Guifications 3, which
    +was that I needed plugins that could depend on each other, be able to be
    +written in other languages, have plugins that are loaded before the main load
    +phase, and allow plugins to register types into the GObject type system.
    +
    +%description -n libgplugin0
    +GPlugin is a GObject based library that implements a reusable plugin system
    +that supports loading plugins in other languages via loaders. GPlugin also
    +implements dependencies among the plugins.
    +
    +It was started due to the infamous "Plugin Problem" for Guifications 3, which
    +was that I needed plugins that could depend on each other, be able to be
    +written in other languages, have plugins that are loaded before the main load
    +phase, and allow plugins to register types into the GObject type system.
    +
    +%description devel
    +GPlugin is a GObject based library that implements a reusable plugin system
    +that supports loading plugins in other languages via loaders. GPlugin also
    +implements dependencies among the plugins.
    +
    +It was started due to the infamous "Plugin Problem" for Guifications 3, which
    +was that I needed plugins that could depend on each other, be able to be
    +written in other languages, have plugins that are loaded before the main load
    +phase, and allow plugins to register types into the GObject type system.
    +
    +This package contains all necessary include files and libraries needed
    +to develop applications that require these.
    +
    +%description gtk3
    +GPlugin is a GObject based library that implements a reusable plugin system
    +that supports loading plugins in other languages via loaders. GPlugin also
    +implements dependencies among the plugins.
    +
    +It was started due to the infamous "Plugin Problem" for Guifications 3, which
    +was that I needed plugins that could depend on each other, be able to be
    +written in other languages, have plugins that are loaded before the main load
    +phase, and allow plugins to register types into the GObject type system.
    +
    +This package contains additional GTK3 dependencies for %{name} library.
    +
    +%description gtk3-devel
    +GPlugin is a GObject based library that implements a reusable plugin system
    +that supports loading plugins in other languages via loaders. GPlugin also
    +implements dependencies among the plugins.
    +
    +It was started due to the infamous "Plugin Problem" for Guifications 3, which
    +was that I needed plugins that could depend on each other, be able to be
    +written in other languages, have plugins that are loaded before the main load
    +phase, and allow plugins to register types into the GObject type system.
    +
    +This package contains all necessary include files and libraries needed
    +to develop GTK3 applications that require these.
    +
    +%description lua
    +GPlugin is a GObject based library that implements a reusable plugin system
    +that supports loading plugins in other languages via loaders. GPlugin also
    +implements dependencies among the plugins.
    +
    +It was started due to the infamous "Plugin Problem" for Guifications 3, which
    +was that I needed plugins that could depend on each other, be able to be
    +written in other languages, have plugins that are loaded before the main load
    +phase, and allow plugins to register types into the GObject type system.
    +
    +This package contains the Lua Loader for %{name} library.
    +
    +%description python3
    +GPlugin is a GObject based library that implements a reusable plugin system
    +that supports loading plugins in other languages via loaders. GPlugin also
    +implements dependencies among the plugins.
    +
    +It was started due to the infamous "Plugin Problem" for Guifications 3, which
    +was that I needed plugins that could depend on each other, be able to be
    +written in other languages, have plugins that are loaded before the main load
    +phase, and allow plugins to register types into the GObject type system.
    +
    +This package contains Python 3 loader for %{name} library.
    +
    +
    +%build
    +mkdir -p build
    +pushd build
    +
    +CFLAGS="%{optflags}" cmake \
    + -Wno-dev \
    + -DCMAKE_INSTALL_PREFIX=%{_prefix} \
    + -DBUILD_LUA=On \
    + -DBUILD_PYTHON=On \
    + ..
    +
    +make %{?_smp_mflags}
    +
    +
    +%install
    +pushd build
    +
    +make install DESTDIR=%{buildroot}
    +
    +# Unneeded files
    +rm -rf %{buildroot}%{_datadir}/doc/gplugin/
    +%if %{notownedhack} == 1
    +rm -rf %{buildroot}%{_datadir}/gplugin/
    +%endif
    +
    +%post -n libgplugin0 -p /sbin/ldconfig
    +
    +%postun -n libgplugin0 -p /sbin/ldconfig
    +
    +%post -n gplugin-gtk3 -p /sbin/ldconfig
    +
    +%postun -n gplugin-gtk3 -p /sbin/ldconfig
    +
    +
    +%files
    +%defattr(-,root,root)
    +%doc README ChangeLog
    +%if %{notownedhack} == 0
    +%license COPYING
    +%endif
    +%{_bindir}/gplugin-query
    +%{_libdir}/gplugin/
    +%{_mandir}/man1/gplugin-query.1*
    +
    +%files -n libgplugin0
    +%defattr(-,root,root)
    +%{_libdir}/libgplugin.so.0.1.0
    +
    +%files devel
    +%defattr(-,root,root)
    +%doc README HACKING
    +%if %{notownedhack} == 0
    +%license COPYING
    +%endif
    +%{_includedir}/gplugin-1.0/
    +%{_libdir}/libgplugin.so
    +%{_libdir}/libgplugin.so.0
    +%{_libdir}/pkgconfig/gplugin.pc
    +%{_libdir}/pkgconfig/gplugin-gtk.pc
    +%{_libdir}/girepository-1.0/GPlugin-0.0.typelib
    +%{_datadir}/gir-1.0/GPlugin-0.0.gir
    +
    +%files gtk3
    +%defattr(-,root,root)
    +%doc README
    +%if %{notownedhack} == 0
    +%license COPYING
    +%endif
    +%{_bindir}/gplugin-gtk-viewer
    +%{_libdir}/libgplugin-gtk.so.0.1.0
    +%if %{notownedhack} == 0
    +%{_datadir}/gplugin/gplugin-gtk/
    +%endif
    +%{_mandir}/man1/gplugin-gtk-viewer.1*
    +
    +%files gtk3-devel
    +%defattr(-,root,root)
    +%doc README
    +%if %{notownedhack} == 0
    +%license COPYING
    +%endif
    +%{_libdir}/libgplugin-gtk.so
    +%{_libdir}/libgplugin-gtk.so.0
    +
    +%files lua
    +%defattr(-,root,root)
    +%doc README
    +%license COPYING
    +%{_libdir}/gplugin/gplugin-lua.so
    +
    +%files python3
    +%defattr(-,root,root)
    +%doc README
    +%if %{notownedhack} == 0
    +%license COPYING
    +%endif
    +%{_libdir}/gplugin/gplugin-python.so
    +
    +
    +%changelog
    +* Sun May 15 2016 Gary Kramlich <grim@reaperworld.com>
    +- Updates and pulled upstream
    +
    +* Mon May 4 2015 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.0.18-1
    +- Initial package release
    --- a/python/CMakeLists.txt Tue Sep 29 22:45:21 2015 -0500
    +++ b/python/CMakeLists.txt Tue Aug 23 12:08:22 2016 -0500
    @@ -32,6 +32,8 @@
    ${PYGOBJECT_INCLUDE_DIRS}
    )
    + link_directories(${PYTHON3_LIBRARY_DIRS})
    +
    message(STATUS "checking if pygobject works with python3")
    set(GPLUGIN_PYTHON_TEST_PYGOBJECT_INCLUDES)
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tcc/CMakeLists.txt Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,39 @@
    +option(
    + BUILD_TCC
    + "Whether or not to build the TCC plugin loader"
    + "Off"
    +)
    +
    +if(BUILD_TCC)
    + set(GPLUGIN_TCC_SOURCES
    + gplugin-tcc-core.c
    + gplugin-tcc-loader.c
    + gplugin-tcc-plugin.c
    + )
    +
    + set(GPLUGIN_TCC_HEADERS
    + gplugin-tcc-loader.h
    + gplugin-tcc-plugin.h
    + )
    +
    + find_package(LibTcc REQUIRED)
    +
    + include_directories(${LIBTCC_INCLUDE_DIR})
    +
    + #pkg_check_modules(TCC REQUIRED libtcc)
    + add_library(gplugin-tcc MODULE
    + ${GPLUGIN_TCC_SOURCES}
    + ${GPLUGIN_TCC_HEADERS}
    + )
    + set_target_properties(gplugin-tcc PROPERTIES PREFIX "")
    +
    + target_link_libraries(gplugin-tcc
    + ${LIBTCC_LIBRARIES}
    + gplugin
    + )
    +
    + install(TARGETS gplugin-tcc DESTINATION lib/gplugin)
    +endif(BUILD_TCC)
    +
    +add_subdirectory(tests)
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tcc/gplugin-tcc-core.c Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,67 @@
    +/*
    + * Copyright (C) 2011-2013 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU General Public License for more details.
    + *
    + * You should have received a copy of the GNU General Public License
    + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    + */
    +
    +#include <gplugin.h>
    +#include <gplugin-native.h>
    +
    +#include "gplugin-tcc-loader.h"
    +#include "gplugin-tcc-plugin.h"
    +
    +
    +G_MODULE_EXPORT GPluginPluginInfo *
    +gplugin_query(GPLUGIN_UNUSED GError **error) {
    + const gchar * const authors[] = {
    + "Eion Robb <eion@robbmob.com>",
    + NULL
    + };
    +
    + return gplugin_plugin_info_new(
    + "gplugin/tcc-loader",
    + GPLUGIN_NATIVE_PLUGIN_ABI_VERSION,
    + "internal", TRUE,
    + "load-on-query", TRUE,
    + "name", "C source plugin loader",
    + "version", GPLUGIN_VERSION,
    + "license-id", "LGPL2",
    + "summary", "A plugin that can load C source plugins",
    + "description", "This plugin allows the loading of plugins written in C.",
    + "authors", authors,
    + "website", GPLUGIN_WEBSITE,
    + "category", "loaders",
    + NULL
    + );
    +}
    +
    +G_MODULE_EXPORT gboolean
    +gplugin_load(GPluginNativePlugin *plugin,
    + GPLUGIN_UNUSED GError **error)
    +{
    + gplugin_tcc_loader_register(plugin);
    + gplugin_tcc_plugin_register(plugin);
    +
    + gplugin_manager_register_loader(gplugin_tcc_loader_get_type());
    +
    + return TRUE;
    +}
    +
    +G_MODULE_EXPORT gboolean
    +gplugin_unload(GPLUGIN_UNUSED GPluginNativePlugin *plugin,
    + GPLUGIN_UNUSED GError **error)
    +{
    + return FALSE;
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tcc/gplugin-tcc-loader.c Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,203 @@
    +/*
    + * Copyright (C) 2011-2013 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU General Public License for more details.
    + *
    + * You should have received a copy of the GNU General Public License
    + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    + */
    +
    +#include "gplugin-tcc-loader.h"
    +
    +#include "gplugin-tcc-plugin.h"
    +
    +#include <glib/gi18n.h>
    +
    +#include <libtcc.h>
    +
    +/******************************************************************************
    + * Globals
    + *****************************************************************************/
    +static GObjectClass *parent_class = NULL;
    +static GType type_real = 0;
    +
    +/******************************************************************************
    + * GPluginLoaderInterface API
    + *****************************************************************************/
    +static GSList *
    +gplugin_tcc_loader_class_supported_extensions(GPLUGIN_UNUSED const GPluginLoaderClass *klass) {
    + GSList *exts = NULL;
    +
    + exts = g_slist_append(exts, "c");
    +
    + return exts;
    +}
    +
    +static GPluginPlugin *
    +gplugin_tcc_loader_query(GPluginLoader *loader, const gchar *filename,
    + GError **error)
    +{
    + GPluginPlugin *plugin = NULL;
    + GPluginPluginInfo *info = NULL;
    + TCCState *s = NULL;
    + gpointer memneeded = NULL;
    + int memsize = -1;
    +
    + GPluginTccPluginQueryFunc gplugin_query = NULL;
    +
    + s = tcc_new();
    +
    + tcc_set_output_type(s, TCC_OUTPUT_MEMORY);
    +
    + if(tcc_add_file(s, filename) == -1) {
    + if(error)
    + *error = g_error_new(GPLUGIN_DOMAIN, 0, "couldn't load file %s", filename);
    +
    + tcc_delete(s);
    +
    + return NULL;
    + }
    +
    + /* copy code into memory */
    + if((memsize = tcc_relocate(s, NULL)) < 0) {
    + if(error)
    + *error = g_error_new(GPLUGIN_DOMAIN, 0, "couldn't work out how much memory is needed");
    +
    + tcc_delete(s);
    + return NULL;
    + }
    +
    + memneeded = g_malloc0(memsize);
    + if(tcc_relocate(s, memneeded) < 0) {
    + if(error)
    + *error = g_error_new(GPLUGIN_DOMAIN, 0, "could not relocate plugin into memory");
    +
    + tcc_delete(s);
    + g_free(memneeded);
    + return NULL;
    + }
    +
    + gplugin_query = (GPluginTccPluginQueryFunc) tcc_get_symbol(s, "gplugin_query");
    + if (gplugin_query == NULL) {
    + if(error)
    + *error = g_error_new(GPLUGIN_DOMAIN, 0, "no gplugin_query function found");
    +
    + tcc_delete(s);
    + g_free(memneeded);
    + return NULL;
    + }
    +
    + info = gplugin_query(error);
    + if(info == NULL) {
    + tcc_delete(s);
    + g_free(memneeded);
    + return NULL;
    + }
    +
    + plugin = g_object_new(GPLUGIN_TYPE_TCC_PLUGIN,
    + "filename", filename,
    + "loader", loader,
    + "state", s,
    + "memory", memneeded,
    + "info", info,
    + NULL);
    +
    + return plugin;
    +}
    +
    +static gboolean
    +gplugin_tcc_loader_load(GPLUGIN_UNUSED GPluginLoader *loader,
    + GPluginPlugin *plugin,
    + GError **error)
    +{
    + GPluginTccPluginLoadFunc gplugin_load = NULL;
    + TCCState *s = gplugin_tcc_plugin_get_state(GPLUGIN_TCC_PLUGIN(plugin));
    +
    + gplugin_load = (GPluginTccPluginLoadFunc) tcc_get_symbol(s, "gplugin_load");
    + if (gplugin_load == NULL) {
    + if(error)
    + *error = g_error_new(GPLUGIN_DOMAIN, 0, "no gplugin_load function found");
    +
    + return FALSE;
    + }
    +
    + return gplugin_load(GPLUGIN_NATIVE_PLUGIN(plugin), error);
    +}
    +
    +static gboolean
    +gplugin_tcc_loader_unload(GPLUGIN_UNUSED GPluginLoader *loader,
    + GPluginPlugin *plugin,
    + GError **error)
    +{
    + GPluginTccPluginLoadFunc gplugin_unload = NULL;
    + TCCState *s = gplugin_tcc_plugin_get_state(GPLUGIN_TCC_PLUGIN(plugin));
    +
    + gplugin_unload = (GPluginTccPluginUnloadFunc) tcc_get_symbol(s, "gplugin_unload");
    + if (gplugin_unload == NULL) {
    + if(error)
    + *error = g_error_new(GPLUGIN_DOMAIN, 0, "no gplugin_unload function found");
    +
    + return FALSE;
    + }
    +
    + return gplugin_unload(GPLUGIN_NATIVE_PLUGIN(plugin), error);
    +}
    +
    +/******************************************************************************
    + * GObject Stuff
    + *****************************************************************************/
    +static void
    +gplugin_tcc_loader_class_init(GPluginTccLoaderClass *klass) {
    + GPluginLoaderClass *loader_class = GPLUGIN_LOADER_CLASS(klass);
    +
    + parent_class = g_type_class_peek_parent(klass);
    +
    + loader_class->supported_extensions =
    + gplugin_tcc_loader_class_supported_extensions;
    + loader_class->query = gplugin_tcc_loader_query;
    + loader_class->load = gplugin_tcc_loader_load;
    + loader_class->unload = gplugin_tcc_loader_unload;
    +}
    +
    +/******************************************************************************
    + * API
    + *****************************************************************************/
    +void
    +gplugin_tcc_loader_register(GPluginNativePlugin *plugin) {
    + if(g_once_init_enter(&type_real)) {
    + GType type = 0;
    +
    + static const GTypeInfo info = {
    + .class_size = sizeof(GPluginTccLoaderClass),
    + .class_init = (GClassInitFunc)gplugin_tcc_loader_class_init,
    + .instance_size = sizeof(GPluginTccLoader),
    + };
    +
    + type = gplugin_native_plugin_register_type(plugin,
    + GPLUGIN_TYPE_LOADER,
    + "GPluginTccLoader",
    + &info,
    + 0);
    +
    + g_once_init_leave(&type_real, type);
    + }
    +}
    +
    +GType
    +gplugin_tcc_loader_get_type(void) {
    + if(G_UNLIKELY(type_real == 0)) {
    + g_warning("gplugin_tcc_loader_get_type was called before "
    + "the type was registered!\n");
    + }
    +
    + return type_real;
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tcc/gplugin-tcc-loader.h Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,59 @@
    +/*
    + * Copyright (C) 2011-2013 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU General Public License for more details.
    + *
    + * You should have received a copy of the GNU General Public License
    + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    + */
    +#ifndef GPLUGIN_TCC_LOADER_H
    +#define GPLUGIN_TCC_LOADER_H
    +
    +#define GPLUGIN_TYPE_TCC_LOADER (gplugin_tcc_loader_get_type())
    +#define GPLUGIN_TCC_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GPLUGIN_TYPE_TCC_LOADER, GPluginTccLoader))
    +#define GPLUGIN_TCC_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((obj), GPLUGIN_TYPE_TCC_LOADER, GPluginTccLoaderClass))
    +#define GPLUGIN_IS_TCC_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GPLUGIN_TYPE_TCC_LOADER))
    +#define GPLUGIN_IS_TCC_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((obj), GPLUGIN_TYPE_TCC_LOADER))
    +#define GPLUGIN_TCC_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GPLUGIN_TYPE_TCC_LOADER, GPluginTccLoaderClass))
    +
    +typedef struct _GPluginTccLoader GPluginTccLoader;
    +typedef struct _GPluginTccLoaderClass GPluginTccLoaderClass;
    +
    +#include <gplugin.h>
    +#include <gplugin-native.h>
    +
    +struct _GPluginTccLoader {
    + GPluginLoader parent;
    +
    + void (*_gplugin_reserved_1)(void);
    + void (*_gplugin_reserved_2)(void);
    + void (*_gplugin_reserved_3)(void);
    + void (*_gplugin_reserved_4)(void);
    +};
    +
    +struct _GPluginTccLoaderClass {
    + GPluginLoaderClass parent;
    +
    + void (*_gplugin_reserved_1)(void);
    + void (*_gplugin_reserved_2)(void);
    + void (*_gplugin_reserved_3)(void);
    + void (*_gplugin_reserved_4)(void);
    +};
    +
    +G_BEGIN_DECLS
    +
    +void gplugin_tcc_loader_register(GPluginNativePlugin *plugin);
    +GType gplugin_tcc_loader_get_type(void);
    +
    +G_END_DECLS
    +
    +#endif /* GPLUGIN_TCC_LOADER_H */
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tcc/gplugin-tcc-plugin.c Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,183 @@
    +/*
    + * Copyright (C) 2011-2013 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU General Public License for more details.
    + *
    + * You should have received a copy of the GNU General Public License
    + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    + */
    +
    +#include "gplugin-tcc-plugin.h"
    +
    +#include <libtcc.h>
    +
    +#define GPLUGIN_TCC_PLUGIN_GET_PRIVATE(obj) \
    + (G_TYPE_INSTANCE_GET_PRIVATE((obj), GPLUGIN_TYPE_TCC_PLUGIN, GPluginTccPluginPrivate))
    +
    +/******************************************************************************
    + * Typedefs
    + *****************************************************************************/
    +typedef struct {
    + TCCState *s;
    + gpointer mem;
    +} GPluginTccPluginPrivate;
    +
    +/******************************************************************************
    + * Enums
    + *****************************************************************************/
    +enum {
    + PROP_ZERO,
    + PROP_STATE,
    + PROP_MEM,
    + PROP_LAST,
    +};
    +
    +/******************************************************************************
    + * Globals
    + *****************************************************************************/
    +static GObjectClass *parent_class = NULL;
    +static GType type_real = 0;
    +
    +/******************************************************************************
    + * Private Stuff
    + *****************************************************************************/
    +static void
    +gplugin_tcc_plugin_set_state(GPluginTccPlugin *plugin, TCCState *s) {
    + GPluginTccPluginPrivate *priv = GPLUGIN_TCC_PLUGIN_GET_PRIVATE(plugin);
    +
    + priv->s = s;
    +}
    +
    +static void
    +gplugin_tcc_plugin_set_memory(GPluginTccPlugin *plugin, gpointer mem) {
    + GPluginTccPluginPrivate *priv = GPLUGIN_TCC_PLUGIN_GET_PRIVATE(plugin);
    +
    + priv->mem = mem;
    +}
    +
    +/******************************************************************************
    + * Object Stuff
    + *****************************************************************************/
    +static void
    +gplugin_tcc_plugin_get_property(GObject *obj, guint param_id, GValue *value,
    + GParamSpec *pspec)
    +{
    + GPluginTccPlugin *plugin = GPLUGIN_TCC_PLUGIN(obj);
    +
    + switch(param_id) {
    + case PROP_STATE:
    + g_value_set_pointer(value,
    + gplugin_tcc_plugin_get_state(plugin));
    + break;
    + default:
    + G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
    + break;
    + }
    +}
    +
    +static void
    +gplugin_tcc_plugin_set_property(GObject *obj, guint param_id,
    + const GValue *value, GParamSpec *pspec)
    +{
    + GPluginTccPlugin *plugin = GPLUGIN_TCC_PLUGIN(obj);
    +
    + switch(param_id) {
    + case PROP_STATE:
    + gplugin_tcc_plugin_set_state(plugin,
    + g_value_get_pointer(value));
    + break;
    + case PROP_MEM:
    + gplugin_tcc_plugin_set_memory(plugin,
    + g_value_get_pointer(value));
    + break;
    + default:
    + G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
    + break;
    + }
    +}
    +
    +static void
    +gplugin_tcc_plugin_finalize(GObject *obj) {
    + GPluginTccPluginPrivate *priv = GPLUGIN_TCC_PLUGIN_GET_PRIVATE(obj);
    +
    + if(priv->s)
    + tcc_delete(priv->s);
    +
    + if(priv->mem)
    + g_free(priv->mem);
    +
    + G_OBJECT_CLASS(parent_class)->finalize(obj);
    +}
    +
    +static void
    +gplugin_tcc_plugin_class_init(GPluginTccPluginClass *klass) {
    + GObjectClass *obj_class = G_OBJECT_CLASS(klass);
    +
    + parent_class = g_type_class_peek_parent(klass);
    +
    + g_type_class_add_private(klass, sizeof(GPluginTccPluginPrivate));
    +
    + obj_class->get_property = gplugin_tcc_plugin_get_property;
    + obj_class->set_property = gplugin_tcc_plugin_set_property;
    + obj_class->finalize = gplugin_tcc_plugin_finalize;
    +
    + g_object_class_install_property(obj_class, PROP_STATE,
    + g_param_spec_pointer("state", "state",
    + "The TCC compilation context for the plugin",
    + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
    +
    + g_object_class_install_property(obj_class, PROP_MEM,
    + g_param_spec_pointer("memory", "memory",
    + "The memory allocated for the symbol table for the plugin",
    + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
    +}
    +
    +/******************************************************************************
    + * API
    + *****************************************************************************/
    +void
    +gplugin_tcc_plugin_register(GPluginNativePlugin *plugin) {
    + if(g_once_init_enter(&type_real)) {
    + GType type = 0;
    +
    + static const GTypeInfo info = {
    + .class_size = sizeof(GPluginTccPluginClass),
    + .class_init = (GClassInitFunc)gplugin_tcc_plugin_class_init,
    + .instance_size = sizeof(GPluginTccPlugin),
    + };
    +
    + type = gplugin_native_plugin_register_type(plugin,
    + GPLUGIN_TYPE_PLUGIN,
    + "GPluginTccPlugin",
    + &info,
    + 0);
    +
    + g_once_init_leave(&type_real, type);
    + }
    +}
    +
    +GType
    +gplugin_tcc_plugin_get_type(void) {
    + if(G_UNLIKELY(type_real == 0)) {
    + g_warning("gplugin_tcc_plugin_get_type was called before "
    + "the type was registered!\n");
    + }
    +
    + return type_real;
    +}
    +
    +TCCState *
    +gplugin_tcc_plugin_get_state(const GPluginTccPlugin *plugin) {
    + GPluginTccPluginPrivate *priv = GPLUGIN_TCC_PLUGIN_GET_PRIVATE(plugin);
    +
    + return priv->s;
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tcc/gplugin-tcc-plugin.h Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,62 @@
    +/*
    + * Copyright (C) 2011-2013 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU General Public License for more details.
    + *
    + * You should have received a copy of the GNU General Public License
    + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    + */
    +#ifndef GPLUGIN_TCC_PLUGIN_H
    +#define GPLUGIN_TCC_PLUGIN_H
    +
    +#define GPLUGIN_TYPE_TCC_PLUGIN (gplugin_tcc_plugin_get_type())
    +#define GPLUGIN_TCC_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GPLUGIN_TYPE_TCC_PLUGIN, GPluginTccPlugin))
    +#define GPLUGIN_TCC_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((obj), GPLUGIN_TYPE_TCC_PLUGIN, GPluginTccPluginClass))
    +#define GPLUGIN_IS_TCC_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GPLUGIN_TYPE_TCC_PLUGIN))
    +#define GPLUGIN_IS_TCC_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((obj), GPLUGIN_TYPE_TCC_PLUGIN))
    +#define GPLUGIN_TCC_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GPLUGIN_TYPE_TCC_PLUGIN, GPluginTccPluginClass))
    +
    +typedef struct _GPluginTccPlugin GPluginTccPlugin;
    +typedef struct _GPluginTccPluginClass GPluginTccPluginClass;
    +
    +#include <gplugin.h>
    +#include <gplugin-native.h>
    +
    +#include <libtcc.h>
    +
    +struct _GPluginTccPlugin {
    + GPluginPlugin parent;
    +};
    +
    +struct _GPluginTccPluginClass {
    + GPluginPluginClass parent;
    +
    + void (*_gplugin_reserved_1)(void);
    + void (*_gplugin_reserved_2)(void);
    + void (*_gplugin_reserved_3)(void);
    + void (*_gplugin_reserved_4)(void);
    +};
    +
    +G_BEGIN_DECLS
    +
    +void gplugin_tcc_plugin_register(GPluginNativePlugin *plugin);
    +GType gplugin_tcc_plugin_get_type(void);
    +
    +TCCState *gplugin_tcc_plugin_get_state(const GPluginTccPlugin *plugin);
    +
    +typedef GPluginPluginInfo *(*GPluginTccPluginQueryFunc)(GError **error);
    +typedef gboolean (*GPluginTccPluginLoadFunc)(GPluginNativePlugin *plugin, GError **error);
    +typedef gboolean (*GPluginTccPluginUnloadFunc)(GPluginNativePlugin *plugin, GError **error);
    +
    +G_END_DECLS
    +
    +#endif /* GPLUGIN_TCC_PLUGIN_H */
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tcc/tests/CMakeLists.txt Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,52 @@
    +if(BUILD_TCC)
    +
    +macro(add_tcc_gtest target)
    + add_executable(${target} ${target}.c)
    + target_link_libraries(${target}
    + ${GLIB_LIBRARIES} ${TCC_LIBRARIES} gplugin
    + )
    + add_dependencies(${target} gplugin-tcc)
    +
    + get_target_property(_output_name ${target} RUNTIME_OUTPUT_NAME)
    + if(NOT ${_output_name})
    + get_target_property(_output_name ${target} LOCATION)
    + endif(NOT ${_output_name})
    +
    + list(APPEND TCC_TESTS ${_output_name})
    +endmacro(add_tcc_gtest)
    +
    +add_definitions(
    + -DTCC_LOADER_DIR="${CMAKE_BINARY_DIR}/tcc"
    + -DTCC_PLUGIN_DIR="${CMAKE_CURRENT_SOURCE_DIR}/plugins"
    +)
    +
    +add_tcc_gtest(test-tcc-loader)
    +target_link_libraries(test-tcc-loader gplugin-loader-tests)
    +
    +set(GTESTER_TCC_TESTS "${TCC_TESTS}")
    +set(GTESTER_TCC_LOG "test-gplugin-tcc.xml")
    +set(GTESTER_TCC_JUNIT "test-gplugin-tcc-junit.xml")
    +
    +add_custom_command(
    + COMMAND ${GTESTER} -k --verbose -o ${GTESTER_TCC_LOG} ${TCC_TESTS}
    + OUTPUT ${GTESTER_TCC_LOG}
    + DEPENDS gplugin ${GPLUGIN_GIR_TARGETS} gplugin-tcc
    + ${TCC_TESTS} ${CMAKE_CURRENT_SOURCE_DIR}/plugins
    + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    +)
    +
    +add_custom_command(
    + COMMAND ${XSLTPROC} -o ${GTESTER_TCC_JUNIT} --nonet
    + ${CMAKE_SOURCE_DIR}/xsl/gtester-junit.xsl
    + ${GTESTER_TCC_LOG}
    + OUTPUT ${GTESTER_TCC_JUNIT}
    + DEPENDS ${GTESTER_TCC_LOG}
    + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    +)
    +
    +add_custom_target(tcc-tests ALL
    + DEPENDS ${GTESTER_TCC_LOG} ${GTESTER_TCC_JUNIT} ${TCC_TESTS}
    +)
    +
    +endif(BUILD_TCC)
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tcc/tests/plugins/basic-plugin.c Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,55 @@
    +/*
    + * Copyright (C) 2011-2013 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU General Public License for more details.
    + *
    + * You should have received a copy of the GNU General Public License
    + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplugin.h>
    +#include <gplugin-native.h>
    +
    +G_MODULE_EXPORT GPluginPluginInfo *
    +gplugin_query(GPLUGIN_UNUSED GError **error) {
    + const gchar * const authors[] = {
    + "author1",
    + NULL
    + };
    +
    + return gplugin_plugin_info_new(
    + "gplugin/native-basic-plugin",
    + 0x01020304,
    + "name", "basic plugin",
    + "category", "test",
    + "version", "version",
    + "summary", "summary",
    + "license-id", "license",
    + "description", "description",
    + "authors", authors,
    + "website", "website",
    + NULL
    + );
    +}
    +
    +G_MODULE_EXPORT gboolean
    +gplugin_load(GPLUGIN_UNUSED GPluginNativePlugin *plugin,
    + GPLUGIN_UNUSED GError **error)
    +{
    + return TRUE;
    +}
    +
    +G_MODULE_EXPORT gboolean
    +gplugin_unload(GPLUGIN_UNUSED GPluginNativePlugin *plugin,
    + GPLUGIN_UNUSED GError **error)
    +{
    + return TRUE;
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tcc/tests/plugins/dependent.c Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,49 @@
    +/*
    + * Copyright (C) 2011-2013 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU General Public License for more details.
    + *
    + * You should have received a copy of the GNU General Public License
    + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplugin.h>
    +#include <gplugin-native.h>
    +
    +G_MODULE_EXPORT GPluginPluginInfo *
    +gplugin_query(GPLUGIN_UNUSED GError **error) {
    + const gchar * const dependencies[] = {
    + "dependency1",
    + "dependency2",
    + NULL
    + };
    +
    + return gplugin_plugin_info_new(
    + "gplugin/native-dependent-plugin",
    + GPLUGIN_NATIVE_PLUGIN_ABI_VERSION,
    + "dependencies", dependencies,
    + NULL
    + );
    +}
    +
    +G_MODULE_EXPORT gboolean
    +gplugin_load(GPLUGIN_UNUSED GPluginNativePlugin *plugin,
    + GPLUGIN_UNUSED GError **error)
    +{
    + return TRUE;
    +}
    +
    +G_MODULE_EXPORT gboolean
    +gplugin_unload(GPLUGIN_UNUSED GPluginNativePlugin *plugin,
    + GPLUGIN_UNUSED GError **error)
    +{
    + return TRUE;
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tcc/tests/plugins/load-exception.c Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,42 @@
    +/*
    + * Copyright (C) 2011-2013 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU General Public License for more details.
    + *
    + * You should have received a copy of the GNU General Public License
    + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplugin.h>
    +#include <gplugin-native.h>
    +
    +G_MODULE_EXPORT GPluginPluginInfo *
    +gplugin_query(GPLUGIN_UNUSED GError **error) {
    + return gplugin_plugin_info_new(
    + "gplugin/native-load-exception",
    + GPLUGIN_NATIVE_PLUGIN_ABI_VERSION,
    + NULL
    + );
    +}
    +
    +G_MODULE_EXPORT gboolean
    +gplugin_load(GPLUGIN_UNUSED GPluginNativePlugin *plugin,
    + GPLUGIN_UNUSED GError **error)
    +{
    + return FALSE;
    +}
    +
    +G_MODULE_EXPORT gboolean
    +gplugin_unload(GPLUGIN_UNUSED GPluginNativePlugin *plugin,
    + GPLUGIN_UNUSED GError **error)
    +{
    + return TRUE;
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tcc/tests/plugins/load-failed.c Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,43 @@
    +/*
    + * Copyright (C) 2011-2013 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU General Public License for more details.
    + *
    + * You should have received a copy of the GNU General Public License
    + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplugin.h>
    +#include <gplugin-native.h>
    +
    +G_MODULE_EXPORT GPluginPluginInfo *
    +gplugin_query(GPLUGIN_UNUSED GError **error) {
    + return gplugin_plugin_info_new(
    + "gplugin/native-load-failed",
    + GPLUGIN_NATIVE_PLUGIN_ABI_VERSION,
    + NULL
    + );
    +}
    +
    +G_MODULE_EXPORT gboolean
    +gplugin_load(GPLUGIN_UNUSED GPluginNativePlugin *plugin, GError **error) {
    + if(error)
    + *error = g_error_new(GPLUGIN_DOMAIN, 0, "expected error");
    +
    + return FALSE;
    +}
    +
    +G_MODULE_EXPORT gboolean
    +gplugin_unload(GPLUGIN_UNUSED GPluginNativePlugin *plugin,
    + GPLUGIN_UNUSED GError **error)
    +{
    + return TRUE;
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tcc/tests/plugins/unload-failed.c Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,43 @@
    +/*
    + * Copyright (C) 2011-2013 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU General Public License for more details.
    + *
    + * You should have received a copy of the GNU General Public License
    + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    + */
    +#include <gplugin.h>
    +#include <gplugin-native.h>
    +
    +G_MODULE_EXPORT GPluginPluginInfo *
    +gplugin_query(GPLUGIN_UNUSED GError **error) {
    + return gplugin_plugin_info_new(
    + "gplugin/native-unload-failed",
    + GPLUGIN_NATIVE_PLUGIN_ABI_VERSION,
    + NULL
    + );
    +}
    +
    +G_MODULE_EXPORT gboolean
    +gplugin_load(GPLUGIN_UNUSED GPluginNativePlugin *plugin,
    + GPLUGIN_UNUSED GError **error)
    +{
    + return TRUE;
    +}
    +
    +G_MODULE_EXPORT gboolean
    +gplugin_unload(GPLUGIN_UNUSED GPluginNativePlugin *plugin, GError **error) {
    + if(error)
    + *error = g_error_new(GPLUGIN_DOMAIN, 0, "expected error");
    +
    + return FALSE;
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/tcc/tests/test-tcc-loader.c Tue Aug 23 12:08:22 2016 -0500
    @@ -0,0 +1,31 @@
    +/*
    + * Copyright (C) 2011-2013 Gary Kramlich <grim@reaperworld.com>
    + *
    + * This program is free software: you can redistribute it and/or modify
    + * it under the terms of the GNU General Public License as published by
    + * the Free Software Foundation, either version 3 of the License, or
    + * (at your option) any later version.
    + *
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU General Public License for more details.
    + *
    + * You should have received a copy of the GNU General Public License
    + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    + */
    +
    +#include <glib.h>
    +#include <gplugin.h>
    +
    +#include <gplugin/gplugin-loader-tests.h>
    +
    +gint
    +main(gint argc, gchar **argv) {
    + g_test_init(&argc, &argv, NULL);
    +
    + gplugin_loader_tests_main(TCC_LOADER_DIR, TCC_PLUGIN_DIR, "c");
    +
    + return g_test_run();
    +}
    +
    --- a/tools/glib-mkenums Tue Sep 29 22:45:21 2015 -0500
    +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
    @@ -1,565 +0,0 @@
    -#! /usr/bin/perl
    -
    -use warnings;
    -use File::Basename;
    -use Safe;
    -
    -# glib-mkenums.pl
    -# Information about the current enumeration
    -my $flags; # Is enumeration a bitmask?
    -my $option_underscore_name; # Overriden underscore variant of the enum name
    - # for example to fix the cases we don't get the
    - # mixed-case -> underscorized transform right.
    -my $option_lowercase_name; # DEPRECATED. A lower case name to use as part
    - # of the *_get_type() function, instead of the
    - # one that we guess. For instance, when an enum
    - # uses abnormal capitalization and we can not
    - # guess where to put the underscores.
    -my $seenbitshift; # Have we seen bitshift operators?
    -my $enum_prefix; # Prefix for this enumeration
    -my $enumname; # Name for this enumeration
    -my $enumshort; # $enumname without prefix
    -my $enumname_prefix; # prefix of $enumname
    -my $enumindex = 0; # Global enum counter
    -my $firstenum = 1; # Is this the first enumeration per file?
    -my @entries; # [ $name, $val ] for each entry
    -my $sandbox = Safe->new; # sandbox for safe evaluation of expressions
    -
    -sub parse_trigraph {
    - my $opts = shift;
    - my @opts;
    -
    - for $opt (split /\s*,\s*/, $opts) {
    - $opt =~ s/^\s*//;
    - $opt =~ s/\s*$//;
    - my ($key,$val) = $opt =~ /(\w+)(?:=(.+))?/;
    - defined $val or $val = 1;
    - push @opts, $key, $val;
    - }
    - @opts;
    -}
    -sub parse_entries {
    - my $file = shift;
    - my $file_name = shift;
    - my $looking_for_name = 0;
    -
    - while (<$file>) {
    - # read lines until we have no open comments
    - while (m@/\*([^*]|\*(?!/))*$@) {
    - my $new;
    - defined ($new = <$file>) || die "Unmatched comment in $ARGV";
    - $_ .= $new;
    - }
    - # strip comments w/o options
    - s@/\*(?!<)
    - ([^*]+|\*(?!/))*
    - \*/@@gx;
    -
    - # strip newlines
    - s@\n@ @;
    -
    - # skip empty lines
    - next if m@^\s*$@;
    -
    - if ($looking_for_name) {
    - if (/^\s*(\w+)/) {
    - $enumname = $1;
    - return 1;
    - }
    - }
    -
    - # Handle include files
    - if (/^\#include\s*<([^>]*)>/ ) {
    - my $file= "../$1";
    - open NEWFILE, $file or die "Cannot open include file $file: $!\n";
    -
    - if (parse_entries (\*NEWFILE, $NEWFILE)) {
    - return 1;
    - } else {
    - next;
    - }
    - }
    -
    - if (/^\s*\}\s*(\w+)/) {
    - $enumname = $1;
    - $enumindex++;
    - return 1;
    - }
    -
    - if (/^\s*\}/) {
    - $enumindex++;
    - $looking_for_name = 1;
    - next;
    - }
    -
    - if (m@^\s*
    - (\w+)\s* # name
    - (?:=( # value
    - \s*\w+\s*\(.*\)\s* # macro with multiple args
    - | # OR
    - (?:[^,/]|/(?!\*))* # anything but a comma or comment
    - ))?,?\s*
    - (?:/\*< # options
    - (([^*]|\*(?!/))*)
    - >\s*\*/)?,?
    - \s*$
    - @x) {
    - my ($name, $value, $options) = ($1,$2,$3);
    -
    - if (!defined $flags && defined $value && $value =~ /<</) {
    - $seenbitshift = 1;
    - }
    -
    - if (defined $options) {
    - my %options = parse_trigraph($options);
    - if (!defined $options{skip}) {
    - push @entries, [ $name, $value, $options{nick} ];
    - }
    - } else {
    - push @entries, [ $name, $value ];
    - }
    - } elsif (m@^\s*\#@) {
    - # ignore preprocessor directives
    - } else {
    - print STDERR "$0: $file_name:$.: Failed to parse `$_'\n";
    - }
    - }
    -
    - return 0;
    -}
    -
    -sub version {
    - print "glib-mkenums version glib-2.36.3\n";
    - print "glib-mkenums comes with ABSOLUTELY NO WARRANTY.\n";
    - print "You may redistribute copies of glib-mkenums under the terms of\n";
    - print "the GNU General Public License which can be found in the\n";
    - print "GLib source package. Sources, examples and contact\n";
    - print "information are available at http://www.gtk.org\n";
    - exit 0;
    -}
    -sub usage {
    - print "Usage:\n";
    - print " glib-mkenums [OPTION...] [FILES...]\n\n";
    - print "Help Options:\n";
    - print " -h, --help Show this help message\n\n";
    - print "Utility Options:\n";
    - print " --identifier-prefix <text> Identifier prefix\n";
    - print " --symbol-prefix <text> Symbol prefix\n";
    - print " --fhead <text> Output file header\n";
    - print " --fprod <text> Per input file production\n";
    - print " --ftail <text> Output file trailer\n";
    - print " --eprod <text> Per enum text (produced prior to value itarations)\n";
    - print " --vhead <text> Value header, produced before iterating over enum values\n";
    - print " --vprod <text> Value text, produced for each enum value\n";
    - print " --vtail <text> Value tail, produced after iterating over enum values\n";
    - print " --comments <text> Comment structure\n";
    - print " --template file Template file\n";
    - print " -v, --version Print version informations\n\n";
    - print "Production text substitutions:\n";
    - print " \@EnumName\@ PrefixTheXEnum\n";
    - print " \@enum_name\@ prefix_the_xenum\n";
    - print " \@ENUMNAME\@ PREFIX_THE_XENUM\n";
    - print " \@ENUMSHORT\@ THE_XENUM\n";
    - print " \@ENUMPREFIX\@ PREFIX\n";
    - print " \@VALUENAME\@ PREFIX_THE_XVALUE\n";
    - print " \@valuenick\@ the-xvalue\n";
    - print " \@valuenum\@ the integer value (limited support, Since: 2.26)\n";
    - print " \@type\@ either enum or flags\n";
    - print " \@Type\@ either Enum or Flags\n";
    - print " \@TYPE\@ either ENUM or FLAGS\n";
    - print " \@filename\@ name of current input file\n";
    - print " \@basename\@ base name of the current input file (Since: 2.22)\n";
    - exit 0;
    -}
    -
    -# production variables:
    -my $idprefix = ""; # "G", "Gtk", etc
    -my $symprefix = ""; # "g", "gtk", etc, if not just lc($idprefix)
    -my $fhead = ""; # output file header
    -my $fprod = ""; # per input file production
    -my $ftail = ""; # output file trailer
    -my $eprod = ""; # per enum text (produced prior to value itarations)
    -my $vhead = ""; # value header, produced before iterating over enum values
    -my $vprod = ""; # value text, produced for each enum value
    -my $vtail = ""; # value tail, produced after iterating over enum values
    -my $comment_tmpl = ""; # comment template
    -
    -sub read_template_file {
    - my ($file) = @_;
    - my %tmpl = ('file-header', $fhead,
    - 'file-production', $fprod,
    - 'file-tail', $ftail,
    - 'enumeration-production', $eprod,
    - 'value-header', $vhead,
    - 'value-production', $vprod,
    - 'value-tail', $vtail,
    - 'comment', $comment_tmpl);
    - my $in = 'junk';
    - open (FILE, $file) || die "Can't open $file: $!\n";
    - while (<FILE>) {
    - if (/^\/\*\*\*\s+(BEGIN|END)\s+([\w-]+)\s+\*\*\*\//) {
    - if (($in eq 'junk') && ($1 eq 'BEGIN') && (exists($tmpl{$2}))) {
    - $in = $2;
    - next;
    - }
    - elsif (($in eq $2) && ($1 eq 'END') && (exists($tmpl{$2}))) {
    - $in = 'junk';
    - next;
    - } else {
    - die "Malformed template file $file\n";
    - }
    - }
    - if (!($in eq 'junk')) {
    - $tmpl{$in} .= $_;
    - }
    - }
    - close (FILE);
    - if (!($in eq 'junk')) {
    - die "Malformed template file $file\n";
    - }
    - $fhead = $tmpl{'file-header'};
    - $fprod = $tmpl{'file-production'};
    - $ftail = $tmpl{'file-tail'};
    - $eprod = $tmpl{'enumeration-production'};
    - $vhead = $tmpl{'value-header'};
    - $vprod = $tmpl{'value-production'};
    - $vtail = $tmpl{'value-tail'};
    - $comment_tmpl = $tmpl{'comment'};
    -
    - # default to C-style comments
    - $comment_tmpl = "/* \@comment\@ */" if $comment_tmpl eq "";
    -}
    -
    -if (!defined $ARGV[0]) {
    - usage;
    -}
    -while ($_=$ARGV[0],/^-/) {
    - shift;
    - last if /^--$/;
    - if (/^--template$/) { read_template_file (shift); }
    - elsif (/^--identifier-prefix$/) { $idprefix = shift }
    - elsif (/^--symbol-prefix$/) { $symprefix = shift }
    - elsif (/^--fhead$/) { $fhead = $fhead . shift }
    - elsif (/^--fprod$/) { $fprod = $fprod . shift }
    - elsif (/^--ftail$/) { $ftail = $ftail . shift }
    - elsif (/^--eprod$/) { $eprod = $eprod . shift }
    - elsif (/^--vhead$/) { $vhead = $vhead . shift }
    - elsif (/^--vprod$/) { $vprod = $vprod . shift }
    - elsif (/^--vtail$/) { $vtail = $vtail . shift }
    - elsif (/^--comments$/) { $comment_tmpl = shift }
    - elsif (/^--help$/ || /^-h$/ || /^-\?$/) { usage; }
    - elsif (/^--version$/ || /^-v$/) { version; }
    - else { usage; }
    - last if not defined($ARGV[0]);
    -}
    -
    -# put auto-generation comment
    -{
    - my $comment = $comment_tmpl;
    - $comment =~ s/\@comment\@/Generated data (by glib-mkenums)/;
    - print "\n" . $comment . "\n\n";
    -}
    -
    -if (length($fhead)) {
    - my $prod = $fhead;
    - my $base = basename ($ARGV[0]);
    -
    - $prod =~ s/\@filename\@/$ARGV[0]/g;
    - $prod =~ s/\@basename\@/$base/g;
    - $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
    - $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
    - chomp ($prod);
    -
    - print "$prod\n";
    -}
    -
    -while (<>) {
    - if (eof) {
    - close (ARGV); # reset line numbering
    - $firstenum = 1; # Flag to print filename at next enum
    - }
    -
    - # read lines until we have no open comments
    - while (m@/\*([^*]|\*(?!/))*$@) {
    - my $new;
    - defined ($new = <>) || die "Unmatched comment in $ARGV";
    - $_ .= $new;
    - }
    - # strip comments w/o options
    - s@/\*(?!<)
    - ([^*]+|\*(?!/))*
    - \*/@@gx;
    -
    - # ignore forward declarations
    - next if /^\s*typedef\s+enum.*;/;
    -
    - if (m@^\s*typedef\s+enum\s*
    - ({)?\s*
    - (?:/\*<
    - (([^*]|\*(?!/))*)
    - >\s*\*/)?
    - \s*({)?
    - @x) {
    - if (defined $2) {
    - my %options = parse_trigraph ($2);
    - next if defined $options{skip};
    - $enum_prefix = $options{prefix};
    - $flags = $options{flags};
    - $option_lowercase_name = $options{lowercase_name};
    - $option_underscore_name = $options{underscore_name};
    - } else {
    - $enum_prefix = undef;
    - $flags = undef;
    - $option_lowercase_name = undef;
    - $option_underscore_name = undef;
    - }
    - if (defined $option_lowercase_name) {
    - if (defined $option_underscore_name) {
    - print STDERR "$0: $ARGV:$.: lowercase_name overriden with underscore_name\n";
    - $option_lowercase_name = undef;
    - } else {
    - print STDERR "$0: $ARGV:$.: lowercase_name is deprecated, use underscore_name\n";
    - }
    - }
    - # Didn't have trailing '{' look on next lines
    - if (!defined $1 && !defined $4) {
    - while (<>) {
    - if (eof) {
    - die "Hit end of file while parsing enum in $ARGV";
    - }
    - if (s/^\s*\{//) {
    - last;
    - }
    - }
    - }
    -
    - $seenbitshift = 0;
    - @entries = ();
    -
    - # Now parse the entries
    - parse_entries (\*ARGV, $ARGV);
    -
    - # figure out if this was a flags or enums enumeration
    - if (!defined $flags) {
    - $flags = $seenbitshift;
    - }
    -
    - # Autogenerate a prefix
    - if (!defined $enum_prefix) {
    - for (@entries) {
    - my $nick = $_->[2];
    - if (!defined $nick) {
    - my $name = $_->[0];
    - if (defined $enum_prefix) {
    - my $tmp = ~ ($name ^ $enum_prefix);
    - ($tmp) = $tmp =~ /(^\xff*)/;
    - $enum_prefix = $enum_prefix & $tmp;
    - } else {
    - $enum_prefix = $name;
    - }
    - }
    - }
    - if (!defined $enum_prefix) {
    - $enum_prefix = "";
    - } else {
    - # Trim so that it ends in an underscore
    - $enum_prefix =~ s/_[^_]*$/_/;
    - }
    - } else {
    - # canonicalize user defined prefixes
    - $enum_prefix = uc($enum_prefix);
    - $enum_prefix =~ s/-/_/g;
    - $enum_prefix =~ s/(.*)([^_])$/$1$2_/;
    - }
    -
    - for $entry (@entries) {
    - my ($name,$num,$nick) = @{$entry};
    - if (!defined $nick) {
    - ($nick = $name) =~ s/^$enum_prefix//;
    - $nick =~ tr/_/-/;
    - $nick = lc($nick);
    - @{$entry} = ($name, $num, $nick);
    - }
    - }
    -
    -
    - # Spit out the output
    - if (defined $option_underscore_name) {
    - $enumlong = uc $option_underscore_name;
    - $enumsym = lc $option_underscore_name;
    - $enumshort = $enumlong;
    - $enumshort =~ s/^[A-Z][A-Z0-9]*_//;
    -
    - $enumname_prefix = $enumlong;
    - $enumname_prefix =~ s/_$enumshort$//;
    - } elsif (!$symprefix && !$idprefix) {
    - # enumname is e.g. GMatchType
    - $enspace = $enumname;
    - $enspace =~ s/^([A-Z][a-z]*).*$/$1/;
    -
    - $enumshort = $enumname;
    - $enumshort =~ s/^[A-Z][a-z]*//;
    - $enumshort =~ s/([^A-Z])([A-Z])/$1_$2/g;
    - $enumshort =~ s/([A-Z][A-Z])([A-Z][0-9a-z])/$1_$2/g;
    - $enumshort = uc($enumshort);
    -
    - $enumname_prefix = $enumname;
    - $enumname_prefix =~ s/^([A-Z][a-z]*).*$/$1/;
    - $enumname_prefix = uc($enumname_prefix);
    -
    - $enumlong = uc($enspace) . "_" . $enumshort;
    - $enumsym = lc($enspace) . "_" . lc($enumshort);
    -
    - if (defined($option_lowercase_name)) {
    - $enumsym = $option_lowercase_name;
    - }
    - } else {
    - $enumshort = $enumname;
    - if ($idprefix) {
    - $enumshort =~ s/^${idprefix}//;
    - } else {
    - $enumshort =~ s/^[A-Z][a-z]*//;
    - }
    - $enumshort =~ s/([^A-Z])([A-Z])/$1_$2/g;
    - $enumshort =~ s/([A-Z][A-Z])([A-Z][0-9a-z])/$1_$2/g;
    - $enumshort = uc($enumshort);
    -
    - $enumname_prefix = $symprefix && uc($symprefix) || uc($idprefix);
    -
    - $enumlong = $enumname_prefix . "_" . $enumshort;
    - $enumsym = lc($enumlong);
    - }
    -
    - if ($firstenum) {
    - $firstenum = 0;
    -
    - if (length($fprod)) {
    - my $prod = $fprod;
    - my $base = basename ($ARGV);
    -
    - $prod =~ s/\@filename\@/$ARGV/g;
    - $prod =~ s/\@basename\@/$base/g;
    - $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
    - $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
    - chomp ($prod);
    -
    - print "$prod\n";
    - }
    - }
    -
    - if (length($eprod)) {
    - my $prod = $eprod;
    -
    - $prod =~ s/\@enum_name\@/$enumsym/g;
    - $prod =~ s/\@EnumName\@/$enumname/g;
    - $prod =~ s/\@ENUMSHORT\@/$enumshort/g;
    - $prod =~ s/\@ENUMNAME\@/$enumlong/g;
    - $prod =~ s/\@ENUMPREFIX\@/$enumname_prefix/g;
    - if ($flags) { $prod =~ s/\@type\@/flags/g; } else { $prod =~ s/\@type\@/enum/g; }
    - if ($flags) { $prod =~ s/\@Type\@/Flags/g; } else { $prod =~ s/\@Type\@/Enum/g; }
    - if ($flags) { $prod =~ s/\@TYPE\@/FLAGS/g; } else { $prod =~ s/\@TYPE\@/ENUM/g; }
    - $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
    - $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
    - chomp ($prod);
    -
    - print "$prod\n";
    - }
    -
    - if (length($vhead)) {
    - my $prod = $vhead;
    -
    - $prod =~ s/\@enum_name\@/$enumsym/g;
    - $prod =~ s/\@EnumName\@/$enumname/g;
    - $prod =~ s/\@ENUMSHORT\@/$enumshort/g;
    - $prod =~ s/\@ENUMNAME\@/$enumlong/g;
    - $prod =~ s/\@ENUMPREFIX\@/$enumname_prefix/g;
    - if ($flags) { $prod =~ s/\@type\@/flags/g; } else { $prod =~ s/\@type\@/enum/g; }
    - if ($flags) { $prod =~ s/\@Type\@/Flags/g; } else { $prod =~ s/\@Type\@/Enum/g; }
    - if ($flags) { $prod =~ s/\@TYPE\@/FLAGS/g; } else { $prod =~ s/\@TYPE\@/ENUM/g; }
    - $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
    - $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
    - chomp ($prod);
    -
    - print "$prod\n";
    - }
    -
    - if (length($vprod)) {
    - my $prod = $vprod;
    - my $next_num = 0;
    -
    - $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
    - $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
    - for (@entries) {
    - my ($name,$num,$nick) = @{$_};
    - my $tmp_prod = $prod;
    -
    - if ($prod =~ /\@valuenum\@/) {
    - # only attempt to eval the value if it is requested
    - # this prevents us from throwing errors otherwise
    - if (defined $num) {
    - # use sandboxed perl evaluation as a reasonable
    - # approximation to C constant folding
    - $num = $sandbox->reval ($num);
    -
    - # make sure it parsed to an integer
    - if (!defined $num or $num !~ /^-?\d+$/) {
    - die "Unable to parse enum value '$num'";
    - }
    - } else {
    - $num = $next_num;
    - }
    -
    - $tmp_prod =~ s/\@valuenum\@/$num/g;
    - $next_num = $num + 1;
    - }
    -
    - $tmp_prod =~ s/\@VALUENAME\@/$name/g;
    - $tmp_prod =~ s/\@valuenick\@/$nick/g;
    - if ($flags) { $tmp_prod =~ s/\@type\@/flags/g; } else { $tmp_prod =~ s/\@type\@/enum/g; }
    - if ($flags) { $tmp_prod =~ s/\@Type\@/Flags/g; } else { $tmp_prod =~ s/\@Type\@/Enum/g; }
    - if ($flags) { $tmp_prod =~ s/\@TYPE\@/FLAGS/g; } else { $tmp_prod =~ s/\@TYPE\@/ENUM/g; }
    - chomp ($tmp_prod);
    -
    - print "$tmp_prod\n";
    - }
    - }
    -
    - if (length($vtail)) {
    - my $prod = $vtail;
    -
    - $prod =~ s/\@enum_name\@/$enumsym/g;
    - $prod =~ s/\@EnumName\@/$enumname/g;
    - $prod =~ s/\@ENUMSHORT\@/$enumshort/g;
    - $prod =~ s/\@ENUMNAME\@/$enumlong/g;
    - $prod =~ s/\@ENUMPREFIX\@/$enumname_prefix/g;
    - if ($flags) { $prod =~ s/\@type\@/flags/g; } else { $prod =~ s/\@type\@/enum/g; }
    - if ($flags) { $prod =~ s/\@Type\@/Flags/g; } else { $prod =~ s/\@Type\@/Enum/g; }
    - if ($flags) { $prod =~ s/\@TYPE\@/FLAGS/g; } else { $prod =~ s/\@TYPE\@/ENUM/g; }
    - $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
    - $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
    - chomp ($prod);
    -
    - print "$prod\n";
    - }
    - }
    -}
    -
    -if (length($ftail)) {
    - my $prod = $ftail;
    - my $base = basename ($ARGV);
    -
    - $prod =~ s/\@filename\@/$ARGV/g;
    - $prod =~ s/\@basename\@/$base/g;
    - $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
    - $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
    - chomp ($prod);
    -
    - print "$prod\n";
    -}
    -
    -# put auto-generation comment
    -{
    - my $comment = $comment_tmpl;
    - $comment =~ s/\@comment\@/Generated data ends here/;
    - print "\n" . $comment . "\n\n";
    -}