diff options
author | Alwin Esch <alwin.esch@web.de> | 2019-07-13 12:41:24 +0200 |
---|---|---|
committer | Alwin Esch <alwin.esch@web.de> | 2019-07-17 23:06:42 +0200 |
commit | b4f4ada89714538b98173dd7304b653d6e1eab31 (patch) | |
tree | 450acdee497063de8814672d1735f999fb00834a /lib | |
parent | e61b7e08b6f5f4f1a41e67910149cf8119934e07 (diff) |
[addons] remove cpluff complete
Diffstat (limited to 'lib')
185 files changed, 0 insertions, 26637 deletions
diff --git a/lib/cpluff/.gitignore b/lib/cpluff/.gitignore deleted file mode 100644 index 8054936cb1..0000000000 --- a/lib/cpluff/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -autom4te.cache -Makefile -Makefile.in -aclocal.m4 -config.status -configure -.deps -*.o -.libs -libtool -stamp-h1 -testmain -m4 -build* -config.h.in -auxliary -config.h diff --git a/lib/cpluff/CMakeLists.txt b/lib/cpluff/CMakeLists.txt deleted file mode 100644 index ff5b1cb038..0000000000 --- a/lib/cpluff/CMakeLists.txt +++ /dev/null @@ -1,57 +0,0 @@ -cmake_minimum_required(VERSION 3.0) - -project(libcpluff VERSION 0.1.4 LANGUAGES C) - -find_package(expat 2.2.0 REQUIRED) - -add_library(${PROJECT_NAME} - ${CMAKE_CURRENT_SOURCE_DIR}/kazlib/hash.h - ${CMAKE_CURRENT_SOURCE_DIR}/kazlib/hash.c - ${CMAKE_CURRENT_SOURCE_DIR}/kazlib/list.h - ${CMAKE_CURRENT_SOURCE_DIR}/kazlib/list.c - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/context.c - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/cpluff.h - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/cpluff.c - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/defines.h - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/internal.h - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/logging.c - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/pcontrol.c - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/pinfo.c - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/ploader.c - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/pscan.c - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/psymbol.c - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/serial.c - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/thread.h - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/util.h - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/util.c -) - -if(WIN32) - target_sources(${PROJECT_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/thread_windows.c - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/win32/cpluffdef.h - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/win32/dirent.h - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/win32/dirent.c - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/win32/win32_utils.h - ${CMAKE_CURRENT_SOURCE_DIR}/libcpluff/win32/win32_utils.c - ) -endif() - -target_link_libraries(${PROJECT_NAME} PRIVATE ${EXPAT_LIBRARIES}) - -target_include_directories(${PROJECT_NAME} - PRIVATE - $<BUILD_INTERFACE:kazlib;libcpluff;libcpluff/win32;${EXPAT_INCLUDE_DIR}> - INTERFACE - $<INSTALL_INTERFACE:include> -) - -target_compile_definitions(${PROJECT_NAME} PRIVATE -Dhash_delete=kazlib_hash_delete -Dhash_free=kazlib_hash_free -Dhash_insert=kazlib_hash_insert -Dlist_delete=kazlib_list_delete) - -target_compile_definitions(${PROJECT_NAME} - PRIVATE - XML_STATIC - CP_C_API=CP_EXPORT - _CRT_SECURE_NO_WARNINGS - _CRT_NONSTDC_NO_DEPRECATE -) diff --git a/lib/cpluff/COPYRIGHT.txt b/lib/cpluff/COPYRIGHT.txt deleted file mode 100644 index f9cf4c959b..0000000000 --- a/lib/cpluff/COPYRIGHT.txt +++ /dev/null @@ -1,65 +0,0 @@ -C-PLUFF COPYRIGHT INFORMATION -============================= - -This is C-Pluff, a plug-in framework for C programs. -C-Pluff author is Johannes Lehtinen <johannes.lehtinen@iki.fi>. -Except where otherwise noted in the source code the C-Pluff source -code is licensed under the C-Pluff license included below (also known -as the MIT license, an OSI approved open source license). - -C-Pluff uses data structure implementations from Kazlib library. -Kazlib author is Kaz Kylheku. In C-Pluff source code distribution the -files derived from Kazlib are contained in kazlib subdirectory. These -files are licensed under the Kazlib license included below. Kazlib was -obtained from http://users.footprints.net/~kaz/kazlib.html. - -Please notice that the resulting binaries are linked with libraries that -may impose additional licensing conditions for the binaries. Specifically, -the C-Pluff Console binary, cpluff-console, may be linked with the GNU -Readline Library meaning that you have to comply with the conditions of -the GNU General Public License when distributing it in binary form. - - -C-Pluff copyright and license ------------------------------ - -C-Pluff, a plug-in framework for C -Copyright 2007 Johannes Lehtinen - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -KazLib copyright and license ----------------------------- - -Hash Table Data Type -List Abstract Data Type -Copyright (C) 1997 Kaz Kylheku <kaz@ashi.footprints.net> - -Free Software License: - -All rights are reserved by the author, with the following exceptions: -Permission is granted to freely reproduce and distribute this software, -possibly in exchange for a fee, provided that this copyright notice appears -intact. Permission is also granted to adapt this software to produce -derivative works, as long as the modified versions carry this copyright -notice and additional notices stating that the work has been modified. -This source code may be translated into executable form and incorporated -into proprietary software; there is no requirement for such software to -contain a copyright notice related to this source. diff --git a/lib/cpluff/ChangeLog.txt b/lib/cpluff/ChangeLog.txt deleted file mode 100644 index 179f541788..0000000000 --- a/lib/cpluff/ChangeLog.txt +++ /dev/null @@ -1,73 +0,0 @@ -C-Pluff (0.1.4) - - * Merged cp_load_plugin_descriptor_from_memory() by Jonathan Marshall from - Kodi/XBMC codebase and added a unit test for it. - * Merged German translation by Chris Leick from Kodi/XBMC codebase. - * Updated build environment for current Autotools versions. - * More complete distribution auto-checking. - * Minor fixes and improvements. - - -- Johannes Lehtinen <johannes.lehtinen@iki.fi> Fri, 01 Jan 2016 23:08:33 +0200 - -C-Pluff (0.1.3) alpha - - * Fixed a bug in Windows multi-threading support. Mutex was not - actually locked in cpi_lock_mutex. - * Fixed a bug in libltdl support. libltdl was not being initialized. - * Made cpfile example application compatible with Windows. - * Added Windows packaging using cross-compilation on Debian. - * Added Microsoft Visual C build environment for examples. - * Small improvements to installation documentation and packaging. - * Support Expat 1.95.1 and GnuWin32 version of libintl. - * Tools: Delegate binding of gettext domain to the library. - * Moved documentation sources out from C source directories. - - -- Johannes Lehtinen <johannes.lehtinen@iki.fi> Fri, 6 Apr 2007 15:36:30 +0300 - -C-Pluff (0.1.2) alpha - - * Removed a flawed check of whether dynamically resolved symbols are - in use when a plug-in is being stopped. - * Fixed a bug in libcpluff: When stopping plug-in dependency chains, - first call stop function of every plug-in in the chain and then call - destroy functions. This makes it possible to do safe two-phase cleanup. - Previously the destroy function of a plug-in was called immediately - after the stop function of the corresponding plug-in. - * Make plug-in dependency loop log message an informational message - and not a warning. - * Minor documentation changes and corrections. - * Build, install and distribute internationalization support files. - * Link with libintl if internationalization support needs it. - * Unified message string structure and wording. - * Include finnish translation (to test internationalization). - * Fixed some installation/packaging problems. - * Install documentation as part of installation. - * Install example source code as part of installation. - * Include optional stand-alone build system for example code. - * Respect DESTDIR during installation. - - -- Johannes Lehtinen <johannes.lehtinen@iki.fi> Wed, 28 Mar 2007 10:24:31 +0300 - -C-Pluff (0.1.1) alpha - - * More complete documentation. - * Added an example of extensible application (cpfile). - * Fixed bug in cpluff-loader: Use empty string for the first argument - instead of NULL pointer. - * Fixed bug in cp_get_extensions_info: Overwrote memory when - returning extensions for a specific extension point. - * Fixed bug in plug-in uninstallation: Accessed freed memory when - uninstalling a plug-in. - * Do not warn about unknown attributes of an extension element - because they might be extension point specific data. - * Build reference documentation in build directory. - * Added a test for inter-plugin symbol usage. - - -- Johannes Lehtinen <johannes.lehtinen@iki.fi> Sun, 18 Mar 2007 23:28:59 +0200 - -C-Pluff (0.1.0) alpha - - * Initial public release. - * Includes incomplete documentation. - - -- Johannes Lehtinen <johannes.lehtinen@iki.fi> Thu, 08 Mar 2007 15:45:00 +0200 diff --git a/lib/cpluff/INSTALL.txt b/lib/cpluff/INSTALL.txt deleted file mode 100644 index fceffa51d0..0000000000 --- a/lib/cpluff/INSTALL.txt +++ /dev/null @@ -1,100 +0,0 @@ -INSTALLING C-PLUFF -================== - -These are instructions for building and installing the C-Pluff framework -implementation using the source code distribution or the source code from the -version control repository. - -For help on building C-Pluff based applications, see the examples in the -examples directory. - - -Prerequisites -------------- - -To build C-Pluff, you need to have following prerequisites installed: - - - GNU Make, C/C++ compiler (GCC), etc. - - - a C library supporting POSIX dlopen - (for example, GNU C library) - or - GNU Libtool libltdl library - (http://www.gnu.org/software/libtool/) - - - Expat XML Parser library for C - (http://expat.sourceforge.net/) - -Following components are optional and are used if they are installed: - - - GNU gettext libintl library for localization - (http://www.gnu.org/software/gettext/gettext.html) - - - GNU Readline Library for enhanced command line - (http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html) - - -Preparing GNU Autotools build environment ------------------------------------------ - -If you are using a pre-packaged source distribution cpluff-VERSION.tar.gz then -you may skip directly to section Building. - -If you are building from source checked out from the version control repository -then you have to first prepare the GNU autotools build environment. To do this, -simply execute the following command in the top level source directory. - - ./autogen.sh - -The following tools must be installed to successfully prepare the build -environment. - - - GNU Gettext - - - GNU Libtool - - - GNU Automake - - - GNU Autoconf - - -Building --------- - -To build C-Pluff, follow the usual Autotools procedure: - - Building in the source directory: - ./configure - make - - Building in a separate build directory: - cd BUILD_DIR - SOURCE_DIR/configure - make - -You can specify the installation prefix (for example, /usr or /usr/local) -when running the configure script. - - ./configure --prefix=/usr - -The default installation prefix is /usr/local. More help on available -configuration options is available using the --help option. - - ./configure --help - - -Installation ------------- - -You can install the library, header files, utilities, documentation and -examples by making target install: - - make install - -If installing to system directories you have to do this as root. - -Additionally, you can specify a directory to be used in place of the -root directory during installation. This is typically used to create -binary packages. - - make DESTDIR=/tmp/installation install diff --git a/lib/cpluff/Issues.txt b/lib/cpluff/Issues.txt deleted file mode 100644 index 458983f1bb..0000000000 --- a/lib/cpluff/Issues.txt +++ /dev/null @@ -1,43 +0,0 @@ -KNOWN ISSUES -============ - - -cpfile does not rezognize directories when compiled with MinGW --------------------------------------------------------------- - -(Thu, 5 Apr 2007 06:58:32 +0300) - -MinGW cross-compiled version of cpfile example application does not -recognize special files (directories) although the support is in place. -Reason for the problem is not known. The related source code is in -examples/cpfile/plugins/special/special.c. The following test code -works fine when cross-compiled with MinGW. - -- clip - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <stdio.h> -#include <windows.h> - -int main(int argc, char *argv[]) { - int i; - - for (i = 1; i < argc; i++) { - struct stat s; - - printf("%s: ", argv[i]); - if (stat(argv[i], &s)) { - fflush(stdout); - perror("stat failed"); - } else { - if (S_ISDIR(s.st_mode)) { - fputs("is directory\n", stdout); - } else { - fputs("is not directory\n", stdout); - } - } - } - return 0; -} -- clip - diff --git a/lib/cpluff/Makefile.am b/lib/cpluff/Makefile.am deleted file mode 100644 index dcba780cbc..0000000000 --- a/lib/cpluff/Makefile.am +++ /dev/null @@ -1,65 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -ACLOCAL_AMFLAGS = -I m4 - -SUBDIRS = libcpluff loader console po test -DIST_SUBDIRS = $(SUBDIRS) examples - -EXTRA_DIST = COPYRIGHT.txt INSTALL.txt ChangeLog.txt Roadmap.txt autogen.sh plugin.xsd - -doc_DATA = COPYRIGHT.txt ChangeLog.txt Roadmap.txt - -doc: - cd libcpluff && $(MAKE) $(AM_MAKEFLAGS) $@ - -examples: all - cd examples && $(MAKE) $(AM_MAKEFLAGS) all LIBS='$(CURDIR)/libcpluff/libcpluff.la' - -examples-install: install - cd examples && $(MAKE) $(AM_MAKEFLAGS) install LIBS='$(CURDIR)/libcpluff/libcpluff.la' - -dist-hook: - rm -f '$(distdir)/ABOUT-NLS' - -distcheck-hook: distcheck-potfiles distcheck-examples - -distcheck-potfiles: - files="`cd '$(srcdir)' && find console libcpluff loader -type f -name '*.[ch]' -exec grep -q '_(' '{}' \; -print`"; \ - rc=0; \ - for f in $$files; do \ - if ! grep -q "$$f" '$(srcdir)/po/POTFILES.in'; then \ - echo "$$f missing from POTFILES.in"; \ - rc=1; \ - fi; \ - done; \ - exit $$rc - -distcheck-examples: - { test ! -d _examples_test || { \ - chmod -R u+w _examples_test; \ - rm -rf _examples_test; } && \ - mkdir _examples_test && \ - absdistdir="`cd '$(distdir)' && pwd`" && \ - cd _examples_test && \ - instdir="`pwd`/_inst" && \ - "$$absdistdir"/configure --prefix="$$instdir" && \ - make install && \ - cd _inst/share/doc/cpluff/examples && \ - ./autogen.sh && \ - CPPFLAGS="-I$$instdir/include" LDFLAGS="-L$$instdir/lib" CPLUFF_LOADER="$$instdir/bin/cpluff-loader" ./configure --prefix="$$instdir" && \ - make install && \ - test "`LC_ALL=C "$$instdir"/bin/cpfile . | tail -1`" = ".: directory" && \ - cd ../../../../../.. && \ - chmod -R u+w _examples_test && \ - rm -rf _examples_test; } || \ - { echo "Could not compile, install or run example source code"; \ - exit 1; } - -clean-local: - test ! -f examples/Makefile || (cd examples && $(MAKE) $(AM_MAKEFLAGS) clean) - -.PHONY: doc examples examples-install examples-clean diff --git a/lib/cpluff/README.txt b/lib/cpluff/README.txt deleted file mode 100644 index 9102eb9964..0000000000 --- a/lib/cpluff/README.txt +++ /dev/null @@ -1,14 +0,0 @@ -C-Pluff, a plug-in framework for C -================================== - -C-Pluff is a plug-in framework for C programs. It has been strongly inspired by -the Java plug-in framework in Eclipse. C-Pluff focuses on providing core -services for plug-in interaction and plug-in management. It aims to be platform -neutral and supports dynamic changes to plug-in configuration without stopping -the whole application or framework. - -For more information, see the documentation at C-Pluff web site. - - http://www.c-pluff.org/ - -For build and installation instructions, see INSTALL.txt. diff --git a/lib/cpluff/Roadmap.txt b/lib/cpluff/Roadmap.txt deleted file mode 100644 index 11b8589bc1..0000000000 --- a/lib/cpluff/Roadmap.txt +++ /dev/null @@ -1,12 +0,0 @@ -C-Pluff (0.2.0) alpha - - * [ ] Introduce C-Pluff C++ API and C++ runtime library. - - -- Johannes Lehtinen <johannes.lehtinen@iki.fi> ??? - -C-Pluff (0.3.0) beta - - * [ ] Introduce plug-in package format for distribution. - * [ ] Introduce tools for making and installing plug-in packages. - - -- Johannes Lehtinen <johannes.lehtinen@iki.fi> ??? diff --git a/lib/cpluff/autogen.sh b/lib/cpluff/autogen.sh deleted file mode 100755 index ee0a418108..0000000000 --- a/lib/cpluff/autogen.sh +++ /dev/null @@ -1,25 +0,0 @@ -#! /bin/sh - -# Copyright 2007 Johannes Lehtinen -# This shell script is free software; Johannes Lehtinen gives -# unlimited permission to copy, distribute and modify it. - -set -e - -# Check directory -basedir="`dirname "$0"`" -if ! test -f "$basedir"/libcpluff/cpluff.h; then - echo 'Run autogen.sh in the top level source directory.' 1>&2 - exit 1 -fi - -# Generate files in top level directory -cd "$basedir" -autopoint -rm -f ABOUT-NLS -test -d auxliary || mkdir auxliary -libtoolize --automake -f -aclocal -I m4 -autoconf -autoheader -automake -a diff --git a/lib/cpluff/configure.ac b/lib/cpluff/configure.ac deleted file mode 100644 index d9a1771532..0000000000 --- a/lib/cpluff/configure.ac +++ /dev/null @@ -1,347 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -dnl Copyright 2007 Johannes Lehtinen -dnl This configure.ac script is free software; Johannes Lehtinen gives -dnl unlimited permission to copy, distribute and modify it. - -dnl Version information -dnl ------------------- - -dnl Version information -define(CP_M4_VERSION_MAJOR, [0]) -define(CP_M4_VERSION_MINOR, [1]) -define(CP_M4_VERSION_REV, [4]) -define(CP_M4_RELEASE_VERSION, CP_M4_VERSION_MAJOR.CP_M4_VERSION_MINOR.CP_M4_VERSION_REV) - -dnl Backwards compatibility information -define(CP_M4_ABI_COMPATIBILITY, [0.1]) - -dnl Library version information -define(CP_M4_C_LIB_VERSION, [1:0:1]) -define(CP_M4_CXX_LIB_VERSION, [0:0:0]) - -# Autoconf initialization -# ----------------------- -AC_INIT([C-Pluff], CP_M4_RELEASE_VERSION, [johannes.lehtinen@iki.fi], [cpluff]) -AC_COPYRIGHT([Copyright 2007 Johannes Lehtinen -This configure script is free software; Johannes Lehtinen gives unlimited -permission to copy, distribute and modify it.]) -AC_CONFIG_SRCDIR([libcpluff/cpluff.h]) -AC_CONFIG_AUX_DIR([auxliary]) -AC_CONFIG_HEADERS([config.h]) - -# Version information -# ------------------- -CP_VERSION_MAJOR=CP_M4_VERSION_MAJOR -CP_VERSION_MINOR=CP_M4_VERSION_MINOR -AC_DEFINE([CP_ABI_COMPATIBILITY], "CP_M4_ABI_COMPATIBILITY", [The earliest ABI compatible version or undefined]) -CP_C_LIB_VERSION=CP_M4_C_LIB_VERSION -CP_CXX_LIB_VERSION=CP_M4_CXX_LIB_VERSION -AC_SUBST([CP_VERSION_MAJOR]) -AC_SUBST([CP_VERSION_MINOR]) -AC_SUBST([CP_C_LIB_VERSION]) -AC_SUBST([CP_CXX_LIB_VERSION]) - -# Automake initialization -# ----------------------- -AM_INIT_AUTOMAKE([foreign subdir-objects]) -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -AM_GNU_GETTEXT([external]) -AM_GNU_GETTEXT_VERSION([0.16.1]) - -# C/C++ compiler settings -# ------------------- -AC_LANG([C]) -AC_PROG_CC -if test -z "$CC"; then - AC_MSG_ERROR([C compiler was not found (required)]) -fi -AC_PROG_CC_C_O -AC_C_CONST -case "$ac_cv_c_const" in - no) - DEFINE_EMPTY_CONST=1 - ;; - *) - DEFINE_EMPTY_CONST=0 - ;; -esac -AC_SUBST([DEFINE_EMPTY_CONST]) -AC_LIBTOOL_DLOPEN -AC_LIBTOOL_WIN32_DLL -AC_PROG_LIBTOOL - -# Other programs -# -------------- -AC_PROG_LN_S - -# For config.h -CPPFLAGS="$CPPFLAGS -I\$(top_builddir)" - -# For cpluff.h and cpluffdef.h -CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/libcpluff -I\$(top_srcdir)/libcpluff" - -# Substitute variables for libcpluff and non-libcpluff components -AC_SUBST([LIBS_LIBCPLUFF]) -AC_SUBST([LIBS_TESTSUITE]) -AC_SUBST([LIBS_OTHER]) - -# Define shared library extension -# ------------------------------- -AC_DEFINE_UNQUOTED([CP_SHREXT], ["$shrext_cmds"], [Shared library extension]) - -# Thread support checks -# --------------------- - -# Check the options -AC_ARG_ENABLE([threads], AS_HELP_STRING([--enable-threads@<:@=TYPE@:>@], [enable multi-threading support (supported TYPEs are "Posix" and "Windows", default is to check support in this order)])) -case "$enable_threads" in - yes) - # Use the default auto detection - enable_threads='' - ;; - ''|no|Posix|Windows) - # Ok, legal value, no action needed - ;; - *) - AC_MSG_ERROR([$enable_threads threads not supported]) - ;; -esac - -# Only check for different thread types if threading not disabled -cp_threads='' -if test "$enable_threads" != no; then - - # Check for Posix thread support - if test -z "$cp_threads" && \ - ( test -z "$enable_threads" || test "$enable_threads" = Posix ); then - AC_CACHE_CHECK([for Posix threads], [cp_cv_sys_pthread], - [AC_LINK_IFELSE( -[AC_LANG_SOURCE([#include <pthread.h> - -int main(int argc, char **argv) { - pthread_mutex_t mutex; - - pthread_mutex_init(&mutex, NULL); - return 0; -} -])], [cp_cv_sys_pthread=yes], [cp_cv_sys_pthread=no])]) - if test "$cp_cv_sys_pthread" = yes; then - cp_threads=Posix - fi - fi - - # Check for Windows thread suppport - if test -z "$cp_threads" && \ - ( test -z "$enable_threads" || test "$enable_threads" = Windows ); then - AC_CACHE_CHECK([for Windows threads], [cp_cv_sys_wthread], - [AC_LINK_IFELSE( -[AC_LANG_SOURCE([#include <windows.h> - -int main(int argc, char **argv) { - CreateMutex(NULL, FALSE, NULL); - return 0; -} -])], [cp_cv_sys_wthread=yes], [cp_cv_sys_wthread=no])]) - if test "$cp_cv_sys_wthread" = yes; then - cp_threads=Windows - fi - fi - - # Check if we got the desired thread support - if test -n "$enable_threads" && test "$enable_threads" != "$cp_threads"; then - AC_MSG_ERROR([$enable_threads threads not detected]) - fi - -fi - -if test -z "$cp_threads" && test "$enable_threads" != no; then - AC_MSG_WARN([multi-threading support not detected]) -fi - -if test -n "$cp_threads"; then - AC_DEFINE_UNQUOTED([CP_THREADS], ["$cp_threads"], [Multi-threading support type]) -fi -AM_CONDITIONAL([POSIX_THREADS], test "$cp_threads" = Posix) -AM_CONDITIONAL([WINDOWS_THREADS], test "$cp_threads" = Windows) - -# Check for the dlopen mechanism (Posix dlopen or GNU Libtool libltdl) -# -------------------------------------------------------------------- -AC_ARG_WITH([dlopen], - AS_HELP_STRING([--with-dlopen], - [use the Posix dlopen facility])) -AC_ARG_WITH([libltdl], - AS_HELP_STRING([--with-libltdl], - [use the GNU Libtool libltdl])) -if test "$with_dlopen" = yes && test "$with_libltdl" = yes; then - AC_MSG_ERROR([Can not use both Posix dlopen and GNU Libtool libltdl]) -fi -dlmechanism=none -if test "$with_dlopen" != no && test "$with_libltdl" != yes; then - AC_CHECK_HEADER([dlfcn.h], - AC_CHECK_LIB([dl], [dlopen], - [LIBS_DL="-ldl $LIBS_DL"; dlmechanism=dlopen], - AC_CHECK_LIB([c], [dlopen], [dlmechanism=dlopen]))) -fi -if test "$dlmechanism" = none && test "$with_libltdl" != no && test "$with_dlopen" != yes; then - AC_CHECK_HEADER([ltdl.h], - AC_CHECK_LIB([ltdl], [lt_dlopen], - [LIBS_DL="-lltdl $LIBS_DL"; dlmechanism=libltdl])) -fi -case "$dlmechanism" in - dlopen) - AC_DEFINE([DLOPEN_POSIX], [], [Define to use Posix dlopen]) - ;; - libltdl) - AC_DEFINE([DLOPEN_LIBTOOL], [], [Define to use GNU Libtool libltdl]) - ;; - *) - AC_MSG_ERROR([Either the Posix dlopen facility or GNU Libtool libltdl is required]) - ;; -esac -LIBS_LIBCPLUFF="$LIBS_DL $LIBS_LIBCPLUFF" -LIBS_TESTSUITE="$LIBS_DL $LIBS_TESTSUITE" - -# Check for Expat XML parsing library -# ----------------------------------- -AC_CHECK_HEADER([expat.h],, AC_MSG_ERROR([Expat header file is required])) -AC_CHECK_LIB([expat], [XML_ParseBuffer], [LIBS_LIBCPLUFF="-lexpat $LIBS_LIBCPLUFF"], AC_MSG_ERROR([Expat library is required])) - -# Check for the GNU Readline Library -# ---------------------------------- -AC_ARG_WITH([readline], - AS_HELP_STRING([--with-readline], - [use the GNU Readline Library])) -have_readline=no -LIB_READLINE= -if test "$with_readline" != no; then - AC_CHECK_HEADER([readline/readline.h], - AC_CHECK_LIB([readline], [add_history], [LIB_READLINE="-lreadline"; have_readline=yes])) - if test "$with_readline" = yes && test "$have_readline" != yes; then - AC_MSG_ERROR([GNU readline requested but headers or library not found]) - fi -fi -AC_SUBST([LIB_READLINE]) -AM_CONDITIONAL([HAVE_READLINE], test "$have_readline" = yes) - -# Link non-library parts with the C-Pluff library -# ----------------------------------------------- -LIBS_OTHER="\$(top_builddir)/libcpluff/libcpluff.la $LIBS_OTHER" - -# Check for stat/lstat functions -# ------------------------------ -AC_CHECK_FUNCS([stat lstat]) - -# Check for isatty and fileno functions -# ------------------------------------- -AC_MSG_CHECKING([for isatty and fileno]) -AC_LINK_IFELSE( -[AC_LANG_SOURCE([#include <unistd.h> -#include <stdio.h> - -int main(int argc, char *argv[]) { - return isatty(fileno(stdin)); -} -])], [AC_MSG_RESULT([yes]) -AC_DEFINE([HAVE_ISATTY_FILENO],[],[Define to use isatty and fileno])], AC_MSG_RESULT([no])) - -# Debugging support -# ----------------- -AC_ARG_ENABLE([debug], - AS_HELP_STRING([--enable-assertions], [enable assertion checks for debugging])) -if ! test "$enable_assertions" = yes; then - CPPFLAGS="$CPPFLAGS -DNDEBUG" -fi -AC_ARG_ENABLE([gcc-warnings], - AS_HELP_STRING([--enable-gcc-warnings], - [enable default set of GCC compiler warnings])) -if test "$enable_gcc_warnings" = yes; then - CFLAGS="$CFLAGS -Wall -pedantic -std=gnu99" - CXXFLAGS="$CXXFLAGS -Wall -pedantic -std=c++0x" -fi - -# File name separator character -# ----------------------------- -AC_MSG_CHECKING([which file name separator to use]) -case "$host" in - *-*-mingw32* | *-*-windows*) - cp_fnamesep='\\' - ;; - *) - cp_fnamesep='/' - ;; -esac -AC_MSG_RESULT(['$cp_fnamesep']) -AC_DEFINE_UNQUOTED([CP_FNAMESEP_CHAR], ['$cp_fnamesep'], [File name separator character]) -AC_DEFINE_UNQUOTED([CP_FNAMESEP_STR], ["$cp_fnamesep"], [File name separator string]) - -# Substitute C-Pluff loader for examples -# -------------------------------------- -CPLUFF_LOADER="$bindir/cpluff-loader" -AC_SUBST(CPLUFF_LOADER) - -# Output Makefiles -# ---------------- -AC_CONFIG_FILES([Makefile -libcpluff/Makefile -libcpluff/cpluffdef.h -libcpluff/docsrc/Makefile -libcpluff/docsrc/Doxyfile-ref -libcpluff/docsrc/Doxyfile-impl -loader/Makefile -console/Makefile -po/Makefile.in -doc/Makefile -doc/img/Makefile -docsrc/Makefile -test/Makefile -test/plugins-source/Makefile -test/plugins-source/callbackcounter/Makefile -test/plugins-source/symuser/Makefile -test/plugins-source/symprovider/Makefile -examples/Makefile -examples/cpfile/Makefile -examples/cpfile/cpfile -examples/cpfile/plugins/Makefile -examples/cpfile/plugins/core/Makefile -examples/cpfile/plugins/special/Makefile -examples/cpfile/plugins/extension/Makefile -examples/cpfile/plugins/cext/Makefile]) -AC_OUTPUT - - -# Print configuration information -# ------------------------------- -AC_MSG_NOTICE([-----------------------------------------------------------]) -AC_MSG_NOTICE([C-Pluff configuration]) -AC_MSG_NOTICE([ release version: $PACKAGE_VERSION]) -if test -n "$cp_threads"; then - val="yes ($cp_threads)" -else - val=no -fi -AC_MSG_NOTICE([ multi-threading support: $val]) -AC_MSG_NOTICE([ dlopening mechanism: $dlmechanism]) -val=no -test "$USE_NLS" = no || val="yes (gettext)" -AC_MSG_NOTICE([ localization support: $val]) -AC_MSG_NOTICE([ use GNU readline library: $have_readline]) -if test "$enable_assertions" = yes; then - val=yes -else - val=no; -fi -AC_MSG_NOTICE([ assertion checks for debugging: $val]) -AC_MSG_NOTICE([ file name separator character: '$cp_fnamesep']) -AC_MSG_NOTICE([ compiler and linker settings:]) -AC_MSG_NOTICE([ CC='$CC']) -AC_MSG_NOTICE([ CPPFLAGS='$CPPFLAGS']) -AC_MSG_NOTICE([ CFLAGS='$CFLAGS']) -AC_MSG_NOTICE([ LDFLAGS='$LDFLAGS']) -AC_MSG_NOTICE([ LIBS='$LIBS']) -AC_MSG_NOTICE([ LIBS_LIBCPLUFF='$LIBS_LIBCPLUFF']) -AC_MSG_NOTICE([ LIBS_TESTSUITE='$LIBS_TESTSUITE']) -AC_MSG_NOTICE([ LIBS_OTHER='$LIBS_OTHER']) -AC_MSG_NOTICE([ LIB_READLINE='$LIB_READLINE']) -AC_MSG_NOTICE([ LTLIBINTL='$LTLIBINTL']) -AC_MSG_NOTICE([-----------------------------------------------------------]) diff --git a/lib/cpluff/console/Makefile.am b/lib/cpluff/console/Makefile.am deleted file mode 100644 index 9c94e6b81e..0000000000 --- a/lib/cpluff/console/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -LIBS = @LIB_READLINE@ @LIBS_OTHER@ @LTLIBINTL@ @LIBS@ - -bin_PROGRAMS = cpluff-console - -cpluff_console_SOURCES = console.c console.h -if HAVE_READLINE -cpluff_console_SOURCES += cmdinput_readline.c -else -cpluff_console_SOURCES += cmdinput_basic.c -endif diff --git a/lib/cpluff/console/cmdinput_basic.c b/lib/cpluff/console/cmdinput_basic.c deleted file mode 100644 index 71977fedd0..0000000000 --- a/lib/cpluff/console/cmdinput_basic.c +++ /dev/null @@ -1,72 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -// Basic command line input functionality - -#include <stdio.h> -#include <string.h> -#include "console.h" -#if defined(HAVE_ISATTY_FILENO) -#include <unistd.h> -#endif - -#define CMDLINE_SIZE 256 - -CP_HIDDEN void cmdline_init(void) {} - -CP_HIDDEN char *cmdline_input(const char *prompt) { - static char cmdline[CMDLINE_SIZE]; - int i, success = 0; - - do { - fputs(prompt, stdout); - if (fgets(cmdline, CMDLINE_SIZE, stdin) == NULL) { - return NULL; - } - if (strlen(cmdline) == CMDLINE_SIZE - 1 - && cmdline[CMDLINE_SIZE - 2] != '\n') { - char c; - do { - c = getchar(); - } while (c != '\n'); - fputs(_("ERROR: Command line is too long.\n"), stderr); - } else { - success = 1; - } - } while (!success); - -#if defined(HAVE_ISATTY_FILENO) - /* Echo input if not tty input */ - if (!isatty(fileno(stdin))) { - fputs(cmdline, stdout); - } -#endif - - i = strlen(cmdline); - if (i > 0 && cmdline[i - 1] == '\n') { - cmdline[i - 1] = '\0'; - } - return cmdline; -} - -CP_HIDDEN void cmdline_destroy(void) {} diff --git a/lib/cpluff/console/cmdinput_readline.c b/lib/cpluff/console/cmdinput_readline.c deleted file mode 100644 index b8d78af005..0000000000 --- a/lib/cpluff/console/cmdinput_readline.c +++ /dev/null @@ -1,202 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -// GNU readline based command line input - -#include <stdio.h> -#include <stdlib.h> -#include <ctype.h> -#include <string.h> -#include <readline/readline.h> -#include <readline/history.h> -#include "console.h" - -static cp_plugin_info_t **plugins = NULL; - -static char *cp_console_compl_cmdgen(const char *text, int state) { - static int counter; - static int textlen; - - if (!state) { - counter = 0; - textlen = strlen(text); - } - while (commands[counter].name != NULL && strncmp(text, commands[counter].name, textlen)) { - counter++; - } - if (commands[counter].name == NULL) { - return NULL; - } else { - char *buffer = strdup(commands[counter].name); - counter++; - return buffer; - } -} - -static char *cp_console_compl_flagsgen(const char *text, int state) { - static int counter; - static int textlen; - - if (!state) { - counter = 0; - textlen = strlen(text); - } - while(load_flags[counter].name != NULL && strncmp(text, load_flags[counter].name, textlen)) { - counter++; - } - if (load_flags[counter].name == NULL) { - return NULL; - } else { - char *buffer = strdup(load_flags[counter].name); - counter++; - return buffer; - } -} - -static char *cp_console_compl_loggen(const char *text, int state) { - static int counter; - static int textlen; - - if (!state) { - counter = 0; - textlen = strlen(text); - } - while (log_levels[counter].name != NULL && strncmp(text, log_levels[counter].name, textlen)) { - counter++; - } - if (log_levels[counter].name == NULL) { - return NULL; - } else { - char *buffer = strdup(log_levels[counter].name); - counter++; - return buffer; - } -} - -static char *cp_console_compl_plugingen(const char *text, int state) { - static int counter; - static int textlen; - - if (!state) { - counter = 0; - textlen = strlen(text); - if (plugins != NULL) { - cp_release_info(context, plugins); - } - plugins = cp_get_plugins_info(context, NULL, NULL); - } - if (plugins != NULL) { - while (plugins[counter] != NULL && strncmp(text, plugins[counter]->identifier, textlen)) { - counter++; - } - if (plugins[counter] == NULL) { - cp_release_info(context, plugins); - plugins = NULL; - return NULL; - } else { - char *buffer = strdup(plugins[counter]->identifier); - counter++; - return buffer; - } - } else { - return NULL; - } -} - -static char **cp_console_completion(const char *text, int start, int end) { - int cs, ce; - char **matches = NULL; - - // Search for start and end of command - for (cs = 0; cs < start && isspace(rl_line_buffer[cs]); cs++); - for (ce = cs; ce <= start && !isspace(rl_line_buffer[ce]); ce++); - - // If no command entered yet, use command completion - if (ce >= start) { - matches = rl_completion_matches(text, cp_console_compl_cmdgen); - rl_attempted_completion_over = 1; - } - - // Otherwise check if known command and complete accordingly - else { - int j = 0; - while (commands[j].name != NULL - && strncmp(rl_line_buffer + cs, commands[j].name, ce - cs)) { - j++; - } - if (commands[j].name != NULL) { - switch(commands[j].arg_completion) { - case CPC_COMPL_FILE: - break; - case CPC_COMPL_FLAG: - matches = rl_completion_matches(text, cp_console_compl_flagsgen); - rl_attempted_completion_over = 1; - break; - case CPC_COMPL_LOG_LEVEL: - matches = rl_completion_matches(text, cp_console_compl_loggen); - rl_attempted_completion_over = 1; - break; - case CPC_COMPL_PLUGIN: - matches = rl_completion_matches(text, cp_console_compl_plugingen); - rl_attempted_completion_over = 1; - break; - default: - rl_attempted_completion_over = 1; - break; - } - } else { - rl_attempted_completion_over = 1; - } - } - return matches; -} - -CP_HIDDEN void cmdline_init(void) { - rl_readline_name = PACKAGE_NAME; - rl_attempted_completion_function = cp_console_completion; -} - -CP_HIDDEN char *cmdline_input(const char *prompt) { - static char *cmdline = NULL; - - // Free previously returned command line, if any - if (cmdline != NULL) { - free(cmdline); - cmdline = NULL; - } - - // Obtain new command line and record it for history - cmdline = readline(prompt); - if (cmdline != NULL && *cmdline != '\0') { - add_history(cmdline); - } - - return cmdline; -} - -CP_HIDDEN void cmdline_destroy(void) { - if (plugins != NULL) { - cp_release_info(context, plugins); - plugins = NULL; - } -} diff --git a/lib/cpluff/console/console.c b/lib/cpluff/console/console.c deleted file mode 100644 index 9e0a24f919..0000000000 --- a/lib/cpluff/console/console.c +++ /dev/null @@ -1,931 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -// Core console logic - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <ctype.h> -#ifdef HAVE_GETTEXT -#include <locale.h> -#endif -#include <assert.h> -#include <cpluff.h> -#include "console.h" - - -/* ------------------------------------------------------------------------ - * Function declarations - * ----------------------------------------------------------------------*/ - -// Function declarations for command implementations -static void cmd_help(int argc, char *argv[]); -static void cmd_set_log_level(int argc, char *argv[]); -static void cmd_register_pcollection(int argc, char *argv[]); -static void cmd_unregister_pcollection(int argc, char *argv[]); -static void cmd_unregister_pcollections(int argc, char *argv[]); -static void cmd_load_plugin(int argc, char *argv[]); -static void cmd_scan_plugins(int argc, char *argv[]); -static void cmd_list_plugins(int argc, char *argv[]); -static void cmd_show_plugin_info(int argc, char *argv[]); -static void cmd_list_ext_points(int argc, char *argv[]); -static void cmd_list_extensions(int argc, char *argv[]); -static void cmd_set_context_args(int argc, char *argv[]); -static void cmd_start_plugin(int argc, char *argv[]); -static void cmd_run_plugins_step(int argc, char *argv[]); -static void cmd_run_plugins(int argc, char *argv[]); -static void cmd_stop_plugin(int argc, char *argv[]); -static void cmd_stop_plugins(int argc, char *argv[]); -static void cmd_uninstall_plugin(int argc, char *argv[]); -static void cmd_uninstall_plugins(int argc, char *argv[]); -static void cmd_exit(int argc, char *argv[]); - -/* ------------------------------------------------------------------------ - * Variables - * ----------------------------------------------------------------------*/ - -/// The plug-in context -CP_HIDDEN cp_context_t *context; - -/// The available commands -CP_HIDDEN const command_info_t commands[] = { - { "help", N_("displays available commands"), cmd_help, CPC_COMPL_NONE }, - { "set-log-level", N_("sets the displayed log level"), cmd_set_log_level, CPC_COMPL_LOG_LEVEL }, - { "register-collection", N_("registers a plug-in collection"), cmd_register_pcollection, CPC_COMPL_FILE }, - { "unregister-collection", N_("unregisters a plug-in collection"), cmd_unregister_pcollection, CPC_COMPL_FILE }, - { "unregister-collections", N_("unregisters all plug-in collections"), cmd_unregister_pcollections, CPC_COMPL_NONE }, - { "load-plugin", N_("loads and installs a plug-in from the specified path"), cmd_load_plugin, CPC_COMPL_FILE }, - { "scan-plugins", N_("scans plug-ins in the registered plug-in collections"), cmd_scan_plugins, CPC_COMPL_FLAG }, - { "set-context-args", N_("sets context startup arguments"), cmd_set_context_args, CPC_COMPL_FILE }, - { "start-plugin", N_("starts a plug-in"), cmd_start_plugin, CPC_COMPL_PLUGIN }, - { "run-plugins-step", N_("runs one plug-in run function"), cmd_run_plugins_step, CPC_COMPL_NONE }, - { "run-plugins", N_("runs plug-in run functions until all work is done"), cmd_run_plugins, CPC_COMPL_NONE }, - { "stop-plugin", N_("stops a plug-in"), cmd_stop_plugin, CPC_COMPL_PLUGIN }, - { "stop-plugins", N_("stops all plug-ins"), cmd_stop_plugins, CPC_COMPL_NONE }, - { "uninstall-plugin", N_("uninstalls a plug-in"), cmd_uninstall_plugin, CPC_COMPL_PLUGIN }, - { "uninstall-plugins", N_("uninstalls all plug-ins"), cmd_uninstall_plugins, CPC_COMPL_NONE }, - { "list-plugins", N_("lists the installed plug-ins"), cmd_list_plugins, CPC_COMPL_NONE }, - { "list-ext-points", N_("lists the installed extension points"), cmd_list_ext_points, CPC_COMPL_NONE }, - { "list-extensions", N_("lists the installed extensions"), cmd_list_extensions, CPC_COMPL_NONE }, - { "show-plugin-info", N_("shows static plug-in information"), cmd_show_plugin_info, CPC_COMPL_PLUGIN }, - { "quit", N_("quits the program"), cmd_exit, CPC_COMPL_NONE }, - { "exit", N_("quits the program"), cmd_exit, CPC_COMPL_NONE }, - { NULL, NULL, NULL, CPC_COMPL_NONE } -}; - -/// The available load flags -CP_HIDDEN const flag_info_t load_flags[] = { - { "upgrade", N_("enables upgrades of installed plug-ins"), CP_SP_UPGRADE }, - { "stop-all-on-upgrade", N_("stops all plug-ins on first upgrade"), CP_SP_STOP_ALL_ON_UPGRADE }, - { "stop-all-on-install", N_("stops all plug-ins on first install or upgrade"), CP_SP_STOP_ALL_ON_INSTALL }, - { "restart-active", N_("restarts the currently active plug-ins after the scan"), CP_SP_RESTART_ACTIVE }, - { NULL, NULL, -1 } -}; - -/// The available log levels -CP_HIDDEN const log_level_info_t log_levels[] = { - { "debug", N_("detailed debug messages"), CP_LOG_DEBUG }, - { "info", N_("informational messages"), CP_LOG_INFO }, - { "warning", N_("warnings about possible problems"), CP_LOG_WARNING }, - { "error", N_("error messages"), CP_LOG_ERROR }, - { "none", N_("disable logging"), CP_LOG_ERROR + 1 }, - { NULL, NULL, -1 } -}; - - -/* ------------------------------------------------------------------------ - * Function definitions - * ----------------------------------------------------------------------*/ - -/** - * Parses a command line (in place) into white-space separated elements. - * Returns the number of elements and the pointer to argument table including - * command and arguments. The argument table is valid until the next call - * to this function. - * - * @param cmdline the command line to be parsed - * @param argv pointer to the argument table is stored here - * @return the number of command line elements, or -1 on failure - */ -static int cmdline_parse(char *cmdline, char **argv[]) { - static char *sargv[16]; - int i, argc; - - for (i = 0; isspace(cmdline[i]); i++); - for (argc = 0; cmdline[i] != '\0' && argc < 16; argc++) { - sargv[argc] = cmdline + i; - while (cmdline[i] != '\0' && !isspace(cmdline[i])) { - i++; - } - if (cmdline[i] != '\0') { - cmdline[i++] = '\0'; - while (isspace(cmdline[i])) { - i++; - } - } - } - if (cmdline[i] != '\0') { - fputs(_("Command has too many arguments.\n"), stdout); - return -1; - } else { - *argv = sargv; - return argc; - } -} - -static void cmd_exit(int argc, char *argv[]) { - - // Uninitialize input - cmdline_destroy(); - - // Destroy C-Pluff framework - cp_destroy(); - - // Exit program - exit(0); -} - -static void cmd_help(int argc, char *argv[]) { - int i; - - fputs(_("The following commands are available:\n"), stdout); - for (i = 0; commands[i].name != NULL; i++) { - printf(" %s - %s\n", commands[i].name, _(commands[i].description)); - } -} - -static void logger(cp_log_severity_t severity, const char *msg, const char *apid, void *dummy) { - const char *level; - switch (severity) { - case CP_LOG_DEBUG: - /* TRANSLATORS: A tag for debug level log entries. */ - level = _("DEBUG"); - break; - case CP_LOG_INFO: - /* TRANSLATORS: A tag for info level log entries. */ - level = _("INFO"); - break; - case CP_LOG_WARNING: - /* TRANSLATORS: A tag for warning level log entries. */ - level = _("WARNING"); - break; - case CP_LOG_ERROR: - /* TRANSLATORS: A tag for error level log entries. */ - level = _("ERROR"); - break; - default: - /* TRANSLATORS: A tag for unknown severity level. */ - level = _("UNKNOWN"); - break; - } - fprintf(stderr, "C-Pluff: %s: [%s] %s\n", - level, - apid != NULL ? apid : - /* TRANSLATORS: Used when displaying log messages originating - from console activities. */ - _("console"), - msg); -} - -static void cmd_set_log_level(int argc, char *argv[]) { - if (argc != 2) { - /* TRANSLATORS: Usage instructions for setting log level */ - printf(_("Usage: %s <level>\n"), argv[0]); - } else { - int i; - - for (i = 0; log_levels[i].name != NULL; i++) { - if (!strcmp(argv[1], log_levels[i].name)) { - break; - } - } - if (log_levels[i].name == NULL) { - printf(_("Unknown log level %s.\n"), argv[1]); - fputs(_("Available log levels are:\n"), stdout); - for (i = 0; log_levels[i].name != NULL; i++) { - printf(" %s - %s\n", log_levels[i].name, _(log_levels[i].description)); - } - } else { - if (log_levels[i].level <= CP_LOG_ERROR) { - cp_register_logger(context, logger, NULL, log_levels[i].level); - } else { - cp_unregister_logger(context, logger); - } - /* TRANSLATORS: The first %s is the log level name and the second the localized log level description. */ - printf(_("Using display log level %s (%s).\n"), log_levels[i].name, _(log_levels[i].description)); - } - } -} - -static const char *status_to_desc(cp_status_t status) { - switch (status) { - case CP_OK: - /* TRANSLATORS: Return status for a successfull API call */ - return _("success"); - case CP_ERR_RESOURCE: - return _("insufficient system resources"); - case CP_ERR_UNKNOWN: - return _("an unknown object was specified"); - case CP_ERR_IO: - return _("an input or output error"); - case CP_ERR_MALFORMED: - return _("a malformed plug-in descriptor"); - case CP_ERR_CONFLICT: - return _("a plug-in or symbol conflicts with an existing one"); - case CP_ERR_DEPENDENCY: - return _("unsatisfiable dependencies"); - case CP_ERR_RUNTIME: - return _("a plug-in runtime library encountered an error"); - default: - return _("unknown error code"); - } -} - -static void api_failed(const char *func, cp_status_t status) { - printf(_("API function %s failed with error code %d (%s).\n"), - func, - status, - status_to_desc(status)); -} - -static void cmd_register_pcollection(int argc, char *argv[]) { - cp_status_t status; - - if (argc != 2) { - /* TRANSLATORS: Usage instructions for registering a plug-in collection */ - printf(_("Usage: %s <path>\n"), argv[0]); - } else if ((status = cp_register_pcollection(context, argv[1])) != CP_OK) { - api_failed("cp_register_pcollection", status); - } else { - printf(_("Registered a plug-in collection in path %s.\n"), argv[1]); - } -} - -static void cmd_unregister_pcollection(int argc, char *argv[]) { - if (argc != 2) { - /* TRANSLATORS: Usage instructions for unregistering a plug-in collection */ - printf(_("Usage: %s <path>\n"), argv[0]); - } else { - cp_unregister_pcollection(context, argv[1]); - printf(_("Unregistered a plug-in collection in path %s.\n"), argv[1]); - } -} - -static void cmd_unregister_pcollections(int argc, char *argv[]) { - if (argc != 1) { - /* TRANSLATORS: Usage instructions for unregistering all plug-in collections */ - printf(_("Usage: %s\n"), argv[0]); - } else { - cp_unregister_pcollections(context); - fputs(_("Unregistered all plug-in collections.\n"), stdout); - } -} - -static void cmd_load_plugin(int argc, char *argv[]) { - cp_plugin_info_t *plugin; - cp_status_t status; - - if (argc != 2) { - /* TRANSLATORS: Usage instructios for loading a plug-in */ - printf(_("Usage: %s <path>\n"), argv[0]); - } else if ((plugin = cp_load_plugin_descriptor(context, argv[1], &status)) == NULL) { - api_failed("cp_load_plugin_descriptor", status); - } else if ((status = cp_install_plugin(context, plugin)) != CP_OK) { - api_failed("cp_install_plugin", status); - cp_release_info(context, plugin); - } else { - printf(_("Installed plug-in %s.\n"), plugin->identifier); - cp_release_info(context, plugin); - } -} - -static void cmd_scan_plugins(int argc, char *argv[]) { - int flags = 0; - cp_status_t status; - int i; - - // Set flags - for (i = 1; i < argc; i++) { - int j; - - for (j = 0; load_flags[j].name != NULL; j++) { - if (!strcmp(argv[i], load_flags[j].name)) { - flags |= load_flags[j].value; - break; - } - } - if (load_flags[j].name == NULL) { - printf(_("Unknown flag %s.\n"), argv[i]); - /* TRANSLATORS: Usage instructions for scanning plug-ins */ - printf(_("Usage: %s [<flag>...]\n"), argv[0]); - fputs(_("Available flags are:\n"), stdout); - for (j = 0; load_flags[j].name != NULL; j++) { - printf(" %s - %s\n", load_flags[j].name, _(load_flags[j].description)); - } - return; - } - } - - if ((status = cp_scan_plugins(context, flags)) != CP_OK) { - api_failed("cp_scan_plugins", status); - return; - } - fputs(_("Plug-ins loaded.\n"), stdout); -} - -static char *state_to_string(cp_plugin_state_t state) { - switch (state) { - case CP_PLUGIN_UNINSTALLED: - return _("uninstalled"); - case CP_PLUGIN_INSTALLED: - return _("installed"); - case CP_PLUGIN_RESOLVED: - return _("resolved"); - case CP_PLUGIN_STARTING: - return _("starting"); - case CP_PLUGIN_STOPPING: - return _("stopping"); - case CP_PLUGIN_ACTIVE: - return _("active"); - default: - return _("unknown"); - } -} - -static void cmd_list_plugins(int argc, char *argv[]) { - cp_plugin_info_t **plugins; - cp_status_t status; - int i; - - if (argc != 1) { - /* TRANSLATORS: Usage instructions for listing plug-ins */ - printf(_("Usage: %s\n"), argv[0]); - } else if ((plugins = cp_get_plugins_info(context, &status, NULL)) == NULL) { - api_failed("cp_get_plugins_info", status); - } else { - const char format[] = " %-24s %-8s %-12s %s\n"; - fputs(_("Installed plug-ins:\n"), stdout); - printf(format, - _("IDENTIFIER"), - _("VERSION"), - _("STATE"), - _("NAME")); - for (i = 0; plugins[i] != NULL; i++) { - printf(format, - plugins[i]->identifier, - plugins[i]->version != NULL ? plugins[i]->version : "", - state_to_string(cp_get_plugin_state(context, plugins[i]->identifier)), - plugins[i]->name != NULL ? plugins[i]->name : ""); - } - cp_release_info(context, plugins); - } -} - -struct str_list_entry_t { - char *str; - struct str_list_entry_t *next; -}; - -static struct str_list_entry_t *str_list = NULL; - -static char *str_or_null(const char *str) { - if (str != NULL) { - char *s = malloc((strlen(str) + 3) * sizeof(char)); - struct str_list_entry_t *entry = malloc(sizeof(struct str_list_entry_t)); - if (s == NULL || entry == NULL) { - fputs(_("Memory allocation failed.\n"), stderr); - abort(); - } - sprintf(s, "\"%s\"", str); - entry->next = str_list; - entry->str = s; - str_list = entry; - return s; - } else { - return "NULL"; - } -} - -static void str_or_null_free(void) { - while (str_list != NULL) { - struct str_list_entry_t *next = str_list->next; - free(str_list->str); - free(str_list); - str_list = next; - } -} - -static void show_plugin_info_import(cp_plugin_import_t *import) { - printf(" plugin_id = \"%s\",\n" - " version = %s,\n" - " optional = %d,\n", - import->plugin_id, - str_or_null(import->version), - import->optional); -} - -static void show_plugin_info_ext_point(cp_ext_point_t *ep) { - assert(ep->plugin != NULL); - printf(" local_id = \"%s\",\n" - " identifier = \"%s\",\n" - " name = %s,\n" - " schema_path = %s,\n", - ep->local_id, - ep->identifier, - str_or_null(ep->name), - str_or_null(ep->schema_path)); -} - -static void strcat_quote_xml(char *dst, const char *src, int is_attr) { - char c; - - while (*dst != '\0') - dst++; - do { - switch ((c = *(src++))) { - case '&': - strcpy(dst, "&"); - dst += 5; - break; - case '<': - strcpy(dst, "<"); - dst += 4; - break; - case '>': - strcpy(dst, ">"); - dst += 4; - break; - case '"': - if (is_attr) { - strcpy(dst, """); - dst += 6; - break; - } - default: - *(dst++) = c; - break; - } - } while (c != '\0'); -} - -static int strlen_quoted_xml(const char *str,int is_attr) { - int len = 0; - int i; - - for (i = 0; str[i] != '\0'; i++) { - switch (str[i]) { - case '&': - len += 5; - break; - case '<': - case '>': - len += 4; - break; - case '"': - if (is_attr) { - len += 6; - break; - } - default: - len++; - } - } - return len; -} - -static void show_plugin_info_cfg(cp_cfg_element_t *ce, int indent) { - char *buffer = NULL; - int rs; - int i; - - // Calculate the maximum required buffer size - rs = 2 * strlen(ce->name) + 6 + indent; - if (ce->value != NULL) { - rs += strlen_quoted_xml(ce->value, 0); - } - for (i = 0; i < ce->num_atts; i++) { - rs += strlen(ce->atts[2*i]); - rs += strlen_quoted_xml(ce->atts[2*i + 1], 1); - rs += 4; - } - - // Allocate buffer - if ((buffer = malloc(rs * sizeof(char))) == NULL) { - fputs(_("Memory allocation failed.\n"), stderr); - abort(); - } - - // Create the string - for (i = 0; i < indent; i++) { - buffer[i] = ' '; - } - buffer[i++] = '<'; - buffer[i] = '\0'; - strcat(buffer, ce->name); - for (i = 0; i < ce->num_atts; i++) { - strcat(buffer, " "); - strcat(buffer, ce->atts[2*i]); - strcat(buffer, "=\""); - strcat_quote_xml(buffer, ce->atts[2*i + 1], 1); - strcat(buffer, "\""); - } - if (ce->value != NULL || ce->num_children) { - strcat(buffer, ">"); - if (ce->value != NULL) { - strcat_quote_xml(buffer, ce->value, 0); - } - if (ce->num_children) { - fputs(buffer, stdout); - putchar('\n'); - for (i = 0; i < ce->num_children; i++) { - show_plugin_info_cfg(ce->children + i, indent + 2); - } - for (i = 0; i < indent; i++) { - buffer[i] = ' '; - } - buffer[i++] = '<'; - buffer[i++] = '/'; - buffer[i] = '\0'; - strcat(buffer, ce->name); - strcat(buffer, ">"); - } else { - strcat(buffer, "</"); - strcat(buffer, ce->name); - strcat(buffer, ">"); - } - } else { - strcat(buffer, "/>"); - } - fputs(buffer, stdout); - putchar('\n'); - free(buffer); -} - -static void show_plugin_info_extension(cp_extension_t *e) { - assert(e->plugin != NULL); - printf(" ext_point_id = \"%s\",\n" - " local_id = %s,\n" - " identifier = %s,\n" - " name = %s,\n" - " configuration = {\n", - e->ext_point_id, - str_or_null(e->local_id), - str_or_null(e->identifier), - str_or_null(e->name)); - show_plugin_info_cfg(e->configuration, 6); - fputs(" },\n", stdout); -} - -static void cmd_show_plugin_info(int argc, char *argv[]) { - cp_plugin_info_t *plugin; - cp_status_t status; - int i; - - if (argc != 2) { - /* TRANSLATORS: Usage instructions for showing plug-in information */ - printf(_("Usage: %s <plugin>\n"), argv[0]); - } else if ((plugin = cp_get_plugin_info(context, argv[1], &status)) == NULL) { - api_failed("cp_get_plugin_info", status); - } else { - printf("{\n" - " identifier = \"%s\",\n" - " name = %s,\n" - " version = %s,\n" - " provider_name = %s,\n" - " abi_bw_compatibility = %s,\n" - " api_bw_compatibility = %s,\n" - " plugin_path = %s,\n" - " req_cpluff_version = %s,\n", - plugin->identifier, - str_or_null(plugin->name), - str_or_null(plugin->version), - str_or_null(plugin->provider_name), - str_or_null(plugin->abi_bw_compatibility), - str_or_null(plugin->api_bw_compatibility), - str_or_null(plugin->plugin_path), - str_or_null(plugin->req_cpluff_version)); - if (plugin->num_imports) { - fputs(" imports = {{\n", stdout); - for (i = 0; i < plugin->num_imports; i++) { - if (i) - fputs(" }, {\n", stdout); - show_plugin_info_import(plugin->imports + i); - } - fputs(" }},\n", stdout); - } else { - fputs(" imports = {},\n", stdout); - } - printf(" runtime_lib_name = %s,\n" - " runtime_funcs_symbol = %s,\n", - str_or_null(plugin->runtime_lib_name), - str_or_null(plugin->runtime_funcs_symbol)); - if (plugin->num_ext_points) { - fputs(" ext_points = {{\n", stdout); - for (i = 0; i < plugin->num_ext_points; i++) { - if (i) - fputs(" }, {\n", stdout); - show_plugin_info_ext_point(plugin->ext_points + i); - } - fputs(" }},\n", stdout); - } else { - fputs(" ext_points = {},\n", stdout); - } - if (plugin->num_extensions) { - fputs(" extensions = {{\n", stdout); - for (i = 0; i < plugin->num_extensions; i++) { - if (i) - fputs(" }, {\n", stdout); - show_plugin_info_extension(plugin->extensions + i); - } - fputs(" }}\n", stdout); - } else { - fputs(" extensions = {},\n", stdout); - } - fputs("}\n", stdout); - cp_release_info(context, plugin); - str_or_null_free(); - } -} - -static void cmd_list_ext_points(int argc, char *argv[]) { - cp_ext_point_t **ext_points; - cp_status_t status; - int i; - - if (argc != 1) { - /* TRANSLATORS: Usage instructions for listing extension points */ - printf(_("Usage: %s\n"), argv[0]); - } else if ((ext_points = cp_get_ext_points_info(context, &status, NULL)) == NULL) { - api_failed("cp_get_ext_points_info", status); - } else { - const char format[] = " %-32s %s\n"; - fputs(_("Installed extension points:\n"), stdout); - printf(format, - _("IDENTIFIER"), - _("NAME")); - for (i = 0; ext_points[i] != NULL; i++) { - printf(format, - ext_points[i]->identifier, - ext_points[i]->name != NULL ? ext_points[i]->name : ""); - } - cp_release_info(context, ext_points); - } -} - -static void cmd_list_extensions(int argc, char *argv[]) { - cp_extension_t **extensions; - cp_status_t status; - int i; - - if (argc != 1) { - /* TRANSLATORS: Usage instructions for listing extensions */ - printf(_("Usage: %s\n"), argv[0]); - } else if ((extensions = cp_get_extensions_info(context, NULL, &status, NULL)) == NULL) { - api_failed("cp_get_extensions_info", status); - } else { - const char format[] = " %-32s %s\n"; - fputs(_("Installed extensions:\n"), stdout); - printf(format, - _("IDENTIFIER"), - _("NAME")); - for (i = 0; extensions[i] != NULL; i++) { - if (extensions[i]->identifier == NULL) { - char buffer[128]; - snprintf(buffer, sizeof(buffer), "%s%s", extensions[i]->plugin->identifier, _(".<anonymous>")); - strcpy(buffer + sizeof(buffer)/sizeof(char) - 4, "..."); - printf(format, - buffer, - extensions[i]->name != NULL ? extensions[i]->name : ""); - } else { - printf(format, - extensions[i]->identifier, - extensions[i]->name != NULL ? extensions[i]->name : ""); - } - } - cp_release_info(context, extensions); - } -} - -static char **argv_dup(int argc, char *argv[]) { - char **dup; - int i; - - if ((dup = malloc((argc + 1) * sizeof(char *))) == NULL) { - return NULL; - } - dup[0] = ""; - for (i = 1; i < argc; i++) { - if ((dup[i] = strdup(argv[i])) == NULL) { - for (i--; i > 0; i--) { - free(dup[i]); - } - free(dup); - return NULL; - } - } - dup[argc] = NULL; - return dup; -} - -static void cmd_set_context_args(int argc, char *argv[]) { - char **ctx_argv; - - if (argc != 1) { - /* TRANSLATORS: Usage instructions for setting context arguments */ - printf(_("Usage: %s [<arg>...]\n"), argv[0]); - } else if ((ctx_argv = argv_dup(argc, argv)) == NULL) { - fputs(_("Memory allocation failed.\n"), stderr); - } else { - cp_set_context_args(context, ctx_argv); - fputs(_("Plug-in context startup arguments have been set.\n"), stdout); - } -} - -static void cmd_start_plugin(int argc, char *argv[]) { - cp_status_t status; - - if (argc != 2) { - /* TRANSLATORS: Usage instructions for starting a plug-in */ - printf(_("Usage: %s <plugin>\n"), argv[0]); - } else if ((status = cp_start_plugin(context, argv[1])) != CP_OK) { - api_failed("cp_start_plugin", status); - } else { - printf(_("Started plug-in %s.\n"), argv[1]); - } -} - -static void cmd_run_plugins_step(int argc, char *argv[]) { - - if (argc != 1) { - /* TRANSLATORS: Usage instructions for running one plug-in run function */ - printf(_("Usage: %s\n"), argv[0]); - } else { - int pending = cp_run_plugins_step(context); - if (pending) { - fputs(_("Ran one plug-in run function. There are pending run functions.\n"), stdout); - } else { - fputs(_("Ran one plug-in run function. No more pending run functions.\n"), stdout); - } - } -} - -static void cmd_run_plugins(int argc, char *argv[]) { - if (argc != 1) { - /* TRANSLATORS: Usage instructions for running plug-in run functions until all work is done */ - printf(_("Usage: %s\n"), argv[0]); - } else { - cp_run_plugins(context); - fputs(_("Ran plug-in run functions. No more pending run functions.\n"), stdout); - } -} - -static void cmd_stop_plugin(int argc, char *argv[]) { - cp_status_t status; - - if (argc != 2) { - /* TRANSLATORS: Usage instructions for stopping a plug-in */ - printf(_("Usage: %s <plugin>\n"), argv[0]); - } else if ((status = cp_stop_plugin(context, argv[1])) != CP_OK) { - api_failed("cp_stop_plugin", status); - } else { - printf(_("Stopped plug-in %s.\n"), argv[1]); - } -} - -static void cmd_stop_plugins(int argc, char *argv[]) { - if (argc != 1) { - /* TRANSLATORS: Usage instructions for stopping all plug-ins */ - printf(_("Usage: %s\n"), argv[0]); - } else { - cp_stop_plugins(context); - fputs(_("Stopped all plug-ins.\n"), stdout); - } -} - -static void cmd_uninstall_plugin(int argc, char *argv[]) { - cp_status_t status; - - if (argc != 2) { - /* TRANSLATORS: Usage instructions for uninstalling a plug-in */ - printf(_("Usage: %s <plugin>\n"), argv[0]); - } else if ((status = cp_uninstall_plugin(context, argv[1])) != CP_OK) { - api_failed("cp_uninstall_plugin", status); - } else { - printf(_("Uninstalled plug-in %s.\n"), argv[1]); - } -} - -static void cmd_uninstall_plugins(int argc, char *argv[]) { - if (argc != 1) { - /* TRANSLATORS: Usage instructions for uninstalling all plug-ins */ - printf(_("Usage: %s\n"), argv[0]); - } else { - cp_uninstall_plugins(context); - fputs(_("Uninstalled all plug-ins.\n"), stdout); - } -} - -int main(int argc, char *argv[]) { - char *prompt; - int i; - cp_status_t status; - - // Set locale -#ifdef HAVE_GETTEXT - setlocale(LC_ALL, ""); -#endif - - // Initialize C-Pluff library - if ((status = cp_init()) != CP_OK) { - api_failed("cp_init", status); - exit(1); - } - - // Set gettext domain -#ifdef HAVE_GETTEXT - textdomain(PACKAGE); -#endif - - // Display startup information - printf( - /* TRANSLATORS: This is a version string displayed on startup. */ - _("C-Pluff Console, version %s\n"), PACKAGE_VERSION); - printf( - /* TRANSLATORS: This is a version string displayed on startup. - The first %s is version and the second %s is platform type. */ - _("C-Pluff Library, version %s for %s\n"), - cp_get_version(), cp_get_host_type()); - - // Create a plug-in context - context = cp_create_context(&status); - if (context == NULL) { - api_failed("cp_create_context", status); - exit(1); - } - - // Initialize logging - cp_register_logger(context, logger, NULL, log_levels[1].level); - printf(_("Using display log level %s (%s).\n"), log_levels[1].name, _(log_levels[1].description)); - - // Command line loop - fputs(_("Type \"help\" for help on available commands.\n"), stdout); - cmdline_init(); - - /* TRANSLATORS: This is the input prompt for cpluff-console. */ - prompt = _("C-Pluff Console > "); - - while (1) { - char *cmdline; - int argc; - char **argv; - - // Get command line - cmdline = cmdline_input(prompt); - if (cmdline == NULL) { - putchar('\n'); - cmdline = "exit"; - } - - // Parse command line - argc = cmdline_parse(cmdline, &argv); - if (argc <= 0) { - continue; - } - - // Choose command - for (i = 0; commands[i].name != NULL; i++) { - if (!strcmp(argv[0], commands[i].name)) { - commands[i].implementation(argc, argv); - break; - } - } - if (commands[i].name == NULL) { - printf(_("Unknown command %s.\n"), argv[0]); - } - } -} diff --git a/lib/cpluff/console/console.h b/lib/cpluff/console/console.h deleted file mode 100644 index b8253dfdd6..0000000000 --- a/lib/cpluff/console/console.h +++ /dev/null @@ -1,171 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -// Global declarations - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#ifdef HAVE_GETTEXT -#include <libintl.h> -#endif -#include <cpluff.h> - - -/* ------------------------------------------------------------------------ - * Defines - * ----------------------------------------------------------------------*/ - -// Gettext defines -#ifdef HAVE_GETTEXT -#define _(String) gettext(String) -#define gettext_noop(String) String -#define N_(String) gettext_noop(String) -#else -#define _(String) (String) -#define N_(String) String -#define textdomain(Domain) -#define bindtextdomain(Package, Directory) -#endif - - -/* ------------------------------------------------------------------------ - * Data types - * ----------------------------------------------------------------------*/ - -/// Type of argument completion -typedef enum arg_compl_t { - - /// Do not use completion - CPC_COMPL_NONE, - - /// Use file name completion - CPC_COMPL_FILE, - - /// Use scan flag completion - CPC_COMPL_FLAG, - - /// Use log level completion - CPC_COMPL_LOG_LEVEL, - - /// Use plug-in identifier completion - CPC_COMPL_PLUGIN, - -} arg_compl_t; - -/// Type for command implementations -typedef void (*command_func_t)(int argc, char *argv[]); - -/// Type for command information -typedef struct command_info_t { - - /// The name of the command - char *name; - - /// The description for the command - const char *description; - - /// The command implementation - command_func_t implementation; - - /// The type of argument completion to use - arg_compl_t arg_completion; - -} command_info_t; - -/// Type for flag information -typedef struct flag_info_t { - - /// The name of the flag - const char *name; - - /// The description of the flag - const char *description; - - /// The value of the flag - int value; - -} flag_info_t; - -/// Type for log level information -typedef struct log_level_info_t { - - /// The name of the log level - const char *name; - - /// The descriptor of the log level - const char *description; - - /// The value of the log level - int level; - -} log_level_info_t; - - -/* ------------------------------------------------------------------------ - * Global variables - * ----------------------------------------------------------------------*/ - -/// The plug-in context -CP_HIDDEN extern cp_context_t *context; - -/// The available commands -CP_HIDDEN extern const command_info_t commands[]; - -/// The available load flags -CP_HIDDEN extern const flag_info_t load_flags[]; - -/// The available logging levels -CP_HIDDEN extern const log_level_info_t log_levels[]; - - -/* ------------------------------------------------------------------------ - * Function declarations - * ----------------------------------------------------------------------*/ - -/** - * Initializes command line reading. Must be called once to initialize - * everything before using cmdline_input. - */ -CP_HIDDEN void cmdline_init(void); - -/** - * Returns a command line entered by the user. Uses the specified prompt. - * The returned command line is valid and it may be modified until the - * next call to this function. - * - * @param prompt the prompt to be used - * @return the command line entered by the user - */ -CP_HIDDEN char *cmdline_input(const char *prompt); - -/** - * Releases command line reading resources. Must be called after command - * line input is not needed and before destroying the context. - */ -CP_HIDDEN void cmdline_destroy(void); - -#ifndef CONSOLE_H_ -#define CONSOLE_H_ - -#endif //CONSOLE_H_ diff --git a/lib/cpluff/doc/.htaccess b/lib/cpluff/doc/.htaccess deleted file mode 100644 index 82d4d99531..0000000000 --- a/lib/cpluff/doc/.htaccess +++ /dev/null @@ -1,12 +0,0 @@ -Options +MultiViews -DirectoryIndex index -AddType text/plain;charset=US-ASCII .asc -AddType text/plain;charset=US-ASCII .gpg -AddType text/html;charset=UTF-8 .html -AddType text/css .css -AddType image/vnd.microsoft.icon .ico -AddLanguage en .en -AddLanguage fi .fi -AddLanguage sv .sv -LanguagePriority en fi sv -ForceLanguagePriority Fallback diff --git a/lib/cpluff/doc/Makefile.am b/lib/cpluff/doc/Makefile.am deleted file mode 100644 index 6f67e6912f..0000000000 --- a/lib/cpluff/doc/Makefile.am +++ /dev/null @@ -1,66 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -SUBDIRS = img - -EXTRA_DIST = index.en.html copyright.en.html cpluff_style.css common_style.css - -htmldocdir = $(docdir)/html -htmldoc_DATA = index.en.html copyright.en.html cpluff_style.css common_style.css - -examplesdir = $(docdir)/examples - -install-data-local: install-reference-doc install-examples-source - -install-reference-doc: - { test ! -d '$(DESTDIR)$(htmldocdir)/reference' || \ - { chmod -R u+w '$(DESTDIR)$(htmldocdir)/reference' && \ - rm -rf '$(DESTDIR)$(htmldocdir)/reference'; }; } && \ - $(MKDIR_P) '$(DESTDIR)$(htmldocdir)' && \ - if test -d '$(srcdir)/reference'; then \ - cp -r '$(srcdir)/reference' '$(DESTDIR)$(htmldocdir)'; \ - else \ - cd .. && \ - $(MAKE) $(AM_MAKEFLAGS) doc && \ - cp -r libcpluff/doc/reference '$(DESTDIR)$(htmldocdir)' && \ - cd doc; \ - fi && \ - find '$(DESTDIR)$(htmldocdir)/reference' -type f -exec chmod 644 '{}' \; && \ - cd '$(DESTDIR)$(htmldocdir)' && \ - rm -f index.html && \ - $(LN_S) index.en.html index.html - -install-examples-source: - { test ! -d '$(DESTDIR)$(examplesdir)' || \ - { chmod -R u+w '$(DESTDIR)$(examplesdir)' && \ - rm -rf '$(DESTDIR)$(examplesdir)'; }; } && \ - for d in \ - cpfile/plugins/cext \ - cpfile/plugins/core \ - cpfile/plugins/extension \ - cpfile/plugins/special; do \ - $(MKDIR_P) "$(DESTDIR)$(examplesdir)/$$d"; \ - done && \ - cd '$(srcdir)/..' && \ - find examples -type f \( -name 'autogen.sh' \ - -or -name 'configure.ac' \ - -or -name 'Makefile.am' \ - -or -name 'cpfile.in' \ - -or -name '*.nmake' \ - -or -name '*.bat' \ - -or -name '*.txt' \ - -or -name '*.xml' \ - -or -name '*.xsd' \ - -or -name '*.c' \ - -or -name '*.h' \) \ - -exec $(INSTALL_DATA) '{}' '$(DESTDIR)$(docdir)/{}' \; && \ - chmod 755 '$(DESTDIR)$(examplesdir)/autogen.sh' - -uninstall-local: - chmod -R u+w '$(DESTDIR)$(docdir)' - rm -rf '$(DESTDIR)$(docdir)' - -.PHONY: install-reference-doc install-examples-source diff --git a/lib/cpluff/doc/common_style.css b/lib/cpluff/doc/common_style.css deleted file mode 100644 index d3d156c897..0000000000 --- a/lib/cpluff/doc/common_style.css +++ /dev/null @@ -1,33 +0,0 @@ -html { - background-color: white; - color: black; - font-family: Arial, sans-serif; - text-align: justify; -} -a { - color: inherit; - background-color: inherit; -} -a:link { - color: #0000e0; -} -a:visited { - color: #8000a0; -} -a:hover { - color: red; -} -img { - border-style: none; -} -p.footer { - clear: both; - border-top-style: solid; - border-top-width: 1px; - padding-top: 1ex; - text-align: center; - font-size: smaller; -} -li { - text-align: left; -} diff --git a/lib/cpluff/doc/copyright.en.html b/lib/cpluff/doc/copyright.en.html deleted file mode 100644 index 1455a271be..0000000000 --- a/lib/cpluff/doc/copyright.en.html +++ /dev/null @@ -1,118 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> - <head> - <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> - <meta name="author" content="Johannes Lehtinen"/> - <meta name="copyright" content="Copyright 2007 Johannes Lehtinen"/> - <meta name="keywords" content="C-Pluff,copyright,license"/> - <meta name="identifier" content="http://www.c-pluff.org/copyright.en.html"/> - <title>C-Pluff copyright information</title> - <link rel="Stylesheet" type="text/css" href="cpluff_style.css"/> - </head> - <body> - <div id="content"> - - <h1>C-Pluff copyright information</h1> - - <ul class="menu"> - <li><a href="index.en.html">C-Pluff</a></li> - <li>License</li> - <li><a href="reference/c-api/index.html">Documentation</a></li> - <li><a href="http://www.c-pluff.org/lists">Mailing lists</a></li> - <li><a href="http://www.c-pluff.org/download">Download</a></li> - <li><a href="http://www.c-pluff.org/repository">Repository</a></li> - </ul> - - <p> - C-Pluff author is Johannes Lehtinen - <<a href="mailto:johannes.lehtinen@iki.fi">johannes.lehtinen@iki.fi</a>>. - Except where otherwise noted in the source code the C-Pluff source code - is licensed under the <a href="#cpluff-license">C-Pluff license</a> - included below (also known as the MIT license, an OSI approved open - source license). - </p> - <p> - C-Pluff uses data structure implementations from Kazlib library. - Kazlib author is Kaz Kylheku. - In C-Pluff source code distribution the files derived from Kazlib - are contained in kazlib subdirectory. These files are licensed under - the <a href="#kazlib-license">Kazlib license</a> included below. - Kazlib was obtained from - <a href="http://users.footprints.net/~kaz/kazlib.html">http://users.footprints.net/~kaz/kazlib.html</a>. - </p> - <p> - Please notice that the resulting binaries are linked with libraries that - may impose additional licensing conditions for the binaries. Specifically, - the C-Pluff Console binary, cpluff-console, may be linked with the GNU - Readline Library meaning that you have to comply with the conditions of - the GNU General Public License when distributing it in binary form. - </p> - - <h2 id="cpluff-license">C-Pluff license</h2> - <p> - C-Pluff, a plug-in framework for C<br/> - Copyright 2007 Johannes Lehtinen - </p> - <p> - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - </p> - <p> - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - </p> - <p> - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - </p> - - <h2 id="kazlib-license">Kazlib license</h2> - <p> - Hash Table Data Type<br/> - List Abstract Data Type<br/> - Copyright (C) 1997 Kaz Kylheku <kaz at ashi.footprints.net> - </p> - <p> - Free Software License: - </p> - <p> - All rights are reserved by the author, with the following exceptions: - Permission is granted to freely reproduce and distribute this software, - possibly in exchange for a fee, provided that this copyright notice appears - intact. Permission is also granted to adapt this software to produce - derivative works, as long as the modified versions carry this copyright - notice and additional notices stating that the work has been modified. - This source code may be translated into executable form and incorporated - into proprietary software; there is no requirement for such software to - contain a copyright notice related to this source. - </p> - - <ul class="menu"> - <li><a href="index.en.html">C-Pluff</a></li> - <li>License</li> - <li><a href="reference/c-api/index.html">Documentation</a></li> - <li><a href="http://www.c-pluff.org/lists">Mailing lists</a></li> - <li><a href="http://www.c-pluff.org/download">Download</a></li> - <li><a href="http://www.c-pluff.org/repository">Repository</a></li> - </ul> - - <p class="footer"> - Copyright 2007 <a href="http://www.jlehtinen.net/">Johannes Lehtinen</a><br/> - Validation: - <a href="http://validator.w3.org/check?uri=referer">XHTML Basic 1.0</a>, - <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS 2</a> - </p> - - </div> - </body> -</html> diff --git a/lib/cpluff/doc/cpluff_style.css b/lib/cpluff/doc/cpluff_style.css deleted file mode 100644 index bf8cdab739..0000000000 --- a/lib/cpluff/doc/cpluff_style.css +++ /dev/null @@ -1,45 +0,0 @@ -@import "common_style.css"; -html { - background-color: #eff6fd; -} -body { - margin: 0; - padding: 0; - - /* For IE */ - text-align: center; -} -#content { - text-align: justify; - margin: 0 auto; - padding: 2ex 6ex 2ex 10ex; - background-color: white; - background-image: url(img/pageborder.png); - background-position: 100% 0; - background-repeat: repeat-y; - - /* Using width instead of max-width for IE */ - width: 70ex; -} -span.signature { - font-style: italic; -} -ul.menu { - text-align: center; - padding-left: 0; -} -ul.menu li { - display: inline; -} -ul.menu li:before { - content: "["; -} -ul.menu li:after { - content: "]"; -} -pre.example { - border-style: solid; - border-width: 1px; - padding: 0.5ex; - background-color: #e0e0e0; -} diff --git a/lib/cpluff/doc/download.en.html b/lib/cpluff/doc/download.en.html deleted file mode 100644 index 2d862c775b..0000000000 --- a/lib/cpluff/doc/download.en.html +++ /dev/null @@ -1,199 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> - <head> - <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> - <meta name="author" content="Johannes Lehtinen"/> - <meta name="copyright" content="Copyright 2007 Johannes Lehtinen"/> - <meta name="keywords" content="C-Pluff,download"/> - <meta name="identifier" content="http://www.c-pluff.org/download.en.html"/> - <title>Download C-Pluff</title> - <link rel="Stylesheet" type="text/css" href="cpluff_style.css"/> - </head> - <body> - <div id="content"> - - <h1>Download C-Pluff</h1> - - <ul class="menu"> - <li><a href="/">C-Pluff</a></li> - <li><a href="copyright.en.html">License</a></li> - <li><a href="reference/c-api/index.html">Documentation</a></li> - <li><a href="http://www.c-pluff.org/lists">Mailing lists</a></li> - <li>Download</li> - <li><a href="http://www.c-pluff.org/repository">Repository</a></li> - </ul> - - <h2>Source code distribution</h2> - <p> - You can download the source code distribution here. It is currently - known to compile on Linux with GCC and MinGW (for Windows - cross-compilation). - </p> - <ul class="downloads"> - <li><a href="downloads/cpluff-0.1.3.tar.gz">cpluff-0.1.3.tar.gz</a> (736 KiB, Apr 6 2007, <a href="downloads/cpluff-0.1.3.tar.gz.asc">PGP signature</a>)</li> - <li><a href="downloads/cpluff-0.1.2.tar.gz">cpluff-0.1.2.tar.gz</a> (720 KiB, Mar 28 2007, <a href="downloads/cpluff-0.1.2.tar.gz.asc">PGP signature</a>)</li> - <li><a href="downloads/cpluff-0.1.1.tar.gz">cpluff-0.1.1.tar.gz</a> (680 KiB, Mar 18 2007, <a href="downloads/cpluff-0.1.1.tar.gz.asc">PGP signature</a>)</li> - <li><a href="downloads/cpluff-0.1.0.tar.gz">cpluff-0.1.0.tar.gz</a> (600 KiB, Mar 8 2007, <a href="downloads/cpluff-0.1.0.tar.gz.asc">PGP signature</a>)</li> - </ul> - <p> - <a href="downloads/ChangeLog">The change log</a> and - <a href="downloads/Roadmap">the roadmap</a> are available separately. - </p> - - <h2>Precompiled binaries</h2> - <p> - Here are the binary distributions currently available. If you would - like to have precompiled binaries for some other platform, you can ask - for it on the users mailing list and we will see if that can be arranged. - </p> - <ul> - <li><a href="#debian">Debian GNU/Linux (i386)</a></li> - <li><a href="#debian-mingw">MinGW cross-compilation on Debian GNU/Linux</a></li> - <li><a href="#windows">Microsoft Windows (i386)</a></li> - </ul> - - <h3 id="debian">Debian GNU/Linux</h3> - <p> - Precompiled binaries are currently available for the i386 architecture. - C-Pluff is divided into three separate binary packages and the - debianized source package: - </p> - <dl> - - <dt>cpluff</dt> - <dd>the debianized source package</dd> - - <dt>libcpluff0</dt> - <dd>the runtime library and locale data</dd> - - <dt>cpluff-loader</dt> - <dd>C-Pluff Loader, a generic plug-in loader</dd> - - <dt>libcpluff0-dev</dt> - <dd>the development library, header files, documentation, example - source code and C-Pluff Console</dd> - - </dl> - <p> - To be able to install the packages, add the following source - specification into /etc/apt/sources.list. - </p> - <pre class="example"> -deb http://www.c-pluff.org/downloads/debian stable cpluff -deb-src http://www.c-pluff.org/downloads/debian stable cpluff</pre> - <p> - You can replace "stable" with "testing", "sarge" or "etch". Currently - there is only one set of binaries which can be used with any of the - listed Debian releases (not tested with unstable or experimental). - The second line is needed only if you want to download the debianized - source package. - </p> - <p> - Then run "aptitude update" as root and install selected packages using - "aptitude install <package>" (or the interactive user interface). - The source package is downloaded by running "apt-get source cpluff". - </p> - <p> - APT checks signatures since Debian GNU/Linux 4.0 (Etch). - The C-Pluff distribution has been signed with - <a href="http://www.jlehtinen.net/gpg_johannes_lehtinen.asc">my - PGP key</a>. - If you verify the key and choose to trust me as a software - provider (yeah, right ;), you can install the key as a - trusted APT key by downloading it and using the command - "apt-key add gpg_johannes_lehtinen.asc". - </p> - - <h3 id="debian-mingw">MinGW cross-compilation on Debian GNU/Linux</h3> - <p> - Precompiled binaries are available also for MinGW cross-compilation - environment on Debian GNU/Linux. Binaries (and sources) for third - party dependencies are also provided. These can be used on Debian - GNU/Linux to cross-compile C-Pluff based applications for Windows. - The Windows binary distribution (see below) is based on these binaries. - </p> - <dl> - - <dt>cpluff-mingw</dt> - <dd>C-Pluff runtime library, binaries and other material</dd> - - <dt>cpluff-examples-mingw</dt> - <dd>C-Pluff example application binaries</dd> - - <dt>expat-mingw</dt> - <dd>Expat XML parser library runtime library and headers</dd> - - <dt>libltdl-mingw</dt> - <dd>GNU Libtool libltdl runtime library and headers</dd> - - <dt>gettext-runtime-mingw</dt> - <dd>GNU Gettext runtime binaries and headers</dd> - - </dl> - <p> - To be able to install the packages, add the following source - specification into /etc/apt/sources.list. Notice, although these packages - are placed in the i386 section, they are actually architecture - independent as they target the host platform, i586-mingw32msvc. - </p> - <pre class="example"> -deb http://www.c-pluff.org/downloads/debian stable cpluff 3rdparty -deb-src http://www.c-pluff.org/downloads/debian stable cpluff 3rdparty</pre> - - <h3 id="windows">Microsoft Windows</h3> - <p> - These precompiled binaries are for Microsoft Windows. Download one or - more zip files and extract them to the same location. The following - describes the ZIP file naming conventions. - </p> - <dl> - - <dt>cpluff-VERSION.zip</dt> - <dd>C-Pluff runtime library, binaries and other material together - with third party binary dependencies (this is a union of the following - two packages, so you only need this one or the next two packages)</dd> - - <dt>cpluff-VERSION-only.zip</dt> - <dd>C-Pluff runtime library, binaries and other material</dd> - - <dt>cpluff-VERSION-deps.zip</dt> - <dd>third party binary dependencies</dd> - - <dt>cpluff-VERSION-examples.zip</dt> - <dd>C-Pluff example application binaries</dd> - - </dl> - <p> - Download selected packages here. - </p> - <ul class="downloads"> - <li>C-Pluff 0.1.3 (Apr 6 2007) - <ul> - <li><a href="downloads/windows/cpluff-0.1.3.zip">cpluff-0.1.3.zip</a> (1768 KiB, <a href="downloads/windows/cpluff-0.1.3.zip.asc">PGP signature</a>)</li> - <li><a href="downloads/windows/cpluff-0.1.3-only.zip">cpluff-0.1.3-only.zip</a> (700 KiB, <a href="downloads/windows/cpluff-0.1.3-only.zip.asc">PGP signature</a>)</li> - <li><a href="downloads/windows/cpluff-0.1.3-deps.zip">cpluff-0.1.3-deps.zip</a> (1076 KiB, <a href="downloads/windows/cpluff-0.1.3-deps.zip.asc">PGP signature</a>)</li> - <li><a href="downloads/windows/cpluff-0.1.3-examples.zip">cpluff-0.1.3-examples.zip</a> (336 KiB, <a href="downloads/windows/cpluff-0.1.3-examples.zip.asc">PGP signature</a>)</li> - </ul> - </li> - </ul> - - <ul class="menu"> - <li><a href="/">C-Pluff</a></li> - <li><a href="copyright.en.html">License</a></li> - <li><a href="reference/c-api/index.html">Documentation</a></li> - <li><a href="http://www.c-pluff.org/lists">Mailing lists</a></li> - <li>Download</li> - <li><a href="http://www.c-pluff.org/repository">Repository</a></li> - </ul> - - <p class="footer"> - Copyright 2007 <a href="http://www.jlehtinen.net/">Johannes Lehtinen</a><br/> - Validation: - <a href="http://validator.w3.org/check?uri=referer">XHTML Basic 1.0</a>, - <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS 2</a> - </p> - - </div> - </body> -</html> diff --git a/lib/cpluff/doc/img/Makefile.am b/lib/cpluff/doc/img/Makefile.am deleted file mode 100644 index 03f5391879..0000000000 --- a/lib/cpluff/doc/img/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -EXTRA_DIST = architecture.svg architecture.png pageborder.png - -htmlimgdir=$(docdir)/html/img -htmlimg_DATA = architecture.png pageborder.png diff --git a/lib/cpluff/doc/img/architecture.png b/lib/cpluff/doc/img/architecture.png Binary files differdeleted file mode 100644 index fa7cf75b29..0000000000 --- a/lib/cpluff/doc/img/architecture.png +++ /dev/null diff --git a/lib/cpluff/doc/img/architecture.svg b/lib/cpluff/doc/img/architecture.svg deleted file mode 100644 index 6af48d8c18..0000000000 --- a/lib/cpluff/doc/img/architecture.svg +++ /dev/null @@ -1,253 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://web.resource.org/cc/" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="744.09448819" - height="1052.3622047" - id="svg2" - sodipodi:version="0.32" - inkscape:version="0.44.1" - sodipodi:docbase="/home/jle/eclipse-workspace/c-pluff/doc" - sodipodi:docname="architecture.svg" - inkscape:export-filename="/home/jle/eclipse-workspace/c-pluff/doc/architecture.png" - inkscape:export-xdpi="90" - inkscape:export-ydpi="90"> - <defs - id="defs4" /> - <sodipodi:namedview - id="base" - pagecolor="white" - bordercolor="#666666" - borderopacity="1.0" - gridtolerance="10000" - guidetolerance="10" - objecttolerance="10" - inkscape:pageopacity="1" - inkscape:pageshadow="2" - inkscape:zoom="1" - inkscape:cx="375" - inkscape:cy="758.07143" - inkscape:document-units="px" - inkscape:current-layer="layer1" - showgrid="false" - inkscape:window-width="1192" - inkscape:window-height="957" - inkscape:window-x="88" - inkscape:window-y="0" /> - <metadata - id="metadata7"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - </cc:Work> - </rdf:RDF> - </metadata> - <g - inkscape:label="Layer 1" - inkscape:groupmode="layer" - id="layer1"> - <rect - style="font-size:14px;opacity:1;color:black;fill:#fffe57;fill-opacity:1;fill-rule:nonzero;stroke:#2b0000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - id="rect1904" - width="300" - height="30" - x="120" - y="132.36218" - rx="10" - ry="10" /> - <text - xml:space="preserve" - style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:black;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans" - x="221.06152" - y="151.22449" - id="text1906" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan1908" - x="221.06152" - y="151.22449">Main program</tspan></text> - <rect - style="opacity:1;color:black;fill:#bae9ff;fill-opacity:1;fill-rule:nonzero;stroke:#2b0000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - id="rect1910" - width="300" - height="110" - x="120" - y="162.36218" - rx="10" - ry="10" /> - <text - xml:space="preserve" - style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:black;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans" - x="246.51514" - y="182.9989" - id="text1912" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan1914" - x="246.51514" - y="182.9989">C-Pluff</tspan></text> - <path - style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;opacity:1;color:black;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;visibility:visible;display:inline;overflow:visible" - d="M 235,248.36218 C 287,199.36218 345.5,196.61218 345,235.36218" - id="path1897" - sodipodi:nodetypes="cs" /> - <path - style="color:black;fill:#68ff5c;fill-opacity:1;fill-rule:nonzero;stroke:#2b0000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible" - d="M 150 242.375 C 144.46 242.375 140 246.835 140 252.375 L 140 322.375 C 140 327.915 144.46 332.375 150 332.375 L 230 332.375 C 235.54 332.375 240 327.915 240 322.375 L 240 252.375 C 240 246.835 235.54 242.375 230 242.375 L 180 242.375 L 180 262.375 L 170 262.375 L 160 262.375 L 160 242.375 L 150 242.375 z " - id="rect1916" /> - <path - style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;opacity:1;color:black;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;visibility:visible;display:inline;overflow:visible" - d="M 225,235.36218 C 272,191.36218 305.75,215.86218 322,249.36218" - id="path1895" - sodipodi:nodetypes="cs" /> - <path - style="color:black;fill:#a5baff;fill-opacity:1;fill-rule:nonzero;stroke:#2b0000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible" - d="M 320 242.375 C 314.46 242.375 310 246.835 310 252.375 L 310 322.375 C 310 327.915 314.46 332.375 320 332.375 L 390 332.375 C 395.54 332.375 400 327.915 400 322.375 L 400 252.375 C 400 246.83499 395.54 242.375 390 242.375 L 390 262.375 L 370 262.375 L 370 242.375 L 320 242.375 z " - id="rect1920" /> - <rect - style="opacity:1;color:black;fill:#68ff5c;fill-opacity:1;fill-rule:nonzero;stroke:#2b0000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - id="rect1928" - width="11" - height="30" - x="200" - y="232.36218" /> - <rect - style="opacity:1;color:black;fill:#a5baff;fill-opacity:1;fill-rule:nonzero;stroke:#2b0000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - id="rect1930" - width="10" - height="29" - x="220" - y="232.36218" /> - <path - style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;opacity:1;color:black;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;visibility:visible;display:inline;overflow:visible" - d="M 194,237.36218 C 222,185.36218 272.5,223.36218 272,253.36218" - id="path1889" - sodipodi:nodetypes="cs" /> - <rect - style="opacity:1;color:black;fill:#ff9e69;fill-opacity:1;fill-rule:nonzero;stroke:#2b0000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - id="rect1934" - width="10" - height="30" - x="190" - y="232.36218" - rx="0" - ry="0" /> - <rect - style="opacity:1;color:black;fill:#68ff5c;fill-opacity:1;fill-rule:nonzero;stroke:#2b0000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - id="rect1936" - width="10" - height="30" - x="340" - y="232.36218" /> - <path - style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;opacity:1;color:black;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;visibility:visible;display:inline;overflow:visible" - d="M 279,248.36218 C 281,211.36218 335,213.36218 335,236.36218" - id="path1893" - sodipodi:nodetypes="cs" /> - <rect - style="opacity:1;color:black;fill:#ff9e69;fill-opacity:1;fill-rule:nonzero;stroke:#2b0000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - id="rect1938" - width="10" - height="30" - x="330" - y="232.36218" /> - <path - style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" - d="M 156,234.36218 C 184,182.36218 276,190.36218 275,244.36218" - id="path3744" - sodipodi:nodetypes="cc" /> - <rect - style="opacity:1;color:black;fill:#ff9e69;fill-opacity:1;fill-rule:nonzero;stroke:#2b0000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - id="rect1918" - width="30" - height="90" - x="260" - y="242.36218" - rx="10" - ry="10.000005" /> - <rect - style="opacity:1;color:black;fill:#ff9e69;fill-opacity:1;fill-rule:nonzero;stroke:#2b0000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" - id="rect1922" - width="10" - height="30" - x="150" - y="232.36218" - rx="0" - ry="0" /> - <text - xml:space="preserve" - style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:black;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans" - x="31" - y="223.36218" - id="text1899" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan1901" - x="31" - y="223.36218">Extension</tspan></text> - <text - xml:space="preserve" - style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:black;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans" - x="19" - y="314.36218" - id="text1903" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan1905" - x="19" - y="314.36218">Extension point</tspan></text> - <text - xml:space="preserve" - style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:black;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans" - x="159.38721" - y="319.2373" - id="text1907" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan1909" - x="159.38721" - y="319.2373">Plug-in A</tspan></text> - <text - xml:space="preserve" - style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:black;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans" - x="325" - y="320.36218" - id="text1911" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan1913" - x="325" - y="320.36218">Plug-in C</tspan></text> - <text - xml:space="preserve" - style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:black;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans" - x="256.17322" - y="-271.1377" - id="text1915" - sodipodi:linespacing="125%" - transform="matrix(0,1,-1,0,0,0)"><tspan - sodipodi:role="line" - id="tspan1917" - x="256.17322" - y="-271.1377">Plug-in B</tspan></text> - <path - style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" - d="M 122,301.36218 L 166,265.36218" - id="path1931" - sodipodi:nodetypes="cc" /> - <path - style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" - d="M 104,223.36218 L 154,238.36218" - id="path1933" - sodipodi:nodetypes="cc" /> - </g> -</svg> diff --git a/lib/cpluff/doc/img/pageborder.png b/lib/cpluff/doc/img/pageborder.png Binary files differdeleted file mode 100644 index 9d643c3416..0000000000 --- a/lib/cpluff/doc/img/pageborder.png +++ /dev/null diff --git a/lib/cpluff/doc/index.en.html b/lib/cpluff/doc/index.en.html deleted file mode 100644 index 860fd0130e..0000000000 --- a/lib/cpluff/doc/index.en.html +++ /dev/null @@ -1,91 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> - <head> - <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> - <meta name="author" content="Johannes Lehtinen"/> - <meta name="copyright" content="Copyright 2007 Johannes Lehtinen"/> - <meta name="keywords" content="C-Pluff,plug-in framework,plug-in,plugin framework,plugin,C,free software,open source"/> - <meta name="identifier" content="http://www.c-pluff.org/index.en.html"/> - <meta name="verify-v1" content="TJCP/6uZGEHJUCSPUk32yvXT6xwvnzC7INBhiIPsZ1A=" /> - <title>C-Pluff, a plug-in framework for C</title> - <link rel="Stylesheet" type="text/css" href="cpluff_style.css"/> - </head> - <body> - <div id="content"> - - <h1>C-Pluff, a plug-in framework for C</h1> - - <ul class="menu"> - <li>C-Pluff</li> - <li><a href="copyright.en.html">License</a></li> - <li><a href="reference/c-api/index.html">Documentation</a></li> - <li><a href="http://www.c-pluff.org/lists">Mailing lists</a></li> - <li><a href="http://www.c-pluff.org/download">Download</a></li> - <li><a href="http://www.c-pluff.org/repository">Repository</a></li> - </ul> - - <h2 id="overview">Overview</h2> - <p> - C-Pluff is a plug-in framework for C programs. - It has been strongly inspired by the Java plug-in framework in - <a href="http://www.eclipse.org/">Eclipse</a>. C-Pluff focuses on - providing core services for plug-in interaction and plug-in - management. It aims to be platform neutral and supports dynamic - changes to plug-in configuration without stopping the whole - application or framework. It does not yet provide special facilities - for distribution such as signed plug-in packages or remote plug-in - repositories but it is possible to build such features on top of the - current framework. - </p> - <p> - The current C-Pluff implementation and documentation is very much - work in progress so it should be considered early alpha stage software. - I will be updating the documentation and source distribution on this - site as I proceed with documentation and implementation. - If you are interested in C-Pluff, take a look at - <a href="reference/c-api/index.html">reference documentation</a>, - join <a href="http://www.c-pluff.org/lists">mailing lists</a> or - <a href="http://www.c-pluff.org/download">download it</a>. You can also send - feedback, ideas and thoughts about such platform directly to the - <a href="mailto:johannes.lehtinen@iki.fi">author</a>. - </p> - - <h2 id="structure">Architecture</h2> - <p> - The plug-in architecture supported by C-Pluff is presented in the - following figure. There is a thin main program controlling the plug-in - framework. The main program is responsible for initializing and setting - up the plug-in environment. Most of the application logic is contained in - plug-ins which are independent components and can be developed and - distributed separately. Plug-ins integrate with each other by providing - extension points and extensions. An extension point is a point into which - other plug-ins can attach extensions. An extension can be just - information, expressed in XML format, or the plug-in may also provide - program logic as part of the plug-in runtime library. The framework - provides services for accessing extensions and for managing plug-in - dependencies. - </p> - <p> - <img src="img/architecture.png" alt="Plug-in architecture" /> - </p> - - <ul class="menu"> - <li>C-Pluff</li> - <li><a href="copyright.en.html">License</a></li> - <li><a href="reference/c-api/index.html">Documentation</a></li> - <li><a href="http://www.c-pluff.org/lists">Mailing lists</a></li> - <li><a href="http://www.c-pluff.org/download">Download</a></li> - <li><a href="http://www.c-pluff.org/repository">Repository</a></li> - </ul> - - <p class="footer"> - Copyright 2007 <a href="http://www.jlehtinen.net/">Johannes Lehtinen</a><br/> - Validation: - <a href="http://validator.w3.org/check?uri=referer">XHTML Basic 1.0</a>, - <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS 2</a> - </p> - - </div> - </body> -</html> diff --git a/lib/cpluff/doc/listconfirm/alreadyon.en.php b/lib/cpluff/doc/listconfirm/alreadyon.en.php deleted file mode 100644 index 3b1ea5147d..0000000000 --- a/lib/cpluff/doc/listconfirm/alreadyon.en.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> - <head> - <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> - <meta name="author" content="Johannes Lehtinen"/> - <meta name="copyright" content="Copyright 2007 Johannes Lehtinen"/> - <title>Already subscribed</title> - <link rel="Stylesheet" type="text/css" href="../cpluff_style.css"/> - </head> - <body> - <div id="content"> - - <h1>Already subscribed</h1> - - <p> - Your e-mail address <?php echo htmlspecialchars($_REQUEST['address']); ?> - is already subscribed to the mailing list. If you have any problems - with C-Pluff mailing lists, please contact the mailing list administrator - at <a href="mailto:listmaster@c-pluff.org">listmaster@c-pluff.org</a>. - </p> - <p> - Return to - <a href="../lists.en">the C-Pluff mailing list page</a>. - </p> - - <p class="footer"> - Copyright 2007 <a href="http://www.jlehtinen.net/">Johannes Lehtinen</a><br/> - Validation: - <a href="http://validator.w3.org/check?uri=referer">XHTML Basic 1.0</a>, - <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS 2</a> - </p> - - </div> - </body> -</html> diff --git a/lib/cpluff/doc/listconfirm/confirm.en.php b/lib/cpluff/doc/listconfirm/confirm.en.php deleted file mode 100644 index d0879e5609..0000000000 --- a/lib/cpluff/doc/listconfirm/confirm.en.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> - <head> - <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> - <meta name="author" content="Johannes Lehtinen"/> - <meta name="copyright" content="Copyright 2007 Johannes Lehtinen"/> - <title>Confirm subscription</title> - <link rel="Stylesheet" type="text/css" href="../cpluff_style.css"/> - </head> - <body> - <div id="content"> - - <h1>Confirm subscription</h1> - - <p> - Your subscription request has been processed successfully but your - mailing list subscription has not yet been activated. To complete your - subscription you have to visit the link included in the verification - e-mail that has just been sent to your e-mail address - <?php echo htmlspecialchars($_REQUEST['address']); ?>. It might take - some time for the e-mail to arrive into your inbox. - </p> - <p> - Return to - <a href="../lists.en">the C-Pluff mailing list page</a>. - </p> - - <p class="footer"> - Copyright 2007 <a href="http://www.jlehtinen.net/">Johannes Lehtinen</a><br/> - Validation: - <a href="http://validator.w3.org/check?uri=referer">XHTML Basic 1.0</a>, - <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS 2</a> - </p> - - </div> - </body> -</html> diff --git a/lib/cpluff/doc/listconfirm/invalid.en.php b/lib/cpluff/doc/listconfirm/invalid.en.php deleted file mode 100644 index 2c96d99db0..0000000000 --- a/lib/cpluff/doc/listconfirm/invalid.en.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> - <head> - <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> - <meta name="author" content="Johannes Lehtinen"/> - <meta name="copyright" content="Copyright 2007 Johannes Lehtinen"/> - <title>Invalid e-mail address</title> - <link rel="Stylesheet" type="text/css" href="../cpluff_style.css"/> - </head> - <body> - <div id="content"> - - <h1>Invalid e-mail address</h1> - - <p> - The e-mail address you specified, - <?php echo htmlspecialchars($_REQUEST['address']); ?>, - is invalid. Please check that you specified - a correct address and try again. If you have any problems - with C-Pluff mailing lists, you may contact the mailing list - administrator at - <a href="mailto:listmaster@c-pluff.org">listmaster@c-pluff.org</a>. - </p> - <p> - Return to - <a href="../lists.en">the C-Pluff mailing list page</a>. - </p> - - <p class="footer"> - Copyright 2007 <a href="http://www.jlehtinen.net/">Johannes Lehtinen</a><br/> - Validation: - <a href="http://validator.w3.org/check?uri=referer">XHTML Basic 1.0</a>, - <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS 2</a> - </p> - - </div> - </body> -</html> diff --git a/lib/cpluff/doc/listconfirm/noton.en.php b/lib/cpluff/doc/listconfirm/noton.en.php deleted file mode 100644 index 836dca1d1e..0000000000 --- a/lib/cpluff/doc/listconfirm/noton.en.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> - <head> - <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> - <meta name="author" content="Johannes Lehtinen"/> - <meta name="copyright" content="Copyright 2007 Johannes Lehtinen"/> - <title>Not subscribed</title> - <link rel="Stylesheet" type="text/css" href="../cpluff_style.css"/> - </head> - <body> - <div id="content"> - - <h1>Not subscribed</h1> - - <p> - Your e-mail address <?php echo htmlspecialchars($_REQUEST['address']); ?> - is not subscribed to the mailing list. Please check that you specified - a correct address and try again. If you have any problems - with C-Pluff mailing lists, you may contact the mailing list - administrator at - <a href="mailto:listmaster@c-pluff.org">listmaster@c-pluff.org</a>. - </p> - <p> - Return to - <a href="../lists.en">the C-Pluff mailing list page</a>. - </p> - - <p class="footer"> - Copyright 2007 <a href="http://www.jlehtinen.net/">Johannes Lehtinen</a><br/> - Validation: - <a href="http://validator.w3.org/check?uri=referer">XHTML Basic 1.0</a>, - <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS 2</a> - </p> - - </div> - </body> -</html> diff --git a/lib/cpluff/doc/listconfirm/subscribed-announcement.en.php b/lib/cpluff/doc/listconfirm/subscribed-announcement.en.php deleted file mode 100644 index 8be148d6cb..0000000000 --- a/lib/cpluff/doc/listconfirm/subscribed-announcement.en.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> - <head> - <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> - <meta name="author" content="Johannes Lehtinen"/> - <meta name="copyright" content="Copyright 2007 Johannes Lehtinen"/> - <title>Subscription completed</title> - <link rel="Stylesheet" type="text/css" href="../cpluff_style.css"/> - </head> - <body> - <div id="content"> - - <h1>Subscription completed</h1> - - <p> - Welcome to the C-Pluff announcement mailing list! - You have successfully subscribed to the list and forthcoming - announcements will be delivered to your - e-mail address <?php echo htmlspecialchars($_REQUEST['address']); ?>. - </p> - <p> - You can unsubscribe from this mailing list at any time by visiting - <a href="../lists.en">the C-Pluff mailing list page</a>. - </p> - <p> - Now you may return to <a href="../index.en">the main C-Pluff page</a>. - </p> - - <p class="footer"> - Copyright 2007 <a href="http://www.jlehtinen.net/">Johannes Lehtinen</a><br/> - Validation: - <a href="http://validator.w3.org/check?uri=referer">XHTML Basic 1.0</a>, - <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS 2</a> - </p> - - </div> - </body> -</html> diff --git a/lib/cpluff/doc/listconfirm/unsubscribed-announcement.en.php b/lib/cpluff/doc/listconfirm/unsubscribed-announcement.en.php deleted file mode 100644 index 5ac3d6eb77..0000000000 --- a/lib/cpluff/doc/listconfirm/unsubscribed-announcement.en.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> - <head> - <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> - <meta name="author" content="Johannes Lehtinen"/> - <meta name="copyright" content="Copyright 2007 Johannes Lehtinen"/> - <title>Unsubscription completed</title> - <link rel="Stylesheet" type="text/css" href="../cpluff_style.css"/> - </head> - <body> - <div id="content"> - - <h1>Unsubscription completed</h1> - - <p> - You have successfully unsubscribed from the C-Pluff announcement mailing - list. Your e-mail address - <?php echo htmlspecialchars($_REQUEST['address']); ?> - has been removed from the mailing list. - </p> - <p> - Now you may return to <a href="../index.en">the main C-Pluff page</a> - or to <a href="../lists.en">the C-Pluff mailing list page</a>. - </p> - - <p class="footer"> - Copyright 2007 <a href="http://www.jlehtinen.net/">Johannes Lehtinen</a><br/> - Validation: - <a href="http://validator.w3.org/check?uri=referer">XHTML Basic 1.0</a>, - <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS 2</a> - </p> - - </div> - </body> -</html> diff --git a/lib/cpluff/doc/lists.en.html b/lib/cpluff/doc/lists.en.html deleted file mode 100644 index d793dd1820..0000000000 --- a/lib/cpluff/doc/lists.en.html +++ /dev/null @@ -1,111 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> - <head> - <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> - <meta name="author" content="Johannes Lehtinen"/> - <meta name="copyright" content="Copyright 2007 Johannes Lehtinen"/> - <meta name="keywords" content="C-Pluff,mailing list"/> - <meta name="identifier" content="http://www.c-pluff.org/lists.en.html"/> - <title>C-Pluff mailing lists</title> - <link rel="Stylesheet" type="text/css" href="cpluff_style.css"/> - </head> - <body> - <div id="content"> - - <h1>C-Pluff mailing lists</h1> - - <ul class="menu"> - <li><a href="/">C-Pluff</a></li> - <li><a href="copyright.en.html">License</a></li> - <li><a href="reference/c-api/index.html">Documentation</a></li> - <li>Mailing lists</li> - <li><a href="http://www.c-pluff.org/download">Download</a></li> - <li><a href="http://www.c-pluff.org/repository">Repository</a></li> - </ul> - - <p> - <em>The C-Pluff announcement list</em> is a - one-way mailing list for announcing new C-Pluff releases and features. - If you want to be always up-to-date, it is a good idea to subscribe to - the announcement list. - </p> - <p> - <em>The C-Pluff users list</em> is for discussion about the usage of - C-Pluff and for reporting problems. It is the right place for support - requests and discussion about how to use C-Pluff to create extensible - applications. - </p> - <p> - <em>The C-Pluff developers list</em> is for discussion about C-Pluff - development. It is the right place for posting patches, discussing new - framework features and informing other developers about internal changes. - If you are interested in participating C-Pluff development, join the - developers list. - </p> - - <h2>Manage subscriptions</h2> - - <p> - All subscriptions are verified by sending you an e-mail containing a link - you must visit to confirm the subscription. Discussion lists allow - unmoderated postings from list members only. Non-member postings - are moderated. List archives are restricted to members to prevent - bots from harvesting e-mail addresses. If you have any problems with - C-Pluff mailing lists, please contact the mailing list administrator at - <a href="mailto:listmaster@c-pluff.org">listmaster@c-pluff.org</a>. - </p> - - <h3>C-Pluff announcement list</h3> - - <form method="post" action="http://scripts.dreamhost.com/add_list.cgi"> - <p> - <input type="hidden" name="list" value="announcement" /> - <input type="hidden" name="domain" value="c-pluff.org" /> - <input type="hidden" name="url" value="http://www.c-pluff.org/listconfirm/subscribed-announcement.en" /> - <input type="hidden" name="unsuburl" value="http://www.c-pluff.org/listconfirm/unsubscribed-announcement.en" /> - <input type="hidden" name="alreadyonurl" value="http://www.c-pluff.org/listconfirm/alreadyon.en" /> - <input type="hidden" name="notonurl" value="http://www.c-pluff.org/listconfirm/noton.en" /> - <input type="hidden" name="invalidurl" value="http://www.c-pluff.org/listconfirm/invalid.en" /> - <input type="hidden" name="emailconfirmurl" value="http://www.c-pluff.org/listconfirm/confirm.en" /> - <input type="hidden" name="emailit" value="1" /> - Your e-mail address:<br /> - <input type="text" name="email" size="32" /><br /> - <input type="submit" name="submit" value="Subscribe" /> - <input type="submit" name="unsub" value="Unsubscribe" /> - </p> - </form> - - <h3>C-Pluff users list</h3> - - <p> - You can manage your subscription and access list archive at - <a href="http://lists.c-pluff.org/listinfo.cgi/users-c-pluff.org">users mailing list info page</a>. - </p> - - <h3>C-Pluff developers list</h3> - - <p> - You can manage your subscription and access list archive at - <a href="http://lists.c-pluff.org/listinfo.cgi/developers-c-pluff.org">developers mailing list info page</a>. - </p> - - <ul class="menu"> - <li><a href="/">C-Pluff</a></li> - <li><a href="copyright.en.html">License</a></li> - <li><a href="reference/c-api/index.html">Documentation</a></li> - <li>Mailing lists</li> - <li><a href="http://www.c-pluff.org/download">Download</a></li> - <li><a href="http://www.c-pluff.org/repository">Repository</a></li> - </ul> - - <p class="footer"> - Copyright 2007 <a href="http://www.jlehtinen.net/">Johannes Lehtinen</a><br/> - Validation: - <a href="http://validator.w3.org/check?uri=referer">XHTML Basic 1.0</a>, - <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS 2</a> - </p> - - </div> - </body> -</html> diff --git a/lib/cpluff/doc/repository.en.html b/lib/cpluff/doc/repository.en.html deleted file mode 100644 index e6ce13f60c..0000000000 --- a/lib/cpluff/doc/repository.en.html +++ /dev/null @@ -1,80 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> - <head> - <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> - <meta name="author" content="Johannes Lehtinen"/> - <meta name="copyright" content="Copyright 2007 Johannes Lehtinen"/> - <meta name="keywords" content="C-Pluff,source code,repository,subversion"/> - <meta name="identifier" content="http://www.c-pluff.org/repository.en.html"/> - <title>C-Pluff source code repository</title> - <link rel="Stylesheet" type="text/css" href="cpluff_style.css"/> - </head> - <body> - <div id="content"> - - <h1>C-Pluff source code repository</h1> - - <ul class="menu"> - <li><a href="/">C-Pluff</a></li> - <li><a href="copyright.en.html">License</a></li> - <li><a href="reference/c-api/index.html">Documentation</a></li> - <li><a href="http://www.c-pluff.org/lists">Mailing lists</a></li> - <li><a href="http://www.c-pluff.org/download">Download</a></li> - <li>Repository</li> - </ul> - - <h2 id="repository">Repository</h2> - <p> - <a href="http://subversion.tigris.org">Subversion</a> is a free - revision control system with many available free clients and tools. - C-Pluff source code, documentation and web site material is stored in a - Subversion repository. The repository with all the material and - history dating back to the origins of C-Pluff is available here. - This is a live repository being updated in real time as new changes - are committed. The source code in the trunk is work in progress. For - released versions, see the tag directory. - </p> - - <h2 id="subversion_dav">Subversion DAV interface</h2> - <p> - The Subversion DAV interface for the repository can be accessed at - the following URL. - </p> - <pre class="example"> -<a href="http://svn.c-pluff.org/repos/">http://svn.c-pluff.org/repos/</a></pre> - <p> - This interface is intended for Subversion aware tools (see - the next section for a browsable interface). Check - <a href="http://en.wikipedia.org/wiki/Subversion_%28software%29">the Wikipedia page for Subversion</a> - for a list of available clients and other tools. - </p> - - <h2 id="websvn">Browsable interface and RSS feeds</h2> - <p> - <a href="http://svn.c-pluff.org/websvn/">A browsable interface</a> is also available based on - <a href="http://websvn.tigris.org/">WebSVN</a>. This provides an easy - way to browse versioned material, change logs and differences between - versions. It also provides RSS feeds which can be used to subscribe to - source code changes. - </p> - - <ul class="menu"> - <li><a href="/">C-Pluff</a></li> - <li><a href="copyright.en.html">License</a></li> - <li><a href="reference/c-api/index.html">Documentation</a></li> - <li><a href="http://www.c-pluff.org/lists">Mailing lists</a></li> - <li><a href="http://www.c-pluff.org/download">Download</a></li> - <li>Repository</li> - </ul> - - <p class="footer"> - Copyright 2007 <a href="http://www.jlehtinen.net/">Johannes Lehtinen</a><br/> - Validation: - <a href="http://validator.w3.org/check?uri=referer">XHTML Basic 1.0</a>, - <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS 2</a> - </p> - - </div> - </body> -</html> diff --git a/lib/cpluff/doc/robots.txt b/lib/cpluff/doc/robots.txt deleted file mode 100644 index 24146adcd9..0000000000 --- a/lib/cpluff/doc/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -User-agent: * -Disallow: /downloads/ -Disallow: /listconfirm/ diff --git a/lib/cpluff/docsrc/Makefile.am b/lib/cpluff/docsrc/Makefile.am deleted file mode 100644 index 860d73aec6..0000000000 --- a/lib/cpluff/docsrc/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -EXTRA_DIST = doxygen.css doxygen.footer diff --git a/lib/cpluff/docsrc/doxygen.css b/lib/cpluff/docsrc/doxygen.css deleted file mode 100644 index 7c359a9c03..0000000000 --- a/lib/cpluff/docsrc/doxygen.css +++ /dev/null @@ -1,360 +0,0 @@ -BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { - font-family: Geneva, Arial, Helvetica, sans-serif; -} -BODY,TD { - font-size: 90%; -} -H1 { - text-align: center; - font-size: 160%; -} -H2 { - font-size: 120%; -} -H3 { - font-size: 100%; -} -CAPTION { font-weight: bold } -DIV.qindex { - width: 100%; - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - padding: 2px; - line-height: 140%; -} -DIV.nav { - width: 100%; - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - padding: 2px; - line-height: 140%; -} -DIV.navtab { - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - margin-right: 15px; - padding: 2px; -} -TD.navtab { - font-size: 70%; -} -A.qindex { - text-decoration: none; - font-weight: bold; - color: #1A419D; -} -A.qindex:visited { - text-decoration: none; - font-weight: bold; - color: #1A419D -} -A.qindex:hover { - text-decoration: none; - background-color: #ddddff; -} -A.qindexHL { - text-decoration: none; - font-weight: bold; - background-color: #6666cc; - color: #ffffff; - border: 1px double #9295C2; -} -A.qindexHL:hover { - text-decoration: none; - background-color: #6666cc; - color: #ffffff; -} -A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } -A.el { text-decoration: none; font-weight: bold } -A.elRef { font-weight: bold } -A.code:link { text-decoration: none; font-weight: normal; color: #0000FF} -A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF} -A.codeRef:link { font-weight: normal; color: #0000FF} -A.codeRef:visited { font-weight: normal; color: #0000FF} -A:hover { text-decoration: none; background-color: #f2f2ff } -DL.el { margin-left: -1cm } -.fragment { - font-family: monospace, fixed; - font-size: 95%; -} -PRE.fragment { - border: 1px solid #CCCCCC; - background-color: #f5f5f5; - margin-top: 4px; - margin-bottom: 4px; - margin-left: 2px; - margin-right: 8px; - padding-left: 6px; - padding-right: 6px; - padding-top: 4px; - padding-bottom: 4px; -} -DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } - -DIV.groupHeader { - margin-left: 16px; - margin-top: 12px; - margin-bottom: 6px; - font-weight: bold; -} -DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% } -BODY { - background: white; - color: black; - margin-right: 20px; - margin-left: 20px; -} -TD.indexkey { - background-color: #e8eef2; - font-weight: bold; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px; - border: 1px solid #CCCCCC; -} -TD.indexvalue { - background-color: #e8eef2; - font-style: italic; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px; - border: 1px solid #CCCCCC; -} -TR.memlist { - background-color: #f0f0f0; -} -P.formulaDsp { text-align: center; } -IMG.formulaDsp { } -IMG.formulaInl { vertical-align: middle; } -SPAN.keyword { color: #008000 } -SPAN.keywordtype { color: #604020 } -SPAN.keywordflow { color: #e08000 } -SPAN.comment { color: #800000 } -SPAN.preprocessor { color: #806020 } -SPAN.stringliteral { color: #002080 } -SPAN.charliteral { color: #008080 } -.mdescLeft { - padding: 0px 8px 4px 8px; - font-size: 80%; - font-style: italic; - background-color: #FAFAFA; - border-top: 1px none #E0E0E0; - border-right: 1px none #E0E0E0; - border-bottom: 1px none #E0E0E0; - border-left: 1px none #E0E0E0; - margin: 0px; -} -.mdescRight { - padding: 0px 8px 4px 8px; - font-size: 80%; - font-style: italic; - background-color: #FAFAFA; - border-top: 1px none #E0E0E0; - border-right: 1px none #E0E0E0; - border-bottom: 1px none #E0E0E0; - border-left: 1px none #E0E0E0; - margin: 0px; -} -.memItemLeft { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memItemRight { - padding: 1px 8px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplItemLeft { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: none; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplItemRight { - padding: 1px 8px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: none; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplParams { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - color: #606060; - background-color: #FAFAFA; - font-size: 80%; -} -.search { color: #003399; - font-weight: bold; -} -FORM.search { - margin-bottom: 0px; - margin-top: 0px; -} -INPUT.search { font-size: 75%; - color: #000080; - font-weight: normal; - background-color: #e8eef2; -} -TD.tiny { font-size: 75%; -} -a { - color: #1A41A8; -} -a:visited { - color: #2A3798; -} -.dirtab { padding: 4px; - border-collapse: collapse; - border: 1px solid #84b0c7; -} -TH.dirtab { background: #e8eef2; - font-weight: bold; -} -HR { height: 1px; - border: none; - border-top: 1px solid black; -} - -/* Style for detailed member documentation */ -.memtemplate { - font-size: 80%; - color: #606060; - font-weight: normal; -} -.memnav { - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - margin-right: 15px; - padding: 2px; -} -.memitem { - padding: 4px; - background-color: #eef3f5; - border-width: 1px; - border-style: solid; - border-color: #dedeee; - -moz-border-radius: 8px 8px 8px 8px; -} -.memname { - white-space: nowrap; - font-weight: bold; -} -.memdoc{ - padding-left: 10px; -} -.memproto { - background-color: #d5e1e8; - width: 100%; - border-width: 1px; - border-style: solid; - border-color: #84b0c7; - font-weight: bold; - -moz-border-radius: 8px 8px 8px 8px; -} -.paramkey { - text-align: right; -} -.paramtype { - white-space: nowrap; -} -.paramname { - color: #602020; - font-style: italic; - white-space: nowrap; -} -/* End Styling for detailed member documentation */ - -/* for the tree view */ -.ftvtree { - font-family: sans-serif; - margin:0.5em; -} -.directory { font-size: 9pt; font-weight: bold; } -.directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } -.directory > h3 { margin-top: 0; } -.directory p { margin: 0px; white-space: nowrap; } -.directory div { display: none; margin: 0px; } -.directory img { vertical-align: -30%; } -P.footer { font-size: smaller; text-align: center; } -P.generated-by { font-size: smaller; font-style: italic; text-align: right; }
\ No newline at end of file diff --git a/lib/cpluff/docsrc/doxygen.footer b/lib/cpluff/docsrc/doxygen.footer deleted file mode 100644 index 537eaab337..0000000000 --- a/lib/cpluff/docsrc/doxygen.footer +++ /dev/null @@ -1,10 +0,0 @@ -<hr size="1"> -<p class="footer"> -<a href="http://www.c-pluff.org/">C-Pluff</a>, a plug-in framework for C<br> -Copyright 2007 <a href="http://www.jlehtinen.net/">Johannes Lehtinen</a> -</p> -<p class="generated-by"> -Generated on $datetime for $projectname by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> $doxygenversion -</p> -</body> -</html> diff --git a/lib/cpluff/examples/COPYRIGHT.txt b/lib/cpluff/examples/COPYRIGHT.txt deleted file mode 100644 index 5d02ccd6af..0000000000 --- a/lib/cpluff/examples/COPYRIGHT.txt +++ /dev/null @@ -1,11 +0,0 @@ -C-PLUFF EXAMPLES COPYRIGHT -========================== - -The following copyright and licensing information applies to the example -material contained in this directory. - -C-Pluff examples -Copyright 2007 Johannes Lehtinen - -These examples are free software; Johannes Lehtinen gives unlimited -permission to copy, distribute and modify them. diff --git a/lib/cpluff/examples/INSTALL.txt b/lib/cpluff/examples/INSTALL.txt deleted file mode 100644 index 77103ed798..0000000000 --- a/lib/cpluff/examples/INSTALL.txt +++ /dev/null @@ -1,149 +0,0 @@ -INSTALLING C-PLUFF EXAMPLES -=========================== - -This directory includes examples of extensible applications based on -C-Pluff. You can build the examples as part of the C-Pluff source tree at -the same time as building the C-Pluff implementation or as a stand-alone -build using an already installed C-Pluff instance. - -These are generic build and installation instructions. For more -information on an individual example, see README.txt in the corresponding -subdirectory. - - -Building as part of the C-Pluff source tree -------------------------------------------- - -This build method can be used if you are building the C-Pluff -implementation and the examples at the same time using the supplied GNU -autotools based build environment. If this is not the case, skip to the -next section. - -Configure C-Pluff as usual using the configure script in the top level -source directory. To build and install the examples make targets -"examples" and "examples-install", respectively, in the top level source -directory. This will build and install the C-Pluff implementation together -with the example applications. - -Notice that example applications will be installed into the same prefix -as the C-Pluff implementation. - - -Building in stand-alone mode using GNU autotools ------------------------------------------------- - -This build method more correctly reflects the way real independent -applications would be built. It is assumed that you already have an -installed C-Pluff instance and you wish to configure, build and install -the example applications separately using GNU autotools. If you wish to -use Windows specific tools, skip to next section. - -If you don't have write access to the example source directory (because -it is part of the installed C-Pluff documentation), make a personal copy -of the source directory. - - cp -r INSTALLED_SOURCE MY_SOURCE - -To use this build method, you must have some GNU tools installed because -the C-Pluff source distribution does not ship intermediate build system -files for examples. You will need these tools anyway if you are about to -develop applications using a build system similar to these examples. The -version numbers in parentheses are known working versions. - - - GNU Autoconf (2.61) - - GNU Automake (1.10) - - GNU libtool (1.5.22) - -To bootstrap the build system, run the autogen.sh script in the source -directory. It will invoke the above mentioned GNU tools to generate -intermediate build system files. - - ./autogen.sh - -Alternatively, if you want to get more familiar with the process, you can -browse through the script and execute the necessary commands manually. - -Now you should have a build system in place and you can configure and -build the examples using the standard autotools procedure. - - Building in the source directory: - ./configure - make - - Building in a separate build directory: - cd BUILD_DIR - SOURCE_DIR/configure - make - -When configuring, you can use the --prefix option to choose another -installation prefix for the examples (the default is /usr/local). - -If C-Pluff has been installed into a location that is not included in the -standard include or library path then you have to specify some additional -environment variables to the configure script. Assuming that C-Pluff was -installed into /usr/local (the default), you would have to set following -environment variables before calling configure. - - CPPFLAGS="-I/usr/local/include" - LDFLAGS="-L/usr/local/lib" - CPLUFF_LOADER="/usr/local/bin/cpluff-loader" - -Finally, install the example applications. - - make install - - -Building in stand-alone mode using Microsoft Visual C ------------------------------------------------------ - -This build method is specific to Microsoft Visual C. It is provided -separately because of complexity involved in setting up more generic GNU -tools on Windows platform. Be warned that this build method is not being -tested as often as the GNU autotools based build method. Please report -any problems to the C-Pluff users mailing list. - -The included build environment and these instructions were initially -tested with Microsoft Visual C++ 2005 Express Edition. The build -environment relies only on command line tools. It is assumed that the -given commands will be entered into command prompt. - -As the first step, you have to set up correct paths in common.nmake using -Notepad or some other text editor. If you are building example source that -has been extracted from cpluff-VER.zip (or cpluff-VER-only.zip) Windows -distribution then the default settings should be fine. Examples will be -installed to the same path as the C-Pluff implementation by default. - -Before trying to use the Visual C command line tools, you have to set up -required environment variables by executing vcvarsall.bat in the Visual C -installation directory. Alter the path in the following example as -necessary for your installation. - - C:\"Program Files"\"Microsoft Visual Studio 8"\VC\vcvarsall - -The C-Pluff Windows distribution includes a precompiled C-Pluff runtime -library as DLL. Additionally, on Windows platform you will also need a -corresponding import library to be able to compile software that uses a -DLL. For some reason import libraries generated by different Windows -compilers (MinGW, Visual C, Borland C, etc.) are generally incompatible. -The C-Pluff Windows distribution only includes an import library for MinGW -(libcpluff.dll.a) so you have to generate one for Visual C. - -This can be done using the Microsoft Library Manager, or lib.exe, and the -export definitions provided in libcpluff.def. Execute the following -command in the library directory containing libcpluff.def. - - lib /machine:I386 /name:libcpluff-0.dll /def:libcpluff.def /out:libcpluff.lib - -This should generate libcpluff.lib, an import library for Visual C. - -Now you should be ready to build the examples. Build the examples by -making target "all" in Makefile.nmake in the examples directory using -nmake. - - nmake /f Makefile.nmake all - -This compiles the examples but does not yet install them. To install -required files to the installation directory make target "install" in -Makefile.nmake in the examples directory using nmake. - - nmake /f Makefile.nmake install diff --git a/lib/cpluff/examples/Makefile.am b/lib/cpluff/examples/Makefile.am deleted file mode 100644 index 62b44eefac..0000000000 --- a/lib/cpluff/examples/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -SUBDIRS = cpfile - -EXTRA_DIST = autogen.sh configure.ac INSTALL.txt COPYRIGHT.txt nmakedir.bat common.nmake Makefile.nmake diff --git a/lib/cpluff/examples/Makefile.nmake b/lib/cpluff/examples/Makefile.nmake deleted file mode 100644 index 1f87419915..0000000000 --- a/lib/cpluff/examples/Makefile.nmake +++ /dev/null @@ -1,9 +0,0 @@ -# C-Pluff examples build system for MSVC
-# Copyright 2007 Johannes Lehtinen
-# This file is free software; Johannes Lehtinen gives unlimited permission
-# to copy, distribute and modify it.
-
-SUBDIRS = cpfile
-TOP = .
-
-include common.nmake
diff --git a/lib/cpluff/examples/autogen.sh b/lib/cpluff/examples/autogen.sh deleted file mode 100755 index 8a8235f348..0000000000 --- a/lib/cpluff/examples/autogen.sh +++ /dev/null @@ -1,22 +0,0 @@ -#! /bin/sh - -# Copyright 2007 Johannes Lehtinen -# This shell script is free software; Johannes Lehtinen gives -# unlimited permission to copy, distribute and modify it. - -set -e - -# Check directory -basedir="`dirname "$0"`" -if ! test -f "$basedir"/cpfile/Makefile.am; then - echo 'Run autogen.sh in the examples source directory.' 1>&2 - exit 1 -fi - -# Generate files in examples directory -cd "$basedir" -test -d auxliary || mkdir auxliary -libtoolize --automake -f -aclocal -autoconf -automake -a diff --git a/lib/cpluff/examples/common.nmake b/lib/cpluff/examples/common.nmake deleted file mode 100755 index 4f3ac2c21c..0000000000 --- a/lib/cpluff/examples/common.nmake +++ /dev/null @@ -1,49 +0,0 @@ -# C-Pluff examples build system for MSVC
-# Copyright 2007 Johannes Lehtinen
-# This file is free software; Johannes Lehtinen gives unlimited permission
-# to copy, distribute and modify it.
-
-
-# Build settings, modify as necessary
-# -----------------------------------
-
-# Each Makefile.nmake sets $(TOP) as path to top level examples directory
-
-# $(cpprefix) is the top directory of C-Pluff installation
-cpprefix = $(TOP)\..\..\..\..
-
-# $(cpincdir) is the include directory of C-Pluff installation
-cpincdir = $(cpprefix)\include
-
-# $(cplibdir) is the library directory of C-Pluff installation
-cplibdir = $(cpprefix)\lib
-
-# $(prefix) is the top installation directory for C-Pluff examples
-prefix = $(cpprefix)
-
-# $(bindir) is the installation directory for C-Pluff example binaries
-bindir = $(prefix)\bin
-
-# Define compiler and flags
-CC = cl
-CFLAGS = /nologo /I$(cpincdir)
-
-
-# Common build rules, no need to modify
-# -------------------------------------
-
-# Windows has stat(2)
-CFLAGS = $(CFLAGS) /DHAVE_STAT
-
-RECURSIVE_RULES = all install clean
-
-$(RECURSIVE_RULES):
- @if not "$(SUBDIRS)"=="" @for %d in ($(SUBDIRS)) do @$(TOP)\nmakedir %d $@
- @echo Making $@ in .
- @nmake /nologo /f Makefile.nmake $@-local
-
-all-local:
-
-install-local: all-local
-
-clean-local:
diff --git a/lib/cpluff/examples/configure.ac b/lib/cpluff/examples/configure.ac deleted file mode 100644 index c83c24cdba..0000000000 --- a/lib/cpluff/examples/configure.ac +++ /dev/null @@ -1,60 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -dnl Copyright 2007 Johannes Lehtinen -dnl This configure.ac script is free software; Johannes Lehtinen gives -dnl unlimited permission to copy, distribute and modify it. - -# Autoconf initialization -# ----------------------- -AC_INIT([C-Pluff examples], [unspecified], [johannes.lehtinen@iki.fi], [cpluff-examples]) -AC_COPYRIGHT([Copyright 2007 Johannes Lehtinen -This configure script is free software; Johannes Lehtinen gives unlimited -permission to copy, distribute and modify it.]) -AC_CONFIG_SRCDIR([cpfile/README.txt]) -AC_CONFIG_AUX_DIR([auxliary]) - -# Automake initialization -# ----------------------- -AM_INIT_AUTOMAKE([foreign]) - -# C/C++ compiler settings -# ------------------- -AC_LANG([C]) -AC_PROG_CC -if test -z "$CC"; then - AC_MSG_ERROR([C compiler was not found (required)]) -fi -AC_PROG_CC_C_O -AC_C_CONST -AC_LIBTOOL_DLOPEN -AC_LIBTOOL_WIN32_DLL -AC_PROG_LIBTOOL - -# Check for C-Pluff loader -# ------------------------ -AC_CHECK_PROG([CPLUFF_LOADER], [cpluff-loader], [cpluff-loader]) -if test -z "$CPLUFF_LOADER"; then - AC_MSG_ERROR([C-Pluff Loader, cpluff-loader, not found]) -fi - -# Check for C-Pluff headers and library -# ------------------------------------- -AC_CHECK_HEADER([cpluff.h],, AC_MSG_ERROR([C-Pluff header files not found])) -AC_CHECK_LIB([cpluff], [cp_init],, AC_MSG_ERROR([C-Pluff libraries not found])) - -# Check for stat/lstat functions -# ------------------------------ -AC_CHECK_FUNCS([stat lstat]) - -# Output Makefiles -# ---------------- -AC_CONFIG_FILES([Makefile -cpfile/Makefile -cpfile/cpfile -cpfile/plugins/Makefile -cpfile/plugins/cext/Makefile -cpfile/plugins/core/Makefile -cpfile/plugins/extension/Makefile -cpfile/plugins/special/Makefile -]) -AC_OUTPUT diff --git a/lib/cpluff/examples/cpfile/Makefile.am b/lib/cpluff/examples/cpfile/Makefile.am deleted file mode 100644 index 6db84d0717..0000000000 --- a/lib/cpluff/examples/cpfile/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -SUBDIRS = plugins - -EXTRA_DIST = README.txt cpfile.in cpfile.bat Makefile.nmake -bin_SCRIPTS = cpfile diff --git a/lib/cpluff/examples/cpfile/Makefile.nmake b/lib/cpluff/examples/cpfile/Makefile.nmake deleted file mode 100644 index c7e89abfcd..0000000000 --- a/lib/cpluff/examples/cpfile/Makefile.nmake +++ /dev/null @@ -1,13 +0,0 @@ -# C-Pluff examples build system for MSVC
-# Copyright 2007 Johannes Lehtinen
-# This file is free software; Johannes Lehtinen gives unlimited permission
-# to copy, distribute and modify it.
-
-SUBDIRS = plugins
-TOP = ..
-
-include ..\common.nmake
-
-install-local: all-local
- if not exist $(bindir) mkdir $(bindir)
- copy /y cpfile.bat $(bindir)
diff --git a/lib/cpluff/examples/cpfile/README.txt b/lib/cpluff/examples/cpfile/README.txt deleted file mode 100644 index d2fea09854..0000000000 --- a/lib/cpluff/examples/cpfile/README.txt +++ /dev/null @@ -1,138 +0,0 @@ -C-PLUFF FILE COMMAND EXAMPLE -============================ - -Overview --------- - -On UNIX systems the file(1) utility can be used to determine file type and -to get information about contents of a file. Here are couple of examples -of file usage in a Linux environment. - - $ file /sbin/init - /sbin/init: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), - for GNU/Linux 2.4.1, dynamically linked (uses shared libs), for - GNU/Linux 2.4.1, stripped - - $ file COPYRIGHT.txt - COPYRIGHT.txt: ASCII English text - -This example shows how a simplistic file clone could be implemented as an -extensible application based on C-Pluff. We will call the resulting -utility cpfile. It can recognize some special files and some file types -based on file extension. But it could be further extended to recognize -files based on their content by deploying a suitable plug-in. Notice that -the focus here was on creating a straightforward example rather than an -efficient one. - - -Architecture ------------- - -This example uses the generic plug-in loader, cpluff-loader, as the main -program. The executable cpfile installed into the bin directory is just -a shell script invoking the cpluff-loader. All program logic is included -in plug-ins. - -The included plug-ins are: - - org.c-pluff.examples.cpfile.core - - This plug-in is the one initially started via cpluff-loader. It - contains the core application logic and provides an extension point - for file classifiers. The plug-in itself does not include any file - classifiers. Instead it uses file classifiers registered as - extensions by other plug-ins and then tries them one at a time in - order of decreasing priority until a matching classification is - found or no more classifiers are left. - - org.c-pluff.examples.cpfile.special - - This plug-in provides a file classifier which uses lstat(2) on the - file to be classified to see if it is a special file such as a - directory or a symbolic link. It also checks for the existence of - the file. - - org.c-pluff.examples.cpfile.extension - - This plug-in provides a file classifier which checks the file name - for known extensions. The plug-in provides an extension point for - file extensions. The file extensions registered as extensions are - then matched against the file name. The plug-in itself includes an - extension for text files. - - org.c-pluff.examples.cpfile.cext - - This plug-in does not include a runtime library at all. Instead, it - just registers some file types and file extensions related to - C program source files. - -Having build and installed the example, you can experiment with different -plug-in configurations by adding and removing plug-ins into cpfile/plugins -directory in the library directory. The core plug-in must be always -included for the application to work as intended. - -You can create a new plug-in for the example by creating a new -subdirectory in the plugins source directory and adding it to SUBDIRS -variable in Makefile.am in the plugins source directory. - - -Example runs ------------- - -Here are couple of examples of using the resulting cpfile application. - - $ cpfile /tmp/testdir - C-Pluff Loader, version 0.1.0 - C-Pluff Library, version 0.1.0 for i686-pc-linux-gnu - /tmp/testdir: directory - - $ cpfile /tmp/test.foo - C-Pluff Loader, version 0.1.0 - C-Pluff Library, version 0.1.0 for i686-pc-linux-gnu - /tmp/test.foo: unknown file type - - $ cpfile /tmp/test.c - C-Pluff Loader, version 0.1.0 - C-Pluff Library, version 0.1.0 for i686-pc-linux-gnu - /tmp/test.c: C source file - - $ cpfile /tmp/test.nonexisting - C-Pluff Loader, version 0.1.0 - C-Pluff Library, version 0.1.0 for i686-pc-linux-gnu - /tmp/test.nonexisting: stat failed: No such file or directory - -You can make cpfile more quiet by giving it -q option, or more verbose by -giving it -v option (repeated for more verbosity up to -vvv). Actually, -these options are processed by cpluff-loader which configures logging -accordingly. - - $ cpfile -q /tmp/test.c - /tmp/test.c: C source file - - $ cpfile -vv /tmp/test.c - C-Pluff Loader, version 0.1.0 - C-Pluff Library, version 0.1.0 for i686-pc-linux-gnu - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.core has been installed. - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.extension has been installed. - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.cext has been installed. - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.special has been installed. - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.core runtime has been loaded. - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.core is starting. - C-Pluff: INFO: [org.c-pluff.examples.cpfile.core] Plug-in org.c-pluff.examples.cpfile.extension runtime has been loaded. - C-Pluff: INFO: [org.c-pluff.examples.cpfile.core] Plug-in org.c-pluff.examples.cpfile.extension is starting. - C-Pluff: INFO: [org.c-pluff.examples.cpfile.core] Plug-in org.c-pluff.examples.cpfile.extension has been started. - C-Pluff: INFO: [org.c-pluff.examples.cpfile.core] Plug-in org.c-pluff.examples.cpfile.special runtime has been loaded. - C-Pluff: INFO: [org.c-pluff.examples.cpfile.core] Plug-in org.c-pluff.examples.cpfile.special has been started. - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.core has been started. - /tmp/test.c: C source file - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.core is stopping. - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.core has been stopped. - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.special has been stopped. - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.extension has been stopped. - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.core runtime has been unloaded. - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.core has been uninstalled. - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.extension runtime has been unloaded. - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.extension has been uninstalled. - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.cext has been uninstalled. - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.special runtime has been unloaded. - C-Pluff: INFO: [loader] Plug-in org.c-pluff.examples.cpfile.special has been uninstalled. diff --git a/lib/cpluff/examples/cpfile/cpfile.bat b/lib/cpluff/examples/cpfile/cpfile.bat deleted file mode 100644 index 7427550782..0000000000 --- a/lib/cpluff/examples/cpfile/cpfile.bat +++ /dev/null @@ -1,5 +0,0 @@ -@REM Copyright 2007 Johannes Lehtinen -@REM This script is free software; Johannes Lehtinen gives unlimited -@REM permission to copy, distribute and modify it. - -@cpluff-loader -c cpfile\plugins -s org.c-pluff.examples.cpfile.core %1 %2 %3 %4 %5 %6 %7 %8 %9 diff --git a/lib/cpluff/examples/cpfile/cpfile.in b/lib/cpluff/examples/cpfile/cpfile.in deleted file mode 100644 index 2e84047630..0000000000 --- a/lib/cpluff/examples/cpfile/cpfile.in +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/sh - -# Copyright 2007 Johannes Lehtinen -# This script is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -prefix="@prefix@" -exec_prefix="@exec_prefix@" -exec "@CPLUFF_LOADER@" -c "@libdir@/cpfile/plugins" -s org.c-pluff.examples.cpfile.core "$@" diff --git a/lib/cpluff/examples/cpfile/plugins/Makefile.am b/lib/cpluff/examples/cpfile/plugins/Makefile.am deleted file mode 100644 index e8f56d453d..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -SUBDIRS = core special extension cext - -EXTRA_DIST = Makefile.nmake diff --git a/lib/cpluff/examples/cpfile/plugins/Makefile.nmake b/lib/cpluff/examples/cpfile/plugins/Makefile.nmake deleted file mode 100644 index 2dda56e1ca..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/Makefile.nmake +++ /dev/null @@ -1,9 +0,0 @@ -# C-Pluff examples build system for MSVC
-# Copyright 2007 Johannes Lehtinen
-# This file is free software; Johannes Lehtinen gives unlimited permission
-# to copy, distribute and modify it.
-
-SUBDIRS = core special extension cext
-TOP = ..\..
-
-include ..\..\common.nmake
diff --git a/lib/cpluff/examples/cpfile/plugins/cext/Makefile.am b/lib/cpluff/examples/cpfile/plugins/cext/Makefile.am deleted file mode 100644 index f5f59be877..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/cext/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -EXTRA_DIST = plugin.xml Makefile.nmake - -pluginsdir = $(libdir)/cpfile/plugins -plugindir = $(pluginsdir)/cext -plugin_DATA = plugin.xml diff --git a/lib/cpluff/examples/cpfile/plugins/cext/Makefile.nmake b/lib/cpluff/examples/cpfile/plugins/cext/Makefile.nmake deleted file mode 100644 index 638be08244..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/cext/Makefile.nmake +++ /dev/null @@ -1,15 +0,0 @@ -# C-Pluff examples build system for MSVC
-# Copyright 2007 Johannes Lehtinen
-# This file is free software; Johannes Lehtinen gives unlimited permission
-# to copy, distribute and modify it.
-
-TOP = ..\..\..
-
-include ..\..\..\common.nmake
-
-pluginsdir = $(bindir)\cpfile\plugins
-plugindir = $(pluginsdir)\cext
-
-install-local: all-local
- if not exist $(plugindir) mkdir $(plugindir)
- for %f in (plugin.xml) do copy /y %f $(plugindir)
diff --git a/lib/cpluff/examples/cpfile/plugins/cext/plugin.xml b/lib/cpluff/examples/cpfile/plugins/cext/plugin.xml deleted file mode 100644 index ff6182c287..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/cext/plugin.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Copyright 2007 Johannes Lehtinen - * This file is free software; Johannes Lehtinen gives unlimited - * permission to copy, distribute and modify it. ---> -<plugin - id="org.c-pluff.examples.cpfile.cext" - version="0.1" - name="File extensions for C source files" - provider-name="Johannes Lehtinen"> - <requires> - <c-pluff version="0.1"/> - <import plugin="org.c-pluff.examples.cpfile.extension" version="0.1"/> - </requires> - <extension - point="org.c-pluff.examples.cpfile.extension.file-types" - name="C source file types"> - <file-type description="C source file"> - <file-extension ext=".c"/> - </file-type> - <file-type description="C header file"> - <file-extension ext=".h"/> - </file-type> - <file-type description="C++ source file"> - <file-extension ext=".cpp"/> - <file-extension ext=".cxx"/> - </file-type> - <file-type description="C++ header file"> - <file-extension ext=".hpp"/> - <file-extension ext=".H"/> - </file-type> - </extension> -</plugin> diff --git a/lib/cpluff/examples/cpfile/plugins/core/Makefile.am b/lib/cpluff/examples/cpfile/plugins/core/Makefile.am deleted file mode 100644 index 542f2a87e0..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/core/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -LIBS = @LIBS@ - -EXTRA_DIST = plugin.xml classifiers.xsd Makefile.nmake - -pluginsdir = $(libdir)/cpfile/plugins -plugindir = $(pluginsdir)/core - -plugin_LTLIBRARIES = libcore.la -plugin_DATA = plugin.xml classifiers.xsd -plugin_HEADERS = core.h - -libcore_la_SOURCES = core.c core.h -libcore_la_LDFLAGS = -no-undefined -module -avoid-version diff --git a/lib/cpluff/examples/cpfile/plugins/core/Makefile.nmake b/lib/cpluff/examples/cpfile/plugins/core/Makefile.nmake deleted file mode 100644 index dad5943c6a..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/core/Makefile.nmake +++ /dev/null @@ -1,25 +0,0 @@ -# C-Pluff examples build system for MSVC
-# Copyright 2007 Johannes Lehtinen
-# This file is free software; Johannes Lehtinen gives unlimited permission
-# to copy, distribute and modify it.
-
-TOP = ..\..\..
-
-include ..\..\..\common.nmake
-
-pluginsdir = $(bindir)\cpfile\plugins
-plugindir = $(pluginsdir)\core
-
-libcore_OBJS = core.obj
-
-all-local: libcore.dll
-
-install-local: all-local
- if not exist $(plugindir) mkdir $(plugindir)
- for %f in (plugin.xml classifiers.xsd libcore.dll) do copy /y %f $(plugindir)
-
-clean-local:
- for %f in ($(libcore_OBJS) libcore.*) do if exist %f del %f
-
-libcore.dll: $(libcore_OBJS)
- cl /nologo /LD /MD /Fe$@ $(libcore_OBJS) $(cplibdir)\libcpluff.lib
diff --git a/lib/cpluff/examples/cpfile/plugins/core/classifiers.xsd b/lib/cpluff/examples/cpfile/plugins/core/classifiers.xsd deleted file mode 100644 index 357e8c09d9..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/core/classifiers.xsd +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "http://www.w3.org/2001/XMLSchema.dtd"> -<!-- - * Copyright 2007 Johannes Lehtinen - * This file is free software; Johannes Lehtinen gives unlimited - * permission to copy, distribute and modify it. ---> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:element name="extension"> - <xs:complexType> - <xs:attribute name="point" type="xs:string" use="required"/> - <xs:attribute name="id" type="simpleIdentifier"/> - <xs:attribute name="name" type="xs:string"/> - - <!-- - * The classifier is the name of a symbol pointing to - * classifier_t strucutre. Priority determines the order - * the file classifiers are tried. - --> - <xs:attribute name="classifier" type="xs:string" use="required"/> - <xs:attribute name="priority" type="xs:integer" use="required"/> - - </xs:complexType> - </xs:element> - <xs:simpleType name="simpleIdentifier"> - <xs:restriction base="xs:string"> - <xs:pattern value="[^.]+"/> - </xs:restriction> - </xs:simpleType> -</xs:schema> diff --git a/lib/cpluff/examples/cpfile/plugins/core/core.c b/lib/cpluff/examples/cpfile/plugins/core/core.c deleted file mode 100644 index 019e41cd88..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/core/core.c +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright 2007 Johannes Lehtinen - * This file is free software; Johannes Lehtinen gives unlimited - * permission to copy, distribute and modify it. - */ - -#include <stdlib.h> -#include <stdio.h> -#include <cpluff.h> -#include "core.h" - - -/* ------------------------------------------------------------------------ - * Data types - * ----------------------------------------------------------------------*/ - -/** Type for plugin_data_t structure */ -typedef struct plugin_data_t plugin_data_t; - -/** Type for registered_classifier_t structure */ -typedef struct registered_classifier_t registered_classifier_t; - -/** Plug-in instance data */ -struct plugin_data_t { - - /** The plug-in context */ - cp_context_t *ctx; - - /** Number of registered classifiers */ - int num_classifiers; - - /** An array of registered classifiers */ - registered_classifier_t *classifiers; -}; - -/** Registered classifier information */ -struct registered_classifier_t { - - /** The priority of the classifier */ - int priority; - - /** The classifier data */ - classifier_t *classifier; -}; - - -/* ------------------------------------------------------------------------ - * Internal functions - * ----------------------------------------------------------------------*/ - -/** - * A run function for the core plug-in. In this case this function acts as - * the application main function so there is no need for us to split the - * execution into small steps. Rather, we execute the whole main loop at - * once to make it simpler. - */ -static int run(void *d) { - plugin_data_t *data = d; - char **argv; - int argc; - int i; - - // Read arguments and print usage, if no arguments given - argv = cp_get_context_args(data->ctx, &argc); - if (argc < 2) { - fputs("usage: cpfile <file> [<file>...]\n", stdout); - return 0; - } - - // Go through all files listed as command arguments - for (i = 1; argv[i] != NULL; i++) { - int j; - int classified = 0; - - // Print file name - printf("%s: ", argv[i]); - - // Try classifiers in order of descending priority - for (j = 0; !classified && j < data->num_classifiers; j++) { - classifier_t *cl - = data->classifiers[j].classifier; - - classified = cl->classify(cl->data, argv[i]); - } - - // Check if unknown file - if (!classified) { - fputs("unknown file type\n", stdout); - } - } - - // All done - return 0; -} - -/** - * Creates a new plug-in instance. - */ -static void *create(cp_context_t *ctx) { - plugin_data_t *data = malloc(sizeof(plugin_data_t)); - if (data != NULL) { - data->ctx = ctx; - data->num_classifiers = 0; - data->classifiers = NULL; - } else { - cp_log(ctx, CP_LOG_ERROR, - "Insufficient memory for plug-in data."); - } - return data; -} - -/** - * Compares two registered classifiers according to priority. - */ -static int comp_classifiers(const registered_classifier_t *c1, - const registered_classifier_t *c2) { - return c2->priority - c1->priority; -} - -/** - * Initializes and starts the plug-in. - */ -static int start(void *d) { - plugin_data_t *data = d; - cp_extension_t **cl_exts; - int num_cl_exts; - cp_status_t status; - int i; - - // Obtain list of registered classifiers - cl_exts = cp_get_extensions_info( - data->ctx, - "org.c-pluff.examples.cpfile.core.classifiers", - &status, - &num_cl_exts - ); - if (cl_exts == NULL) { - - // An error occurred and framework logged it - return status; - } - - // Allocate memory for classifier information, if any - if (num_cl_exts > 0) { - data->classifiers = malloc( - num_cl_exts * sizeof(registered_classifier_t) - ); - if (data->classifiers == NULL) { - - // Memory allocation failed - cp_log(data->ctx, CP_LOG_ERROR, - "Insufficient memory for classifier list."); - return CP_ERR_RESOURCE; - } - } - - /* Resolve classifier functions. This will implicitly start - * plug-ins providing the classifiers. */ - for (i = 0; i < num_cl_exts; i++) { - const char *str; - int pri; - classifier_t *cl; - - // Get the classifier function priority - str = cp_lookup_cfg_value( - cl_exts[i]->configuration, "@priority" - ); - if (str == NULL) { - - // Classifier is missing mandatory priority - cp_log(data->ctx, CP_LOG_ERROR, - "Ignoring classifier without priority."); - continue; - } - pri = atoi(str); - - // Resolve classifier data pointer - str = cp_lookup_cfg_value( - cl_exts[i]->configuration, "@classifier"); - if (str == NULL) { - - // Classifier symbol name is missing - cp_log(data->ctx, CP_LOG_ERROR, - "Ignoring classifier without symbol name."); - continue; - } - cl = cp_resolve_symbol( - data->ctx, - cl_exts[i]->plugin->identifier, - str, - NULL - ); - if (cl == NULL) { - - // Could not resolve classifier symbol - cp_log(data->ctx, CP_LOG_ERROR, - "Ignoring classifier which could not be resolved."); - continue; - } - - // Add classifier to the list of registered classifiers - data->classifiers[data->num_classifiers].priority = pri; - data->classifiers[data->num_classifiers].classifier = cl; - data->num_classifiers++; - } - - // Release extension information - cp_release_info(data->ctx, cl_exts); - - // Sort registered classifiers according to priority - if (data->num_classifiers > 1) { - qsort(data->classifiers, - data->num_classifiers, - sizeof(registered_classifier_t), - (int (*)(const void *, const void *)) comp_classifiers); - } - - // Register run function to do the real work - cp_run_function(data->ctx, run); - - // Successfully started - return CP_OK; -} - -/** - * Releases resources from other plug-ins. - */ -static void stop(void *d) { - plugin_data_t *data = d; - int i; - - // Release classifier data, if any - if (data->classifiers != NULL) { - - // Release classifier pointers - for (i = 0; i < data->num_classifiers; i++) { - cp_release_symbol( - data->ctx, data->classifiers[i].classifier - ); - } - - // Free local data - free(data->classifiers); - data->classifiers = NULL; - data->num_classifiers = 0; - } -} - -/** - * Destroys a plug-in instance. - */ -static void destroy(void *d) { - free(d); -} - - -/* ------------------------------------------------------------------------ - * Exported runtime information - * ----------------------------------------------------------------------*/ - -/** - * Plug-in runtime information for the framework. The name of this symbol - * is stored in the plug-in descriptor. - */ -CP_EXPORT cp_plugin_runtime_t cp_ex_cpfile_core_funcs = { - create, - start, - stop, - destroy -}; diff --git a/lib/cpluff/examples/cpfile/plugins/core/core.h b/lib/cpluff/examples/cpfile/plugins/core/core.h deleted file mode 100644 index dea108906d..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/core/core.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2007 Johannes Lehtinen - * This file is free software; Johannes Lehtinen gives unlimited - * permission to copy, distribute and modify it. - */ - -#ifndef CORE_H_ -#define CORE_H_ - -/** - * A function that classifies a file. If the classification succeeds then - * the function should print file description to standard output and - * return a non-zero value. Otherwise the function must return zero. - * - * @param data classified specific runtime data - * @param path the file path - * @return whether classification was successful - */ -typedef int (*classify_func_t)(void *data, const char *path); - -/** A short hand typedef for classifier_t structure */ -typedef struct classifier_t classifier_t; - -/** - * A container for classifier information. - */ -struct classifier_t { - - /** Classifier specific runtime data */ - void *data; - - /** The classifying function */ - classify_func_t classify; -}; - -#endif /*CORE_H_*/ diff --git a/lib/cpluff/examples/cpfile/plugins/core/plugin.xml b/lib/cpluff/examples/cpfile/plugins/core/plugin.xml deleted file mode 100644 index eb38bf4ef0..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/core/plugin.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Copyright 2007 Johannes Lehtinen - * This file is free software; Johannes Lehtinen gives unlimited - * permission to copy, distribute and modify it. ---> -<plugin - id="org.c-pluff.examples.cpfile.core" - version="0.1" - name="Core logic for cpfile" - provider-name="Johannes Lehtinen"> - <requires> - <c-pluff version="0.1"/> - </requires> - <runtime library="libcore" funcs="cp_ex_cpfile_core_funcs"/> - <extension-point - id="classifiers" - name="File classifiers" - schema="classifiers.xsd"/> -</plugin> diff --git a/lib/cpluff/examples/cpfile/plugins/extension/Makefile.am b/lib/cpluff/examples/cpfile/plugins/extension/Makefile.am deleted file mode 100644 index f9c7fc4257..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/extension/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -LIBS = @LIBS@ - -CPPFLAGS = -I$(srcdir)/../core @CPPFLAGS@ - -EXTRA_DIST = plugin.xml file_types.xsd Makefile.nmake - -pluginsdir = $(libdir)/cpfile/plugins -plugindir = $(pluginsdir)/extension - -plugin_LTLIBRARIES = libextension.la -plugin_DATA = plugin.xml file_types.xsd - -libextension_la_SOURCES = extension.c -libextension_la_LDFLAGS = -no-undefined -module -avoid-version diff --git a/lib/cpluff/examples/cpfile/plugins/extension/Makefile.nmake b/lib/cpluff/examples/cpfile/plugins/extension/Makefile.nmake deleted file mode 100644 index b6829b89f7..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/extension/Makefile.nmake +++ /dev/null @@ -1,27 +0,0 @@ -# C-Pluff examples build system for MSVC
-# Copyright 2007 Johannes Lehtinen
-# This file is free software; Johannes Lehtinen gives unlimited permission
-# to copy, distribute and modify it.
-
-TOP = ..\..\..
-
-include ..\..\..\common.nmake
-
-CFLAGS = /I..\core $(CFLAGS)
-
-pluginsdir = $(bindir)\cpfile\plugins
-plugindir = $(pluginsdir)\extension
-
-libextension_OBJS = extension.obj
-
-all-local: libextension.dll
-
-install-local: all-local
- if not exist $(plugindir) mkdir $(plugindir)
- for %f in (plugin.xml file_types.xsd libextension.dll) do copy /y %f $(plugindir)
-
-clean-local:
- for %f in ($(libextension_OBJS) libextension.*) do if exist %f del %f
-
-libextension.dll: $(libextension_OBJS)
- cl /nologo /LD /MD /Fe$@ $(libextension_OBJS) $(cplibdir)\libcpluff.lib
diff --git a/lib/cpluff/examples/cpfile/plugins/extension/extension.c b/lib/cpluff/examples/cpfile/plugins/extension/extension.c deleted file mode 100644 index e453fb8919..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/extension/extension.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 2007 Johannes Lehtinen - * This file is free software; Johannes Lehtinen gives unlimited - * permission to copy, distribute and modify it. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <cpluff.h> -#include <core.h> - - -/* ------------------------------------------------------------------------ - * Internal functions - * ----------------------------------------------------------------------*/ - -static int is_of_type(const char *path, const cp_cfg_element_t *type); - -/** - * Classifies a file based on file extension. This classifier uses extensions - * installed at the file type extension point. Therefore we need pointer to - * the plug-in context to access the extensions. A plug-in instance initializes - * the classifier structure with the plug-in context pointer and registers a - * virtual symbol pointing to the classifier. - */ -static int classify(void *d, const char *path) { - cp_context_t *ctx = d; - cp_extension_t **exts; - const char *type = NULL; - int i; - - // Go through all extensions registered at the extension point - exts = cp_get_extensions_info(ctx, "org.c-pluff.examples.cpfile.extension.file-types", NULL, NULL); - if (exts == NULL) { - cp_log(ctx, CP_LOG_ERROR, "Could not resolve file type extensions."); - return 0; - } - for (i = 0; type == NULL && exts[i] != NULL; i++) { - int j; - - // Go through all file types provided by the extension - for (j = 0; type == NULL && j < exts[i]->configuration->num_children; j++) { - cp_cfg_element_t *elem = exts[i]->configuration->children + j; - const char *desc = NULL; - - if (strcmp(elem->name, "file-type") == 0 - && (desc = cp_lookup_cfg_value(elem, "@description")) != NULL - && (is_of_type(path, elem))) { - type = desc; - } - } - } - - // Release extension information - cp_release_info(ctx, exts); - - // Print file type if recognized, otherwise try other classifiers - if (type != NULL) { - fputs(type, stdout); - putchar('\n'); - return 1; - } else { - return 0; - } -} - -/** - * Returns whether the specified file is of the type matching the specified - * file-type element. - */ -static int is_of_type(const char *path, const cp_cfg_element_t *type) { - int i; - int iot = 0; - - /* Go through all extensions specified for the type */ - for (i = 0; !iot && i < type->num_children; i++) { - cp_cfg_element_t *ee = type->children + i; - const char *ext; - - iot = (strcmp(ee->name, "file-extension") == 0 - && (ext = cp_lookup_cfg_value(ee, "@ext")) != NULL - && strlen(path) >= strlen(ext) - && strcmp(path + (strlen(path) - strlen(ext)), ext) == 0); - } - - return iot; -} - -/** - * Creates a new plug-in instance. We use classifier instance as plug-in - * instance because it includes all the data our plug-in instance needs. - */ -static void *create(cp_context_t *ctx) { - classifier_t *cl; - - cl = malloc(sizeof(classifier_t)); - if (cl != NULL) { - cl->data = ctx; - cl->classify = classify; - } - return cl; -} - -/** - * Initializes and starts the plug-in. - */ -static int start(void *d) { - classifier_t *cl = d; - cp_context_t *ctx = cl->data; - - return cp_define_symbol(ctx, "cp_ex_cpfile_extension_classifier", cl); -} - -/** - * Destroys a plug-in instance. - */ -static void destroy(void *d) { - if (d != NULL) { - free(d); - } -} - - -/* ------------------------------------------------------------------------ - * Exported classifier information - * ----------------------------------------------------------------------*/ - -/** - * Plug-in runtime information for the framework. The name of this symbol - * is stored in the plug-in descriptor. - */ -CP_EXPORT cp_plugin_runtime_t cp_ex_cpfile_extension_funcs = { - create, - start, - NULL, - destroy -}; diff --git a/lib/cpluff/examples/cpfile/plugins/extension/file_types.xsd b/lib/cpluff/examples/cpfile/plugins/extension/file_types.xsd deleted file mode 100644 index c6ed1844f2..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/extension/file_types.xsd +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "http://www.w3.org/2001/XMLSchema.dtd"> -<!-- - * Copyright 2007 Johannes Lehtinen - * This file is free software; Johannes Lehtinen gives unlimited - * permission to copy, distribute and modify it. ---> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:element name="extension"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" ref="file-type"/> - </xs:sequence> - <xs:attribute name="point" type="xs:string" use="required"/> - <xs:attribute name="id" type="simpleIdentifier"/> - <xs:attribute name="name" type="xs:string"/> - </xs:complexType> - </xs:element> - <xs:element name="file-type"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" ref="file-extension"/> - </xs:sequence> - <xs:attribute name="description" type="xs:string" use="required"/> - </xs:complexType> - </xs:element> - <xs:element name="file-extension"> - <xs:complexType> - <xs:attribute name="ext" type="xs:string" use="required"/> - </xs:complexType> - </xs:element> - <xs:simpleType name="simpleIdentifier"> - <xs:restriction base="xs:string"> - <xs:pattern value="[^.]+"/> - </xs:restriction> - </xs:simpleType> -</xs:schema> diff --git a/lib/cpluff/examples/cpfile/plugins/extension/plugin.xml b/lib/cpluff/examples/cpfile/plugins/extension/plugin.xml deleted file mode 100644 index 4bac8d0d16..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/extension/plugin.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Copyright 2007 Johannes Lehtinen - * This file is free software; Johannes Lehtinen gives unlimited - * permission to copy, distribute and modify it. ---> -<plugin - id="org.c-pluff.examples.cpfile.extension" - version="0.1" - name="File extension classification" - provider-name="Johannes Lehtinen"> - <requires> - <c-pluff version="0.1"/> - <import plugin="org.c-pluff.examples.cpfile.core" version="0.1"/> - </requires> - <runtime library="libextension" funcs="cp_ex_cpfile_extension_funcs"/> - <extension-point - id="file-types" - name="File types by extension" - schema="file_types.xsd"/> - <extension - point="org.c-pluff.examples.cpfile.core.classifiers" - name="File extension classifier" - priority="20" - classifier="cp_ex_cpfile_extension_classifier"/> - <extension - point="org.c-pluff.examples.cpfile.extension.file-types" - name="Base file types"> - <file-type description="text file"> - <file-extension ext=".txt"/> - <file-extension ext=".text"/> - </file-type> - </extension> -</plugin> diff --git a/lib/cpluff/examples/cpfile/plugins/special/Makefile.am b/lib/cpluff/examples/cpfile/plugins/special/Makefile.am deleted file mode 100644 index b65cc74581..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/special/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -LIBS = @LIBS@ - -CPPFLAGS = -I$(srcdir)/../core @CPPFLAGS@ - -EXTRA_DIST = plugin.xml Makefile.nmake - -pluginsdir = $(libdir)/cpfile/plugins -plugindir = $(pluginsdir)/special - -plugin_LTLIBRARIES = libspecial.la -plugin_DATA = plugin.xml - -libspecial_la_SOURCES = special.c -libspecial_la_LDFLAGS = -no-undefined -module -avoid-version diff --git a/lib/cpluff/examples/cpfile/plugins/special/Makefile.nmake b/lib/cpluff/examples/cpfile/plugins/special/Makefile.nmake deleted file mode 100644 index 39f3a46365..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/special/Makefile.nmake +++ /dev/null @@ -1,27 +0,0 @@ -# C-Pluff examples build system for MSVC
-# Copyright 2007 Johannes Lehtinen
-# This file is free software; Johannes Lehtinen gives unlimited permission
-# to copy, distribute and modify it.
-
-TOP = ..\..\..
-
-include ..\..\..\common.nmake
-
-CFLAGS = /I..\core $(CFLAGS)
-
-pluginsdir = $(bindir)\cpfile\plugins
-plugindir = $(pluginsdir)\special
-
-libspecial_OBJS = special.obj
-
-all-local: libspecial.dll
-
-install-local: all-local
- if not exist $(plugindir) mkdir $(plugindir)
- for %f in (plugin.xml libspecial.dll) do copy /y %f $(plugindir)
-
-clean-local:
- for %f in ($(libspecial_OBJS) libspecial.*) do if exist %f del %f
-
-libspecial.dll: $(libspecial_OBJS)
- cl /nologo /LD /MD /Fe$@ $(libspecial_OBJS) $(cplibdir)\libcpluff.lib
diff --git a/lib/cpluff/examples/cpfile/plugins/special/plugin.xml b/lib/cpluff/examples/cpfile/plugins/special/plugin.xml deleted file mode 100644 index a04f6b0eec..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/special/plugin.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Copyright 2007 Johannes Lehtinen - * This file is free software; Johannes Lehtinen gives unlimited - * permission to copy, distribute and modify it. ---> -<plugin - id="org.c-pluff.examples.cpfile.special" - version="0.1" - name="Special file classification" - provider-name="Johannes Lehtinen"> - <requires> - <c-pluff version="0.1"/> - <import plugin="org.c-pluff.examples.cpfile.core" version="0.1"/> - </requires> - <runtime library="libspecial"/> - <extension - point="org.c-pluff.examples.cpfile.core.classifiers" - name="Special file classifier" - priority="100" - classifier="cp_ex_cpfile_special_classifier"/> -</plugin> diff --git a/lib/cpluff/examples/cpfile/plugins/special/special.c b/lib/cpluff/examples/cpfile/plugins/special/special.c deleted file mode 100644 index dc357c966b..0000000000 --- a/lib/cpluff/examples/cpfile/plugins/special/special.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2007 Johannes Lehtinen - * This file is free software; Johannes Lehtinen gives unlimited - * permission to copy, distribute and modify it. - */ - -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <cpluff.h> -#include <core.h> - -#if defined(HAVE_LSTAT) -#define STAT lstat -#elif defined(HAVE_STAT) -#define STAT stat -#endif - - -/* ------------------------------------------------------------------------ - * Internal functions - * ----------------------------------------------------------------------*/ - -/** - * Classifies a file by using stat(2). This classifier does not need - * any classifier data so we use NULL as dummy data pointer. Therefore - * we do not need a plug-in instance either as there is no data to be - * initialized. - */ -static int classify(void *dummy, const char *path) { -#ifdef STAT - struct stat s; - const char *type; - - // Stat the file - if (STAT(path, &s)) { - fflush(stdout); - perror("stat failed"); - - // No point for other classifiers to classify this - return 1; - } - - // Check if this is a special file - if ((s.st_mode & S_IFMT) == S_IFDIR) { - type = "directory"; -#ifdef S_IFCHR - } else if ((s.st_mode & S_IFMT) == S_IFCHR) { - type = "character device"; -#endif -#ifdef S_IFBLK - } else if ((s.st_mode & S_IFMT) == S_IFBLK) { - type = "block device"; -#endif -#ifdef S_IFLNK - } else if ((s.st_mode & S_IFMT) == S_IFLNK) { - type = "symbolic link"; -#endif - } else { - - // Did not recognize it, let other plug-ins try - return 0; - } - - // Print recognized file type - fputs(type, stdout); - putchar('\n'); - return 1; -#else - return 0; -#endif -} - - -/* ------------------------------------------------------------------------ - * Exported classifier information - * ----------------------------------------------------------------------*/ - -CP_EXPORT classifier_t cp_ex_cpfile_special_classifier = { NULL, classify }; diff --git a/lib/cpluff/examples/nmakedir.bat b/lib/cpluff/examples/nmakedir.bat deleted file mode 100755 index 34567c226c..0000000000 --- a/lib/cpluff/examples/nmakedir.bat +++ /dev/null @@ -1,11 +0,0 @@ -@REM C-Pluff examples build system for MSVC
-@REM Copyright 2007 Johannes Lehtinen
-@REM This file is free software; Johannes Lehtinen gives unlimited permission
-@REM to copy, distribute and modify it.
-
-@echo Making %2 in %1
-@cd %1
-@for /f "" %%d in ('cd') do @echo Entering directory %%d
-@nmake /nologo /f Makefile.nmake %2
-@for /f "" %%d in ('cd') do @echo Leaving directory %%d
-@cd ..
diff --git a/lib/cpluff/kazlib/hash.c b/lib/cpluff/kazlib/hash.c deleted file mode 100644 index 4cc281fb0d..0000000000 --- a/lib/cpluff/kazlib/hash.c +++ /dev/null @@ -1,1041 +0,0 @@ -/* - * Hash Table Data Type - * Copyright (C) 1997 Kaz Kylheku <kaz@ashi.footprints.net> - * - * Free Software License: - * - * All rights are reserved by the author, with the following exceptions: - * Permission is granted to freely reproduce and distribute this software, - * possibly in exchange for a fee, provided that this copyright notice appears - * intact. Permission is also granted to adapt this software to produce - * derivative works, as long as the modified versions carry this copyright - * notice and additional notices stating that the work has been modified. - * This source code may be translated into executable form and incorporated - * into proprietary software; there is no requirement for such software to - * contain a copyright notice related to this source. - * - * $Id: hash.c,v 1.36.2.11 2000/11/13 01:36:45 kaz Exp $ - * $Name: kazlib_1_20 $ - */ - -/* - * Modified by Johannes Lehtinen in 2006-2007. - * Included the definition of CP_HIDDEN macro and used it in declarations and - * definitions to hide Kazlib symbols when building a shared C-Pluff library. - */ - -#include <stdlib.h> -#include <stddef.h> -#include <assert.h> -#include <string.h> -#define HASH_IMPLEMENTATION -#include "hash.h" - -#ifdef KAZLIB_RCSID -static const char rcsid[] = "$Id: hash.c,v 1.36.2.11 2000/11/13 01:36:45 kaz Exp $"; -#endif - -#define INIT_BITS 6 -#define INIT_SIZE (1UL << (INIT_BITS)) /* must be power of two */ -#define INIT_MASK ((INIT_SIZE) - 1) - -#define next hash_next -#define key hash_key -#define data hash_data -#define hkey hash_hkey - -#define table hash_table -#define nchains hash_nchains -#define nodecount hash_nodecount -#define maxcount hash_maxcount -#define highmark hash_highmark -#define lowmark hash_lowmark -#define compare hash_compare -#define function hash_function -#define allocnode hash_allocnode -#define freenode hash_freenode -#define context hash_context -#define mask hash_mask -#define dynamic hash_dynamic - -#define table hash_table -#define chain hash_chain - -static hnode_t *hnode_alloc(void *context); -static void hnode_free(hnode_t *node, void *context); -static hash_val_t hash_fun_default(const void *key); -static int hash_comp_default(const void *key1, const void *key2); - -CP_HIDDEN int hash_val_t_bit; - -/* - * Compute the number of bits in the hash_val_t type. We know that hash_val_t - * is an unsigned integral type. Thus the highest value it can hold is a - * Mersenne number (power of two, less one). We initialize a hash_val_t - * object with this value and then shift bits out one by one while counting. - * Notes: - * 1. HASH_VAL_T_MAX is a Mersenne number---one that is one less than a power - * of two. This means that its binary representation consists of all one - * bits, and hence ``val'' is initialized to all one bits. - * 2. While bits remain in val, we increment the bit count and shift it to the - * right, replacing the topmost bit by zero. - */ - -static void compute_bits(void) -{ - hash_val_t val = HASH_VAL_T_MAX; /* 1 */ - int bits = 0; - - while (val) { /* 2 */ - bits++; - val >>= 1; - } - - hash_val_t_bit = bits; -} - -/* - * Verify whether the given argument is a power of two. - */ - -static int is_power_of_two(hash_val_t arg) -{ - if (arg == 0) - return 0; - while ((arg & 1) == 0) - arg >>= 1; - return (arg == 1); -} - -/* - * Compute a shift amount from a given table size - */ - -static hash_val_t compute_mask(hashcount_t size) -{ - assert (is_power_of_two(size)); - assert (size >= 2); - - return size - 1; -} - -/* - * Initialize the table of pointers to null. - */ - -static void clear_table(hash_t *hash) -{ - hash_val_t i; - - for (i = 0; i < hash->nchains; i++) - hash->table[i] = NULL; -} - -/* - * Double the size of a dynamic table. This works as follows. Each chain splits - * into two adjacent chains. The shift amount increases by one, exposing an - * additional bit of each hashed key. For each node in the original chain, the - * value of this newly exposed bit will decide which of the two new chains will - * receive the node: if the bit is 1, the chain with the higher index will have - * the node, otherwise the lower chain will receive the node. In this manner, - * the hash table will continue to function exactly as before without having to - * rehash any of the keys. - * Notes: - * 1. Overflow check. - * 2. The new number of chains is twice the old number of chains. - * 3. The new mask is one bit wider than the previous, revealing a - * new bit in all hashed keys. - * 4. Allocate a new table of chain pointers that is twice as large as the - * previous one. - * 5. If the reallocation was successful, we perform the rest of the growth - * algorithm, otherwise we do nothing. - * 6. The exposed_bit variable holds a mask with which each hashed key can be - * AND-ed to test the value of its newly exposed bit. - * 7. Now loop over each chain in the table and sort its nodes into two - * chains based on the value of each node's newly exposed hash bit. - * 8. The low chain replaces the current chain. The high chain goes - * into the corresponding sister chain in the upper half of the table. - * 9. We have finished dealing with the chains and nodes. We now update - * the various bookeeping fields of the hash structure. - */ - -static void grow_table(hash_t *hash) -{ - hnode_t **newtable; - - assert (2 * hash->nchains > hash->nchains); /* 1 */ - - newtable = realloc(hash->table, - sizeof *newtable * hash->nchains * 2); /* 4 */ - - if (newtable) { /* 5 */ - hash_val_t mask = (hash->mask << 1) | 1; /* 3 */ - hash_val_t exposed_bit = mask ^ hash->mask; /* 6 */ - hash_val_t chain; - - assert (mask != hash->mask); - - for (chain = 0; chain < hash->nchains; chain++) { /* 7 */ - hnode_t *low_chain = 0, *high_chain = 0, *hptr, *next; - - for (hptr = newtable[chain]; hptr != 0; hptr = next) { - next = hptr->next; - - if (hptr->hkey & exposed_bit) { - hptr->next = high_chain; - high_chain = hptr; - } else { - hptr->next = low_chain; - low_chain = hptr; - } - } - - newtable[chain] = low_chain; /* 8 */ - newtable[chain + hash->nchains] = high_chain; - } - - hash->table = newtable; /* 9 */ - hash->mask = mask; - hash->nchains *= 2; - hash->lowmark *= 2; - hash->highmark *= 2; - } - assert (hash_verify(hash)); -} - -/* - * Cut a table size in half. This is done by folding together adjacent chains - * and populating the lower half of the table with these chains. The chains are - * simply spliced together. Once this is done, the whole table is reallocated - * to a smaller object. - * Notes: - * 1. It is illegal to have a hash table with one slot. This would mean that - * hash->shift is equal to hash_val_t_bit, an illegal shift value. - * Also, other things could go wrong, such as hash->lowmark becoming zero. - * 2. Looping over each pair of sister chains, the low_chain is set to - * point to the head node of the chain in the lower half of the table, - * and high_chain points to the head node of the sister in the upper half. - * 3. The intent here is to compute a pointer to the last node of the - * lower chain into the low_tail variable. If this chain is empty, - * low_tail ends up with a null value. - * 4. If the lower chain is not empty, we simply tack the upper chain onto it. - * If the upper chain is a null pointer, nothing happens. - * 5. Otherwise if the lower chain is empty but the upper one is not, - * If the low chain is empty, but the high chain is not, then the - * high chain is simply transferred to the lower half of the table. - * 6. Otherwise if both chains are empty, there is nothing to do. - * 7. All the chain pointers are in the lower half of the table now, so - * we reallocate it to a smaller object. This, of course, invalidates - * all pointer-to-pointers which reference into the table from the - * first node of each chain. - * 8. Though it's unlikely, the reallocation may fail. In this case we - * pretend that the table _was_ reallocated to a smaller object. - * 9. Finally, update the various table parameters to reflect the new size. - */ - -static void shrink_table(hash_t *hash) -{ - hash_val_t chain, nchains; - hnode_t **newtable, *low_tail, *low_chain, *high_chain; - - assert (hash->nchains >= 2); /* 1 */ - nchains = hash->nchains / 2; - - for (chain = 0; chain < nchains; chain++) { - low_chain = hash->table[chain]; /* 2 */ - high_chain = hash->table[chain + nchains]; - for (low_tail = low_chain; low_tail && low_tail->next; low_tail = low_tail->next) - ; /* 3 */ - if (low_chain != 0) /* 4 */ - low_tail->next = high_chain; - else if (high_chain != 0) /* 5 */ - hash->table[chain] = high_chain; - else - assert (hash->table[chain] == NULL); /* 6 */ - } - newtable = realloc(hash->table, - sizeof *newtable * nchains); /* 7 */ - if (newtable) /* 8 */ - hash->table = newtable; - hash->mask >>= 1; /* 9 */ - hash->nchains = nchains; - hash->lowmark /= 2; - hash->highmark /= 2; - assert (hash_verify(hash)); -} - - -/* - * Create a dynamic hash table. Both the hash table structure and the table - * itself are dynamically allocated. Furthermore, the table is extendible in - * that it will automatically grow as its load factor increases beyond a - * certain threshold. - * Notes: - * 1. If the number of bits in the hash_val_t type has not been computed yet, - * we do so here, because this is likely to be the first function that the - * user calls. - * 2. Allocate a hash table control structure. - * 3. If a hash table control structure is successfully allocated, we - * proceed to initialize it. Otherwise we return a null pointer. - * 4. We try to allocate the table of hash chains. - * 5. If we were able to allocate the hash chain table, we can finish - * initializing the hash structure and the table. Otherwise, we must - * backtrack by freeing the hash structure. - * 6. INIT_SIZE should be a power of two. The high and low marks are always set - * to be twice the table size and half the table size respectively. When the - * number of nodes in the table grows beyond the high size (beyond load - * factor 2), it will double in size to cut the load factor down to about - * about 1. If the table shrinks down to or beneath load factor 0.5, - * it will shrink, bringing the load up to about 1. However, the table - * will never shrink beneath INIT_SIZE even if it's emptied. - * 7. This indicates that the table is dynamically allocated and dynamically - * resized on the fly. A table that has this value set to zero is - * assumed to be statically allocated and will not be resized. - * 8. The table of chains must be properly reset to all null pointers. - */ - -CP_HIDDEN hash_t *hash_create(hashcount_t maxcount, hash_comp_t compfun, - hash_fun_t hashfun) -{ - hash_t *hash; - - if (hash_val_t_bit == 0) /* 1 */ - compute_bits(); - - hash = malloc(sizeof *hash); /* 2 */ - - if (hash) { /* 3 */ - hash->table = malloc(sizeof *hash->table * INIT_SIZE); /* 4 */ - if (hash->table) { /* 5 */ - hash->nchains = INIT_SIZE; /* 6 */ - hash->highmark = INIT_SIZE * 2; - hash->lowmark = INIT_SIZE / 2; - hash->nodecount = 0; - hash->maxcount = maxcount; - hash->compare = compfun ? compfun : hash_comp_default; - hash->function = hashfun ? hashfun : hash_fun_default; - hash->allocnode = hnode_alloc; - hash->freenode = hnode_free; - hash->context = NULL; - hash->mask = INIT_MASK; - hash->dynamic = 1; /* 7 */ - clear_table(hash); /* 8 */ - assert (hash_verify(hash)); - return hash; - } - free(hash); - } - - return NULL; -} - -/* - * Select a different set of node allocator routines. - */ - -CP_HIDDEN void hash_set_allocator(hash_t *hash, hnode_alloc_t al, - hnode_free_t fr, void *context) -{ - assert (hash_count(hash) == 0); - assert ((al == 0 && fr == 0) || (al != 0 && fr != 0)); - - hash->allocnode = al ? al : hnode_alloc; - hash->freenode = fr ? fr : hnode_free; - hash->context = context; -} - -/* - * Free every node in the hash using the hash->freenode() function pointer, and - * cause the hash to become empty. - */ - -CP_HIDDEN void hash_free_nodes(hash_t *hash) -{ - hscan_t hs; - hnode_t *node; - hash_scan_begin(&hs, hash); - while ((node = hash_scan_next(&hs))) { - hash_scan_delete(hash, node); - hash->freenode(node, hash->context); - } - hash->nodecount = 0; - clear_table(hash); -} - -/* - * Obsolescent function for removing all nodes from a table, - * freeing them and then freeing the table all in one step. - */ - -CP_HIDDEN void hash_free(hash_t *hash) -{ -#ifdef KAZLIB_OBSOLESCENT_DEBUG - assert ("call to obsolescent function hash_free()" && 0); -#endif - hash_free_nodes(hash); - hash_destroy(hash); -} - -/* - * Free a dynamic hash table structure. - */ - -CP_HIDDEN void hash_destroy(hash_t *hash) -{ - assert (hash_val_t_bit != 0); - assert (hash_isempty(hash)); - free(hash->table); - free(hash); -} - -/* - * Initialize a user supplied hash structure. The user also supplies a table of - * chains which is assigned to the hash structure. The table is static---it - * will not grow or shrink. - * 1. See note 1. in hash_create(). - * 2. The user supplied array of pointers hopefully contains nchains nodes. - * 3. See note 7. in hash_create(). - * 4. We must dynamically compute the mask from the given power of two table - * size. - * 5. The user supplied table can't be assumed to contain null pointers, - * so we reset it here. - */ - -CP_HIDDEN hash_t *hash_init(hash_t *hash, hashcount_t maxcount, - hash_comp_t compfun, hash_fun_t hashfun, hnode_t **table, - hashcount_t nchains) -{ - if (hash_val_t_bit == 0) /* 1 */ - compute_bits(); - - assert (is_power_of_two(nchains)); - - hash->table = table; /* 2 */ - hash->nchains = nchains; - hash->nodecount = 0; - hash->maxcount = maxcount; - hash->compare = compfun ? compfun : hash_comp_default; - hash->function = hashfun ? hashfun : hash_fun_default; - hash->dynamic = 0; /* 3 */ - hash->mask = compute_mask(nchains); /* 4 */ - clear_table(hash); /* 5 */ - - assert (hash_verify(hash)); - - return hash; -} - -/* - * Reset the hash scanner so that the next element retrieved by - * hash_scan_next() shall be the first element on the first non-empty chain. - * Notes: - * 1. Locate the first non empty chain. - * 2. If an empty chain is found, remember which one it is and set the next - * pointer to refer to its first element. - * 3. Otherwise if a chain is not found, set the next pointer to NULL - * so that hash_scan_next() shall indicate failure. - */ - -CP_HIDDEN void hash_scan_begin(hscan_t *scan, hash_t *hash) -{ - hash_val_t nchains = hash->nchains; - hash_val_t chain; - - scan->table = hash; - - /* 1 */ - - for (chain = 0; chain < nchains && hash->table[chain] == 0; chain++) - ; - - if (chain < nchains) { /* 2 */ - scan->chain = chain; - scan->next = hash->table[chain]; - } else { /* 3 */ - scan->next = NULL; - } -} - -/* - * Retrieve the next node from the hash table, and update the pointer - * for the next invocation of hash_scan_next(). - * Notes: - * 1. Remember the next pointer in a temporary value so that it can be - * returned. - * 2. This assertion essentially checks whether the module has been properly - * initialized. The first point of interaction with the module should be - * either hash_create() or hash_init(), both of which set hash_val_t_bit to - * a non zero value. - * 3. If the next pointer we are returning is not NULL, then the user is - * allowed to call hash_scan_next() again. We prepare the new next pointer - * for that call right now. That way the user is allowed to delete the node - * we are about to return, since we will no longer be needing it to locate - * the next node. - * 4. If there is a next node in the chain (next->next), then that becomes the - * new next node, otherwise ... - * 5. We have exhausted the current chain, and must locate the next subsequent - * non-empty chain in the table. - * 6. If a non-empty chain is found, the first element of that chain becomes - * the new next node. Otherwise there is no new next node and we set the - * pointer to NULL so that the next time hash_scan_next() is called, a null - * pointer shall be immediately returned. - */ - - -CP_HIDDEN hnode_t *hash_scan_next(hscan_t *scan) -{ - hnode_t *next = scan->next; /* 1 */ - hash_t *hash = scan->table; - hash_val_t chain = scan->chain + 1; - hash_val_t nchains = hash->nchains; - - assert (hash_val_t_bit != 0); /* 2 */ - - if (next) { /* 3 */ - if (next->next) { /* 4 */ - scan->next = next->next; - } else { - while (chain < nchains && hash->table[chain] == 0) /* 5 */ - chain++; - if (chain < nchains) { /* 6 */ - scan->chain = chain; - scan->next = hash->table[chain]; - } else { - scan->next = NULL; - } - } - } - return next; -} - -/* - * Insert a node into the hash table. - * Notes: - * 1. It's illegal to insert more than the maximum number of nodes. The client - * should verify that the hash table is not full before attempting an - * insertion. - * 2. The same key may not be inserted into a table twice. - * 3. If the table is dynamic and the load factor is already at >= 2, - * grow the table. - * 4. We take the bottom N bits of the hash value to derive the chain index, - * where N is the base 2 logarithm of the size of the hash table. - */ - -CP_HIDDEN void hash_insert(hash_t *hash, hnode_t *node, const void *key) -{ - hash_val_t hkey, chain; - - assert (hash_val_t_bit != 0); - assert (node->next == NULL); - assert (hash->nodecount < hash->maxcount); /* 1 */ - assert (hash_lookup(hash, key) == NULL); /* 2 */ - - if (hash->dynamic && hash->nodecount >= hash->highmark) /* 3 */ - grow_table(hash); - - hkey = hash->function(key); - chain = hkey & hash->mask; /* 4 */ - - node->key = key; - node->hkey = hkey; - node->next = hash->table[chain]; - hash->table[chain] = node; - hash->nodecount++; - - assert (hash_verify(hash)); -} - -/* - * Find a node in the hash table and return a pointer to it. - * Notes: - * 1. We hash the key and keep the entire hash value. As an optimization, when - * we descend down the chain, we can compare hash values first and only if - * hash values match do we perform a full key comparison. - * 2. To locate the chain from among 2^N chains, we look at the lower N bits of - * the hash value by anding them with the current mask. - * 3. Looping through the chain, we compare the stored hash value inside each - * node against our computed hash. If they match, then we do a full - * comparison between the unhashed keys. If these match, we have located the - * entry. - */ - -CP_HIDDEN hnode_t *hash_lookup(hash_t *hash, const void *key) -{ - hash_val_t hkey, chain; - hnode_t *nptr; - - hkey = hash->function(key); /* 1 */ - chain = hkey & hash->mask; /* 2 */ - - for (nptr = hash->table[chain]; nptr; nptr = nptr->next) { /* 3 */ - if (nptr->hkey == hkey && hash->compare(nptr->key, key) == 0) - return nptr; - } - - return NULL; -} - -/* - * Delete the given node from the hash table. Since the chains - * are singly linked, we must locate the start of the node's chain - * and traverse. - * Notes: - * 1. The node must belong to this hash table, and its key must not have - * been tampered with. - * 2. If this deletion will take the node count below the low mark, we - * shrink the table now. - * 3. Determine which chain the node belongs to, and fetch the pointer - * to the first node in this chain. - * 4. If the node being deleted is the first node in the chain, then - * simply update the chain head pointer. - * 5. Otherwise advance to the node's predecessor, and splice out - * by updating the predecessor's next pointer. - * 6. Indicate that the node is no longer in a hash table. - */ - -CP_HIDDEN hnode_t *hash_delete(hash_t *hash, hnode_t *node) -{ - hash_val_t chain; - hnode_t *hptr; - - assert (hash_lookup(hash, node->key) == node); /* 1 */ - assert (hash_val_t_bit != 0); - - if (hash->dynamic && hash->nodecount <= hash->lowmark - && hash->nodecount > INIT_SIZE) - shrink_table(hash); /* 2 */ - - chain = node->hkey & hash->mask; /* 3 */ - hptr = hash->table[chain]; - - if (hptr == node) { /* 4 */ - hash->table[chain] = node->next; - } else { - while (hptr->next != node) { /* 5 */ - assert (hptr != 0); - hptr = hptr->next; - } - assert (hptr->next == node); - hptr->next = node->next; - } - - hash->nodecount--; - assert (hash_verify(hash)); - - node->next = NULL; /* 6 */ - return node; -} - -CP_HIDDEN int hash_alloc_insert(hash_t *hash, const void *key, void *data) -{ - hnode_t *node = hash->allocnode(hash->context); - - if (node) { - hnode_init(node, data); - hash_insert(hash, node, key); - return 1; - } - return 0; -} - -CP_HIDDEN void hash_delete_free(hash_t *hash, hnode_t *node) -{ - hash_delete(hash, node); - hash->freenode(node, hash->context); -} - -/* - * Exactly like hash_delete, except does not trigger table shrinkage. This is to be - * used from within a hash table scan operation. See notes for hash_delete. - */ - -CP_HIDDEN hnode_t *hash_scan_delete(hash_t *hash, hnode_t *node) -{ - hash_val_t chain; - hnode_t *hptr; - - assert (hash_lookup(hash, node->key) == node); - assert (hash_val_t_bit != 0); - - chain = node->hkey & hash->mask; - hptr = hash->table[chain]; - - if (hptr == node) { - hash->table[chain] = node->next; - } else { - while (hptr->next != node) - hptr = hptr->next; - hptr->next = node->next; - } - - hash->nodecount--; - assert (hash_verify(hash)); - node->next = NULL; - - return node; -} - -/* - * Like hash_delete_free but based on hash_scan_delete. - */ - -CP_HIDDEN void hash_scan_delfree(hash_t *hash, hnode_t *node) -{ - hash_scan_delete(hash, node); - hash->freenode(node, hash->context); -} - -/* - * Verify whether the given object is a valid hash table. This means - * Notes: - * 1. If the hash table is dynamic, verify whether the high and - * low expansion/shrinkage thresholds are powers of two. - * 2. Count all nodes in the table, and test each hash value - * to see whether it is correct for the node's chain. - */ - -CP_HIDDEN int hash_verify(hash_t *hash) -{ - hashcount_t count = 0; - hash_val_t chain; - hnode_t *hptr; - - if (hash->dynamic) { /* 1 */ - if (hash->lowmark >= hash->highmark) - return 0; - if (!is_power_of_two(hash->highmark)) - return 0; - if (!is_power_of_two(hash->lowmark)) - return 0; - } - - for (chain = 0; chain < hash->nchains; chain++) { /* 2 */ - for (hptr = hash->table[chain]; hptr != 0; hptr = hptr->next) { - if ((hptr->hkey & hash->mask) != chain) - return 0; - count++; - } - } - - if (count != hash->nodecount) - return 0; - - return 1; -} - -/* - * Test whether the hash table is full and return 1 if this is true, - * 0 if it is false. - */ - -#undef hash_isfull -CP_HIDDEN int hash_isfull(hash_t *hash) -{ - return hash->nodecount == hash->maxcount; -} - -/* - * Test whether the hash table is empty and return 1 if this is true, - * 0 if it is false. - */ - -#undef hash_isempty -CP_HIDDEN int hash_isempty(hash_t *hash) -{ - return hash->nodecount == 0; -} - -static hnode_t *hnode_alloc(void *context) -{ - return malloc(sizeof *hnode_alloc(NULL)); -} - -static void hnode_free(hnode_t *node, void *context) -{ - free(node); -} - - -/* - * Create a hash table node dynamically and assign it the given data. - */ - -CP_HIDDEN hnode_t *hnode_create(void *data) -{ - hnode_t *node = malloc(sizeof *node); - if (node) { - node->data = data; - node->next = NULL; - } - return node; -} - -/* - * Initialize a client-supplied node - */ - -CP_HIDDEN hnode_t *hnode_init(hnode_t *hnode, void *data) -{ - hnode->data = data; - hnode->next = NULL; - return hnode; -} - -/* - * Destroy a dynamically allocated node. - */ - -CP_HIDDEN void hnode_destroy(hnode_t *hnode) -{ - free(hnode); -} - -#undef hnode_put -CP_HIDDEN void hnode_put(hnode_t *node, void *data) -{ - node->data = data; -} - -#undef hnode_get -CP_HIDDEN void *hnode_get(hnode_t *node) -{ - return node->data; -} - -#undef hnode_getkey -CP_HIDDEN const void *hnode_getkey(hnode_t *node) -{ - return node->key; -} - -#undef hash_count -CP_HIDDEN hashcount_t hash_count(hash_t *hash) -{ - return hash->nodecount; -} - -#undef hash_size -CP_HIDDEN hashcount_t hash_size(hash_t *hash) -{ - return hash->nchains; -} - -static hash_val_t hash_fun_default(const void *key) -{ - static unsigned long randbox[] = { - 0x49848f1bU, 0xe6255dbaU, 0x36da5bdcU, 0x47bf94e9U, - 0x8cbcce22U, 0x559fc06aU, 0xd268f536U, 0xe10af79aU, - 0xc1af4d69U, 0x1d2917b5U, 0xec4c304dU, 0x9ee5016cU, - 0x69232f74U, 0xfead7bb3U, 0xe9089ab6U, 0xf012f6aeU, - }; - - const unsigned char *str = key; - hash_val_t acc = 0; - - while (*str) { - acc ^= randbox[(*str + acc) & 0xf]; - acc = (acc << 1) | (acc >> 31); - acc &= 0xffffffffU; - acc ^= randbox[((*str++ >> 4) + acc) & 0xf]; - acc = (acc << 2) | (acc >> 30); - acc &= 0xffffffffU; - } - return acc; -} - -static int hash_comp_default(const void *key1, const void *key2) -{ - return strcmp(key1, key2); -} - -#ifdef KAZLIB_TEST_MAIN - -#include <stdio.h> -#include <ctype.h> -#include <stdarg.h> - -typedef char input_t[256]; - -static int tokenize(char *string, ...) -{ - char **tokptr; - va_list arglist; - int tokcount = 0; - - va_start(arglist, string); - tokptr = va_arg(arglist, char **); - while (tokptr) { - while (*string && isspace((unsigned char) *string)) - string++; - if (!*string) - break; - *tokptr = string; - while (*string && !isspace((unsigned char) *string)) - string++; - tokptr = va_arg(arglist, char **); - tokcount++; - if (!*string) - break; - *string++ = 0; - } - va_end(arglist); - - return tokcount; -} - -static char *dupstring(char *str) -{ - int sz = strlen(str) + 1; - char *new = malloc(sz); - if (new) - memcpy(new, str, sz); - return new; -} - -static hnode_t *new_node(void *c) -{ - static hnode_t few[5]; - static int count; - - if (count < 5) - return few + count++; - - return NULL; -} - -static void del_node(hnode_t *n, void *c) -{ -} - -int main(void) -{ - input_t in; - hash_t *h = hash_create(HASHCOUNT_T_MAX, 0, 0); - hnode_t *hn; - hscan_t hs; - char *tok1, *tok2, *val; - const char *key; - int prompt = 0; - - char *help = - "a <key> <val> add value to hash table\n" - "d <key> delete value from hash table\n" - "l <key> lookup value in hash table\n" - "n show size of hash table\n" - "c show number of entries\n" - "t dump whole hash table\n" - "+ increase hash table (private func)\n" - "- decrease hash table (private func)\n" - "b print hash_t_bit value\n" - "p turn prompt on\n" - "s switch to non-functioning allocator\n" - "q quit"; - - if (!h) - puts("hash_create failed"); - - for (;;) { - if (prompt) - putchar('>'); - fflush(stdout); - - if (!fgets(in, sizeof(input_t), stdin)) - break; - - switch(in[0]) { - case '?': - puts(help); - break; - case 'b': - printf("%d\n", hash_val_t_bit); - break; - case 'a': - if (tokenize(in+1, &tok1, &tok2, (char **) 0) != 2) { - puts("what?"); - break; - } - key = dupstring(tok1); - val = dupstring(tok2); - - if (!key || !val) { - puts("out of memory"); - free((void *) key); - free(val); - } - - if (!hash_alloc_insert(h, key, val)) { - puts("hash_alloc_insert failed"); - free((void *) key); - free(val); - break; - } - break; - case 'd': - if (tokenize(in+1, &tok1, (char **) 0) != 1) { - puts("what?"); - break; - } - hn = hash_lookup(h, tok1); - if (!hn) { - puts("hash_lookup failed"); - break; - } - val = hnode_get(hn); - key = hnode_getkey(hn); - hash_scan_delfree(h, hn); - free((void *) key); - free(val); - break; - case 'l': - if (tokenize(in+1, &tok1, (char **) 0) != 1) { - puts("what?"); - break; - } - hn = hash_lookup(h, tok1); - if (!hn) { - puts("hash_lookup failed"); - break; - } - val = hnode_get(hn); - puts(val); - break; - case 'n': - printf("%lu\n", (unsigned long) hash_size(h)); - break; - case 'c': - printf("%lu\n", (unsigned long) hash_count(h)); - break; - case 't': - hash_scan_begin(&hs, h); - while ((hn = hash_scan_next(&hs))) - printf("%s\t%s\n", (char*) hnode_getkey(hn), - (char*) hnode_get(hn)); - break; - case '+': - grow_table(h); /* private function */ - break; - case '-': - shrink_table(h); /* private function */ - break; - case 'q': - exit(0); - break; - case '\0': - break; - case 'p': - prompt = 1; - break; - case 's': - hash_set_allocator(h, new_node, del_node, NULL); - break; - default: - putchar('?'); - putchar('\n'); - break; - } - } - - return 0; -} - -#endif diff --git a/lib/cpluff/kazlib/hash.h b/lib/cpluff/kazlib/hash.h deleted file mode 100644 index 50297eed8e..0000000000 --- a/lib/cpluff/kazlib/hash.h +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Hash Table Data Type - * Copyright (C) 1997 Kaz Kylheku <kaz@ashi.footprints.net> - * - * Free Software License: - * - * All rights are reserved by the author, with the following exceptions: - * Permission is granted to freely reproduce and distribute this software, - * possibly in exchange for a fee, provided that this copyright notice appears - * intact. Permission is also granted to adapt this software to produce - * derivative works, as long as the modified versions carry this copyright - * notice and additional notices stating that the work has been modified. - * This source code may be translated into executable form and incorporated - * into proprietary software; there is no requirement for such software to - * contain a copyright notice related to this source. - * - * $Id: hash.h,v 1.22.2.7 2000/11/13 01:36:45 kaz Exp $ - * $Name: kazlib_1_20 $ - */ - -/* - * Modified by Johannes Lehtinen in 2006-2007. - * Included the definition of CP_HIDDEN macro and used it in declarations and - * definitions to hide Kazlib symbols when building a shared C-Pluff library. - */ - -#ifndef HASH_H -#define HASH_H - -#ifdef _WIN32 -#include "../libcpluff/win32/cpluffdef.h" -#else -#include "../libcpluff/cpluffdef.h" -#endif - -#include <limits.h> -#ifdef KAZLIB_SIDEEFFECT_DEBUG -#include "sfx.h" -#endif - -/* - * Blurb for inclusion into C++ translation units - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef unsigned long hashcount_t; -#define HASHCOUNT_T_MAX ULONG_MAX - -typedef unsigned long hash_val_t; -#define HASH_VAL_T_MAX ULONG_MAX - -CP_HIDDEN extern int hash_val_t_bit; - -#ifndef HASH_VAL_T_BIT -#define HASH_VAL_T_BIT ((int) hash_val_t_bit) -#endif - -/* - * Hash chain node structure. - * Notes: - * 1. This preprocessing directive is for debugging purposes. The effect is - * that if the preprocessor symbol KAZLIB_OPAQUE_DEBUG is defined prior to the - * inclusion of this header, then the structure shall be declared as having - * the single member int __OPAQUE__. This way, any attempts by the - * client code to violate the principles of information hiding (by accessing - * the structure directly) can be diagnosed at translation time. However, - * note the resulting compiled unit is not suitable for linking. - * 2. This is a pointer to the next node in the chain. In the last node of a - * chain, this pointer is null. - * 3. The key is a pointer to some user supplied data that contains a unique - * identifier for each hash node in a given table. The interpretation of - * the data is up to the user. When creating or initializing a hash table, - * the user must supply a pointer to a function for comparing two keys, - * and a pointer to a function for hashing a key into a numeric value. - * 4. The value is a user-supplied pointer to void which may refer to - * any data object. It is not interpreted in any way by the hashing - * module. - * 5. The hashed key is stored in each node so that we don't have to rehash - * each key when the table must grow or shrink. - */ - -typedef struct hnode_t { - #if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) /* 1 */ - struct hnode_t *hash_next; /* 2 */ - const void *hash_key; /* 3 */ - void *hash_data; /* 4 */ - hash_val_t hash_hkey; /* 5 */ - #else - int hash_dummy; - #endif -} hnode_t; - -/* - * The comparison function pointer type. A comparison function takes two keys - * and produces a value of -1 if the left key is less than the right key, a - * value of 0 if the keys are equal, and a value of 1 if the left key is - * greater than the right key. - */ - -typedef int (*hash_comp_t)(const void *, const void *); - -/* - * The hashing function performs some computation on a key and produces an - * integral value of type hash_val_t based on that key. For best results, the - * function should have a good randomness properties in *all* significant bits - * over the set of keys that are being inserted into a given hash table. In - * particular, the most significant bits of hash_val_t are most significant to - * the hash module. Only as the hash table expands are less significant bits - * examined. Thus a function that has good distribution in its upper bits but - * not lower is preferrable to one that has poor distribution in the upper bits - * but not the lower ones. - */ - -typedef hash_val_t (*hash_fun_t)(const void *); - -/* - * allocator functions - */ - -typedef hnode_t *(*hnode_alloc_t)(void *); -typedef void (*hnode_free_t)(hnode_t *, void *); - -/* - * This is the hash table control structure. It keeps track of information - * about a hash table, as well as the hash table itself. - * Notes: - * 1. Pointer to the hash table proper. The table is an array of pointers to - * hash nodes (of type hnode_t). If the table is empty, every element of - * this table is a null pointer. A non-null entry points to the first - * element of a chain of nodes. - * 2. This member keeps track of the size of the hash table---that is, the - * number of chain pointers. - * 3. The count member maintains the number of elements that are presently - * in the hash table. - * 4. The maximum count is the greatest number of nodes that can populate this - * table. If the table contains this many nodes, no more can be inserted, - * and the hash_isfull() function returns true. - * 5. The high mark is a population threshold, measured as a number of nodes, - * which, if exceeded, will trigger a table expansion. Only dynamic hash - * tables are subject to this expansion. - * 6. The low mark is a minimum population threshold, measured as a number of - * nodes. If the table population drops below this value, a table shrinkage - * will occur. Only dynamic tables are subject to this reduction. No table - * will shrink beneath a certain absolute minimum number of nodes. - * 7. This is the a pointer to the hash table's comparison function. The - * function is set once at initialization or creation time. - * 8. Pointer to the table's hashing function, set once at creation or - * initialization time. - * 9. The current hash table mask. If the size of the hash table is 2^N, - * this value has its low N bits set to 1, and the others clear. It is used - * to select bits from the result of the hashing function to compute an - * index into the table. - * 10. A flag which indicates whether the table is to be dynamically resized. It - * is set to 1 in dynamically allocated tables, 0 in tables that are - * statically allocated. - */ - -typedef struct hash_t { - #if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) - struct hnode_t **hash_table; /* 1 */ - hashcount_t hash_nchains; /* 2 */ - hashcount_t hash_nodecount; /* 3 */ - hashcount_t hash_maxcount; /* 4 */ - hashcount_t hash_highmark; /* 5 */ - hashcount_t hash_lowmark; /* 6 */ - hash_comp_t hash_compare; /* 7 */ - hash_fun_t hash_function; /* 8 */ - hnode_alloc_t hash_allocnode; - hnode_free_t hash_freenode; - void *hash_context; - hash_val_t hash_mask; /* 9 */ - int hash_dynamic; /* 10 */ - #else - int hash_dummy; - #endif -} hash_t; - -/* - * Hash scanner structure, used for traversals of the data structure. - * Notes: - * 1. Pointer to the hash table that is being traversed. - * 2. Reference to the current chain in the table being traversed (the chain - * that contains the next node that shall be retrieved). - * 3. Pointer to the node that will be retrieved by the subsequent call to - * hash_scan_next(). - */ - -typedef struct hscan_t { - #if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) - hash_t *hash_table; /* 1 */ - hash_val_t hash_chain; /* 2 */ - hnode_t *hash_next; /* 3 */ - #else - int hash_dummy; - #endif -} hscan_t; - -CP_HIDDEN extern hash_t *hash_create(hashcount_t, hash_comp_t, hash_fun_t); -CP_HIDDEN extern void hash_set_allocator(hash_t *, hnode_alloc_t, hnode_free_t, void *); -CP_HIDDEN extern void hash_destroy(hash_t *); -CP_HIDDEN extern void hash_free_nodes(hash_t *); -CP_HIDDEN extern void hash_free(hash_t *); -CP_HIDDEN extern hash_t *hash_init(hash_t *, hashcount_t, hash_comp_t, - hash_fun_t, hnode_t **, hashcount_t); -CP_HIDDEN extern void hash_insert(hash_t *, hnode_t *, const void *); -CP_HIDDEN extern hnode_t *hash_lookup(hash_t *, const void *); -CP_HIDDEN extern hnode_t *hash_delete(hash_t *, hnode_t *); -CP_HIDDEN extern int hash_alloc_insert(hash_t *, const void *, void *); -CP_HIDDEN extern void hash_delete_free(hash_t *, hnode_t *); - -CP_HIDDEN extern void hnode_put(hnode_t *, void *); -CP_HIDDEN extern void *hnode_get(hnode_t *); -CP_HIDDEN extern const void *hnode_getkey(hnode_t *); -CP_HIDDEN extern hashcount_t hash_count(hash_t *); -CP_HIDDEN extern hashcount_t hash_size(hash_t *); - -CP_HIDDEN extern int hash_isfull(hash_t *); -CP_HIDDEN extern int hash_isempty(hash_t *); - -CP_HIDDEN extern void hash_scan_begin(hscan_t *, hash_t *); -CP_HIDDEN extern hnode_t *hash_scan_next(hscan_t *); -CP_HIDDEN extern hnode_t *hash_scan_delete(hash_t *, hnode_t *); -CP_HIDDEN extern void hash_scan_delfree(hash_t *, hnode_t *); - -CP_HIDDEN extern int hash_verify(hash_t *); - -CP_HIDDEN extern hnode_t *hnode_create(void *); -CP_HIDDEN extern hnode_t *hnode_init(hnode_t *, void *); -CP_HIDDEN extern void hnode_destroy(hnode_t *); - -#if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) -#ifdef KAZLIB_SIDEEFFECT_DEBUG -#define hash_isfull(H) (SFX_CHECK(H)->hash_nodecount == (H)->hash_maxcount) -#else -#define hash_isfull(H) ((H)->hash_nodecount == (H)->hash_maxcount) -#endif -#define hash_isempty(H) ((H)->hash_nodecount == 0) -#define hash_count(H) ((H)->hash_nodecount) -#define hash_size(H) ((H)->hash_nchains) -#define hnode_get(N) ((N)->hash_data) -#define hnode_getkey(N) ((N)->hash_key) -#define hnode_put(N, V) ((N)->hash_data = (V)) -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/lib/cpluff/kazlib/list.c b/lib/cpluff/kazlib/list.c deleted file mode 100644 index dc8eed0e63..0000000000 --- a/lib/cpluff/kazlib/list.c +++ /dev/null @@ -1,935 +0,0 @@ -/* - * List Abstract Data Type - * Copyright (C) 1997 Kaz Kylheku <kaz@ashi.footprints.net> - * - * Free Software License: - * - * All rights are reserved by the author, with the following exceptions: - * Permission is granted to freely reproduce and distribute this software, - * possibly in exchange for a fee, provided that this copyright notice appears - * intact. Permission is also granted to adapt this software to produce - * derivative works, as long as the modified versions carry this copyright - * notice and additional notices stating that the work has been modified. - * This source code may be translated into executable form and incorporated - * into proprietary software; there is no requirement for such software to - * contain a copyright notice related to this source. - * - * $Id: list.c,v 1.19.2.1 2000/04/17 01:07:21 kaz Exp $ - * $Name: kazlib_1_20 $ - */ - -/* - * Modified by Johannes Lehtinen in 2006-2007. - * Included the definition of CP_HIDDEN macro and used it in declarations and - * definitions to hide Kazlib symbols when building a shared C-Pluff library. - */ - - -#include <stdlib.h> -#include <stddef.h> -#include <assert.h> -#define LIST_IMPLEMENTATION -#include "list.h" - -#define next list_next -#define prev list_prev -#define data list_data - -#define pool list_pool -#define fre list_free -#define size list_size - -#define nilnode list_nilnode -#define nodecount list_nodecount -#define maxcount list_maxcount - -#define list_nil(L) (&(L)->nilnode) -#define list_first_priv(L) ((L)->nilnode.next) -#define list_last_priv(L) ((L)->nilnode.prev) -#define lnode_next(N) ((N)->next) -#define lnode_prev(N) ((N)->prev) - -#ifdef KAZLIB_RCSID -static const char rcsid[] = "$Id: list.c,v 1.19.2.1 2000/04/17 01:07:21 kaz Exp $"; -#endif - -/* - * Initialize a list object supplied by the client such that it becomes a valid - * empty list. If the list is to be ``unbounded'', the maxcount should be - * specified as LISTCOUNT_T_MAX, or, alternately, as -1. The value zero - * is not permitted. - */ - -CP_HIDDEN list_t *list_init(list_t *list, listcount_t maxcount) -{ - assert (maxcount != 0); - list->nilnode.next = &list->nilnode; - list->nilnode.prev = &list->nilnode; - list->nodecount = 0; - list->maxcount = maxcount; - return list; -} - -/* - * Dynamically allocate a list object using malloc(), and initialize it so that - * it is a valid empty list. If the list is to be ``unbounded'', the maxcount - * should be specified as LISTCOUNT_T_MAX, or, alternately, as -1. - */ - -CP_HIDDEN list_t *list_create(listcount_t maxcount) -{ - list_t *new = malloc(sizeof *new); - if (new) { - assert (maxcount != 0); - new->nilnode.next = &new->nilnode; - new->nilnode.prev = &new->nilnode; - new->nodecount = 0; - new->maxcount = maxcount; - } - return new; -} - -/* - * Destroy a dynamically allocated list object. - * The client must remove the nodes first. - */ - -CP_HIDDEN void list_destroy(list_t *list) -{ - assert (list_isempty(list)); - free(list); -} - -/* - * Free all of the nodes of a list. The list must contain only - * dynamically allocated nodes. After this call, the list - * is empty. - */ - -CP_HIDDEN void list_destroy_nodes(list_t *list) -{ - lnode_t *lnode = list_first_priv(list), *nil = list_nil(list), *tmp; - - while (lnode != nil) { - tmp = lnode->next; - lnode->next = NULL; - lnode->prev = NULL; - lnode_destroy(lnode); - lnode = tmp; - } - - list_init(list, list->maxcount); -} - -/* - * Return all of the nodes of a list to a node pool. The nodes in - * the list must all have come from the same pool. - */ - -CP_HIDDEN void list_return_nodes(list_t *list, lnodepool_t *pool) -{ - lnode_t *lnode = list_first_priv(list), *tmp, *nil = list_nil(list); - - while (lnode != nil) { - tmp = lnode->next; - lnode->next = NULL; - lnode->prev = NULL; - lnode_return(pool, lnode); - lnode = tmp; - } - - list_init(list, list->maxcount); -} - -/* - * Insert the node ``new'' into the list immediately after ``this'' node. - */ - -CP_HIDDEN void list_ins_after(list_t *list, lnode_t *new, lnode_t *this) -{ - lnode_t *that = this->next; - - assert (new != NULL); - assert (!list_contains(list, new)); - assert (!lnode_is_in_a_list(new)); - assert (this == list_nil(list) || list_contains(list, this)); - assert (list->nodecount + 1 > list->nodecount); - - new->prev = this; - new->next = that; - that->prev = new; - this->next = new; - list->nodecount++; - - assert (list->nodecount <= list->maxcount); -} - -/* - * Insert the node ``new'' into the list immediately before ``this'' node. - */ - -CP_HIDDEN void list_ins_before(list_t *list, lnode_t *new, lnode_t *this) -{ - lnode_t *that = this->prev; - - assert (new != NULL); - assert (!list_contains(list, new)); - assert (!lnode_is_in_a_list(new)); - assert (this == list_nil(list) || list_contains(list, this)); - assert (list->nodecount + 1 > list->nodecount); - - new->next = this; - new->prev = that; - that->next = new; - this->prev = new; - list->nodecount++; - - assert (list->nodecount <= list->maxcount); -} - -/* - * Delete the given node from the list. - */ - -CP_HIDDEN lnode_t *list_delete(list_t *list, lnode_t *del) -{ - lnode_t *next = del->next; - lnode_t *prev = del->prev; - - assert (list_contains(list, del)); - - prev->next = next; - next->prev = prev; - list->nodecount--; - - del->next = del->prev = NULL; - - return del; -} - -/* - * For each node in the list, execute the given function. The list, - * current node and the given context pointer are passed on each - * call to the function. - */ - -CP_HIDDEN void list_process(list_t *list, void *context, - void (* function)(list_t *list, lnode_t *lnode, void *context)) -{ - lnode_t *node = list_first_priv(list), *next, *nil = list_nil(list); - - while (node != nil) { - /* check for callback function deleting */ - /* the next node from under us */ - assert (list_contains(list, node)); - next = node->next; - function(list, node, context); - node = next; - } -} - -/* - * Dynamically allocate a list node and assign it the given piece of data. - */ - -CP_HIDDEN lnode_t *lnode_create(void *data) -{ - lnode_t *new = malloc(sizeof *new); - if (new) { - new->data = data; - new->next = NULL; - new->prev = NULL; - } - return new; -} - -/* - * Initialize a user-supplied lnode. - */ - -CP_HIDDEN lnode_t *lnode_init(lnode_t *lnode, void *data) -{ - lnode->data = data; - lnode->next = NULL; - lnode->prev = NULL; - return lnode; -} - -/* - * Destroy a dynamically allocated node. - */ - -CP_HIDDEN void lnode_destroy(lnode_t *lnode) -{ - assert (!lnode_is_in_a_list(lnode)); - free(lnode); -} - -/* - * Initialize a node pool object to use a user-supplied set of nodes. - * The ``nodes'' pointer refers to an array of lnode_t objects, containing - * ``n'' elements. - */ - -CP_HIDDEN lnodepool_t *lnode_pool_init(lnodepool_t *pool, lnode_t *nodes, listcount_t n) -{ - listcount_t i; - - assert (n != 0); - - pool->pool = nodes; - pool->fre = nodes; - pool->size = n; - for (i = 0; i < n - 1; i++) { - nodes[i].next = nodes + i + 1; - } - nodes[i].next = NULL; - nodes[i].prev = nodes; /* to make sure node is marked ``on list'' */ - return pool; -} - -/* - * Create a dynamically allocated pool of n nodes. - */ - -CP_HIDDEN lnodepool_t *lnode_pool_create(listcount_t n) -{ - lnodepool_t *pool; - lnode_t *nodes; - - assert (n != 0); - - pool = malloc(sizeof *pool); - if (!pool) - return NULL; - nodes = malloc(n * sizeof *nodes); - if (!nodes) { - free(pool); - return NULL; - } - lnode_pool_init(pool, nodes, n); - return pool; -} - -/* - * Determine whether the given pool is from this pool. - */ - -CP_HIDDEN int lnode_pool_isfrom(lnodepool_t *pool, lnode_t *node) -{ - listcount_t i; - - /* this is carefully coded this way because ANSI C forbids pointers - to different objects from being subtracted or compared other - than for exact equality */ - - for (i = 0; i < pool->size; i++) { - if (pool->pool + i == node) - return 1; - } - return 0; -} - -/* - * Destroy a dynamically allocated pool of nodes. - */ - -CP_HIDDEN void lnode_pool_destroy(lnodepool_t *p) -{ - free(p->pool); - free(p); -} - -/* - * Borrow a node from a node pool. Returns a null pointer if the pool - * is exhausted. - */ - -CP_HIDDEN lnode_t *lnode_borrow(lnodepool_t *pool, void *data) -{ - lnode_t *new = pool->fre; - if (new) { - pool->fre = new->next; - new->data = data; - new->next = NULL; - new->prev = NULL; - } - return new; -} - -/* - * Return a node to a node pool. A node must be returned to the pool - * from which it came. - */ - -CP_HIDDEN void lnode_return(lnodepool_t *pool, lnode_t *node) -{ - assert (lnode_pool_isfrom(pool, node)); - assert (!lnode_is_in_a_list(node)); - - node->next = pool->fre; - node->prev = node; - pool->fre = node; -} - -/* - * Determine whether the given list contains the given node. - * According to this function, a list does not contain its nilnode. - */ - -CP_HIDDEN int list_contains(list_t *list, lnode_t *node) -{ - lnode_t *n, *nil = list_nil(list); - - for (n = list_first_priv(list); n != nil; n = lnode_next(n)) { - if (node == n) - return 1; - } - - return 0; -} - -/* - * A more generalized variant of list_transfer. This one removes a - * ``slice'' from the source list and appends it to the destination - * list. - */ - -CP_HIDDEN void list_extract(list_t *dest, list_t *source, lnode_t *first, lnode_t *last) -{ - listcount_t moved = 1; - - assert (first == NULL || list_contains(source, first)); - assert (last == NULL || list_contains(source, last)); - - if (first == NULL || last == NULL) - return; - - /* adjust the destination list so that the slice is spliced out */ - - first->prev->next = last->next; - last->next->prev = first->prev; - - /* graft the splice at the end of the dest list */ - - last->next = &dest->nilnode; - first->prev = dest->nilnode.prev; - dest->nilnode.prev->next = first; - dest->nilnode.prev = last; - - while (first != last) { - first = first->next; - assert (first != list_nil(source)); /* oops, last before first! */ - moved++; - } - - /* assert no overflows */ - assert (source->nodecount - moved <= source->nodecount); - assert (dest->nodecount + moved >= dest->nodecount); - - /* assert no weirdness */ - assert (moved <= source->nodecount); - - source->nodecount -= moved; - dest->nodecount += moved; - - /* assert list sanity */ - assert (list_verify(source)); - assert (list_verify(dest)); -} - - -/* - * Split off a trailing sequence of nodes from the source list and relocate - * them to the tail of the destination list. The trailing sequence begins - * with node ``first'' and terminates with the last node of the source - * list. The nodes are added to the end of the new list in their original - * order. - */ - -CP_HIDDEN void list_transfer(list_t *dest, list_t *source, lnode_t *first) -{ - listcount_t moved = 1; - lnode_t *last; - - assert (first == NULL || list_contains(source, first)); - - if (first == NULL) - return; - - last = source->nilnode.prev; - - source->nilnode.prev = first->prev; - first->prev->next = &source->nilnode; - - last->next = &dest->nilnode; - first->prev = dest->nilnode.prev; - dest->nilnode.prev->next = first; - dest->nilnode.prev = last; - - while (first != last) { - first = first->next; - moved++; - } - - /* assert no overflows */ - assert (source->nodecount - moved <= source->nodecount); - assert (dest->nodecount + moved >= dest->nodecount); - - /* assert no weirdness */ - assert (moved <= source->nodecount); - - source->nodecount -= moved; - dest->nodecount += moved; - - /* assert list sanity */ - assert (list_verify(source)); - assert (list_verify(dest)); -} - -CP_HIDDEN void list_merge(list_t *dest, list_t *sour, - int compare (const void *, const void *)) -{ - lnode_t *dn, *sn, *tn; - lnode_t *d_nil = list_nil(dest), *s_nil = list_nil(sour); - - /* Nothing to do if source and destination list are the same. */ - if (dest == sour) - return; - - /* overflow check */ - assert (list_count(sour) + list_count(dest) >= list_count(sour)); - - /* lists must be sorted */ - assert (list_is_sorted(sour, compare)); - assert (list_is_sorted(dest, compare)); - - dn = list_first_priv(dest); - sn = list_first_priv(sour); - - while (dn != d_nil && sn != s_nil) { - if (compare(lnode_get(dn), lnode_get(sn)) >= 0) { - tn = lnode_next(sn); - list_delete(sour, sn); - list_ins_before(dest, sn, dn); - sn = tn; - } else { - dn = lnode_next(dn); - } - } - - if (dn != d_nil) - return; - - if (sn != s_nil) - list_transfer(dest, sour, sn); -} - -CP_HIDDEN void list_sort(list_t *list, int compare(const void *, const void *)) -{ - list_t extra; - listcount_t middle; - lnode_t *node; - - if (list_count(list) > 1) { - middle = list_count(list) / 2; - node = list_first_priv(list); - - list_init(&extra, list_count(list) - middle); - - while (middle--) - node = lnode_next(node); - - list_transfer(&extra, list, node); - list_sort(list, compare); - list_sort(&extra, compare); - list_merge(list, &extra, compare); - } - assert (list_is_sorted(list, compare)); -} - -CP_HIDDEN lnode_t *list_find(list_t *list, const void *key, int compare(const void *, const void *)) -{ - lnode_t *node; - - for (node = list_first_priv(list); node != list_nil(list); node = node->next) { - if (compare(lnode_get(node), key) == 0) - return node; - } - - return 0; -} - - -/* - * Return 1 if the list is in sorted order, 0 otherwise - */ - -CP_HIDDEN int list_is_sorted(list_t *list, int compare(const void *, const void *)) -{ - lnode_t *node, *next, *nil; - - next = nil = list_nil(list); - node = list_first_priv(list); - - if (node != nil) - next = lnode_next(node); - - for (; next != nil; node = next, next = lnode_next(next)) { - if (compare(lnode_get(node), lnode_get(next)) > 0) - return 0; - } - - return 1; -} - -/* - * Get rid of macro functions definitions so they don't interfere - * with the actual definitions - */ - -#undef list_isempty -#undef list_isfull -#undef lnode_pool_isempty -#undef list_append -#undef list_prepend -#undef list_first -#undef list_last -#undef list_next -#undef list_prev -#undef list_count -#undef list_del_first -#undef list_del_last -#undef lnode_put -#undef lnode_get - -/* - * Return 1 if the list is empty, 0 otherwise - */ - -CP_HIDDEN int list_isempty(list_t *list) -{ - return list->nodecount == 0; -} - -/* - * Return 1 if the list is full, 0 otherwise - * Permitted only on bounded lists. - */ - -CP_HIDDEN int list_isfull(list_t *list) -{ - return list->nodecount == list->maxcount; -} - -/* - * Check if the node pool is empty. - */ - -CP_HIDDEN int lnode_pool_isempty(lnodepool_t *pool) -{ - return (pool->fre == NULL); -} - -/* - * Add the given node at the end of the list - */ - -CP_HIDDEN void list_append(list_t *list, lnode_t *node) -{ - list_ins_before(list, node, &list->nilnode); -} - -/* - * Add the given node at the beginning of the list. - */ - -CP_HIDDEN void list_prepend(list_t *list, lnode_t *node) -{ - list_ins_after(list, node, &list->nilnode); -} - -/* - * Retrieve the first node of the list - */ - -CP_HIDDEN lnode_t *list_first(list_t *list) -{ - if (list->nilnode.next == &list->nilnode) - return NULL; - return list->nilnode.next; -} - -/* - * Retrieve the last node of the list - */ - -CP_HIDDEN lnode_t *list_last(list_t *list) -{ - if (list->nilnode.prev == &list->nilnode) - return NULL; - return list->nilnode.prev; -} - -/* - * Retrieve the count of nodes in the list - */ - -CP_HIDDEN listcount_t list_count(list_t *list) -{ - return list->nodecount; -} - -/* - * Remove the first node from the list and return it. - */ - -CP_HIDDEN lnode_t *list_del_first(list_t *list) -{ - return list_delete(list, list->nilnode.next); -} - -/* - * Remove the last node from the list and return it. - */ - -CP_HIDDEN lnode_t *list_del_last(list_t *list) -{ - return list_delete(list, list->nilnode.prev); -} - - -/* - * Associate a data item with the given node. - */ - -CP_HIDDEN void lnode_put(lnode_t *lnode, void *data) -{ - lnode->data = data; -} - -/* - * Retrieve the data item associated with the node. - */ - -CP_HIDDEN void *lnode_get(lnode_t *lnode) -{ - return lnode->data; -} - -/* - * Retrieve the node's successor. If there is no successor, - * NULL is returned. - */ - -CP_HIDDEN lnode_t *list_next(list_t *list, lnode_t *lnode) -{ - assert (list_contains(list, lnode)); - - if (lnode->next == list_nil(list)) - return NULL; - return lnode->next; -} - -/* - * Retrieve the node's predecessor. See comment for lnode_next(). - */ - -CP_HIDDEN lnode_t *list_prev(list_t *list, lnode_t *lnode) -{ - assert (list_contains(list, lnode)); - - if (lnode->prev == list_nil(list)) - return NULL; - return lnode->prev; -} - -/* - * Return 1 if the lnode is in some list, otherwise return 0. - */ - -CP_HIDDEN int lnode_is_in_a_list(lnode_t *lnode) -{ - return (lnode->next != NULL || lnode->prev != NULL); -} - - -CP_HIDDEN int list_verify(list_t *list) -{ - lnode_t *node = list_first_priv(list), *nil = list_nil(list); - listcount_t count = list_count(list); - - if (node->prev != nil) - return 0; - - if (count > list->maxcount) - return 0; - - while (node != nil && count--) { - if (node->next->prev != node) - return 0; - node = node->next; - } - - if (count != 0 || node != nil) - return 0; - - return 1; -} - -#ifdef KAZLIB_TEST_MAIN - -#include <stdio.h> -#include <string.h> -#include <ctype.h> -#include <stdarg.h> - -typedef char input_t[256]; - -static int tokenize(char *string, ...) -{ - char **tokptr; - va_list arglist; - int tokcount = 0; - - va_start(arglist, string); - tokptr = va_arg(arglist, char **); - while (tokptr) { - while (*string && isspace((unsigned char) *string)) - string++; - if (!*string) - break; - *tokptr = string; - while (*string && !isspace((unsigned char) *string)) - string++; - tokptr = va_arg(arglist, char **); - tokcount++; - if (!*string) - break; - *string++ = 0; - } - va_end(arglist); - - return tokcount; -} - -static int comparef(const void *key1, const void *key2) -{ - return strcmp(key1, key2); -} - -static char *dupstring(char *str) -{ - int sz = strlen(str) + 1; - char *new = malloc(sz); - if (new) - memcpy(new, str, sz); - return new; -} - -int main(void) -{ - input_t in; - list_t *l = list_create(LISTCOUNT_T_MAX); - lnode_t *ln; - char *tok1, *val; - int prompt = 0; - - char *help = - "a <val> append value to list\n" - "d <val> delete value from list\n" - "l <val> lookup value in list\n" - "s sort list\n" - "c show number of entries\n" - "t dump whole list\n" - "p turn prompt on\n" - "q quit"; - - if (!l) - puts("list_create failed"); - - for (;;) { - if (prompt) - putchar('>'); - fflush(stdout); - - if (!fgets(in, sizeof(input_t), stdin)) - break; - - switch(in[0]) { - case '?': - puts(help); - break; - case 'a': - if (tokenize(in+1, &tok1, (char **) 0) != 1) { - puts("what?"); - break; - } - val = dupstring(tok1); - ln = lnode_create(val); - - if (!val || !ln) { - puts("allocation failure"); - if (ln) - lnode_destroy(ln); - free(val); - break; - } - - list_append(l, ln); - break; - case 'd': - if (tokenize(in+1, &tok1, (char **) 0) != 1) { - puts("what?"); - break; - } - ln = list_find(l, tok1, comparef); - if (!ln) { - puts("list_find failed"); - break; - } - list_delete(l, ln); - val = lnode_get(ln); - lnode_destroy(ln); - free(val); - break; - case 'l': - if (tokenize(in+1, &tok1, (char **) 0) != 1) { - puts("what?"); - break; - } - ln = list_find(l, tok1, comparef); - if (!ln) - puts("list_find failed"); - else - puts("found"); - break; - case 's': - list_sort(l, comparef); - break; - case 'c': - printf("%lu\n", (unsigned long) list_count(l)); - break; - case 't': - for (ln = list_first(l); ln != 0; ln = list_next(l, ln)) - puts(lnode_get(ln)); - break; - case 'q': - exit(0); - break; - case '\0': - break; - case 'p': - prompt = 1; - break; - default: - putchar('?'); - putchar('\n'); - break; - } - } - - return 0; -} - -#endif /* defined TEST_MAIN */ diff --git a/lib/cpluff/kazlib/list.h b/lib/cpluff/kazlib/list.h deleted file mode 100644 index ccad262327..0000000000 --- a/lib/cpluff/kazlib/list.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * List Abstract Data Type - * Copyright (C) 1997 Kaz Kylheku <kaz@ashi.footprints.net> - * - * Free Software License: - * - * All rights are reserved by the author, with the following exceptions: - * Permission is granted to freely reproduce and distribute this software, - * possibly in exchange for a fee, provided that this copyright notice appears - * intact. Permission is also granted to adapt this software to produce - * derivative works, as long as the modified versions carry this copyright - * notice and additional notices stating that the work has been modified. - * This source code may be translated into executable form and incorporated - * into proprietary software; there is no requirement for such software to - * contain a copyright notice related to this source. - * - * $Id: list.h,v 1.19 1999/11/14 20:46:19 kaz Exp $ - * $Name: kazlib_1_20 $ - */ - -/* - * Modified by Johannes Lehtinen in 2006-2007. - * Included the definition of CP_HIDDEN macro and used it in declarations and - * definitions to hide Kazlib symbols when building a shared C-Pluff library. - */ - -#ifndef LIST_H -#define LIST_H - -#ifdef _WIN32 -#include "../libcpluff/win32/cpluffdef.h" -#else -#include "../libcpluff/cpluffdef.h" -#endif - -#include <limits.h> - -#ifdef KAZLIB_SIDEEFFECT_DEBUG -#include "sfx.h" -#define LIST_SFX_CHECK(E) SFX_CHECK(E) -#else -#define LIST_SFX_CHECK(E) (E) -#endif - -/* - * Blurb for inclusion into C++ translation units - */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef unsigned long listcount_t; -#define LISTCOUNT_T_MAX ULONG_MAX - -typedef struct lnode_t { - #if defined(LIST_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) - struct lnode_t *list_next; - struct lnode_t *list_prev; - void *list_data; - #else - int list_dummy; - #endif -} lnode_t; - -typedef struct lnodepool_t { - #if defined(LIST_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) - struct lnode_t *list_pool; - struct lnode_t *list_free; - listcount_t list_size; - #else - int list_dummy; - #endif -} lnodepool_t; - -typedef struct list_t { - #if defined(LIST_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) - lnode_t list_nilnode; - listcount_t list_nodecount; - listcount_t list_maxcount; - #else - int list_dummy; - #endif -} list_t; - -CP_HIDDEN lnode_t *lnode_create(void *); -CP_HIDDEN lnode_t *lnode_init(lnode_t *, void *); -CP_HIDDEN void lnode_destroy(lnode_t *); -CP_HIDDEN void lnode_put(lnode_t *, void *); -CP_HIDDEN void *lnode_get(lnode_t *); -CP_HIDDEN int lnode_is_in_a_list(lnode_t *); - -#if defined(LIST_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) -#define lnode_put(N, D) ((N)->list_data = (D)) -#define lnode_get(N) ((N)->list_data) -#endif - -CP_HIDDEN lnodepool_t *lnode_pool_init(lnodepool_t *, lnode_t *, listcount_t); -CP_HIDDEN lnodepool_t *lnode_pool_create(listcount_t); -CP_HIDDEN void lnode_pool_destroy(lnodepool_t *); -CP_HIDDEN lnode_t *lnode_borrow(lnodepool_t *, void *); -CP_HIDDEN void lnode_return(lnodepool_t *, lnode_t *); -CP_HIDDEN int lnode_pool_isempty(lnodepool_t *); -CP_HIDDEN int lnode_pool_isfrom(lnodepool_t *, lnode_t *); - -CP_HIDDEN list_t *list_init(list_t *, listcount_t); -CP_HIDDEN list_t *list_create(listcount_t); -CP_HIDDEN void list_destroy(list_t *); -CP_HIDDEN void list_destroy_nodes(list_t *); -CP_HIDDEN void list_return_nodes(list_t *, lnodepool_t *); - -CP_HIDDEN listcount_t list_count(list_t *); -CP_HIDDEN int list_isempty(list_t *); -CP_HIDDEN int list_isfull(list_t *); -CP_HIDDEN int list_contains(list_t *, lnode_t *); - -CP_HIDDEN void list_append(list_t *, lnode_t *); -CP_HIDDEN void list_prepend(list_t *, lnode_t *); -CP_HIDDEN void list_ins_before(list_t *, lnode_t *, lnode_t *); -CP_HIDDEN void list_ins_after(list_t *, lnode_t *, lnode_t *); - -CP_HIDDEN lnode_t *list_first(list_t *); -CP_HIDDEN lnode_t *list_last(list_t *); -CP_HIDDEN lnode_t *list_next(list_t *, lnode_t *); -CP_HIDDEN lnode_t *list_prev(list_t *, lnode_t *); - -CP_HIDDEN lnode_t *list_del_first(list_t *); -CP_HIDDEN lnode_t *list_del_last(list_t *); -CP_HIDDEN lnode_t *list_delete(list_t *, lnode_t *); - -CP_HIDDEN void list_process(list_t *, void *, void (*)(list_t *, lnode_t *, void *)); - -CP_HIDDEN int list_verify(list_t *); - -#if defined(LIST_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) -#define lnode_pool_isempty(P) ((P)->list_free == 0) -#define list_count(L) ((L)->list_nodecount) -#define list_isempty(L) ((L)->list_nodecount == 0) -#define list_isfull(L) (LIST_SFX_CHECK(L)->list_nodecount == (L)->list_maxcount) -#define list_next(L, N) (LIST_SFX_CHECK(N)->list_next == &(L)->list_nilnode ? NULL : (N)->list_next) -#define list_prev(L, N) (LIST_SFX_CHECK(N)->list_prev == &(L)->list_nilnode ? NULL : (N)->list_prev) -#define list_first(L) list_next(LIST_SFX_CHECK(L), &(L)->list_nilnode) -#define list_last(L) list_prev(LIST_SFX_CHECK(L), &(L)->list_nilnode) -#endif - -#if defined(LIST_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) -#define list_append(L, N) list_ins_before(LIST_SFX_CHECK(L), N, &(L)->list_nilnode) -#define list_prepend(L, N) list_ins_after(LIST_SFX_CHECK(L), N, &(L)->list_nilnode) -#define list_del_first(L) list_delete(LIST_SFX_CHECK(L), list_first(L)) -#define list_del_last(L) list_delete(LIST_SFX_CHECK(L), list_last(L)) -#endif - -/* destination list on the left, source on the right */ - -CP_HIDDEN void list_extract(list_t *, list_t *, lnode_t *, lnode_t *); -CP_HIDDEN void list_transfer(list_t *, list_t *, lnode_t *first); -CP_HIDDEN void list_merge(list_t *, list_t *, int (const void *, const void *)); -CP_HIDDEN void list_sort(list_t *, int (const void *, const void *)); -CP_HIDDEN lnode_t *list_find(list_t *, const void *, int (const void *, const void *)); -CP_HIDDEN int list_is_sorted(list_t *, int (const void *, const void *)); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/lib/cpluff/libcpluff/Makefile.am b/lib/cpluff/libcpluff/Makefile.am deleted file mode 100644 index 0f121e012a..0000000000 --- a/lib/cpluff/libcpluff/Makefile.am +++ /dev/null @@ -1,75 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -SUBDIRS = docsrc - -LIBS = @LIBS_LIBCPLUFF@ @LTLIBINTL@ @LIBS@ - -CPPFLAGS = @CPPFLAGS@ -CPPFLAGS += -I. -DCP_C_API=CP_EXPORT -DCP_HOST="\"$(host)\"" -DCP_DATADIR="\"$(datadir)\"" -# the following symbols are clashing with mariadb symbols -CPPFLAGS += -Dhash_delete=kazlib_hash_delete -Dhash_free=kazlib_hash_free -Dhash_insert=kazlib_hash_insert -Dlist_delete=kazlib_list_delete - -DOXYGEN = doxygen -DOXYGEN_SOURCE = cpluffdef.h $(srcdir)/cpluff.h $(srcdir)/docsrc/*.dox -DOXYGEN_STYLE = $(top_srcdir)/docsrc/doxygen.footer $(top_srcdir)/docsrc/doxygen.css - -lib_LTLIBRARIES = libcpluff.la -libcpluff_la_SOURCES = psymbol.c pscan.c ploader.c pinfo.c pcontrol.c serial.c logging.c context.c cpluff.c util.c ../kazlib/list.c ../kazlib/list.h ../kazlib/hash.c ../kazlib/hash.h internal.h thread.h util.h defines.h -if POSIX_THREADS -libcpluff_la_SOURCES += thread_posix.c -endif -if WINDOWS_THREADS -libcpluff_la_SOURCES += thread_windows.c -endif -libcpluff_la_LDFLAGS = -no-undefined -version-info $(CP_C_LIB_VERSION) - -include_HEADERS = cpluff.h cpluffdef.h - -doc: refdoc - -refdoc: doc/reference/c-api/index.html - -doc/reference/c-api/index.html: $(DOXYGEN_SOURCE) $(top_srcdir)/doc/img/architecture.png docsrc/Doxyfile-ref $(DOXYGEN_STYLE) - rm -rf doxygen-ref - mkdir -p doxygen-ref - cp -p $^ doxygen-ref - cd doxygen-ref && $(DOXYGEN) Doxyfile-ref - mkdir -p doc/reference - rm -rf doc/reference/c-api - mv doxygen-ref/html doc/reference/c-api - rm -rf doxygen-ref - -impldoc: doc/implementation/c-api/index.html - -doc/implementation/c-api/index.html: $(srcdir)/*.h $(srcdir)/*.c cpluffdef.h ../config.h docsrc/Doxyfile-impl $(DOXYGEN_STYLE) - rm -rf doxygen-impl - mkdir -p doxygen-impl - cp -p $^ doxygen-impl - cd doxygen-impl && $(DOXYGEN) Doxyfile-impl - mkdir -p doc/implementation - rm -rf doc/implementation/c-api - mv doxygen-impl/html doc/implementation/c-api - rm -rf doxygen-impl - -dist-hook: refdoc - mkdir -p $(top_distdir)/doc/reference - cp -rp doc/reference/c-api $(top_distdir)/doc/reference - -clean-local: - rm -rf doc - -check-local: - rc=0; \ - find '$(srcdir)' -name '*.c' -print | while read f; do \ - if grep -q -E 'cpi_(debug|warn|error)f?\(.*[^N]_\(' "$$f"; then \ - echo "invalid use of cpi_(debug|warn|error)f? macros in $$f."; \ - rc=1; \ - fi; \ - done; \ - exit $$rc - -.PHONY: doc refdoc impldoc diff --git a/lib/cpluff/libcpluff/context.c b/lib/cpluff/libcpluff/context.c deleted file mode 100644 index 0a38c6d516..0000000000 --- a/lib/cpluff/libcpluff/context.c +++ /dev/null @@ -1,530 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Plug-in context implementation - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <assert.h> -#include <stdarg.h> -#include <string.h> -#include "../kazlib/list.h" -#include "cpluff.h" -#include "util.h" -#ifdef CP_THREADS -#include "thread.h" -#endif -#include "internal.h" - - -/* ------------------------------------------------------------------------ - * Variables - * ----------------------------------------------------------------------*/ - -/// Existing contexts -static list_t *contexts = NULL; - - -/* ------------------------------------------------------------------------ - * Function definitions - * ----------------------------------------------------------------------*/ - -// Generic - -static void free_plugin_env(cp_plugin_env_t *env) { - assert(env != NULL); - - // Free environment data - if (env->plugin_listeners != NULL) { - cpi_unregister_plisteners(env->plugin_listeners, NULL); - list_destroy(env->plugin_listeners); - env->plugin_listeners = NULL; - } - if (env->loggers != NULL) { - cpi_unregister_loggers(env->loggers, NULL); - list_destroy(env->loggers); - env->loggers = NULL; - } - if (env->plugin_dirs != NULL) { - list_process(env->plugin_dirs, NULL, cpi_process_free_ptr); - list_destroy(env->plugin_dirs); - env->plugin_dirs = NULL; - } - if (env->infos != NULL) { - assert(hash_isempty(env->infos)); - hash_destroy(env->infos); - env->infos = NULL; - } - if (env->plugins != NULL) { - assert(hash_isempty(env->plugins)); - hash_destroy(env->plugins); - env->plugins = NULL; - } - if (env->started_plugins != NULL) { - assert(list_isempty(env->started_plugins)); - list_destroy(env->started_plugins); - env->started_plugins = NULL; - } - if (env->ext_points != NULL) { - assert(hash_isempty(env->ext_points)); - hash_destroy(env->ext_points); - } - if (env->extensions != NULL) { - assert(hash_isempty(env->extensions)); - hash_destroy(env->extensions); - } - if (env->run_funcs != NULL) { - assert(list_isempty(env->run_funcs)); - list_destroy(env->run_funcs); - } - - // Destroy mutex -#ifdef CP_THREADS - if (env->mutex != NULL) { - cpi_destroy_mutex(env->mutex); - } -#endif - - // Free environment - free(env); - -} - -CP_HIDDEN void cpi_free_context(cp_context_t *context) { - assert(context != NULL); - - // Free environment if this is the client program context - if (context->plugin == NULL && context->env != NULL) { - free_plugin_env(context->env); - } - - // Destroy symbol lists - if (context->resolved_symbols != NULL) { - assert(hash_isempty(context->resolved_symbols)); - hash_destroy(context->resolved_symbols); - } - if (context->symbol_providers != NULL) { - assert(hash_isempty(context->symbol_providers)); - hash_destroy(context->symbol_providers); - } - - // Free context - free(context); -} - -CP_HIDDEN cp_context_t * cpi_new_context(cp_plugin_t *plugin, cp_plugin_env_t *env, cp_status_t *error) { - cp_context_t *context = NULL; - cp_status_t status = CP_OK; - - assert(env != NULL); - assert(error != NULL); - - do { - - // Allocate memory for the context - if ((context = malloc(sizeof(cp_context_t))) == NULL) { - status = CP_ERR_RESOURCE; - break; - } - - // Initialize context - context->plugin = plugin; - context->env = env; - context->resolved_symbols = NULL; - context->symbol_providers = NULL; - - } while (0); - - // Free context on error - if (status != CP_OK && context != NULL) { - free(context); - context = NULL; - } - - *error = status; - return context; -} - -CP_C_API cp_context_t * cp_create_context(cp_status_t *error) { - cp_plugin_env_t *env = NULL; - cp_context_t *context = NULL; - cp_status_t status = CP_OK; - - // Initialize internal state - do { - - // Allocate memory for the plug-in environment - if ((env = malloc(sizeof(cp_plugin_env_t))) == NULL) { - status = CP_ERR_RESOURCE; - break; - } - - // Initialize plug-in environment - memset(env, 0, sizeof(cp_plugin_env_t)); -#ifdef CP_THREADS - env->mutex = cpi_create_mutex(); -#endif - env->argc = 0; - env->argv = NULL; - env->plugin_listeners = list_create(LISTCOUNT_T_MAX); - env->loggers = list_create(LISTCOUNT_T_MAX); - env->log_min_severity = CP_LOG_NONE; - env->plugin_dirs = list_create(LISTCOUNT_T_MAX); - env->infos = hash_create(HASHCOUNT_T_MAX, cpi_comp_ptr, cpi_hashfunc_ptr); - env->plugins = hash_create(HASHCOUNT_T_MAX, - (int (*)(const void *, const void *)) strcmp, NULL); - env->started_plugins = list_create(LISTCOUNT_T_MAX); - env->ext_points = hash_create(HASHCOUNT_T_MAX, - (int (*)(const void *, const void *)) strcmp, NULL); - env->extensions = hash_create(HASHCOUNT_T_MAX, - (int (*)(const void *, const void *)) strcmp, NULL); - env->run_funcs = list_create(LISTCOUNT_T_MAX); - env->run_wait = NULL; - if (env->plugin_listeners == NULL - || env->loggers == NULL -#ifdef CP_THREADS - || env->mutex == NULL -#endif - || env->plugin_dirs == NULL - || env->infos == NULL - || env->plugins == NULL - || env->started_plugins == NULL - || env->ext_points == NULL - || env->extensions == NULL - || env->run_funcs == NULL) { - status = CP_ERR_RESOURCE; - break; - } - - // Create the plug-in context - if ((context = cpi_new_context(NULL, env, &status)) == NULL) { - break; - } - env = NULL; - - // Create a context list, if necessary, and add context to the list - cpi_lock_framework(); - if (contexts == NULL) { - if ((contexts = list_create(LISTCOUNT_T_MAX)) == NULL) { - status = CP_ERR_RESOURCE; - } - } - if (status == CP_OK) { - lnode_t *node; - - if ((node = lnode_create(context)) == NULL) { - status = CP_ERR_RESOURCE; - } else { - list_append(contexts, node); - } - } - cpi_unlock_framework(); - - } while (0); - - // Release resources on failure - if (status != CP_OK) { - if (env != NULL) { - free_plugin_env(env); - } - if (context != NULL) { - cpi_free_context(context); - } - context = NULL; - } - - // Return the final status - if (error != NULL) { - *error = status; - } - - // Return the context (or NULL on failure) - return context; -} - -CP_C_API void cp_destroy_context(cp_context_t *context) { - CHECK_NOT_NULL(context); - if (context->plugin != NULL) { - cpi_fatalf(_("Only the main program can destroy a plug-in context.")); - } - - // Check invocation - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_ANY, __func__); - cpi_unlock_context(context); - -#ifdef CP_THREADS - assert(context->env->mutex == NULL || !cpi_is_mutex_locked(context->env->mutex)); -#else - assert(!context->env->locked); -#endif - - // Remove context from the context list - cpi_lock_framework(); - if (contexts != NULL) { - lnode_t *node; - - if ((node = list_find(contexts, context, cpi_comp_ptr)) != NULL) { - list_delete(contexts, node); - lnode_destroy(node); - } - } - cpi_unlock_framework(); - - // Unload all plug-ins - cp_uninstall_plugins(context); - - // Release remaining information objects - cpi_release_infos(context); - - // Free context - cpi_free_context(context); -} - -CP_HIDDEN void cpi_destroy_all_contexts(void) { - cpi_lock_framework(); - if (contexts != NULL) { - lnode_t *node; - - while ((node = list_last(contexts)) != NULL) { - cpi_unlock_framework(); - cp_destroy_context(lnode_get(node)); - cpi_lock_framework(); - } - list_destroy(contexts); - contexts = NULL; - } - cpi_unlock_framework(); -} - - -// Plug-in directories - -CP_C_API cp_status_t cp_register_pcollection(cp_context_t *context, const char *dir) { - char *d = NULL; - lnode_t *node = NULL; - cp_status_t status = CP_OK; - - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(dir); - - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_ANY, __func__); - do { - - // Check if directory has already been registered - if (list_find(context->env->plugin_dirs, dir, (int (*)(const void *, const void *)) strcmp) != NULL) { - break; - } - - // Allocate resources - d = malloc(sizeof(char) * (strlen(dir) + 1)); - node = lnode_create(d); - if (d == NULL || node == NULL) { - status = CP_ERR_RESOURCE; - break; - } - - // Register directory - strcpy(d, dir); - list_append(context->env->plugin_dirs, node); - - } while (0); - - // Report error or success - if (status != CP_OK) { - cpi_errorf(context, N_("The plug-in collection in path %s could not be registered due to insufficient memory."), dir); - } else { - cpi_debugf(context, N_("The plug-in collection in path %s was registered."), dir); - } - cpi_unlock_context(context); - - // Release resources on failure - if (status != CP_OK) { - if (d != NULL) { - free(d); - } - if (node != NULL) { - lnode_destroy(node); - } - } - - return status; -} - -CP_C_API void cp_unregister_pcollection(cp_context_t *context, const char *dir) { - char *d; - lnode_t *node; - - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(dir); - - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_ANY, __func__); - node = list_find(context->env->plugin_dirs, dir, (int (*)(const void *, const void *)) strcmp); - if (node != NULL) { - d = lnode_get(node); - list_delete(context->env->plugin_dirs, node); - lnode_destroy(node); - free(d); - } - cpi_debugf(context, N_("The plug-in collection in path %s was unregistered."), dir); - cpi_unlock_context(context); -} - -CP_C_API void cp_unregister_pcollections(cp_context_t *context) { - CHECK_NOT_NULL(context); - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_ANY, __func__); - list_process(context->env->plugin_dirs, NULL, cpi_process_free_ptr); - cpi_debug(context, N_("All plug-in collections were unregistered.")); - cpi_unlock_context(context); -} - - -// Startup arguments - -CP_C_API void cp_set_context_args(cp_context_t *ctx, char **argv) { - int argc; - - CHECK_NOT_NULL(ctx); - CHECK_NOT_NULL(argv); - for (argc = 0; argv[argc] != NULL; argc++); - if (argc < 1) { - cpi_fatalf(_("At least one startup argument must be given in call to function %s."), __func__); - } - cpi_lock_context(ctx); - ctx->env->argc = argc; - ctx->env->argv = argv; - cpi_unlock_context(ctx); -} - -CP_C_API char **cp_get_context_args(cp_context_t *ctx, int *argc) { - char **argv; - - CHECK_NOT_NULL(ctx); - cpi_lock_context(ctx); - if (argc != NULL) { - *argc = ctx->env->argc; - } - argv = ctx->env->argv; - cpi_unlock_context(ctx); - return argv; -} - - -// Checking API call invocation - -CP_HIDDEN void cpi_check_invocation(cp_context_t *ctx, int funcmask, const char *func) { - assert(ctx != NULL); - assert(funcmask != 0); - assert(func != NULL); - assert(cpi_is_context_locked(ctx)); - if ((funcmask & CPI_CF_LOGGER) - &&ctx->env->in_logger_invocation) { - cpi_fatalf(_("Function %s was called from within a logger invocation."), func); - } - if ((funcmask & CPI_CF_LISTENER) - && ctx->env->in_event_listener_invocation) { - cpi_fatalf(_("Function %s was called from within an event listener invocation."), func); - } - if ((funcmask & CPI_CF_START) - && ctx->env->in_start_func_invocation) { - cpi_fatalf(_("Function %s was called from within a plug-in start function invocation."), func); - } - if ((funcmask & CPI_CF_STOP) - && ctx->env->in_stop_func_invocation) { - cpi_fatalf(_("Function %s was called from within a plug-in stop function invocation."), func); - } - if (ctx->env->in_create_func_invocation) { - cpi_fatalf(_("Function %s was called from within a plug-in create function invocation."), func); - } - if (ctx->env->in_destroy_func_invocation) { - cpi_fatalf(_("Function %s was called from within a plug-in destroy function invocation."), func); - } -} - - -// Locking - -#if defined(CP_THREADS) || !defined(NDEBUG) - -CP_HIDDEN void cpi_lock_context(cp_context_t *context) { -#if defined(CP_THREADS) - cpi_lock_mutex(context->env->mutex); -#elif !defined(NDEBUG) - context->env->locked++; -#endif -} - -CP_HIDDEN void cpi_unlock_context(cp_context_t *context) { -#if defined(CP_THREADS) - cpi_unlock_mutex(context->env->mutex); -#elif !defined(NDEBUG) - assert(context->env->locked > 0); - context->env->locked--; -#endif -} - -CP_HIDDEN void cpi_wait_context(cp_context_t *context) { -#if defined(CP_THREADS) - cpi_wait_mutex(context->env->mutex); -#elif !defined(NDEBUG) - assert(context->env->locked > 0); - assert(0); -#endif -} - -CP_HIDDEN void cpi_signal_context(cp_context_t *context) { -#if defined(CP_THREADS) - cpi_signal_mutex(context->env->mutex); -#elif !defined(NDEBUG) - assert(context->env->locked > 0); -#endif -} - - -// Debug helpers - -CP_HIDDEN char *cpi_context_owner(cp_context_t *ctx, char *name, size_t size) { - if (ctx->plugin != NULL) { - /* TRANSLATORS: The context owner (when it is a plug-in) used in some strings. - Search for "context owner" to find these strings. */ - snprintf(name, size, _("Plug-in %s"), ctx->plugin->plugin->identifier); - } else { - /* TRANSLATORS: The context owner (when it is the main program) used in some strings. - Search for "context owner" to find these strings. */ - strncpy(name, _("The main program"), size); - } - assert(size >= 4); - strcpy(name + size - 4, "..."); - return name; -} - -#endif diff --git a/lib/cpluff/libcpluff/cpluff.c b/lib/cpluff/libcpluff/cpluff.c deleted file mode 100644 index 59b6d5ab77..0000000000 --- a/lib/cpluff/libcpluff/cpluff.c +++ /dev/null @@ -1,188 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Core framework functions - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> -#include <assert.h> -#ifdef DLOPEN_LIBTOOL -#include <ltdl.h> -#endif -#include "cpluff.h" -#include "defines.h" -#include "util.h" -#ifdef CP_THREADS -#include "thread.h" -#endif -#include "internal.h" - - -/* ------------------------------------------------------------------------ - * Variables - * ----------------------------------------------------------------------*/ - -/// Number of initializations -static int initialized = 0; - -#ifdef CP_THREADS - -/// Framework mutex -static cpi_mutex_t *framework_mutex = NULL; - -#elif !defined(NDEBUG) - -/// Framework locking count -static int framework_locked = 0; - -#endif - -/// Fatal error handler, or NULL for default -static cp_fatal_error_func_t fatal_error_handler = NULL; - - -/* ------------------------------------------------------------------------ - * Function definitions - * ----------------------------------------------------------------------*/ - -CP_C_API const char *cp_get_version(void) { - return CP_VERSION; -} - -CP_C_API const char *cp_get_host_type(void) { - return CP_HOST; -} - -CP_HIDDEN void cpi_lock_framework(void) { -#if defined(CP_THREADS) - cpi_lock_mutex(framework_mutex); -#elif !defined(NDEBUG) - framework_locked++; -#endif -} - -CP_HIDDEN void cpi_unlock_framework(void) { -#if defined(CP_THREADS) - cpi_unlock_mutex(framework_mutex); -#elif !defined(NDEBUG) - assert(framework_locked > 0); - framework_locked--; -#endif -} - -static void reset(void) { -#ifdef CP_THREADS - if (framework_mutex != NULL) { - cpi_destroy_mutex(framework_mutex); - framework_mutex = NULL; - } -#endif -} - -CP_C_API cp_status_t cp_init(void) { - cp_status_t status = CP_OK; - - // Initialize if necessary - do { - if (!initialized) { - bindtextdomain(PACKAGE, CP_DATADIR CP_FNAMESEP_STR "locale"); -#ifdef CP_THREADS - if ((framework_mutex = cpi_create_mutex()) == NULL) { - status = CP_ERR_RESOURCE; - break; - } -#endif -#ifdef DLOPEN_LIBTOOL - if (lt_dlinit()) { - status = CP_ERR_RESOURCE; - break; - } -#endif - } - initialized++; - } while (0); - - // Rollback on failure - if (status != CP_OK) { - reset(); - } - - return status; -} - -CP_C_API void cp_destroy(void) { - if (initialized <= 0) { - cpi_fatalf(_("Attempt to destroy uninitialized framework.")); - } - initialized--; - if (!initialized) { -#ifdef CP_THREADS - assert(framework_mutex == NULL || !cpi_is_mutex_locked(framework_mutex)); -#else - assert(!framework_locked); -#endif - cpi_destroy_all_contexts(); -#ifdef DLOPEN_LIBTOOL - lt_dlexit(); -#endif - reset(); - } -} - -CP_C_API void cp_set_fatal_error_handler(cp_fatal_error_func_t error_handler) { - fatal_error_handler = error_handler; -} - -CP_HIDDEN void cpi_fatalf(const char *msg, ...) { - va_list params; - char fmsg[256]; - - // Format message - assert(msg != NULL); - va_start(params, msg); - vsnprintf(fmsg, sizeof(fmsg), msg, params); - va_end(params); - fmsg[sizeof(fmsg)/sizeof(char) - 1] = '\0'; - - // Call error handler or print the error message - if (fatal_error_handler != NULL) { - fatal_error_handler(fmsg); - } else { - fprintf(stderr, _("C-Pluff: FATAL ERROR: %s\n"), fmsg); - } - - // Abort if still alive - abort(); -} - -CP_HIDDEN void cpi_fatal_null_arg(const char *arg, const char *func) { - cpi_fatalf(_("Argument %s has illegal NULL value in call to function %s."), arg, func); -} diff --git a/lib/cpluff/libcpluff/cpluff.h b/lib/cpluff/libcpluff/cpluff.h deleted file mode 100644 index d497af3dc7..0000000000 --- a/lib/cpluff/libcpluff/cpluff.h +++ /dev/null @@ -1,1520 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * C-Pluff C API header file. - * The elements declared here constitute the C-Pluff C API. To use the - * API include this file and link the main program and plug-in runtime - * libraries with the C-Pluff C library. In addition to local declarations, - * this file also includes cpluffdef.h header file for defines common to C - * and C++ API. - */ - -#ifndef CPLUFF_H_ -#define CPLUFF_H_ - -/** - * @defgroup cDefines Defines - * Preprocessor defines. - */ - -#ifdef _WIN32 -#include "win32/cpluffdef.h" -#else -#include "cpluffdef.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif /*__cplusplus*/ - - -/* ------------------------------------------------------------------------ - * Defines - * ----------------------------------------------------------------------*/ - -/** - * @def CP_C_API - * @ingroup cDefines - * - * Marks a symbol declaration to be part of the C-Pluff C API. - * This macro declares the symbol to be imported from the C-Pluff library. - */ - -#ifndef CP_C_API -#define CP_C_API CP_IMPORT -#endif - - -/** - * @defgroup cScanFlags Flags for plug-in scanning - * @ingroup cDefines - * - * These constants can be orred together for the flags - * parameter of ::cp_scan_plugins. - */ -/*@{*/ - -/** - * This flag enables upgrades of installed plug-ins by unloading - * the old version and installing the new version. - */ -#define CP_SP_UPGRADE 0x01 - -/** - * This flag causes all plug-ins to be stopped before any - * plug-ins are to be upgraded. - */ -#define CP_SP_STOP_ALL_ON_UPGRADE 0x02 - -/** - * This flag causes all plug-ins to be stopped before any - * plugins are to be installed (also if new version is to be installed - * as part of an upgrade). - */ -#define CP_SP_STOP_ALL_ON_INSTALL 0x04 - -/** - * Setting this flag causes the currently active plug-ins to be restarted - * after all changes to the plug-ins have been made (if they were stopped). - */ -#define CP_SP_RESTART_ACTIVE 0x08 - -/*@}*/ - - -/* ------------------------------------------------------------------------ - * Data types - * ----------------------------------------------------------------------*/ - -/** - * @defgroup cEnums Enumerations - * Constant value enumerations. - */ - -/** - * @defgroup cTypedefs Typedefs - * Typedefs of various kind. - */ - -/** - * @defgroup cStructs Data structures - * Data structure definitions. - */ - - -/* Enumerations */ - -/** - * @ingroup cEnums - * - * An enumeration of status codes returned by API functions. - * Most of the interface functions return a status code. The returned - * status code either indicates successful completion of the operation - * or some specific kind of error. Some functions do not return a status - * code because they never fail. - */ -enum cp_status_t { - - /** - * Operation was performed successfully (equals to zero). - * @showinitializer - */ - CP_OK = 0, - - /** Not enough memory or other operating system resources available */ - CP_ERR_RESOURCE, - - /** The specified object is unknown to the framework */ - CP_ERR_UNKNOWN, - - /** An I/O error occurred */ - CP_ERR_IO, - - /** Malformed plug-in descriptor was encountered when loading a plug-in */ - CP_ERR_MALFORMED, - - /** Plug-in or symbol conflicts with another plug-in or symbol. */ - CP_ERR_CONFLICT, - - /** Plug-in dependencies could not be satisfied. */ - CP_ERR_DEPENDENCY, - - /** Plug-in runtime signaled an error. */ - CP_ERR_RUNTIME - -}; - -/** - * @ingroup cEnums - * An enumeration of possible plug-in states. Plug-in states are controlled - * by @ref cFuncsPlugin "plug-in management functions". Plug-in states can be - * observed by @ref cp_register_plistener "registering" a - * @ref cp_plugin_listener_func_t "plug-in listener function" - * or by calling ::cp_get_plugin_state. - * - * @sa cp_plugin_listener_t - * @sa cp_get_plugin_state - */ -enum cp_plugin_state_t { - - /** - * Plug-in is not installed. No plug-in information has been - * loaded. - */ - CP_PLUGIN_UNINSTALLED, - - /** - * Plug-in is installed. At this stage the plug-in information has - * been loaded but its dependencies to other plug-ins has not yet - * been resolved. The plug-in runtime has not been loaded yet. - * The extension points and extensions provided by the plug-in - * have been registered. - */ - CP_PLUGIN_INSTALLED, - - /** - * Plug-in dependencies have been resolved. At this stage it has - * been verified that the dependencies of the plug-in are satisfied - * and the plug-in runtime has been loaded but it is not active - * (it has not been started or it has been stopped). - * Plug-in is resolved when a dependent plug-in is being - * resolved or before the plug-in is started. Plug-in is put - * back to installed stage if its dependencies are being - * uninstalled. - */ - CP_PLUGIN_RESOLVED, - - /** - * Plug-in is starting. The plug-in has been resolved and the start - * function (if any) of the plug-in runtime is about to be called. - * A plug-in is started when explicitly requested by the main - * program or when a dependent plug-in is about to be started or when - * a dynamic symbol defined by the plug-in is being resolved. This state - * is omitted and the state changes directly from resolved to active - * if the plug-in runtime does not define a start function. - */ - CP_PLUGIN_STARTING, - - /** - * Plug-in is stopping. The stop function (if any) of the plug-in - * runtime is about to be called. A plug-in is stopped if the start - * function fails or when stopping is explicitly - * requested by the main program or when its dependencies are being - * stopped. This state is omitted and the state changes directly from - * active to resolved if the plug-in runtime does not define a stop - * function. - */ - CP_PLUGIN_STOPPING, - - /** - * Plug-in has been successfully started and it has not yet been - * stopped. - */ - CP_PLUGIN_ACTIVE - -}; - -/** - * @ingroup cEnums - * An enumeration of possible message severities for framework logging. These - * constants are used when passing a log message to a - * @ref cp_logger_func_t "logger function" and when - * @ref cp_register_logger "registering" a logger function. - */ -enum cp_log_severity_t { - - /** Used for detailed debug messages */ - CP_LOG_DEBUG, - - /** Used for informational messages such as plug-in state changes */ - CP_LOG_INFO, - - /** Used for messages warning about possible problems */ - CP_LOG_WARNING, - - /** Used for messages reporting errors */ - CP_LOG_ERROR - -}; - -/*@}*/ - - -/* Typedefs */ - -/** - * @defgroup cTypedefsOpaque Opaque types - * @ingroup cTypedefs - * Opaque data type definitions. - */ -/*@{*/ - -/** - * A plug-in context represents the co-operation environment of a set of - * plug-ins from the perspective of a particular participating plug-in or - * the perspective of the main program. It is used as an opaque handle to - * the shared resources but the framework also uses the context to identify - * the plug-in or the main program invoking framework functions. Therefore - * a plug-in should not generally expose its context instance to other - * plug-ins or the main program and neither should the main program - * expose its context instance to plug-ins. The main program creates - * plug-in contexts using ::cp_create_context and plug-ins receive their - * plug-in contexts via @ref cp_plugin_runtime_t::create. - */ -typedef struct cp_context_t cp_context_t; - -/*@}*/ - - /** - * @defgroup cTypedefsShorthand Shorthand type names - * @ingroup cTypedefs - * Shorthand type names for structs and enumerations. - */ -/*@{*/ - -/** A type for cp_plugin_info_t structure. */ -typedef struct cp_plugin_info_t cp_plugin_info_t; - -/** A type for cp_plugin_import_t structure. */ -typedef struct cp_plugin_import_t cp_plugin_import_t; - -/** A type for cp_ext_point_t structure. */ -typedef struct cp_ext_point_t cp_ext_point_t; - -/** A type for cp_extension_t structure. */ -typedef struct cp_extension_t cp_extension_t; - -/** A type for cp_cfg_element_t structure. */ -typedef struct cp_cfg_element_t cp_cfg_element_t; - -/** A type for cp_plugin_runtime_t structure. */ -typedef struct cp_plugin_runtime_t cp_plugin_runtime_t; - -/** A type for cp_status_t enumeration. */ -typedef enum cp_status_t cp_status_t; - -/** A type for cp_plugin_state_t enumeration. */ -typedef enum cp_plugin_state_t cp_plugin_state_t; - -/** A type for cp_log_severity_t enumeration. */ -typedef enum cp_log_severity_t cp_log_severity_t; - -/*@}*/ - -/** - * @defgroup cTypedefsFuncs Callback function types - * @ingroup cTypedefs - * Typedefs for client supplied callback functions. - */ -/*@{*/ - -/** - * A listener function called synchronously after a plugin state change. - * The function should return promptly. - * @ref cFuncsInit "Library initialization", - * @ref cFuncsContext "plug-in context management", - * @ref cFuncsPlugin "plug-in management", - * listener registration (::cp_register_plistener and ::cp_unregister_plistener) - * and @ref cFuncsSymbols "dynamic symbol" functions must not be called from - * within a plug-in listener invocation. Listener functions are registered - * using ::cp_register_plistener. - * - * @param plugin_id the plug-in identifier - * @param old_state the old plug-in state - * @param new_state the new plug-in state - * @param user_data the user data pointer supplied at listener registration - */ -typedef void (*cp_plugin_listener_func_t)(const char *plugin_id, cp_plugin_state_t old_state, cp_plugin_state_t new_state, void *user_data); - -/** - * A logger function called to log selected plug-in framework messages. The - * messages may be localized. Plug-in framework API functions must not - * be called from within a logger function invocation. In a multi-threaded - * environment logger function invocations are serialized by the framework. - * Logger functions are registered using ::cp_register_logger. - * - * @param severity the severity of the message - * @param msg the message to be logged, possibly localized - * @param apid the identifier of the activating plug-in or NULL for the main program - * @param user_data the user data pointer given when the logger was registered - */ -typedef void (*cp_logger_func_t)(cp_log_severity_t severity, const char *msg, const char *apid, void *user_data); - -/** - * A fatal error handler for handling unrecoverable errors. If the error - * handler returns then the framework aborts the program. Plug-in framework - * API functions must not be called from within a fatal error handler - * invocation. The fatal error handler function is set using - * ::cp_set_fatal_error_handler. - * - * @param msg the possibly localized error message - */ -typedef void (*cp_fatal_error_func_t)(const char *msg); - -/** - * A run function registered by a plug-in to perform work. - * The run function should perform a finite chunk of work and it should - * return a non-zero value if there is more work to be done. Run functions - * are registered using ::cp_run_function and the usage is discussed in - * more detail in the @ref cFuncsPluginExec "serial execution" section. - * - * @param plugin_data the plug-in instance data pointer - * @return non-zero if there is more work to be done or zero if finished - */ -typedef int (*cp_run_func_t)(void *plugin_data); - -/*@}*/ - - -/* Data structures */ - -/** - * @ingroup cStructs - * Plug-in information structure captures information about a plug-in. This - * information can be loaded from a plug-in descriptor using - * ::cp_load_plugin_descriptor. Information about installed plug-ins can - * be obtained using ::cp_get_plugin_info and ::cp_get_plugins_info. This - * structure corresponds to the @a plugin element in a plug-in descriptor. - */ -struct cp_plugin_info_t { - - /** - * The obligatory unique identifier of the plugin. A recommended way - * to generate identifiers is to use domain name service (DNS) prefixes - * (for example, org.cpluff.ExamplePlugin) to avoid naming conflicts. This - * corresponds to the @a id attribute of the @a plugin element in a plug-in - * descriptor. - */ - char *identifier; - - /** - * An optional plug-in name. NULL if not available. The plug-in name is - * intended only for display purposes and the value can be localized. - * This corresponds to the @a name attribute of the @a plugin element in - * a plug-in descriptor. - */ - char *name; - - /** - * An optional release version string. NULL if not available. This - * corresponds to the @a version attribute of the @a plugin element in - * a plug-in descriptor. - */ - char *version; - - /** - * An optional provider name. NULL if not available. This is the name of - * the author or the organization providing the plug-in. The - * provider name is intended only for display purposes and the value can - * be localized. This corresponds to the @a provider-name attribute of the - * @a plugin element in a plug-in descriptor. - */ - char *provider_name; - - /** - * Path of the plugin directory or NULL if not known. This is the - * (absolute or relative) path to the plug-in directory containing - * plug-in data and the plug-in runtime library. The value corresponds - * to the path specified to ::cp_load_plugin_descriptor when loading - * the plug-in. - */ - char *plugin_path; - - /** - * Optional ABI compatibility information. NULL if not available. - * This is the earliest version of the plug-in interface the current - * interface is backwards compatible with when it comes to the application - * binary interface (ABI) of the plug-in. That is, plug-in clients compiled against - * any plug-in interface version from @a abi_bw_compatibility to - * @ref version (inclusive) can use the current version of the plug-in - * binary. This describes binary or runtime compatibility. - * The value corresponds to the @a abi-compatibility - * attribute of the @a backwards-compatibility element in a plug-in descriptor. - */ - char *abi_bw_compatibility; - - /** - * Optional API compatibility information. NULL if not available. - * This is the earliest version of the plug-in interface the current - * interface is backwards compatible with when it comes to the - * application programming interface (API) of the plug-in. That is, - * plug-in clients written for any plug-in interface version from - * @a api_bw_compatibility to @ref version (inclusive) can be compiled - * against the current version of the plug-in API. This describes - * source or build time compatibility. The value corresponds to the - * @a api-compatibility attribute of the @a backwards-compatibility - * element in a plug-in descriptor. - */ - char *api_bw_compatibility; - - /** - * Optional C-Pluff version requirement. NULL if not available. - * This is the version of the C-Pluff implementation the plug-in was - * compiled against. It is used to determine the compatibility of - * the plug-in runtime and the linked in C-Pluff implementation. Any - * C-Pluff version that is backwards compatible on binary level with the - * specified version fulfills the requirement. - */ - char *req_cpluff_version; - - /** Number of import entries in the @ref imports array. */ - unsigned int num_imports; - - /** - * An array of @ref num_imports import entries. These correspond to - * @a import elements in a plug-in descriptor. - */ - cp_plugin_import_t *imports; - - /** - * The base name of the plug-in runtime library, or NULL if none. - * A platform specific prefix (for example, "lib") and an extension - * (for example, ".dll" or ".so") may be added to the base name. - * This corresponds to the @a library attribute of the - * @a runtime element in a plug-in descriptor. - */ - char *runtime_lib_name; - - /** - * The symbol pointing to the plug-in runtime function information or - * NULL if none. The symbol with this name should point to an instance of - * @ref cp_plugin_runtime_t structure. This corresponds to the - * @a funcs attribute of the @a runtime element in a plug-in descriptor. - */ - char *runtime_funcs_symbol; - - /** Number of extension points in @ref ext_points array. */ - unsigned int num_ext_points; - - /** - * An array of @ref num_ext_points extension points provided by this - * plug-in. These correspond to @a extension-point elements in a - * plug-in descriptor. - */ - cp_ext_point_t *ext_points; - - /** Number of extensions in @ref extensions array. */ - unsigned int num_extensions; - - /** - * An array of @ref num_extensions extensions provided by this - * plug-in. These correspond to @a extension elements in a plug-in - * descriptor. - */ - cp_extension_t *extensions; - -}; - -/** - * @ingroup cStructs - * Information about plug-in import. Plug-in import structures are - * contained in @ref cp_plugin_info_t::imports. - */ -struct cp_plugin_import_t { - - /** - * The identifier of the imported plug-in. This corresponds to the - * @a plugin attribute of the @a import element in a plug-in descriptor. - */ - char *plugin_id; - - /** - * An optional version requirement. NULL if no version requirement. - * This is the version of the imported plug-in the importing plug-in was - * compiled against. Any version of the imported plug-in that is - * backwards compatible with this version fulfills the requirement. - * This corresponds to the @a if-version attribute of the @a import - * element in a plug-in descriptor. - */ - char *version; - - /** - * Is this import optional. 1 for optional and 0 for mandatory import. - * An optional import causes the imported plug-in to be started if it is - * available but does not stop the importing plug-in from starting if the - * imported plug-in is not available. If the imported plug-in is available - * but the API version conflicts with the API version requirement then the - * importing plug-in fails to start. This corresponds to the @a optional - * attribute of the @a import element in a plug-in descriptor. - */ - int optional; -}; - -/** - * @ingroup cStructs - * Extension point structure captures information about an extension - * point. Extension point structures are contained in - * @ref cp_plugin_info_t::ext_points. - */ -struct cp_ext_point_t { - - /** - * A pointer to plug-in information containing this extension point. - * This reverse pointer is provided to make it easy to get information - * about the plug-in which is hosting a particular extension point. - */ - cp_plugin_info_t *plugin; - - /** - * The local identifier uniquely identifying the extension point within the - * host plug-in. This corresponds to the @name id attribute of an - * @a extension-point element in a plug-in descriptor. - */ - char *local_id; - - /** - * The unique identifier of the extension point. This is automatically - * constructed by concatenating the identifier of the host plug-in and - * the local identifier of the extension point. - */ - char *identifier; - - /** - * An optional extension point name. NULL if not available. The extension - * point name is intended for display purposes only and the value can be - * localized. This corresponds to the @a name attribute of - * an @a extension-point element in a plug-in descriptor. - */ - char *name; - - /** - * An optional path to the extension schema definition. - * NULL if not available. The path is relative to the plug-in directory. - * This corresponds to the @a schema attribute - * of an @a extension-point element in a plug-in descriptor. - */ - char *schema_path; -}; - -/** - * @ingroup cStructs - * Extension structure captures information about an extension. Extension - * structures are contained in @ref cp_plugin_info_t::extensions. - */ -struct cp_extension_t { - - /** - * A pointer to plug-in information containing this extension. - * This reverse pointer is provided to make it easy to get information - * about the plug-in which is hosting a particular extension. - */ - cp_plugin_info_t *plugin; - - /** - * The unique identifier of the extension point this extension is - * attached to. This corresponds to the @a point attribute of an - * @a extension element in a plug-in descriptor. - */ - char *ext_point_id; - - /** - * An optional local identifier uniquely identifying the extension within - * the host plug-in. NULL if not available. This corresponds to the - * @a id attribute of an @a extension element in a plug-in descriptor. - */ - char *local_id; - - /** - * An optional unique identifier of the extension. NULL if not available. - * This is automatically constructed by concatenating the identifier - * of the host plug-in and the local identifier of the extension. - */ - char *identifier; - - /** - * An optional extension name. NULL if not available. The extension name - * is intended for display purposes only and the value can be localized. - * This corresponds to the @a name attribute - * of an @a extension element in a plug-in descriptor. - **/ - char *name; - - /** - * Extension configuration starting with the extension element. - * This includes extension configuration information as a tree of - * configuration elements. These correspond to the @a extension - * element and its contents in a plug-in descriptor. - */ - cp_cfg_element_t *configuration; -}; - -/** - * @ingroup cStructs - * A configuration element contains configuration information for an - * extension. Utility functions ::cp_lookup_cfg_element and - * ::cp_lookup_cfg_value can be used for traversing the tree of - * configuration elements. Pointer to the root configuration element is - * stored at @ref cp_extension_t::configuration and others are contained as - * @ref cp_cfg_element_t::children "children" of parent elements. - */ -struct cp_cfg_element_t { - - /** - * The name of the configuration element. This corresponds to the name of - * the element in a plug-in descriptor. - */ - char *name; - - /** Number of attribute name, value pairs in the @ref atts array. */ - unsigned int num_atts; - - /** - * An array of pointers to alternating attribute names and values. - * Attribute values can be localized. - */ - char **atts; - - /** - * An optional value of this configuration element. NULL if not available. - * The value can be localized. This corresponds to the - * text contents of the element in a plug-in descriptor. - */ - char *value; - - /** A pointer to the parent element or NULL if this is a root element. */ - cp_cfg_element_t *parent; - - /** The index of this element among its siblings (0-based). */ - unsigned int index; - - /** Number of children in the @ref children array. */ - unsigned int num_children; - - /** - * An array of @ref num_children childrens of this element. These - * correspond to child elements in a plug-in descriptor. - */ - cp_cfg_element_t *children; -}; - -/** - * @ingroup cStructs - * Container for plug-in runtime information. A plug-in runtime defines a - * static instance of this structure to pass information to the plug-in - * framework. The plug-in framework then uses the information - * to create and control plug-in instances. The symbol pointing - * to the runtime information instance is named by the @a funcs - * attribute of the @a runtime element in a plug-in descriptor. - * - * The following graph displays how these functions are used to control the - * state of the plug-in instance. - * - * @dot - * digraph lifecycle { - * rankdir=LR; - * node [shape=ellipse, fontname=Helvetica, fontsize=10]; - * edge [fontname=Helvetica, fontsize=10]; - * none [label="no instance"]; - * inactive [label="inactive"]; - * active [label="active"]; - * none -> inactive [label="create", URL="\ref create"]; - * inactive -> active [label="start", URL="\ref start"]; - * active -> inactive [label="stop", URL="\ref stop"]; - * inactive -> none [label="destroy", URL="\ref destroy"]; - * } - * @enddot - */ -struct cp_plugin_runtime_t { - - /** - * An initialization function called to create a new plug-in - * runtime instance. The initialization function initializes and - * returns an opaque plug-in instance data pointer which is then - * passed on to other control functions. This data pointer should - * be used to access plug-in instance specific data. For example, - * the context reference must be stored as part of plug-in instance - * data if the plug-in runtime needs it. On failure, the function - * must return NULL. - * - * C-pluff API functions must not be called from within a create - * function invocation and symbols from imported plug-ins must not be - * used because they may not available yet. - * - * @param ctx the plug-in context of the new plug-in instance - * @return an opaque pointer to plug-in instance data or NULL on failure - */ - void *(*create)(cp_context_t *ctx); - - /** - * A start function called to start a plug-in instance. - * The start function must return zero (CP_OK) on success and non-zero - * on failure. If the start fails then the stop function (if any) is - * called to clean up plug-in state. @ref cFuncsInit "Library initialization", - * @ref cFuncsContext "plug-in context management" and - * @ref cFuncsPlugin "plug-in management" functions must not be - * called from within a start function invocation. The start function - * pointer can be NULL if the plug-in runtime does not have a start - * function. - * - * The start function implementation should set up plug-in and return - * promptly. If there is further work to be done then a plug-in can - * start a thread or register a run function using ::cp_run_function. - * Symbols from imported plug-ins are guaranteed to be available for - * the start function. - * - * @param data an opaque pointer to plug-in instance data - * @return non-zero on success, or zero on failure - */ - int (*start)(void *data); - - /** - * A stop function called to stop a plugin instance. - * This function must cease all plug-in runtime activities. - * @ref cFuncsInit "Library initialization", - * @ref cFuncsContext "plug-in context management", - * @ref cFuncsPlugin "plug-in management" - * functions, ::cp_run_function and ::cp_resolve_symbol must not be called - * from within a stop function invocation. The stop function pointer can - * be NULL if the plug-in runtime does not have a stop function. - * It is guaranteed that no run functions registered by the plug-in are - * called simultaneously or after the call to the stop function. - * - * The stop function should release any external resources hold by - * the plug-in. Dynamically resolved symbols are automatically released - * and dynamically defined symbols and registered run functions are - * automatically unregistered after the call to stop function. - * Resolved external symbols are still available for the stop function - * and symbols provided by the plug-in should remain available - * after the call to stop function (although functionality might be - * limited). Final cleanup can be safely done in the destroy function. - * - * @param data an opaque pointer to plug-in instance data - */ - void (*stop)(void *data); - - /** - * A destroy function called to destroy a plug-in instance. - * This function should release any plug-in instance data. - * The plug-in is stopped before this function is called. - * C-Pluff API functions must not be called from within a destroy - * function invocation and symbols from imported plug-ins must not be - * used because they may not be available anymore. Correspondingly, - * it is guaranteed that the symbols provided by the plug-in are not - * used by other plug-ins when destroy function has been called. - * - * @param data an opaque pointer to plug-in instance data - */ - void (*destroy)(void *data); - -}; - -/*@}*/ - - -/* ------------------------------------------------------------------------ - * Function declarations - * ----------------------------------------------------------------------*/ - -/** - * @defgroup cFuncs Functions - * - * C API functions. The C-Pluff C API functions and - * any data exposed by them are generally thread-safe if the library has been - * compiled with multi-threading support. The - * @ref cFuncsInit "framework initialization functions" - * are exceptions, they are not thread-safe. - */ - -/** - * @defgroup cFuncsFrameworkInfo Framework information - * @ingroup cFuncs - * - * These functions can be used to query runtime information about the - * linked in C-Pluff implementation. They may be used by the main program or - * by a plug-in runtime. - */ -/*@{*/ - -/** - * Returns the release version string of the linked in C-Pluff - * implementation. - * - * @return the C-Pluff release version string - */ -CP_C_API const char *cp_get_version(void) CP_GCC_PURE; - -/** - * Returns the canonical host type associated with the linked in C-Pluff implementation. - * A multi-platform installation manager could use this information to - * determine what plug-in versions to install. - * - * @return the canonical host type - */ -CP_C_API const char *cp_get_host_type(void) CP_GCC_PURE; - -/*@}*/ - - -/** - * @defgroup cFuncsInit Framework initialization - * @ingroup cFuncs - * - * These functions are used for framework initialization. - * They are intended to be used by the main program. These functions are - * not thread safe. - */ -/*@{*/ - -/** - * Sets the fatal error handler called on non-recoverable errors. The default - * error handler prints the error message out to standard error and aborts - * the program. If the user specified error handler returns then the framework - * will abort the program. Setting NULL error handler will restore the default - * handler. This function is not thread-safe and it should be called - * before initializing the framework to catch all fatal errors. - * - * @param error_handler the fatal error handler - */ -CP_C_API void cp_set_fatal_error_handler(cp_fatal_error_func_t error_handler); - -/** - * Initializes the plug-in framework. This function must be called - * by the main program before calling any other plug-in framework - * functions except @ref cFuncsFrameworkInfo "framework information" functions and - * ::cp_set_fatal_error_handler. This function may be - * called several times but it is not thread-safe. Library resources - * should be released by calling ::cp_destroy when the framework is - * not needed anymore. - * - * Additionally, to enable localization support, the main program should - * set the current locale using @code setlocale(LC_ALL, "") @endcode - * before calling this function. - * - * @return @ref CP_OK (zero) on success or error code on failure - */ -CP_C_API cp_status_t cp_init(void); - -/** - * Destroys the plug-in framework and releases the resources used by it. - * The plug-in framework is only destroyed after this function has - * been called as many times as ::cp_init. This function is not - * thread-safe. Plug-in framework functions other than ::cp_init, - * ::cp_get_framework_info and ::cp_set_fatal_error_handler - * must not be called after the plug-in framework has been destroyed. - * All contexts are destroyed and all data references returned by the - * framework become invalid. - */ -CP_C_API void cp_destroy(void); - -/*@}*/ - - -/** - * @defgroup cFuncsContext Plug-in context initialization - * @ingroup cFuncs - * - * These functions are used to manage plug-in contexts from the main - * program perspective. They are not intended to be used by a plug-in runtime. - * From the main program perspective a plug-in context is a container for - * installed plug-ins. There can be several plug-in context instances if there - * are several independent sets of plug-ins. However, different plug-in - * contexts are not very isolated from each other in practice because the - * global symbols exported by a plug-in runtime in one context are visible to - * all plug-ins in all context instances. - */ -/*@{*/ - -/** - * Creates a new plug-in context which can be used as a container for plug-ins. - * Plug-ins are loaded and installed into a specific context. The main - * program may have more than one plug-in context but the plug-ins that - * interact with each other should be placed in the same context. The - * resources associated with the context are released by calling - * ::cp_destroy_context when the context is not needed anymore. Remaining - * contexts are automatically destroyed when the plug-in framework is - * destroyed. - * - * @param status pointer to the location where status code is to be stored, or NULL - * @return the newly created plugin context, or NULL on failure - */ -CP_C_API cp_context_t * cp_create_context(cp_status_t *status); - -/** - * Destroys the specified plug-in context and releases the associated resources. - * Stops and uninstalls all plug-ins in the context. The context must not be - * accessed after calling this function. - * - * @param ctx the context to be destroyed - */ -CP_C_API void cp_destroy_context(cp_context_t *ctx) CP_GCC_NONNULL(1); - -/** - * Registers a plug-in collection with a plug-in context. A plug-in collection - * is a directory that has plug-ins as its immediate subdirectories. The - * plug-in context will scan the directory when ::cp_scan_plugins is called. - * Returns @ref CP_OK if the directory has already been registered. A plug-in - * collection can be unregistered using ::cp_unregister_pcollection or - * ::cp_unregister_pcollections. - * - * @param ctx the plug-in context - * @param dir the directory - * @return @ref CP_OK (zero) on success or @ref CP_ERR_RESOURCE if insufficient memory - */ -CP_C_API cp_status_t cp_register_pcollection(cp_context_t *ctx, const char *dir) CP_GCC_NONNULL(1, 2); - -/** - * Unregisters a previously registered plug-in collection from a - * plug-in context. Plug-ins already loaded from the collection are not - * affected. Does nothing if the directory has not been registered. - * Plug-in collections can be registered using ::cp_register_pcollection. - * - * @param ctx the plug-in context - * @param dir the previously registered directory - */ -CP_C_API void cp_unregister_pcollection(cp_context_t *ctx, const char *dir) CP_GCC_NONNULL(1, 2); - -/** - * Unregisters all plug-in collections from a plug-in context. - * Plug-ins already loaded are not affected. Plug-in collections can - * be registered using ::cp_register_pcollection. - * - * @param ctx the plug-in context - */ -CP_C_API void cp_unregister_pcollections(cp_context_t *ctx) CP_GCC_NONNULL(1); - -/*@}*/ - - -/** - * @defgroup cFuncsLogging Logging - * @ingroup cFuncs - * - * These functions can be used to receive and emit log messages related - * to a particular plug-in context. They can be used by the main program - * or by a plug-in runtime. - */ -/*@{*/ - -/** - * Registers a logger with a plug-in context or updates the settings of a - * registered logger. The logger will receive selected log messages. - * If the specified logger is not yet known, a new logger registration - * is made, otherwise the settings for the existing logger are updated. - * The logger can be unregistered using ::cp_unregister_logger and it is - * automatically unregistered when the registering plug-in is stopped or - * when the context is destroyed. - * - * @param ctx the plug-in context to log - * @param logger the logger function to be called - * @param user_data the user data pointer passed to the logger - * @param min_severity the minimum severity of messages passed to logger - * @return @ref CP_OK (zero) on success or @ref CP_ERR_RESOURCE if insufficient memory - */ -CP_C_API cp_status_t cp_register_logger(cp_context_t *ctx, cp_logger_func_t logger, void *user_data, cp_log_severity_t min_severity) CP_GCC_NONNULL(1, 2); - -/** - * Removes a logger registration. - * - * @param ctx the plug-in context - * @param logger the logger function to be unregistered - */ -CP_C_API void cp_unregister_logger(cp_context_t *ctx, cp_logger_func_t logger) CP_GCC_NONNULL(1, 2); - -/** - * Emits a new log message. - * - * @param ctx the plug-in context - * @param severity the severity of the event - * @param msg the log message (possibly localized) - */ -CP_C_API void cp_log(cp_context_t *ctx, cp_log_severity_t severity, const char *msg) CP_GCC_NONNULL(1, 3); - -/** - * Returns whether a message of the specified severity would get logged. - * - * @param ctx the plug-in context - * @param severity the target logging severity - * @return whether a message of the specified severity would get logged - */ -CP_C_API int cp_is_logged(cp_context_t *ctx, cp_log_severity_t severity) CP_GCC_NONNULL(1); - -/*@}*/ - - -/** - * @defgroup cFuncsPlugin Plug-in management - * @ingroup cFuncs - * - * These functions can be used to manage plug-ins. They are intended to be - * used by the main program. - */ -/*@{*/ - -/** - * Loads a plug-in descriptor from the specified plug-in installation - * path and returns information about the plug-in. The plug-in descriptor - * is validated during loading. Possible loading errors are reported via the - * specified plug-in context. The plug-in is not installed to the context. - * If operation fails or the descriptor - * is invalid then NULL is returned. The caller must release the returned - * information by calling ::cp_release_plugin_info when it does not - * need the information anymore, typically after installing the plug-in. - * The returned plug-in information must not be modified. - * - * @param ctx the plug-in context - * @param path the installation path of the plug-in - * @param status a pointer to the location where status code is to be stored, or NULL - * @return pointer to the information structure or NULL if error occurs - */ -CP_C_API cp_plugin_info_t * cp_load_plugin_descriptor(cp_context_t *ctx, const char *path, cp_status_t *status) CP_GCC_NONNULL(1, 2); - -/** - * Loads a plug-in descriptor from the specified block of memory and returns - * information about the plug-in. The plug-in descriptor - * is validated during loading. Possible loading errors are reported via the - * specified plug-in context. The plug-in is not installed to the context. - * If operation fails or the descriptor - * is invalid then NULL is returned. The caller must release the returned - * information by calling ::cp_release_info when it does not - * need the information anymore, typically after installing the plug-in. - * The returned plug-in information must not be modified. - * - * @param ctx the plug-in context - * @param buffer the buffer containing the plug-in descriptor. - * @param buffer_len the length of the buffer. - * @param status a pointer to the location where status code is to be stored, or NULL - * @return pointer to the information structure or NULL if error occurs - */ -CP_C_API cp_plugin_info_t * cp_load_plugin_descriptor_from_memory(cp_context_t *ctx, const char *buffer, unsigned int buffer_len, cp_status_t *status) CP_GCC_NONNULL(1, 2); - -/** - * Installs the plug-in described by the specified plug-in information - * structure to the specified plug-in context. The plug-in information - * must have been loaded using ::cp_load_plugin_descriptor with the same - * plug-in context. - * The installation fails on #CP_ERR_CONFLICT if the context already - * has an installed plug-in with the same plug-in identifier. Installation - * also fails if the plug-in tries to install an extension point which - * conflicts with an already installed extension point. - * The plug-in information must not be modified but it is safe to call - * ::cp_release_plugin_info after the plug-in has been installed. - * - * @param ctx the plug-in context - * @param pi plug-in information structure - * @return @ref CP_OK (zero) on success or an error code on failure - */ -CP_C_API cp_status_t cp_install_plugin(cp_context_t *ctx, cp_plugin_info_t *pi) CP_GCC_NONNULL(1, 2); - -/** - * Scans for plug-ins in the registered plug-in directories, installing - * new plug-ins and upgrading installed plug-ins. This function can be used to - * initially load the plug-ins and to later rescan for new plug-ins. - * - * When several versions of the same plug-in is available the most recent - * version will be installed. The upgrade behavior depends on the specified - * @ref cScanFlags "flags". If #CP_SP_UPGRADE is set then upgrades to installed plug-ins are - * allowed. The old version is unloaded and the new version installed instead. - * If #CP_SP_STOP_ALL_ON_UPGRADE is set then all active plug-ins are stopped - * if any plug-ins are to be upgraded. If #CP_SP_STOP_ALL_ON_INSTALL is set then - * all active plug-ins are stopped if any plug-ins are to be installed or - * upgraded. Finally, if #CP_SP_RESTART_ACTIVE is set all currently active - * plug-ins will be restarted after the changes (if they were stopped). - * - * When removing plug-in files from the plug-in directories, the - * plug-ins to be removed must be first unloaded. Therefore this function - * does not check for removed plug-ins. - * - * @param ctx the plug-in context - * @param flags the bitmask of flags - * @return @ref CP_OK (zero) on success or an error code on failure - */ -CP_C_API cp_status_t cp_scan_plugins(cp_context_t *ctx, int flags) CP_GCC_NONNULL(1); - -/** - * Starts a plug-in. Also starts any imported plug-ins. If the plug-in is - * already starting then - * this function blocks until the plug-in has started or failed to start. - * If the plug-in is already active then this function returns immediately. - * If the plug-in is stopping then this function blocks until the plug-in - * has stopped and then starts the plug-in. - * - * @param ctx the plug-in context - * @param id identifier of the plug-in to be started - * @return @ref CP_OK (zero) on success or an error code on failure - */ -CP_C_API cp_status_t cp_start_plugin(cp_context_t *ctx, const char *id) CP_GCC_NONNULL(1, 2); - -/** - * Stops a plug-in. First stops any dependent plug-ins that are currently - * active. Then stops the specified plug-in. If the plug-in is already - * stopping then this function blocks until the plug-in has stopped. If the - * plug-in is already stopped then this function returns immediately. If the - * plug-in is starting then this function blocks until the plug-in has - * started (or failed to start) and then stops the plug-in. - * - * @param ctx the plug-in context - * @param id identifier of the plug-in to be stopped - * @return @ref CP_OK (zero) on success or @ref CP_ERR_UNKNOWN if unknown plug-in - */ -CP_C_API cp_status_t cp_stop_plugin(cp_context_t *ctx, const char *id) CP_GCC_NONNULL(1, 2); - -/** - * Stops all active plug-ins. - * - * @param ctx the plug-in context - */ -CP_C_API void cp_stop_plugins(cp_context_t *ctx) CP_GCC_NONNULL(1); - -/** - * Uninstalls the specified plug-in. The plug-in is first stopped if it is active. - * Then uninstalls the plug-in and any dependent plug-ins. - * - * @param ctx the plug-in context - * @param id identifier of the plug-in to be unloaded - * @return @ref CP_OK (zero) on success or @ref CP_ERR_UNKNOWN if unknown plug-in - */ -CP_C_API cp_status_t cp_uninstall_plugin(cp_context_t *ctx, const char *id) CP_GCC_NONNULL(1, 2); - -/** - * Uninstalls all plug-ins. All plug-ins are first stopped and then - * uninstalled. - * - * @param ctx the plug-in context - */ -CP_C_API void cp_uninstall_plugins(cp_context_t *ctx) CP_GCC_NONNULL(1); - -/*@}*/ - - -/** - * @defgroup cFuncsPluginInfo Plug-in and extension information - * @ingroup cFuncs - * - * These functions can be used to query information about the installed - * plug-ins, extension points and extensions or to listen for plug-in state - * changes. They may be used by the main program or by a plug-in runtime. - */ -/*@{*/ - -/** - * Returns static information about the specified plug-in. The returned - * information must not be modified and the caller must - * release the information by calling ::cp_release_info when the - * information is not needed anymore. When a plug-in runtime calls this - * function it may pass NULL as the identifier to get information about the - * plug-in itself. - * - * @param ctx the plug-in context - * @param id identifier of the plug-in to be examined or NULL for self - * @param status a pointer to the location where status code is to be stored, or NULL - * @return pointer to the information structure or NULL on failure - */ -CP_C_API cp_plugin_info_t * cp_get_plugin_info(cp_context_t *ctx, const char *id, cp_status_t *status) CP_GCC_NONNULL(1); - -/** - * Returns static information about the installed plug-ins. The returned - * information must not be modified and the caller must - * release the information by calling ::cp_release_info when the - * information is not needed anymore. - * - * @param ctx the plug-in context - * @param status a pointer to the location where status code is to be stored, or NULL - * @param num a pointer to the location where the number of returned plug-ins is stored, or NULL - * @return pointer to a NULL-terminated list of pointers to plug-in information - * or NULL on failure - */ -CP_C_API cp_plugin_info_t ** cp_get_plugins_info(cp_context_t *ctx, cp_status_t *status, int *num) CP_GCC_NONNULL(1); - -/** - * Returns static information about the currently installed extension points. - * The returned information must not be modified and the caller must - * release the information by calling ::cp_release_info when the - * information is not needed anymore. - * - * @param ctx the plug-in context - * @param status a pointer to the location where status code is to be stored, or NULL - * @param num filled with the number of returned extension points, if non-NULL - * @return pointer to a NULL-terminated list of pointers to extension point - * information or NULL on failure - */ -CP_C_API cp_ext_point_t ** cp_get_ext_points_info(cp_context_t *ctx, cp_status_t *status, int *num) CP_GCC_NONNULL(1); - -/** - * Returns static information about the currently installed extension points. - * The returned information must not be modified and the caller must - * release the information by calling ::cp_release_info when the - * information is not needed anymore. - * - * @param ctx the plug-in context - * @param extpt_id the extension point identifier or NULL for all extensions - * @param status a pointer to the location where status code is to be stored, or NULL - * @param num a pointer to the location where the number of returned extension points is to be stored, or NULL - * @return pointer to a NULL-terminated list of pointers to extension - * information or NULL on failure - */ -CP_C_API cp_extension_t ** cp_get_extensions_info(cp_context_t *ctx, const char *extpt_id, cp_status_t *status, int *num) CP_GCC_NONNULL(1); - -/** - * Releases a previously obtained reference counted information object. The - * documentation for functions returning such information refers - * to this function. The information must not be accessed after it has - * been released. The framework uses reference counting to deallocate - * the information when it is not in use anymore. - * - * @param ctx the plug-in context - * @param info the information to be released - */ -CP_C_API void cp_release_info(cp_context_t *ctx, void *info) CP_GCC_NONNULL(1, 2); - -/** - * Returns the current state of the specified plug-in. Returns - * #CP_PLUGIN_UNINSTALLED if the specified plug-in identifier is unknown. - * - * @param ctx the plug-in context - * @param id the plug-in identifier - * @return the current state of the plug-in - */ -CP_C_API cp_plugin_state_t cp_get_plugin_state(cp_context_t *ctx, const char *id) CP_GCC_NONNULL(1, 2); - -/** - * Registers a plug-in listener with a plug-in context. The listener is called - * synchronously immediately after a plug-in state change. There can be several - * listeners registered with the same context. A plug-in listener can be - * unregistered using ::cp_unregister_plistener and it is automatically - * unregistered when the registering plug-in is stopped or when the context - * is destroyed. - * - * @param ctx the plug-in context - * @param listener the plug-in listener to be added - * @param user_data user data pointer supplied to the listener - * @return @ref CP_OK (zero) on success or @ref CP_ERR_RESOURCE if out of resources - */ -CP_C_API cp_status_t cp_register_plistener(cp_context_t *ctx, cp_plugin_listener_func_t listener, void *user_data) CP_GCC_NONNULL(1, 2); - -/** - * Removes a plug-in listener from a plug-in context. Does nothing if the - * specified listener was not registered. - * - * @param ctx the plug-in context - * @param listener the plug-in listener to be removed - */ -CP_C_API void cp_unregister_plistener(cp_context_t *ctx, cp_plugin_listener_func_t listener) CP_GCC_NONNULL(1, 2); - -/** - * Traverses a configuration element tree and returns the specified element. - * The target element is specified by a base element and a relative path from - * the base element to the target element. The path includes element names - * separated by slash '/'. Two dots ".." can be used to designate a parent - * element. Returns NULL if the specified element does not exist. If there are - * several subelements with the same name, this function chooses the first one - * when traversing the tree. - * - * @param base the base configuration element - * @param path the path to the target element - * @return the target element or NULL if nonexisting - */ -CP_C_API cp_cfg_element_t * cp_lookup_cfg_element(cp_cfg_element_t *base, const char *path) CP_GCC_PURE CP_GCC_NONNULL(1, 2); - -/** - * Traverses a configuration element tree and returns the value of the - * specified element or attribute. The target element or attribute is specified - * by a base element and a relative path from the base element to the target - * element or attributes. The path includes element names - * separated by slash '/'. Two dots ".." can be used to designate a parent - * element. The path may end with '@' followed by an attribute name - * to select an attribute. Returns NULL if the specified element or attribute - * does not exist or does not have a value. If there are several subelements - * with the same name, this function chooses the first one when traversing the - * tree. - * - * @param base the base configuration element - * @param path the path to the target element - * @return the value of the target element or attribute or NULL - */ -CP_C_API char * cp_lookup_cfg_value(cp_cfg_element_t *base, const char *path) CP_GCC_PURE CP_GCC_NONNULL(1, 2); - -/*@}*/ - - -/** - * @defgroup cFuncsPluginExec Plug-in execution - * @ingroup cFuncs - * - * These functions support a plug-in controlled execution model. Started plug-ins can - * use ::cp_run_function to register @ref cp_run_func_t "a run function" which is called when the - * main program calls ::cp_run_plugins or ::cp_run_plugins_step. A run - * function should do a finite chunk of work and then return telling whether - * there is more work to be done. A run function is automatically unregistered - * when the plug-in is stopped. Run functions make it possible for plug-ins - * to control the flow of execution or they can be used as a coarse - * way of task switching if there is no multi-threading support. - * - * The C-Pluff distribution includes a generic main program, cpluff-loader, - * which only acts as a plug-in loader. It loads and starts up the - * specified plug-ins, passing any additional startup arguments to them and - * then just calls run functions of the plug-ins. This - * makes it is possible to put all the application specific logic in - * plug-ins. Application does not necessarily need a main program of its own. - * - * It is also safe, from framework perspective, to call these functions from - * multiple threads. Run functions may then be executed in parallel threads. - */ -/*@{*/ - -/** - * Registers a new run function. The plug-in instance data pointer is given to - * the run function as a parameter. The run function must return zero if it has - * finished its work or non-zero if it should be called again later. The run - * function is unregistered when it returns zero. Plug-in framework functions - * stopping the registering plug-in must not be called from within a run - * function. This function does nothing if the specified run - * function is already registered for the calling plug-in instance. - * - * @param ctx the plug-in context of the registering plug-in - * @param runfunc the run function to be registered - * @return @ref CP_OK (zero) on success or an error code on failure - */ -CP_C_API cp_status_t cp_run_function(cp_context_t *ctx, cp_run_func_t runfunc) CP_GCC_NONNULL(1, 2); - -/** - * Runs the started plug-ins as long as there is something to run. - * This function calls repeatedly run functions registered by started plug-ins - * until there are no more active run functions. This function is normally - * called by a thin main proram, a loader, which loads plug-ins, starts some - * plug-ins and then passes control over to the started plug-ins. - * - * @param ctx the plug-in context containing the plug-ins - */ -CP_C_API void cp_run_plugins(cp_context_t *ctx) CP_GCC_NONNULL(1); - -/** - * Runs one registered run function. This function calls one - * active run function registered by a started plug-in. When the run function - * returns this function also returns and passes control back to the main - * program. The return value can be used to determine whether there are any - * active run functions left. This function does nothing if there are no active - * registered run functions. - * - * @param ctx the plug-in context containing the plug-ins - * @return whether there are active run functions waiting to be run - */ -CP_C_API int cp_run_plugins_step(cp_context_t *ctx) CP_GCC_NONNULL(1); - -/** - * Sets startup arguments for the specified plug-in context. Like for usual - * C main functions, the first argument is expected to be the name of the - * program being executed or an empty string and the argument array should be - * terminated by NULL entry. If the main program is - * about to pass startup arguments to plug-ins it should call this function - * before starting any plug-ins in the context. The arguments are not copied - * and the caller is responsible for keeping the argument data available once - * the arguments have been set until the context is destroyed. Plug-ins can - * access the startup arguments using ::cp_get_context_args. - * - * @param ctx the plug-in context - * @param argv a NULL-terminated array of arguments - */ -CP_C_API void cp_set_context_args(cp_context_t *ctx, char **argv) CP_GCC_NONNULL(1, 2); - -/** - * Returns the startup arguments associated with the specified - * plug-in context. This function is intended to be used by a plug-in runtime. - * Startup arguments are set by the main program using ::cp_set_context_args. - * The returned argument count is zero and the array pointer is NULL if no - * arguments have been set. - * - * @param ctx the plug-in context - * @param argc a pointer to a location where the number of startup arguments is stored, or NULL for none - * @return an argument array terminated by NULL or NULL if not set - */ -CP_C_API char **cp_get_context_args(cp_context_t *ctx, int *argc) CP_GCC_NONNULL(1); - -/*@}*/ - - -/** - * @defgroup cFuncsSymbols Dynamic symbols - * @ingroup cFuncs - * - * These functions can be used to dynamically access symbols exported by the - * plug-ins. They are intended to be used by a plug-in runtime or by the main - * program. - */ -/*@{*/ - -/** - * Defines a context specific symbol. If a plug-in has symbols which have - * a plug-in instance specific value then the plug-in should define those - * symbols when it is started. The defined symbols are cleared - * automatically when the plug-in instance is stopped. Symbols can not be - * redefined. - * - * @param ctx the plug-in context - * @param name the name of the symbol - * @param ptr pointer value for the symbol - * @return @ref CP_OK (zero) on success or a status code on failure - */ -CP_C_API cp_status_t cp_define_symbol(cp_context_t *ctx, const char *name, void *ptr) CP_GCC_NONNULL(1, 2, 3); - -/** - * Resolves a symbol provided by the specified plug-in. The plug-in is started - * automatically if it is not already active. The symbol may be context - * specific or global. The framework first looks for a context specific - * symbol and then falls back to resolving a global symbol exported by the - * plug-in runtime library. The symbol can be released using - * ::cp_release_symbol when it is not needed anymore. Pointers obtained from - * this function must not be passed on to other plug-ins or the main - * program. - * - * When a plug-in runtime calls this function the plug-in framework creates - * a dynamic dependency from the symbol using plug-in to the symbol - * defining plug-in. The symbol using plug-in is stopped automatically if the - * symbol defining plug-in is about to be stopped. If the symbol using plug-in - * does not explicitly release the symbol then it is automatically released - * after a call to the stop function. It is not safe to refer to a dynamically - * resolved symbol in the stop function except to release it using - * ::cp_release_symbol. - * - * When the main program calls this function it is the responsibility of the - * main program to always release the symbol before the symbol defining plug-in - * is stopped. It is a fatal error if the symbol is not released before the - * symbol defining plug-in is stopped. - * - * @param ctx the plug-in context - * @param id the identifier of the symbol defining plug-in - * @param name the name of the symbol - * @param status a pointer to the location where the status code is to be stored, or NULL - * @return the pointer associated with the symbol or NULL on failure - */ -CP_C_API void *cp_resolve_symbol(cp_context_t *ctx, const char *id, const char *name, cp_status_t *status) CP_GCC_NONNULL(1, 2, 3); - -/** - * Releases a previously obtained symbol. The pointer must not be used after - * the symbol has been released. The symbol is released - * only after as many calls to this function as there have been for - * ::cp_resolve_symbol for the same plug-in and symbol. - * - * @param ctx the plug-in context - * @param ptr the pointer associated with the symbol - */ -CP_C_API void cp_release_symbol(cp_context_t *ctx, const void *ptr) CP_GCC_NONNULL(1, 2); - -/*@}*/ - - -#ifdef __cplusplus -} -#endif /*__cplusplus*/ - -#endif /*CPLUFF_H_*/ diff --git a/lib/cpluff/libcpluff/cpluffdef.h.in b/lib/cpluff/libcpluff/cpluffdef.h.in deleted file mode 100644 index 0d2dd15ba6..0000000000 --- a/lib/cpluff/libcpluff/cpluffdef.h.in +++ /dev/null @@ -1,204 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Common defines shared by C-Pluff C and C++ APIs. - * This file is automatically included by the top level C and C++ - * API header files. There should be no need to include it explicitly. - */ - -#ifndef CPLUFFDEF_H_ -#define CPLUFFDEF_H_ - - -/* ------------------------------------------------------------------------ - * Version information - * ----------------------------------------------------------------------*/ - -/** - * @defgroup versionInfo Version information - * @ingroup cDefines cxxDefines - * - * C-Pluff version information. Notice that this version information - * is static version information included in header files. The - * macros introduced here can be used for compile time checks. - */ -/*@{*/ - -/** - * The C-Pluff release version string. This string identifies a specific - * version of the C-Pluff distribution. Compile time software compatibility - * checks should use #CP_VERSION_MAJOR and #CP_VERSION_MINOR instead. - */ -#define CP_VERSION "@PACKAGE_VERSION@" - -/** - * The major version number component of the release version. This is an - * integer. - */ -#define CP_VERSION_MAJOR @CP_VERSION_MAJOR@ - -/** - * The minor version number component of the release version. This is an - * integer. - */ -#define CP_VERSION_MINOR @CP_VERSION_MINOR@ - -/*@}*/ - - -/* ------------------------------------------------------------------------ - * Symbol visibility - * ----------------------------------------------------------------------*/ - -/** - * @defgroup symbolVisibility Symbol visibility - * @ingroup cDefines cxxDefines - * - * Macros for controlling inter-module symbol visibility and linkage. These - * macros have platform specific values. #CP_EXPORT, #CP_IMPORT and #CP_HIDDEN - * can be reused by plug-in implementations for better portability. The - * complexity is mostly due to Windows DLL exports and imports. - * - * @anchor symbolVisibilityExample - * Each module should usually define its own macro to declare API symbols with - * #CP_EXPORT and #CP_IMPORT as necessary. For example, a mobule could define - * a macro @c MY_API in the API header file as follows. - * - * @code - * #ifndef MY_API - * # define MY_API CP_IMPORT - * #endif - * @endcode - * - * By default the API symbols would then be marked for import which is correct - * when client modules are including the API header file. When compiling the - * module itself the option @c -DMY_API=CP_EXPORT would be passed to the compiler to - * override the API header file and to mark the API symbols for export. - * The overriding definition could also be included in module source files or - * in an internal header file before including the API header file. - */ -/*@{*/ - -/** - * @def CP_EXPORT - * - * Declares a symbol to be exported for inter-module usage. When compiling the - * module which defines the symbol this macro should be placed - * at the start of the symbol declaration to ensure that the symbol is exported - * to other modules. However, when compiling other modules the declaration of - * the symbol should start with #CP_IMPORT. - * See @ref symbolVisibilityExample "the example" of how to do this. - */ - -/** - * @def CP_IMPORT - * - * Declares a symbol to be imported from another module. When compiling a - * module which uses the symbol this macro should be placed at the start of - * the symbol declaration to ensure that the symbol is imported from the - * defining module. However, when compiling the defining module the declaration - * of the symbol should start with #CP_EXPORT. - * See @ref symbolVisibilityExample "the example" of how to do this. - */ - -/** - * @def CP_HIDDEN - * - * Declares a symbol hidden from other modules. This macro should be - * placed at the start of the symbol declaration to hide the symbol from other - * modules (if supported by the platform). This macro is not intended to be - * used with symbols declared as "static" which are already internal to the - * object file. Some platforms do not support hiding of symbols and therefore - * unique prefixes should be used for global symbols internal to the module - * even when they are declared using this macro. - */ - -#if defined(_WIN32) -# define CP_EXPORT __declspec(dllexport) -# define CP_IMPORT extern __declspec(dllimport) -# define CP_HIDDEN -#elif defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) -# define CP_EXPORT -# define CP_IMPORT extern -# define CP_HIDDEN __attribute__ ((visibility ("hidden"))) -#else -# define CP_EXPORT -# define CP_IMPORT extern -# define CP_HIDDEN -#endif - -/*@}*/ - - -/* ------------------------------------------------------------------------ - * GCC attributes - * ----------------------------------------------------------------------*/ - -/** - * @defgroup cDefinesGCCAttributes GCC attributes - * @ingroup cDefines cxxDefines - * - * These macros conditionally define GCC attributes for declarations. - * They are used in C-Pluff API declarations to enable better optimization - * and error checking when using GCC. In non-GCC platforms they have - * empty values. - */ -/*@{*/ - -/** - * @def CP_GCC_PURE - * - * Declares a function as pure function having no side effects. - * This attribute is supported in GCC since version 2.96. - * Such functions can be subject to common subexpression elimination - * and loop optimization. - */ - -/** - * @def CP_GCC_NONNULL - * - * Specifies that some pointer arguments to a function should have - * non-NULL values. Takes a variable length list of argument indexes as - * arguments. This attribute is supported in GCC since version 3.3. - * It can be used for enhanced error checking and some optimizations. - */ - -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -#define CP_GCC_PURE __attribute__((pure)) -#else -#define CP_GCC_PURE -#endif -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) -#define CP_GCC_NONNULL(...) __attribute__((nonnull (__VA_ARGS__))) -#else -#define CP_GCC_NONNULL(...) -#endif - -/*@}*/ - -#if @DEFINE_EMPTY_CONST@ -#define const -#endif - -#endif /*CPLUFFDEF_H_*/ diff --git a/lib/cpluff/libcpluff/defines.h b/lib/cpluff/libcpluff/defines.h deleted file mode 100644 index 98a0e23447..0000000000 --- a/lib/cpluff/libcpluff/defines.h +++ /dev/null @@ -1,66 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Core internal defines - */ - -#ifndef DEFINES_H_ -#define DEFINES_H_ - -#ifdef ENABLE_NLS -#include <libintl.h> -#endif - - -/* ------------------------------------------------------------------------ - * Defines - * ----------------------------------------------------------------------*/ - -// Gettext defines -#ifdef ENABLE_NLS -#define _(String) dgettext(PACKAGE, String) -#define gettext_noop(String) String -#define N_(String) gettext_noop(String) -#else -#define _(String) (String) -#define N_(String) String -#define textdomain(Domain) -#define bindtextdomain(Package, Directory) -#endif //HAVE_GETTEXT - - -// Additional defines for function attributes (under GCC). -#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)) && ! defined(printf) -#define CP_GCC_PRINTF(format_idx, arg_idx) \ - __attribute__((format (printf, format_idx, arg_idx))) -#define CP_GCC_CONST __attribute__((const)) -#define CP_GCC_NORETURN __attribute__((noreturn)) -#else -#define CP_GCC_PRINTF(format_idx, arg_idx) -#define CP_GCC_CONST -#define CP_GCC_NORETURN -#endif - - -#endif //DEFINES_H_ diff --git a/lib/cpluff/libcpluff/docsrc/Doxyfile-impl.in b/lib/cpluff/libcpluff/docsrc/Doxyfile-impl.in deleted file mode 100644 index 3bc1858041..0000000000 --- a/lib/cpluff/libcpluff/docsrc/Doxyfile-impl.in +++ /dev/null @@ -1,1256 +0,0 @@ -# Doxyfile 1.5.1 - -# Copyright 2007 Johannes Lehtinen -# This configuration file is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = "@PACKAGE_NAME@ C Implementation" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = "@PACKAGE_VERSION@ (API version @CP_CORE_API_CURRENT@)" - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, -# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, -# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, -# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. - -OUTPUT_LANGUAGE = English - -# This tag can be used to specify the encoding used in the generated output. -# The encoding is not always determined by the language that is chosen, -# but also whether or not the output is meant for Windows or non-Windows users. -# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES -# forces the Windows encoding (this is the default for the Windows binary), -# whereas setting the tag to NO uses a Unix-style encoding (the default for -# all platforms other than Windows). - -USE_WINDOWS_ENCODING = NO - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = YES - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an -# explicit @brief command for a brief description. - -JAVADOC_AUTOBRIEF = YES - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = YES - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to -# include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = YES - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = YES - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = NO - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from the -# version control system). Doxygen will invoke the program by executing (via -# popen()) the command <command> <input-file>, where <command> is the value of -# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = . - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py - -FILE_PATTERNS = *.c *.h - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command <filter> <input-file>, where <filter> -# is the value of the INPUT_FILTER tag, and <input-file> is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentstion. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = doxygen.footer - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = doxygen.css - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = YES - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = YES - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = NO - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. - -CALL_GRAPH = YES - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a caller dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable caller graphs for selected -# functions only using the \callergraph command. - -CALLER_GRAPH = YES - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_WIDTH = 1024 - -# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_HEIGHT = 1024 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that a graph may be further truncated if the graph's -# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH -# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), -# the graph is not depth-constrained. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, which results in a white background. -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). - -DOT_TRANSPARENT = YES - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff --git a/lib/cpluff/libcpluff/docsrc/Doxyfile-ref.in b/lib/cpluff/libcpluff/docsrc/Doxyfile-ref.in deleted file mode 100644 index 306d7f4038..0000000000 --- a/lib/cpluff/libcpluff/docsrc/Doxyfile-ref.in +++ /dev/null @@ -1,1256 +0,0 @@ -# Doxyfile 1.5.1 - -# Copyright 2007 Johannes Lehtinen -# This configuration file is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = "@PACKAGE_NAME@ C API" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = "@PACKAGE_VERSION@" - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, -# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, -# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, -# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. - -OUTPUT_LANGUAGE = English - -# This tag can be used to specify the encoding used in the generated output. -# The encoding is not always determined by the language that is chosen, -# but also whether or not the output is meant for Windows or non-Windows users. -# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES -# forces the Windows encoding (this is the default for the Windows binary), -# whereas setting the tag to NO uses a Unix-style encoding (the default for -# all platforms other than Windows). - -USE_WINDOWS_ENCODING = NO - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = YES - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an -# explicit @brief command for a brief description. - -JAVADOC_AUTOBRIEF = YES - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = YES - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to -# include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = YES - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = NO - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 0 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from the -# version control system). Doxygen will invoke the program by executing (via -# popen()) the command <command> <input-file>, where <command> is the value of -# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = cpluffdef.h cpluff.h mainpage.dox architecture.dox mainprog.dox plugin.dox - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py - -FILE_PATTERNS = - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = . - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command <filter> <input-file>, where <filter> -# is the value of the INPUT_FILTER tag, and <input-file> is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = NO - -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentstion. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = doxygen.footer - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = doxygen.css - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = YES - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = CP_GCC_PURE CP_GCC_NONNULL CP_C_API - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = YES - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = NO - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a caller dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable caller graphs for selected -# functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_WIDTH = 1024 - -# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_HEIGHT = 1024 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that a graph may be further truncated if the graph's -# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH -# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), -# the graph is not depth-constrained. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, which results in a white background. -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). - -DOT_TRANSPARENT = YES - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff --git a/lib/cpluff/libcpluff/docsrc/Makefile.am b/lib/cpluff/libcpluff/docsrc/Makefile.am deleted file mode 100644 index 5a2f304b3c..0000000000 --- a/lib/cpluff/libcpluff/docsrc/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -EXTRA_DIST = mainpage.dox architecture.dox mainprog.dox plugin.dox diff --git a/lib/cpluff/libcpluff/docsrc/architecture.dox b/lib/cpluff/libcpluff/docsrc/architecture.dox deleted file mode 100644 index e9e6de5386..0000000000 --- a/lib/cpluff/libcpluff/docsrc/architecture.dox +++ /dev/null @@ -1,66 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** - * @page architecture Plug-in architecture - * - * @section architectureOverview Overview - * - * The plug-in architecture supported by C-Pluff is presented in the - * following figure. There is a thin main program controlling the plug-in - * framework. The main program is responsible for initializing and setting - * up the plug-in environment. Most of the application logic is contained in - * plug-ins which are independent components and can be developed and - * distributed separately. Plug-ins integrate with each other by providing - * extension points and extensions. An extension point is a point into which - * other plug-ins can attach extensions. An extension can be just - * information, expressed in XML format, or the plug-in may also provide - * program logic as part of the plug-in runtime library. The framework - * provides services for accessing extensions and for managing plug-in - * dependencies. - * - * @image html architecture.png "C-Pluff plug-in architecture" - * - * @section architectureExtensions Extensions - * - * The idea behind extension points and extensions is that the extensibility - * is not limited only to few fixed plug-in types supported by the - * core application. Although the core plug-ins typically define the extension - * points for the core application logic, it is possible for any plug-in - * to specify additional extension points. - * - * For example, let us assume that we are developing an extensible text - * editor. One extension point defined by core editor plug-in could be - * auto-completion extension point. A plug-in providing basic Java source code - * support could provide an extension for auto-completing Java code. - * Now, while this extension could do basic auto-completion of plain Java code, - * it is customary that Java source code also includes embedded documentation, - * such as JavaDoc comments and tags, or annotations, such as XDoclet tags, as - * part of doc comments. Instead of trying to support all known tags and their - * semantics, the plug-in providing basic Java support could define another - * extension point for additional plug-ins that know how to perform - * auto-completion of different kind of tags in doc comments. - * This way the extensibility of the application is not limited to the - * extension points defined by the core application but the plug-ins can - * incrementally increase the extensibility of the application. - */ diff --git a/lib/cpluff/libcpluff/docsrc/mainpage.dox b/lib/cpluff/libcpluff/docsrc/mainpage.dox deleted file mode 100644 index 7376c324e3..0000000000 --- a/lib/cpluff/libcpluff/docsrc/mainpage.dox +++ /dev/null @@ -1,57 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** - * @mainpage - * - * This is reference documentation for the - * <a href="http://www.c-pluff.org/">C-Pluff</a> C API. - * C-Pluff is a plug-in framework for C programs. - * It has been strongly inspired by the Java plug-in framework in - * <a href="http://www.eclipse.org/">Eclipse</a>. C-Pluff focuses on - * providing core services for plug-in interaction and plug-in - * management. It aims to be platform neutral and supports dynamic changes to - * plug-in configuration without stopping the whole application or framework. - * It does not yet provide special facilities for distribution such as - * signed plug-in packages or remote plug-in repositories but it is - * possible to build such features on top of the current framework. - * - * Here are links to main topics. - * - * - @ref architecture "Plug-in architecture" - * - @ref cMainProgram "Main program" - * - @ref plugin "Plug-in" - * - * - <a class="el" href="modules.html">API elements</a> - * - <a class="el" href="files.html">Header files</a> - * - * For a "quick start guide" in developing C-Pluff based applications, - * see the example in the examples directory of the source distribution. - * - * The latest version of the framework implementation - * and documentation is available at - * <a href="http://www.c-pluff.org/">C-Pluff web site</a>. - * - * This documentation has been generated from the C-Pluff source code - * using <a href="http://www.doxygen.org">Doxygen</a>. - */ diff --git a/lib/cpluff/libcpluff/docsrc/mainprog.dox b/lib/cpluff/libcpluff/docsrc/mainprog.dox deleted file mode 100644 index 78407d032e..0000000000 --- a/lib/cpluff/libcpluff/docsrc/mainprog.dox +++ /dev/null @@ -1,338 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** - * @page cMainProgram Main program - * - * @section cMainProgramOverview Overview - * - * The main program is the part of executable that is located outside the - * plug-in framework. The main program is responsible for setting up - * the plug-in framework and for loading the desired set of - * @ref plugin "plug-ins". The main program should preferably be very - * thin, a mere plug-in loader, because it can not fully participate in plug-in - * interaction. C-Pluff distribution provides a plug-in loader, - * @ref cpluff-loader, which can be used as a generic main program for - * arbitrary plug-in collections. - * - * @section cMainProgramResponsibilities Responsibilities - * - * The main program has several responsibilities: - * - * - @ref cMainProgramInitFramework "initializing the plug-in framework" - * - @ref cMainProgramCreateContext "creating a plug-in context" - * - @ref cMainProgramLoad "loading plug-ins" - * - @ref cMainProgramExec "controlling plug-in execution" - * - @ref cMainProgramChange "changing plug-in configuration" (opt.) - * - @ref cMainProgramDestroyFramework "destroying the plug-in framework" - * - * @subsection cMainProgramInitFramework Initializing the plug-in framework - * - * Plug-in framework, or the C-Pluff library, must be initialized before its - * services can be used. - * Initialization is not a thread-safe operation and should generally be - * done by the main program before any additional plug-in framework accessing - * threads are started. Initialization is done by calling ::cp_init. - * Additionally, the main program can use ::cp_set_fatal_error_handler to register - * a function that is called when a fatal error occurs. A fatal error is one - * that prevents the framework from continuing operation. For example, - * errors in operating system locking operations and a NULL pointer being - * passed as an argument which is expected to have a non-NULL value are fatal - * erors. - * - * Here is an example of possible initialization code. - * - * @code - * #include <locale.h> - * #include <cpluff.h> - * - * void handle_fatal_error(const char *msg) { - * - * // ... log error, flush logs, send bug report, etc. ... - * - * fprintf(stderr, "A fatal error occurred: %s\n", msg); - * abort(); - * } - * - * void initialize(void) { - * cp_status_t status; - * - * setlocale(LC_ALL, ""); - * cp_set_fatal_error_handler(handle_fatal_error); - * status = cp_init(); - * if (status != CP_OK) { - * // ... handle initialization failure ... - * } - * } - * @endcode - * - * @subsection cMainProgramCreateContext Creating a plug-in context - * - * A plug-in context represents the co-operation environment of a set of - * plug-ins from the perspective of a particular participating plug-in or - * the perspective of the main program. From main program perspective, a - * plug-in context is a container for a set of plug-ins. A plug-in can interact - * with other plug-ins in the same container. - * - * An extensible application can have more than one plug-in container but - * usually one container should suffice. Due to the nature of C programs, - * plug-ins deployed to different containers are not very well insulated from - * each other. For example, global variables provided by a plug-in in one - * container are visible to all plug-ins in all containers. Also, by placing - * all plug-ins in the same container they can more efficiently share common - * base components which themselves might provide extensibility. - * - * A main program creates a plug-in context, to be used as a container for - * plugins, using ::cp_create_context. - * - * @code - * #include <cpluff.h> - * - * cp_context_t *ctx; - * - * void create_context(void) { - * cp_status_t status; - * - * ctx = cp_create_context(&status); - * if (ctx == NULL) { - * // ... handle initialization failure ... - * } - * } - * @endcode - * - * @subsection cMainProgramLoad Loading plug-ins - * - * An extensible application is made of plug-ins that can be added and removed - * dynamically. The plug-ins are loaded by the main program using the services - * provided by the framework. The framework provides couple of alternative - * ways of loading plug-ins. - * - * As a lowest level operation, the main program can - * load individual plug-ins from known locations using - * ::cp_load_plugin_descriptor and ::cp_install_plugin. Here is example code - * that loads a set of plug-ins from file system locations listed in a file. - * - * @code - * #include <stdio.h> - * #include <cpluff.h> - * - * extern cp_context_t *ctx; - * static const char pluginListFile[] = "/etc/example/plugins.list"; - * - * void load_plugins(void) { - * char plugindir[128]; - * FILE *lf; - * - * // Open plug-in list file - * lf = fopen(pluginListFile, "r"); - * if (lf == NULL) { - * // ... handle loading failure ... - * } - * - * // Load each listed plug-in - * while (fgets(plugindir, 128, lf) != NULL) { - * cp_plugin_info_t *plugininfo; - * cp_status_t status; - * int i; - * - * // Remove possible trailing newline from plug-in location - * for (i = 0; plugindir[i + 1] != '\0'; i++); - * if (plugindir[i] == '\n') { - * plugindir[i] = '\0'; - * } - * - * // Load plug-in descriptor - * plugininfo = cp_load_plugin_descriptor(ctx, plugindir, &status); - * if (pinfo == NULL) { - * // ... handle loading failure ... - * } - * - * // Install plug-in descriptor - * status = cp_install_plugin(ctx, plugininfo); - * if (status != CP_OK) { - * // ... handle loading failure ... - * } - * - * // Release plug-in descriptor information - * cp_release_info(ctx, plugininfo); - * } - * - * // Close plug-in list file - * fclose(lf); - * } - * @endcode - * - * Alternatively, the main program can register and load plug-in collections. - * A plug-in collection is a file system directory which includes individual - * plug-ins in subdirectories, one plug-in in each subdirectory. Plug-in - * collections can be registered with a plug-in context using - * ::cp_register_pcollection. Plug-ins of the collection can then be scanned - * and loaded using ::cp_scan_plugins. Here is example code loading plug-ins - * from a plug-in collection. - * - * @code - * #include <cpluff.h> - * - * extern cp_context_t *ctx; - * static const char pluginCollectionDir[] = "/etc/example/plugins"; - * - * void load_plugins(void) { - * cp_status_t status; - * - * status = cp_register_pcollection(ctx, pluginCollectionDir); - * if (status != CP_OK) { - * // ... handle loading failure ... - * } - * status = cp_scan_plugins(ctx, 0); - * if (status != CP_OK) { - * // ... handle loading failure ... - * // (notice that some plug-ins might have been loaded) - * } - * } - * @endcode - * - * @subsection cMainProgramExec Controlling plug-in execution - * - * The main program controls plug-in execution by starting and stopping - * plug-ins and by executing run functions registered by plug-ins. - * Additionally, the main program can pass startup arguments to plug-ins. - * - * When plug-ins are installed they are not yet activated and their - * runtime library is not even loaded at that point. The main program - * typically activates plug-ins by starting a main plug-in - * responsible for user interface or core application logic. This plug-in - * then implicitly causes other plug-ins to be activated via dependencies and - * by dynamically resolving symbols provided by other plug-ins. Plug-ins - * recursively activate each other until all initially needed plug-ins have - * been started. Some plug-ins might be activated at a later time when their - * functionality is needed, for example due to user action. - * - * If a plug-in needs to perform background operations, that is operations - * executed outside the invocation of plug-in provided interface functions, - * then it can either start a new thread or it can register a run function. - * A run function is a function that is typically executed as part of the - * main loop by the main program. - * - * The following example code shows how a main program might initialize - * plug-in startup arguments using ::cp_set_context_args, start the core - * plug-in using ::cp_start_plugin and then execute plug-in run functions - * using ::cp_run_plugins. - * - * @code - * #include <cpluff.h> - * - * extern cp_context_t *ctx; - * static const char corePluginId[] = "org.example.core"; - * - * void run_plugins(char *argv[]) { - * cp_status_t status; - * - * // Set plug-in startup arguments - * cp_set_context_args(ctx, argv); - * - * // Start the core plug-in, possibly activating other plug-ins as well - * status = cp_start_plugin(ctx, corePluginId); - * if (status != CP_OK) { - * // ... handle startup failure ... - * } - * - * // Execute plug-ins until there is no more work to be done - * cp_run_plugins(ctx); - * } - * - * int main(int argc, char *argv[]) { - * // ... do initialization and load plug-ins ... - * - * run_plugins(argv); - * - * // ... do destruction ... - * } - * @endcode - * - * Alternatively, if the main program has some operations it must perform - * as part of the main loop, the call to ::cp_run_plugins can be replaced - * by code using ::cp_run_plugins_step like in the following example. - * - * @code - * void mainloop(void) { - * int finished = 0; - * - * while (!finished) { - * // ... do main program specific operations ... - * - * finished = !cp_run_plugins_step(ctx); - * } - * } - * @endcode - * - * @subsection cMainProgramChange Changing plug-in configuration - * - * C-Pluff has been designed to allow dynamic changes to the plug-in - * configuration, that is plug-ins being added or removed without shutting - * down the application or the framework. It is the responsibility of the - * main program to manage such changes if the application is to support - * dynamic configuration changes. - * - * Adding plug-ins is straightforward because there is no need to - * consider dependencies of active plug-ins. For example, if one uses - * plug-in collections as introduced above then new plug-ins can be - * deployed under the plug-in collection directory while the application is - * running and the main program can load them incrementally by calling - * ::cp_scan_plugins again. This call might be activated by some user interface - * element, for example a plug-in manager component which just downloaded and - * installed new plug-ins as requested by the user. The flags - * #CP_SP_STOP_ALL_ON_INSTALL and #CP_SP_RESTART_ACTIVE - * orred together can be used to cause all active plug-ins to be restarted - * if they do not otherwise notice the extensions provided by new plug-ins. - * - * Upgrading plug-ins is almost as straightforward because the C-Pluff - * framework manages plug-in dependencies (assuming the plug-ins have - * declared their dependencies properly). The new version of a plug-in - * can be deployed under the plug-in collection directory in a - * new subdirectory parallel to the old version while the application is - * running. The main program can then call ::cp_scan_plugins with - * #CP_SP_UPGRADE and #CP_SP_RESTART_ACTIVE orred together. This will stop - * the old version of the upgraded plug-in (implicitly stopping all plug-ins - * that depend on it), unload the plug-in from the framework, install the - * new version of the plug-in and finally restart plug-ins that were - * active before the operation. The old version of the plug-in can now - * be removed from the plug-in collection. Again, #CP_SP_STOP_ALL_ON_UPGRADE - * can be added to restart all active plug-ins. - * - * Deleting plug-ins must be done by first stopping and unloading the - * plug-in to be deleted using ::cp_uninstall_plugin. The the plug-in can - * be removed from the plug-in collection. - * - * @subsection cMainProgramDestroyFramework Destroying the plug-in framework - * - * The plug-in framework can be destroyed and all resources released by - * calling ::cp_destroy as many times as ::cp_init has been called. This - * is not a thread-safe operation and should generally be done by the main - * program just before application exits. The destroy function - * stops and unloads all plug-ins and destroys all plug-in contexts before - * destroying the core framework. - * - * Individual plug-in contexts can be destroyed by calling - * ::cp_destroy_context. The destroy function stops and unloads all plug-ins - * before destroying the context itself. - */ diff --git a/lib/cpluff/libcpluff/docsrc/plugin.dox b/lib/cpluff/libcpluff/docsrc/plugin.dox deleted file mode 100644 index 9b7e954896..0000000000 --- a/lib/cpluff/libcpluff/docsrc/plugin.dox +++ /dev/null @@ -1,286 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** - * @page plugin Plug-in - * - * @section pluginOverview Overview - * - * Plug-in is the core element of an extensible application. The extensions and - * also the main application logic are implemented as plug-ins. Plug-ins can - * be developed, distributed and deployed independently, subject to - * inter-plugin dependencies. Deploying a new plug-in does not require - * recompilation or relinking if the operating system platform supports - * required dynamic linking facilities. - * - * @section pluginStructure Structure - * - * A plug-in includes the following structural elements. - * - * - @ref pluginDescriptor "Plug-in descriptor" - * - @ref pluginRuntime "Plug-in runtime library" - * - @ref pluginData "Static plug-in data" - * - * @subsection pluginDescriptor Plug-in descriptor - * - * A plug-in descriptor is an XML document describing a plug-in. It includes - * information about the contents of the plug-in, the features provided by - * the plug-in, plug-in version information and static dependencies of the - * plug-in. Most of the elements are optional. Most of the descriptor - * information described here is available to software via - * @ref cp_plugin_info_t structure. The plug-in descriptor must be located - * in the plug-in directory as @c plugin.xml. - * - * The formal declaration of plug-in descriptor is available as - * XML Schema Definition in @c plugin.xsd located in the top level source - * directory. Currently there is no namespace associated with the plug-in - * descriptor. Here is an example of a plug-in descriptor. Click element name - * to jump into documentation for that element. - * - * <div class="fragment"> - * <pre class="fragment"> - * <<a class="code" href="#pluginDescPlugin">plugin</a> id=<span class="charliteral">"org.c-pluff.example"</span> name=<span class="charliteral">"Example Plug-in"</span> version=<span class="charliteral">"0.3.2"</span> provider-name=<span class="charliteral">"Johannes Lehtinen"</span>> - * <<a class="code" href="#pluginDescPluginBWC">backwards-compatibility</a> abi=<span class="charliteral">"0.3"</span> api=<span class="charliteral">"0.2.8"</span>/> - * <<a class="code" href="#pluginDescPluginRequires">requires</a>> - * <<a class="code" href="#pluginDescPluginReqCP">c-pluff</a> version=<span class="charliteral">"0.1"</span>/> - * <<a class="code" href="#pluginDescPluginReqImport">import</a> plugin=<span class="charliteral">"org.c-pluff.util"</span> version=<span class="charliteral">"0.2"</span>/> - * <<a class="code" href="#pluginDescPluginReqImport">import</a> plugin=<span class="charliteral">"org.c-pluff.extra"</span> optional=<span class="charliteral">"true"</span>/> - * </<a class="code" href="#pluginDescPluginRequires">requires</a>> - * <<a class="code" href="#pluginDescPluginRuntime">runtime</a> library=<span class="charliteral">"libruntime"</span> funcs=<span class="charliteral">"org_cpluff_example_funcs"</span>/> - * <<a class="code" href="#pluginDescPluginEP">extension-point</a> id=<span class="charliteral">"editors"</span> name=<span class="charliteral">"Text Editors"</span> schema=<span class="charliteral">"editors_schema.xsd"</span>/> - * <<a class="code" href="#pluginDescPluginEP">extension-point</a> id=<span class="charliteral">"url-families"</span>/> - * <<a class="code" href="#pluginDescPluginE">extension</a> point=<span class="charliteral">"org.c-pluff.util.archivers"</span> id=<span class="charliteral">"tar"</span> name=<span class="charliteral">"Tar Archiver Support"</span>> - * <type random-access=<span class="charliteral">"false"</span>/> - * <exec bin=<span class="charliteral">"tar"</span>/> - * </<a class="code" href="#pluginDescPluginE">extension</a>> - * <<a class="code" href="#pluginDescPluginE">extension</a> point=<span class="charliteral">"org.c-pluff.example.editors</span>> - * <editor name=<span class="charliteral">"Text Editor"</span> runtime=<span class="charliteral">"org_cpluff_example_txteditor_runtime"</span>> - * <file-types> - * <file-type mime-type=<span class="charliteral">"text/plain"</span>/> - * </file-types> - * </editor> - * </<a class="code" href="#pluginDescPluginE">extension</a>> - * </<a class="code" href="#pluginDescPlugin">plugin</a>></pre> - * </div> - * - * A descriptor can also be much simpler, depending on the plug-in. - * Here is an example of a minimal descriptor (of a useless plug-in). - * - * <div class="fragment"> - * <pre class="fragment"> - * <<a class="code" href="#pluginDescPlugin">plugin</a> id=<span class="charliteral">"org.c-pluff.useless"</span>/></pre> - * </div> - * - * @subsubsection pluginDescPlugin plugin - * - * This is the top level element of the plug-in descriptor. It can have - * following attributes. - * - * - @a id: A mandatory unique identifier for the plug-in. Plug-in identifiers - * should preferably be generated using a reversed DNS domain name as - * prefix to prevent identifier conflicts. - * - @a name: An optional human-readable name for the plug-in. - * - @a version: An optional version number for the plug-in. Version numbers - * are used for checking compatibility when resolving versioned plug-in - * dependencies. See also information about - * @ref pluginVersions "plug-in versions". - * - @a provider-name: The name of the plug-in provider or author. Optional. - * - * This element can contain following elements. - * - * - @ref pluginDescPluginBWC "backwards-compatibility": Optional information about backwards - * compatibility of this plug-in version. - * - @ref pluginDescPluginRequires "requires": Information about static plug-in dependencies. Can be omitted - * if the plug-in does not have static dependencies. - * - @ref pluginDescPluginRuntime "runtime": Information about the plug-in runtime library. Can be omitted - * if the plug-in does not have a runtime library but only data. - * - @ref pluginDescPluginEP "extension-point": Information about extension points provided by the - * plug-in. This element is repeated if there are multiple extension points - * and omitted if there are none. - * - @ref pluginDescPluginE "extension": Information about extensions provided by the plug-in. - * This element is repeated if there are multiple extensions and omitted - * if there are none. - * - * @subsubsection pluginDescPluginBWC backwards-compatibility - * - * This element includes optional information about the backwards compatibility - * of this plug-in version. It can have following attributes. - * - * - @a abi: Backwards compatibility of the application binary interface (ABI) - * of the plug-in. ABI includes any public symbols exported by the plug-in, - * data structures associated with exported symbols and any extension points - * provided by the plug-in. The ABI of the current plug-in version is - * backwards compatible with any plug-in version from the version specified - * here to the current version. This information is used when resolving - * versioned plug-in dependencies. See also information about - * @ref pluginVersions "plug-in versions". - * - @a api: Backwards compatibility of the application programming interface - * (API) of the plug-in. API compatibility means that source code developed - * against one version of the plug-in also compiles against another version - * of the plug-in. This information is not used by framework but it can be - * used by a developer developing dependent plug-ins. - * - * These apply to plug-ins that provide header files and runtime libraries. - * For example, a plug-in might export global functions to other plug-ins or it - * might provide an extension point where an extension installed by other - * plug-in must conform to data structures defined by the plug-in. - * Both attributes are optional. - * - * @subsubsection pluginDescPluginRequires requires - * - * This element includes information about static plug-in dependencies. - * It can be omitted if there are no dependencies. It can contain following - * elements. - * - * - @ref pluginDescPluginReqCP "c-pluff": An optional version dependency - * on the C-Pluff implementation. - * - @ref pluginDescPluginReqImport "import": Declares a static dependency - * on other plug-in. This element is repeated if there are multiple - * dependencies and omitted if there are none. - * - * @subsubsection pluginDescPluginReqCP c-pluff - * - * This element declares a version dependency on the C-Pluff - * implementation. It can be used to ensure that the plug-in is not loaded by - * incompatible C-Pluff version. It has the following attribute. - * - * - @a version: The required version of the C-Pluff implementation. - * This is used when resolving the plug-in. It is checked that the used - * C-Pluff implementation is backwards compatible with the version specified - * here when it comes to the application binary interface (ABI) of C-Pluff. - * - * @subsubsection pluginDescPluginReqImport import - * - * This element declares a static dependency on other plug-in. It must be - * used when a plug-in uses global symbols or data from other plug-in or when - * a plug-in uses an extension point defined by other plug-in or whenever some - * other plug-in needs to be there for the plug-in to work. The framework takes - * care of resolving and starting the dependencies whenever the plug-in is - * resolved or started. - * - * This element can have following attributes. - * - * - @a plugin: The identifier of the imported plug-in. - * - @a version: An optional version dependency on the imported plug-in. - * The plug-in can be resolved only if the version of the imported plug-in - * is backwards compatible with the version specified here when it comes - * to the application binary interface (ABI) of the imported plug-in. - * - @a optional: Is the import optional or not ("true" or "false"). Default is - * false, a mandatory import. - * An optional import behaves just like the mandatory import as long as the - * imported plug-in is present. However, if it is not present then the - * import is ignored. Optional import can be used if the plug-in works - * in limited capacity even without the specified plug-in. - * - * @subsubsection pluginDescPluginRuntime runtime - * - * This element contains information about the plug-in runtime library. It is - * omitted if the plug-in does not have a runtime library but contains only - * data. It can have following attributes. - * - * - @a library: The name of the plug-in runtime library in the plug-in - * directory. A platform specific extension (for example, ".so" or ".dll") - * is added to the value specified here when loading the library. - * - @a funcs: The functions to be used to create an instance of the plug-in - * runtime. This attribute is optional. It is needed if the plug-in has - * a start or stop function. The value specified here is a name of an - * exported symbol which contains a pointer to @ref cp_plugin_runtime_t - * structure. - * - * @subsubsection pluginDescPluginEP extension-point - * - * This element defines an extension point provided by the plug-in. - * It can have following attributes. - * - * - @a id: The local identifier of the extension point. The value specified - * here is prefixed with the identifier of the plug-in and dot to construct - * the global identifier of the extension point. - * - @a name: An optional human-readable name describing the use of the - * extension point. - * - @a schema: An optional path to the extension point XML schema in - * the plug-in directory. This information is not currently used by the - * framework. But it can be used by a developer to determine what information - * should be provided by extensions attached to this extension point. - * - * @subsubsection pluginDescPluginE extension - * - * This element defines an extension installed into a specified extension - * point provided by the defining plug-in or some other plug-in. - * It can have following attributes. - * - * - @a point: The global identifier of the associated extension point. - * - @a id: An optional local identifier for the extension. The value specified - * here is prefixed with the identifier of the plug-in and dot to construct - * the global identifier for the extension. - * - @a name: An optional human-readable name describing the extension. - * - * The extension element can contain XML elements specific to the associated - * extension point (conforming to the schema defined by the extension point). - * - * @subsection pluginRuntime Plug-in runtime library - * - * A plug-in runtime library is an optional plug-in element. Plug-ins only - * supplying static data in form of XML data and files do not need a runtime - * library. However, a typical plug-in does provide program logic as well. - * - * The plug-in runtime library includes all program logic and program - * data provided by the plug-in. It is simply a shared library, or a - * dynamically linked library, which is linked in to the application when - * the plug-in is started. When plug-in is unloaded, the runtime library is - * unloaded as well. The framework has been designed to manage dependencies - * so that unloading of the runtime library does not cause problems, provided - * that plug-ins behave properly. - * - * A plug-in can expose functionality to other plug-ins either as exported - * global symbols that are directly resolved by other plug-ins or by supplying - * extensions. When other plug-ins are directly using exported symbols the - * plug-in acts just like any standard shared library. Nothing special there. - * The more interesting case is exposing functionality as extensions. Because - * the extension is registered at a specific extension point, the logic in - * other plug-ins can use the extension and the associated program logic even - * if they are not aware of the existence of the extension supplying plug-in. - * - * The extension points accepting program logic as extensions define a way - * to specify the name of the symbol pointing to the supplied logic. This is - * typically an attribute of an XML element contained in the extension - * definition. The plug-in supplying the extension can then export the program - * logic as a global symbol with arbitrary name and then place the name of the - * symbol in extension data. Alternatively, the plug-in can define a virtual - * symbol at runtime using ::cp_define_symbol. Other plug-ins that are using - * extensions registered at the extension point can then resolve the named - * symbol using ::cp_resolve_symbol at runtime. The framework automatically - * creates a dependency from the symbol using plug-in to the symbol supplying - * plug-in to prevent failures in case the symbol supplying plug-in is stopped - * or unloaded. - * - * @subsection pluginData Static plug-in data - * - * Plug-in can supply static data to other plug-ins using at least two - * different mechanisms. A plug-in can easily provide static XML data as part - * of extension elements. Additionally, a plug-in directory can contain - * files that may be accessed by other plug-ins. Currently the platform does - * not provide assistance in accessing data files provided by other plug-ins. - * However, a plug-in can locate the plug-in directory and thus any included - * data files by using plug-in path available in @ref cp_plugin_info_t - * structure of the data providing plug-in. - */ diff --git a/lib/cpluff/libcpluff/internal.h b/lib/cpluff/libcpluff/internal.h deleted file mode 100644 index 5f5761750b..0000000000 --- a/lib/cpluff/libcpluff/internal.h +++ /dev/null @@ -1,576 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Internal data structures and declarations - */ - -#ifndef INTERNAL_H_ -#define INTERNAL_H_ - - -/* ------------------------------------------------------------------------ - * Inclusions - * ----------------------------------------------------------------------*/ - -#include "defines.h" -#include <assert.h> -#if defined(DLOPEN_POSIX) -#include <dlfcn.h> -#elif defined(DLOPEN_LIBTOOL) -#include <ltdl.h> -#endif -#include "../kazlib/list.h" -#include "../kazlib/hash.h" -#include "cpluff.h" -#ifdef CP_THREADS -#include "thread.h" -#endif - - -#ifdef __cplusplus -extern "C" { -#endif //__cplusplus - - -/* ------------------------------------------------------------------------ - * Constants - * ----------------------------------------------------------------------*/ - -/// Preliminarily OK -#define CP_OK_PRELIMINARY (-1) - -/// Callback function logger function -#define CPI_CF_LOGGER 1 - -/// Callback function plug-in listener function -#define CPI_CF_LISTENER 2 - -/// Callback function start function -#define CPI_CF_START 4 - -/// Callback function stop function -#define CPI_CF_STOP 8 - -/// Bitmask corresponding to any callback function -#define CPI_CF_ANY (~0) - -/// Logging limit for no logging -#define CP_LOG_NONE 1000 - - -/* ------------------------------------------------------------------------ - * Macros - * ----------------------------------------------------------------------*/ - -#if defined(_WIN32) -#define DLHANDLE void * -#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) -#define DLOPEN(name) LoadPackagedLibrary(name, 0) -#else -#define DLOPEN(name) LoadLibraryA(name) -#endif -#define DLSYM(handle, symbol) GetProcAddress(handle, symbol) -#define DLCLOSE(handle) CloseHandle(handle) -#define DLERROR() "WIN32 - TODO" -#elif defined(DLOPEN_POSIX) -#define DLHANDLE void * -#define DLOPEN(name) dlopen((name), RTLD_LAZY | RTLD_GLOBAL) -#define DLSYM(handle, symbol) dlsym((handle), (symbol)) -#define DLCLOSE(handle) dlclose(handle) -#define DLERROR() dlerror() -#elif defined(DLOPEN_LIBTOOL) -#define DLHANDLE lt_dlhandle -#define DLOPEN(name) lt_dlopen(name) -#define DLSYM(handle, symbol) lt_dlsym((handle), (symbol)) -#define DLCLOSE(handle) lt_dlclose(handle) -#define DLERROR() lt_dlerror() -#endif - - -/** - * Checks that the specified function argument is not NULL. - * Otherwise, reports a fatal error. - * - * @param arg the argument - */ -#define CHECK_NOT_NULL(arg) do { if ((arg) == NULL) cpi_fatal_null_arg(#arg, __func__); } while (0) - - -/* ------------------------------------------------------------------------ - * Data types - * ----------------------------------------------------------------------*/ - -typedef struct cp_plugin_t cp_plugin_t; -typedef struct cp_plugin_env_t cp_plugin_env_t; - -// Plug-in context -struct cp_context_t { - - /// The associated plug-in instance or NULL for the main program - cp_plugin_t *plugin; - - /// The associated plug-in environment - cp_plugin_env_t *env; - - /// Information about resolved symbols or NULL if not initialized - hash_t *resolved_symbols; - - /// Information about symbol providing plugins or NULL if not initialized - hash_t *symbol_providers; - -}; - -// Plug-in environment -struct cp_plugin_env_t { - -#if defined(CP_THREADS) - - /// Mutex for accessing this plug-in environment. - /// This mutex is signaled when a run function returns. - cpi_mutex_t *mutex; - -#elif !defined(NDEBUG) - int locked; -#endif - - /// Number of startup arguments - int argc; - - /// An array of startup arguments - char **argv; - - /// Installed plug-in listeners - list_t *plugin_listeners; - - /// Registered loggers - list_t *loggers; - - /// Minimum logger selection severity - int log_min_severity; - - /// List of registered plug-in directories - list_t *plugin_dirs; - - /// Map of in-use reference counter information object - hash_t *infos; - - /// Maps plug-in identifiers to plug-in state structures - hash_t *plugins; - - /// List of started plug-ins in the order they were started - list_t *started_plugins; - - /// Maps extension point names to installed extension points - hash_t *ext_points; - - /// Maps extension point names to installed extensions - hash_t *extensions; - - /// FIFO queue of run functions, currently running functions at front - list_t *run_funcs; - - /// First waiting run function, or NULL if none - lnode_t *run_wait; - - /// Is logger currently being invoked - int in_logger_invocation; - - /// Whether currently in event listener invocation - int in_event_listener_invocation; - - // Whether currently in start function invocation - int in_start_func_invocation; - - // Whether currently in stop function invocation - int in_stop_func_invocation; - - // Whether currently in create function invocation - int in_create_func_invocation; - - // Whether currently in destroy function invocation - int in_destroy_func_invocation; - -}; - -// Plug-in instance -struct cp_plugin_t { - - /// The enclosing context or NULL if none exists - cp_context_t *context; - - /// Plug-in information - cp_plugin_info_t *plugin; - - /// The current state of the plug-in - cp_plugin_state_t state; - - /// The set of imported plug-ins, or NULL if not resolved - list_t *imported; - - /// The set of plug-ins importing this plug-in - list_t *importing; - - /// The runtime library handle, or NULL if not resolved - DLHANDLE runtime_lib; - - /// Plug-in runtime function information, or NULL if not resolved - cp_plugin_runtime_t *runtime_funcs; - - /// Plug-in instance data or NULL if instance does not exist - void *plugin_data; - - /// Context specific symbols defined by the plug-in - hash_t *defined_symbols; - - /// Used by recursive operations: has this plug-in been processed already - int processed; - -}; - - -/** - * Deallocates a reference counted resource when the reference count drops - * to zero. The plug-in context is locked on call to the function. - * - * @param ctx the associated plug-in context - * @param resource the resource - */ -typedef void (*cpi_dealloc_func_t)(cp_context_t *ctx, void *resource); - -typedef struct cpi_plugin_event_t cpi_plugin_event_t; - -/// Plug-in event information -struct cpi_plugin_event_t { - - /// The affect plug-in - const char *plugin_id; - - /// Old state - cp_plugin_state_t old_state; - - /// New state - cp_plugin_state_t new_state; -}; - - -/* ------------------------------------------------------------------------ - * Function declarations - * ----------------------------------------------------------------------*/ - - -// Locking data structures for exclusive access - -#if defined(CP_THREADS) || !defined(NDEBUG) - -/** - * Acquires exclusive access to the framework. Thread having the framework - * lock must not acquire plug-in context lock (it is ok to retain a previously - * acquired plug-in context lock). - */ -CP_HIDDEN void cpi_lock_framework(void); - -/** - * Releases exclusive access to the framework. - */ -CP_HIDDEN void cpi_unlock_framework(void); - -/** - * Acquires exclusive access to a plug-in context and the associated - * plug-in environment. - * - * @param context the plug-in context - */ -CP_HIDDEN void cpi_lock_context(cp_context_t *context) CP_GCC_NONNULL(1); - -/** - * Releases exclusive access to a plug-in context. - * - * @param context the plug-in context - */ -CP_HIDDEN void cpi_unlock_context(cp_context_t *context) CP_GCC_NONNULL(1); - -/** - * Waits until the specified plug-in context is signalled. - * - * @param context the plug-in context - */ -CP_HIDDEN void cpi_wait_context(cp_context_t *context) CP_GCC_NONNULL(1); - -/** - * Signals the specified plug-in context. - * - * @param context the plug-in context - */ -CP_HIDDEN void cpi_signal_context(cp_context_t *context) CP_GCC_NONNULL(1); - -#else -#define cpi_lock_context(dummy) do {} while (0) -#define cpi_unlock_context(dummy) do {} while (0) -#define cpi_wait_context(dummy) do {} while (0) -#define cpi_signal_context(dummy) do {} while (0) -#define cpi_lock_framework() do {} while(0) -#define cpi_unlock_framework() do {} while(0) -#endif - -/** - * @def cpi_is_context_locked - * - * Returns whether the context is locked. This is intended to be used in - * assertions only and it is not defined if debugging is not enabled. - */ - -#ifndef NDEBUG -#ifdef CP_THREADS -#define cpi_is_context_locked(ctx) cpi_is_mutex_locked((ctx)->env->mutex) -#else -#define cpi_is_context_locked(ctx) ((ctx)->env->locked) -#endif -#endif - - -// Logging - -/** - * Logs a message. Calls dgettext for @a msg to localize it before delivering - * it to loggers. The caller must have locked the context. This - * function logs the message unconditionally. Use convenience macros - * @ref cpi_error, @ref cpi_warn, @ref cpi_info and @ref cpi_debug - * to log based on the minimum severity level logged. - * - * @param ctx the related plug-in context - * @param severity the severity of the message - * @param msg the localized message - */ -CP_HIDDEN void cpi_log(cp_context_t *ctx, cp_log_severity_t severity, const char *msg) CP_GCC_NONNULL(1, 3); - -/** - * Formats and logs a message. Calls dgettext for @a msg to localize it before - * formatting the message. The caller must have locked the context. This - * function logs the message unconditionally. Use convenience macros - * @ref cpi_errorf, @ref cpi_warnf, @ref cpi_infof and @ref cpi_debugf - * to log based on the minimum severity level logged. - * - * @param ctx the related plug-in context - * @param severity the severity of the message - * @param msg the localized message format - * @param ... the message parameters - */ -CP_HIDDEN void cpi_logf(cp_context_t *ctx, cp_log_severity_t severity, const char *msg, ...) CP_GCC_PRINTF(3, 4) CP_GCC_NONNULL(1, 3); - -/** - * Returns whether the messages of the specified severity level are - * being logged for the specified context. The caller must have locked the context. - * - * @param ctx the plug-in context - * @param severity the severity - * @return whether the messages of the specified severity level are logged - */ -#define cpi_is_logged(context, severity) (assert(cpi_is_context_locked(context)), (severity) >= (context)->env->log_min_severity) - -// Convenience macros for logging -#define cpi_log_cond(ctx, level, msg) do { if (cpi_is_logged((ctx), (level))) cpi_log((ctx), (level), (msg)); } while (0) -#define cpi_logf_cond(ctx, level, msg, ...) do { if (cpi_is_logged((ctx), (level))) cpi_logf((ctx), (level), (msg), __VA_ARGS__); } while (0) -#define cpi_error(ctx, msg) cpi_log_cond((ctx), CP_LOG_ERROR, (msg)) -#define cpi_errorf(ctx, msg, ...) cpi_logf_cond((ctx), CP_LOG_ERROR, (msg), __VA_ARGS__) -#define cpi_warn(ctx, msg) cpi_log_cond((ctx), CP_LOG_WARNING, (msg)) -#define cpi_warnf(ctx, msg, ...) cpi_logf_cond((ctx), CP_LOG_WARNING, (msg), __VA_ARGS__) -#define cpi_info(ctx, msg) cpi_log_cond((ctx), CP_LOG_INFO, (msg)) -#define cpi_infof(ctx, msg, ...) cpi_logf_cond((ctx), CP_LOG_INFO, (msg), __VA_ARGS__) -#define cpi_debug(ctx, msg) cpi_log_cond((ctx), CP_LOG_DEBUG, (msg)) -#define cpi_debugf(ctx, msg, ...) cpi_logf_cond((ctx), CP_LOG_DEBUG, (msg), __VA_ARGS__) - -/** - * Unregisters loggers in the specified logger list. Either unregisters all - * loggers or only loggers installed by the specified plug-in. - * - * @param loggers the logger list - * @param plugin the plug-in whose loggers to unregister or NULL for all - */ -CP_HIDDEN void cpi_unregister_loggers(list_t *loggers, cp_plugin_t *plugin) CP_GCC_NONNULL(1); - -/** - * Unregisters plug-in listeners in the specified list. Either unregisters all - * listeners or only listeners installed by the specified plug-in. - * - * @param listeners the listener list - * @param plugin the plug-in whose listeners to unregister or NULL for all - */ -CP_HIDDEN void cpi_unregister_plisteners(list_t *listeners, cp_plugin_t *plugin) CP_GCC_NONNULL(1); - -/** - * Returns the owner name for a context. - * - * @param ctx the context - * @param name the location where the name of the owner is to be stored - * @param size maximum size of the owner string, including the terminating zero - * @return the pointer passed in as @a name - */ -CP_HIDDEN char *cpi_context_owner(cp_context_t *ctx, char *name, size_t size) CP_GCC_NONNULL(1); - -/** - * Reports a fatal error. This method does not return. - * - * @param msg the formatted error message - * @param ... parameters - */ -CP_HIDDEN void cpi_fatalf(const char *msg, ...) CP_GCC_NORETURN CP_GCC_PRINTF(1, 2) CP_GCC_NONNULL(1); - -/** - * Reports a fatal NULL argument to an API function. - * - * @param arg the argument name - * @param func the API function name - */ -CP_HIDDEN void cpi_fatal_null_arg(const char *arg, const char *func) CP_GCC_NORETURN CP_GCC_NONNULL(1, 2); - -/** - * Checks that we are currently not in a specific callback function invocation. - * Otherwise, reports a fatal error. The caller must have locked the context - * before calling this function. - * - * @param ctx the associated plug-in context - * @param funcmask the bitmask of disallowed callback functions - * @param func the current plug-in framework function - */ -CP_HIDDEN void cpi_check_invocation(cp_context_t *ctx, int funcmask, const char *func) CP_GCC_NONNULL(1, 3); - - -// Context management - -/** - * Allocates a new plug-in context. - * - * @param plugin the associated plug-in or NULL for the client program - * @param env the associated plug-in environment - * @param status a pointer to the location where the status code is to be stored - * @return the newly allocated context or NULL on failure - */ -CP_HIDDEN cp_context_t * cpi_new_context(cp_plugin_t *plugin, cp_plugin_env_t *env, cp_status_t *status) CP_GCC_NONNULL(2, 3); - -/** - * Frees the resources associated with a plug-in context. Also frees the - * associated plug-in environment if the context is a client program plug-in - * context. - * - * @param context the plug-in context to free - */ -CP_HIDDEN void cpi_free_context(cp_context_t *context) CP_GCC_NONNULL(1); - -/** - * Destroys all contexts and releases the context list resources. - */ -CP_HIDDEN void cpi_destroy_all_contexts(void); - - -// Delivering plug-in events - -/** - * Delivers a plug-in event to registered event listeners. - * - * @param context the plug-in context - * @param event the plug-in event - */ -CP_HIDDEN void cpi_deliver_event(cp_context_t *context, const cpi_plugin_event_t *event) CP_GCC_NONNULL(1, 2); - - -// Plug-in management - -/** - * Frees any resources allocated for a plug-in description. - * - * @param plugin the plug-in to be freed - */ -CP_HIDDEN void cpi_free_plugin(cp_plugin_info_t *plugin) CP_GCC_NONNULL(1); - -/** - * Starts the specified plug-in and its dependencies. - * - * @param context the plug-in context - * @param plugin the plug-in - * @return @ref CP_OK (zero) on success or an error code on failure - */ -CP_HIDDEN cp_status_t cpi_start_plugin(cp_context_t *context, cp_plugin_t *plugin) CP_GCC_NONNULL(1, 2); - - -// Dynamic resource management - -/** - * Registers a new reference counted information object. - * Initializes the reference count to 1. The object is released and - * deallocated using the specified deallocation function @a df when its - * reference count becomes zero. Reference count is incresed by - * ::cpi_use_info and decreased by ::cp_release_info. The caller must have - * locked the plug-in context. - * - * @param ctx the associated plug-in context - * @param res the resource - * @param df the deallocation function - * @return @ref CP_OK (zero) on success or an error code on failure - */ -CP_HIDDEN cp_status_t cpi_register_info(cp_context_t *ctx, void *res, cpi_dealloc_func_t df) CP_GCC_NONNULL(1, 2, 3); - -/** - * Increases the reference count for the specified information object. - * The caller must have locked the plug-in context. - * - * @param ctx the plug-in context - * @param res the resource - */ -CP_HIDDEN void cpi_use_info(cp_context_t *ctx, void *res) CP_GCC_NONNULL(1, 2); - -/** - * Decreases the reference count for the specified information object. - * The caller must have locked the plug-in context. - * - * @param ctx the plug-in context - * @param res the resource - */ -CP_HIDDEN void cpi_release_info(cp_context_t *ctx, void *res) CP_GCC_NONNULL(1, 2); - -/** - * Checks for remaining information objects in the specified plug-in context. - * Does not destroy the infos hash. - * - * @param ctx the plug-in context - */ -CP_HIDDEN void cpi_release_infos(cp_context_t *ctx) CP_GCC_NONNULL(1); - - -// Serialized execution - -/** - * Waits for all the run functions registered by the specified plug-in to - * return and then unregisters them. The caller must have locked the - * associated context. - * - * @param plugin the plug-in to be stopped - */ -CP_HIDDEN void cpi_stop_plugin_run(cp_plugin_t *plugin) CP_GCC_NONNULL(1); - - -#ifdef __cplusplus -} -#endif //__cplusplus - -#endif /*INTERNAL_H_*/ diff --git a/lib/cpluff/libcpluff/logging.c b/lib/cpluff/libcpluff/logging.c deleted file mode 100644 index f9871c9061..0000000000 --- a/lib/cpluff/libcpluff/logging.c +++ /dev/null @@ -1,262 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Logging functions - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> -#include <assert.h> -#include "cpluff.h" -#include "defines.h" -#include "util.h" -#include "internal.h" - - -/* ------------------------------------------------------------------------ - * Data types - * ----------------------------------------------------------------------*/ - -/// Contains information about installed loggers -typedef struct logger_t { - - /// Pointer to logger - cp_logger_func_t logger; - - /// Pointer to registering plug-in or NULL for the main program - cp_plugin_t *plugin; - - /// User data pointer - void *user_data; - - /// Minimum severity - cp_log_severity_t min_severity; - - /// Selected environment or NULL - cp_plugin_env_t *env_selection; -} logger_t; - - -/* ------------------------------------------------------------------------ - * Function definitions - * ----------------------------------------------------------------------*/ - -/** - * Updates the context logging limits. The caller must have locked the - * context. - */ -static void update_logging_limits(cp_context_t *context) { - lnode_t *node; - int nms = CP_LOG_NONE; - - node = list_first(context->env->loggers); - while (node != NULL) { - logger_t *lh = lnode_get(node); - if (lh->min_severity < nms) { - nms = lh->min_severity; - } - node = list_next(context->env->loggers, node); - } - context->env->log_min_severity = nms; -} - -static int comp_logger(const void *p1, const void *p2) { - const logger_t *l1 = p1; - const logger_t *l2 = p2; - return l1->logger != l2->logger; -} - -CP_C_API cp_status_t cp_register_logger(cp_context_t *context, cp_logger_func_t logger, void *user_data, cp_log_severity_t min_severity) { - logger_t l; - logger_t *lh = NULL; - lnode_t *node = NULL; - cp_status_t status = CP_OK; - - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(logger); - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_LOGGER, __func__); - do { - - // Check if logger already exists and allocate new holder if necessary - l.logger = logger; - if ((node = list_find(context->env->loggers, &l, comp_logger)) == NULL) { - lh = malloc(sizeof(logger_t)); - node = lnode_create(lh); - if (lh == NULL || node == NULL) { - status = CP_ERR_RESOURCE; - break; - } - lh->logger = logger; - lh->plugin = context->plugin; - list_append(context->env->loggers, node); - } else { - lh = lnode_get(node); - } - - // Initialize or update the logger holder - lh->user_data = user_data; - lh->min_severity = min_severity; - - // Update global limits - update_logging_limits(context); - - } while (0); - - // Report error - if (status == CP_ERR_RESOURCE) { - cpi_error(context, N_("Logger could not be registered due to insufficient memory.")); - } else if (cpi_is_logged(context, CP_LOG_DEBUG)) { - char owner[64]; - /* TRANSLATORS: %s is the context owner */ - cpi_debugf(context, N_("%s registered a logger."), cpi_context_owner(context, owner, sizeof(owner))); - } - cpi_unlock_context(context); - - // Release resources on error - if (status != CP_OK) { - if (node != NULL) { - lnode_destroy(node); - } - if (lh != NULL) { - free(lh); - } - } - - return status; -} - -CP_C_API void cp_unregister_logger(cp_context_t *context, cp_logger_func_t logger) { - logger_t l; - lnode_t *node; - - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(logger); - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_LOGGER, __func__); - - l.logger = logger; - if ((node = list_find(context->env->loggers, &l, comp_logger)) != NULL) { - logger_t *lh = lnode_get(node); - list_delete(context->env->loggers, node); - lnode_destroy(node); - free(lh); - update_logging_limits(context); - } - if (cpi_is_logged(context, CP_LOG_DEBUG)) { - char owner[64]; - /* TRANSLATORS: %s is the context owner */ - cpi_debugf(context, N_("%s unregistered a logger."), cpi_context_owner(context, owner, sizeof(owner))); - } - cpi_unlock_context(context); -} - -static void do_log(cp_context_t *context, cp_log_severity_t severity, const char *msg) { - lnode_t *node; - const char *apid = NULL; - - assert(cpi_is_context_locked(context)); - if (context->env->in_logger_invocation) { - cpi_fatalf(_("Encountered a recursive logging request within a logger invocation.")); - } - if (context->plugin != NULL) { - apid = context->plugin->plugin->identifier; - } - context->env->in_logger_invocation++; - node = list_first(context->env->loggers); - while (node != NULL) { - logger_t *lh = lnode_get(node); - if (severity >= lh->min_severity) { - lh->logger(severity, msg, apid, lh->user_data); - } - node = list_next(context->env->loggers, node); - } - context->env->in_logger_invocation--; -} - -CP_HIDDEN void cpi_log(cp_context_t *context, cp_log_severity_t severity, const char *msg) { - assert(context != NULL); - assert(msg != NULL); - assert(severity >= CP_LOG_DEBUG && severity <= CP_LOG_ERROR); - do_log(context, severity, _(msg)); -} - -CP_HIDDEN void cpi_logf(cp_context_t *context, cp_log_severity_t severity, const char *msg, ...) { - char buffer[256]; - va_list va; - - assert(context != NULL); - assert(msg != NULL); - assert(severity >= CP_LOG_DEBUG && severity <= CP_LOG_ERROR); - - va_start(va, msg); - vsnprintf(buffer, sizeof(buffer), _(msg), va); - va_end(va); - strcpy(buffer + sizeof(buffer)/sizeof(char) - 4, "..."); - do_log(context, severity, buffer); -} - -static void process_unregister_logger(list_t *list, lnode_t *node, void *plugin) { - logger_t *lh = lnode_get(node); - if (plugin == NULL || lh->plugin == plugin) { - list_delete(list, node); - lnode_destroy(node); - free(lh); - } -} - -CP_HIDDEN void cpi_unregister_loggers(list_t *loggers, cp_plugin_t *plugin) { - list_process(loggers, plugin, process_unregister_logger); -} - -CP_C_API void cp_log(cp_context_t *context, cp_log_severity_t severity, const char *msg) { - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(msg); - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_LOGGER, __func__); - if (severity < CP_LOG_DEBUG || severity > CP_LOG_ERROR) { - cpi_fatalf(_("Illegal severity value in call to %s."), __func__); - } - if (cpi_is_logged(context, severity)) { - do_log(context, severity, msg); - } - cpi_unlock_context(context); -} - -CP_C_API int cp_is_logged(cp_context_t *context, cp_log_severity_t severity) { - int is_logged; - - CHECK_NOT_NULL(context); - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_LOGGER, __func__); - is_logged = cpi_is_logged(context, severity); - cpi_unlock_context(context); - return is_logged; -} diff --git a/lib/cpluff/libcpluff/pcontrol.c b/lib/cpluff/libcpluff/pcontrol.c deleted file mode 100644 index 2f475910ff..0000000000 --- a/lib/cpluff/libcpluff/pcontrol.c +++ /dev/null @@ -1,1243 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Core plug-in management functions - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <assert.h> -#include <string.h> -#include <stddef.h> -#include "../kazlib/list.h" -#include "../kazlib/hash.h" -#include "cpluff.h" -#include "defines.h" -#include "util.h" -#include "internal.h" -#ifdef _WIN32 -#include <windows.h> -#endif - - -/* ------------------------------------------------------------------------ - * Function definitions - * ----------------------------------------------------------------------*/ - -// Plug-in control - -#ifndef NDEBUG -static void assert_processed_zero(cp_context_t *context) { - hscan_t scan; - hnode_t *node; - - hash_scan_begin(&scan, context->env->plugins); - while ((node = hash_scan_next(&scan)) != NULL) { - cp_plugin_t *plugin = hnode_get(node); - assert(plugin->processed == 0); - } -} -#else -#define assert_processed_zero(c) assert(1) -#endif - -static void unregister_extensions(cp_context_t *context, cp_plugin_info_t *plugin) { - unsigned int i; - - for (i = 0; i < plugin->num_ext_points; i++) { - cp_ext_point_t *ep = plugin->ext_points + i; - hnode_t *hnode; - - if ((hnode = hash_lookup(context->env->ext_points, ep->identifier)) != NULL - && hnode_get(hnode) == ep) { - hash_delete_free(context->env->ext_points, hnode); - } - } - for (i = 0; i < plugin->num_extensions; i++) { - cp_extension_t *e = plugin->extensions + i; - hnode_t *hnode; - - if ((hnode = hash_lookup(context->env->extensions, e->ext_point_id)) != NULL) { - list_t *el = hnode_get(hnode); - lnode_t *lnode = list_first(el); - - while (lnode != NULL) { - lnode_t *nn = list_next(el, lnode); - if (lnode_get(lnode) == e) { - list_delete(el, lnode); - lnode_destroy(lnode); - break; - } - lnode = nn; - } - if (list_isempty(el)) { - char *epid = (char *) hnode_getkey(hnode); - hash_delete_free(context->env->extensions, hnode); - free(epid); - list_destroy(el); - } - } - } -} - -CP_C_API cp_status_t cp_install_plugin(cp_context_t *context, cp_plugin_info_t *plugin) { - cp_plugin_t *rp = NULL; - cp_status_t status = CP_OK; - cpi_plugin_event_t event; - unsigned int i; - - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(plugin); - - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_ANY, __func__); - do { - - // Check that there is no conflicting plug-in already loaded - if (hash_lookup(context->env->plugins, plugin->identifier) != NULL) { - cpi_errorf(context, - N_("Plug-in %s could not be installed because a plug-in with the same identifier is already installed."), - plugin->identifier); - status = CP_ERR_CONFLICT; - break; - } - - // Increase usage count for the plug-in descriptor - cpi_use_info(context, plugin); - - // Allocate space for the plug-in state - if ((rp = malloc(sizeof(cp_plugin_t))) == NULL) { - status = CP_ERR_RESOURCE; - break; - } - - // Initialize plug-in state - memset(rp, 0, sizeof(cp_plugin_t)); - rp->context = NULL; - rp->plugin = plugin; - rp->state = CP_PLUGIN_INSTALLED; - rp->imported = NULL; - rp->runtime_lib = NULL; - rp->runtime_funcs = NULL; - rp->plugin_data = NULL; - rp->importing = list_create(LISTCOUNT_T_MAX); - if (rp->importing == NULL) { - status = CP_ERR_RESOURCE; - break; - } - if (!hash_alloc_insert(context->env->plugins, plugin->identifier, rp)) { - status = CP_ERR_RESOURCE; - break; - } - - // Register extension points - for (i = 0; status == CP_OK && i < plugin->num_ext_points; i++) { - cp_ext_point_t *ep = plugin->ext_points + i; - hnode_t *hnode; - - if ((hnode = hash_lookup(context->env->ext_points, ep->identifier)) != NULL) { - cpi_errorf(context, N_("Plug-in %s could not be installed because extension point %s conflicts with an already installed extension point."), plugin->identifier, ep->identifier); - status = CP_ERR_CONFLICT; - } else if (!hash_alloc_insert(context->env->ext_points, ep->identifier, ep)) { - status = CP_ERR_RESOURCE; - } - } - - // Register extensions - for (i = 0; status == CP_OK && i < plugin->num_extensions; i++) { - cp_extension_t *e = plugin->extensions + i; - hnode_t *hnode; - lnode_t *lnode; - list_t *el; - - if ((hnode = hash_lookup(context->env->extensions, e->ext_point_id)) == NULL) { - char *epid; - if ((el = list_create(LISTCOUNT_T_MAX)) != NULL - && (epid = strdup(e->ext_point_id)) != NULL) { - if (!hash_alloc_insert(context->env->extensions, epid, el)) { - list_destroy(el); - status = CP_ERR_RESOURCE; - break; - } - } else { - if (el != NULL) { - list_destroy(el); - } - status = CP_ERR_RESOURCE; - break; - } - } else { - el = hnode_get(hnode); - } - if ((lnode = lnode_create(e)) != NULL) { - list_append(el, lnode); - } else { - status = CP_ERR_RESOURCE; - break; - } - } - - // Break if previous loops failed - if (status != CP_OK) { - break; - } - - // Plug-in installed - event.plugin_id = plugin->identifier; - event.old_state = CP_PLUGIN_UNINSTALLED; - event.new_state = rp->state; - cpi_deliver_event(context, &event); - - } while (0); - - // Release resources on failure - if (status != CP_OK) { - if (rp != NULL) { - if (rp->importing != NULL) { - list_destroy(rp->importing); - } - free(rp); - } - unregister_extensions(context, plugin); - } - - // Report possible resource error - if (status == CP_ERR_RESOURCE) { - cpi_errorf(context, - N_("Plug-in %s could not be installed due to insufficient system resources."), plugin->identifier); - } - cpi_unlock_context(context); - - return status; -} - -/** - * Unresolves the plug-in runtime information. - * - * @param plugin the plug-in to unresolve - */ -static void unresolve_plugin_runtime(cp_plugin_t *plugin) { - - // Destroy the plug-in instance, if necessary - if (plugin->context != NULL) { - plugin->context->env->in_destroy_func_invocation++; - plugin->runtime_funcs->destroy(plugin->plugin_data); - plugin->context->env->in_destroy_func_invocation--; - plugin->plugin_data = NULL; - cpi_free_context(plugin->context); - plugin->context = NULL; - } - - // Close plug-in runtime library - plugin->runtime_funcs = NULL; - if (plugin->runtime_lib != NULL) { - DLCLOSE(plugin->runtime_lib); - plugin->runtime_lib = NULL; - } -} - -/** - * Loads and resolves the plug-in runtime library and initialization functions. - * - * @param context the plug-in context - * @param plugin the plugin - * @return CP_OK (zero) on success or error code on failure - */ -static int resolve_plugin_runtime(cp_context_t *context, cp_plugin_t *plugin) { - char *rlpath = NULL; - int rlpath_len; - cp_status_t status = CP_OK; - - assert(plugin->runtime_lib == NULL); - if (plugin->plugin->runtime_lib_name == NULL) { - return CP_OK; - } - - do { - int ppath_len, lname_len; - int cpluff_compatibility = 1; - - // Check C-Pluff compatibility - if (plugin->plugin->req_cpluff_version != NULL) { -#ifdef CP_ABI_COMPATIBILITY - cpluff_compatibility = ( - cpi_vercmp(plugin->plugin->req_cpluff_version, CP_VERSION) <= 0 - && cpi_vercmp(plugin->plugin->req_cpluff_version, CP_ABI_COMPATIBILITY) >= 0); -#else - cpluff_compatibility = (cpi_vercmp(plugin->plugin->req_cpluff_version, CP_VERSION) == 0); -#endif - } - if (!cpluff_compatibility) { - cpi_errorf(context, N_("Plug-in %s could not be resolved due to version incompatibility with C-Pluff."), plugin->plugin->identifier); - status = CP_ERR_DEPENDENCY; - break; - } - - // Construct a path to plug-in runtime library. - /// @todo Add platform specific prefix (for example, "lib") - ppath_len = strlen(plugin->plugin->plugin_path); - lname_len = strlen(plugin->plugin->runtime_lib_name); - rlpath_len = ppath_len + lname_len + strlen(CP_SHREXT) + 2; - if ((rlpath = malloc(rlpath_len * sizeof(char))) == NULL) { - cpi_errorf(context, N_("Plug-in %s runtime library could not be loaded due to insufficient memory."), plugin->plugin->identifier); - status = CP_ERR_RESOURCE; - break; - } - memset(rlpath, 0, rlpath_len * sizeof(char)); - strcpy(rlpath, plugin->plugin->plugin_path); - rlpath[ppath_len] = CP_FNAMESEP_CHAR; - strcpy(rlpath + ppath_len + 1, plugin->plugin->runtime_lib_name); - strcpy(rlpath + ppath_len + 1 + lname_len, CP_SHREXT); - - // Open the plug-in runtime library - plugin->runtime_lib = DLOPEN(rlpath); - if (plugin->runtime_lib == NULL) { - const char *error = DLERROR(); - if (error == NULL) { - error = _("Unspecified error."); - } - cpi_errorf(context, N_("Plug-in %s runtime library %s could not be opened: %s"), plugin->plugin->identifier, rlpath, error); - status = CP_ERR_RUNTIME; - break; - } - - // Resolve plug-in functions - if (plugin->plugin->runtime_funcs_symbol != NULL) { - plugin->runtime_funcs = (cp_plugin_runtime_t *) DLSYM(plugin->runtime_lib, plugin->plugin->runtime_funcs_symbol); - if (plugin->runtime_funcs == NULL) { - const char *error = DLERROR(); - if (error == NULL) { - error = _("Unspecified error."); - } - cpi_errorf(context, N_("Plug-in %s symbol %s containing plug-in runtime information could not be resolved: %s"), plugin->plugin->identifier, plugin->plugin->runtime_funcs_symbol, error); - status = CP_ERR_RUNTIME; - break; - } - if (plugin->runtime_funcs->create == NULL - || plugin->runtime_funcs->destroy == NULL) { - cpi_errorf(context, N_("Plug-in %s is missing a constructor or destructor function."), plugin->plugin->identifier); - status = CP_ERR_RUNTIME; - break; - } - } - - } while (0); - - // Release resources - free(rlpath); - if (status != CP_OK) { - unresolve_plugin_runtime(plugin); - } - - return status; -} - -/** - * Resolves the specified plug-in import into a plug-in pointer. Does not - * try to resolve the imported plug-in. - * - * @param context the plug-in context - * @param plugin the plug-in being resolved - * @param import the plug-in import to resolve - * @param ipptr filled with pointer to the resolved plug-in or NULL - * @return CP_OK on success or error code on failure - */ -static int resolve_plugin_import(cp_context_t *context, cp_plugin_t *plugin, cp_plugin_import_t *import, cp_plugin_t **ipptr) { - cp_plugin_t *ip = NULL; - hnode_t *node; - - // Lookup the plug-in - node = hash_lookup(context->env->plugins, import->plugin_id); - if (node != NULL) { - ip = hnode_get(node); - } - - // Check plug-in version - if (ip != NULL - && import->version != NULL - && (ip->plugin->version == NULL - || (ip->plugin->abi_bw_compatibility == NULL - && cpi_vercmp(import->version, ip->plugin->version) != 0) - || (ip->plugin->abi_bw_compatibility != NULL - && (cpi_vercmp(import->version, ip->plugin->version) > 0 - || cpi_vercmp(import->version, ip->plugin->abi_bw_compatibility) < 0)))) { - cpi_errorf(context, - N_("Plug-in %s could not be resolved due to version incompatibility with plug-in %s."), - plugin->plugin->identifier, - import->plugin_id); - *ipptr = NULL; - return CP_ERR_DEPENDENCY; - } - - // Check if missing mandatory plug-in - if (ip == NULL && !import->optional) { - cpi_errorf(context, - N_("Plug-in %s could not be resolved because it depends on plug-in %s which is not installed."), - plugin->plugin->identifier, - import->plugin_id); - *ipptr = NULL; - return CP_ERR_DEPENDENCY; - } - - // Return imported plug-in - *ipptr = ip; - return CP_OK; -} - -/** - * Resolves the specified plug-in and its dependencies while leaving plug-ins - * with circular dependencies in a preliminarily resolved state. - * - * @param context the plug-in context - * @param plugin the plug-in - * @return CP_OK (zero) or CP_OK_PRELIMINARY or an error code - */ -static int resolve_plugin_prel_rec(cp_context_t *context, cp_plugin_t *plugin) { - cp_status_t status = CP_OK; - int error_reported = 0; - lnode_t *node = NULL; - unsigned int i; - - // Check if already resolved - if (plugin->state >= CP_PLUGIN_RESOLVED) { - return CP_OK; - } - - // Check for dependency loops - if (plugin->processed) { - return CP_OK_PRELIMINARY; - } - plugin->processed = 1; - - do { - - // Recursively resolve the imported plug-ins - assert(plugin->imported == NULL); - if ((plugin->imported = list_create(LISTCOUNT_T_MAX)) == NULL) { - status = CP_ERR_RESOURCE; - break; - } - for (i = 0; i < plugin->plugin->num_imports; i++) { - cp_plugin_t *ip; - int s; - - if ((node = lnode_create(NULL)) == NULL) { - status = CP_ERR_RESOURCE; - break; - } - if ((s = resolve_plugin_import(context, plugin, plugin->plugin->imports + i, &ip)) != CP_OK) { - error_reported = 1; - status = s; - break; - } - if (ip != NULL) { - lnode_put(node, ip); - list_append(plugin->imported, node); - node = NULL; - if (!cpi_ptrset_add(ip->importing, plugin)) { - status = CP_ERR_RESOURCE; - break; - } else if ((s = resolve_plugin_prel_rec(context, ip)) != CP_OK && s != CP_OK_PRELIMINARY) { - cpi_errorf(context, N_("Plug-in %s could not be resolved because it depends on plug-in %s which could not be resolved."), plugin->plugin->identifier, ip->plugin->identifier); - error_reported = 1; - status = s; - break; - } - } else { - lnode_destroy(node); - node = NULL; - } - } - if (status != CP_OK) { - break; - } - - // Resolve this plug-in - assert(plugin->state == CP_PLUGIN_INSTALLED); - if ((i = resolve_plugin_runtime(context, plugin)) != CP_OK) { - status = i; - error_reported = 1; - break; - } - - // Notify event listeners and update state if completely resolved - if (status == CP_OK) { - cpi_plugin_event_t event; - - plugin->processed = 0; - event.plugin_id = plugin->plugin->identifier; - event.old_state = plugin->state; - event.new_state = plugin->state = CP_PLUGIN_RESOLVED; - cpi_deliver_event(context, &event); - } - - } while (0); - - // Clean up - if (node != NULL) { - lnode_destroy(node); - } - - // Handle errors - if (status == CP_ERR_RESOURCE && !error_reported) { - cpi_errorf(context, N_("Plug-in %s could not be resolved because of insufficient memory."), plugin->plugin->identifier); - } - - return status; -} - -/** - * Recursively commits the resolving process for the specified plug-in and - * its dependencies. - * - * @param context the plug-in context - * @param plugin the plug-in - */ -static void resolve_plugin_commit_rec(cp_context_t *context, cp_plugin_t *plugin) { - - // Check if already committed - if (!plugin->processed) { - return; - } - plugin->processed = 0; - - // Commit if only preliminarily resolved - if (plugin->state < CP_PLUGIN_RESOLVED) { - cpi_plugin_event_t event; - lnode_t *node; - - // Recursively commit dependencies - node = list_first(plugin->imported); - while (node != NULL) { - resolve_plugin_commit_rec(context, (cp_plugin_t *) lnode_get(node)); - node = list_next(plugin->imported, node); - } - - // Notify event listeners and update state - event.plugin_id = plugin->plugin->identifier; - event.old_state = plugin->state; - event.new_state = plugin->state = CP_PLUGIN_RESOLVED; - cpi_deliver_event(context, &event); - } -} - -/** - * Recursively cleans up the specified plug-in and its dependencies after - * a failed resolving attempt. - * - * @param plugin the plug-in - */ -static void resolve_plugin_failed_rec(cp_plugin_t *plugin) { - - // Check if already cleaned up - if (!plugin->processed) { - return; - } - plugin->processed = 0; - - // Clean up if only preliminarily resolved - if (plugin->state < CP_PLUGIN_RESOLVED) { - lnode_t *node; - - // Recursively clean up depedencies - while ((node = list_first(plugin->imported)) != NULL) { - cp_plugin_t *ip = lnode_get(node); - - resolve_plugin_failed_rec(ip); - cpi_ptrset_remove(ip->importing, plugin); - list_delete(plugin->imported, node); - lnode_destroy(node); - } - list_destroy(plugin->imported); - plugin->imported = NULL; - } -} - -/** - * Resolves the specified plug-in and its dependencies. - * - * @param context the plug-in context - * @param plugin the plug-in to be resolved - * @return CP_OK (zero) on success or an error code on failure - */ -static int resolve_plugin(cp_context_t *context, cp_plugin_t *plugin) { - cp_status_t status; - - if ((status = resolve_plugin_prel_rec(context, plugin)) == CP_OK || status == CP_OK_PRELIMINARY) { - status = CP_OK; - resolve_plugin_commit_rec(context, plugin); - } else { - resolve_plugin_failed_rec(plugin); - } - assert_processed_zero(context); - return status; -} - -/** - * Starts the plug-in runtime of the specified plug-in. This function does - * not consider dependencies and assumes that the plug-in is resolved but - * not yet started. - * - * @param context the plug-in context - * @param plugin the plug-in - * @return CP_OK (zero) on success or an error code on failure - */ -static int start_plugin_runtime(cp_context_t *context, cp_plugin_t *plugin) { - cp_status_t status = CP_OK; - cpi_plugin_event_t event; - lnode_t *node = NULL; - - event.plugin_id = plugin->plugin->identifier; - do { - - // Allocate space for the list node - node = lnode_create(plugin); - if (node == NULL) { - status = CP_ERR_RESOURCE; - break; - } - - // Set up plug-in instance - if (plugin->runtime_funcs != NULL) { - - // Create plug-in instance if necessary - if (plugin->context == NULL) { - if ((plugin->context = cpi_new_context(plugin, context->env, &status)) == NULL) { - break; - } - context->env->in_create_func_invocation++; - plugin->plugin_data = plugin->runtime_funcs->create(plugin->context); - context->env->in_create_func_invocation--; - if (plugin->plugin_data == NULL) { - status = CP_ERR_RUNTIME; - break; - } - } - - // Start plug-in - if (plugin->runtime_funcs->start != NULL) { - int s; - - // About to start the plug-in - event.old_state = plugin->state; - event.new_state = plugin->state = CP_PLUGIN_STARTING; - cpi_deliver_event(context, &event); - - // Start the plug-in - context->env->in_start_func_invocation++; - s = plugin->runtime_funcs->start(plugin->plugin_data); - context->env->in_start_func_invocation--; - - if (s != CP_OK) { - - // Roll back plug-in state - if (plugin->runtime_funcs->stop != NULL) { - - // Update state - event.old_state = plugin->state; - event.new_state = plugin->state = CP_PLUGIN_STOPPING; - cpi_deliver_event(context, &event); - - // Call stop function - context->env->in_stop_func_invocation++; - plugin->runtime_funcs->stop(plugin->plugin_data); - context->env->in_stop_func_invocation--; - } - - // Destroy plug-in object - context->env->in_destroy_func_invocation++; - plugin->runtime_funcs->destroy(plugin->plugin_data); - context->env->in_destroy_func_invocation--; - - status = CP_ERR_RUNTIME; - break; - } - } - } - - // Plug-in active - list_append(context->env->started_plugins, node); - event.old_state = plugin->state; - event.new_state = plugin->state = CP_PLUGIN_ACTIVE; - cpi_deliver_event(context, &event); - - } while (0); - - // Release resources and roll back plug-in state on failure - if (status != CP_OK) { - if (node != NULL) { - lnode_destroy(node); - } - if (plugin->context != NULL) { - cpi_free_context(plugin->context); - plugin->context = NULL; - } - if (plugin->state != CP_PLUGIN_RESOLVED) { - event.old_state = plugin->state; - event.new_state = plugin->state = CP_PLUGIN_RESOLVED; - cpi_deliver_event(context, &event); - } - plugin->plugin_data = NULL; - } - - // Report error on failure - switch (status) { - case CP_ERR_RESOURCE: - cpi_errorf(context, - N_("Plug-in %s could not be started due to insufficient memory."), - plugin->plugin->identifier); - break; - case CP_ERR_RUNTIME: - cpi_errorf(context, - N_("Plug-in %s failed to start due to plug-in runtime error."), - plugin->plugin->identifier); - break; - default: - break; - } - - return status; -} - -static void warn_dependency_loop(cp_context_t *context, cp_plugin_t *plugin, list_t *importing, int dynamic) { - char *msgbase; - char *msg; - int msgsize; - lnode_t *node; - - // Take the message base - if (dynamic) { - msgbase = N_("Detected a runtime plug-in dependency loop: %s"); - } else { - msgbase = N_("Detected a static plug-in dependency loop: %s"); - } - - // Calculate the required message space - msgsize = 0; - msgsize += strlen(plugin->plugin->identifier); - msgsize += 2; - node = list_last(importing); - while (node != NULL) { - cp_plugin_t *p = lnode_get(node); - if (p == plugin) { - break; - } - msgsize += strlen(p->plugin->identifier); - msgsize += 2; - node = list_prev(importing, node); - } - msg = malloc(sizeof(char) * msgsize); - if (msg != NULL) { - strcpy(msg, plugin->plugin->identifier); - node = list_last(importing); - while (node != NULL) { - cp_plugin_t *p = lnode_get(node); - if (p == plugin) { - break; - } - strcat(msg, ", "); - strcat(msg, p->plugin->identifier); - node = list_prev(importing, node); - } - strcat(msg, "."); - cpi_infof(context, msgbase, msg); - free(msg); - } else { - cpi_infof(context, msgbase, plugin->plugin->identifier); - } -} - -/** - * Starts the specified plug-in and its dependencies. - * - * @param context the plug-in context - * @param plugin the plug-in - * @param importing stack of importing plug-ins - * @return CP_OK (zero) on success or an error code on failure - */ -static int start_plugin_rec(cp_context_t *context, cp_plugin_t *plugin, list_t *importing) { - cp_status_t status = CP_OK; - lnode_t *node; - - // Check if already started or starting - if (plugin->state == CP_PLUGIN_ACTIVE) { - return CP_OK; - } else if (plugin->state == CP_PLUGIN_STARTING) { - warn_dependency_loop(context, plugin, importing, 1); - return CP_OK; - } - assert(plugin->state == CP_PLUGIN_RESOLVED); - - // Check for dependency loops - if (cpi_ptrset_contains(importing, plugin)) { - warn_dependency_loop(context, plugin, importing, 0); - return CP_OK; - } - if (!cpi_ptrset_add(importing, plugin)) { - cpi_errorf(context, - N_("Plug-in %s could not be started due to insufficient memory."), - plugin->plugin->identifier); - return CP_ERR_RESOURCE; - } - - // Start up dependencies - node = list_first(plugin->imported); - while (node != NULL) { - cp_plugin_t *ip = lnode_get(node); - - if ((status = start_plugin_rec(context, ip, importing)) != CP_OK) { - break; - } - node = list_next(plugin->imported, node); - } - cpi_ptrset_remove(importing, plugin); - - // Start up this plug-in - if (status == CP_OK) { - status = start_plugin_runtime(context, plugin); - } - - return status; -} - -CP_HIDDEN cp_status_t cpi_start_plugin(cp_context_t *context, cp_plugin_t *plugin) { - cp_status_t status; - - if ((status = resolve_plugin(context, plugin)) == CP_OK) { - list_t *importing = list_create(LISTCOUNT_T_MAX); - if (importing != NULL) { - status = start_plugin_rec(context, plugin, importing); - assert(list_isempty(importing)); - list_destroy(importing); - } else { - cpi_errorf(context, - N_("Plug-in %s could not be started due to insufficient memory."), - plugin->plugin->identifier); - status = CP_ERR_RESOURCE; - } - } - return status; -} - -CP_C_API cp_status_t cp_start_plugin(cp_context_t *context, const char *id) { - hnode_t *node; - cp_status_t status = CP_OK; - - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(id); - - // Look up and start the plug-in - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_ANY, __func__); - node = hash_lookup(context->env->plugins, id); - if (node != NULL) { - status = cpi_start_plugin(context, hnode_get(node)); - } else { - cpi_warnf(context, N_("Unknown plug-in %s could not be started."), id); - status = CP_ERR_UNKNOWN; - } - cpi_unlock_context(context); - - return status; -} - -/** - * Stops the plug-in runtime of the specified plug-in. This function does - * not consider dependencies and assumes that the plug-in is active. - * - * @param context the plug-in context - * @param plugin the plug-in - */ -static void stop_plugin_runtime(cp_context_t *context, cp_plugin_t *plugin) { - cpi_plugin_event_t event; - - // Destroy plug-in instance - event.plugin_id = plugin->plugin->identifier; - if (plugin->context != NULL) { - - // Wait until possible run functions have stopped - cpi_stop_plugin_run(plugin); - - // Stop the plug-in - if (plugin->runtime_funcs->stop != NULL) { - - // About to stop the plug-in - event.old_state = plugin->state; - event.new_state = plugin->state = CP_PLUGIN_STOPPING; - cpi_deliver_event(context, &event); - - // Invoke stop function - context->env->in_stop_func_invocation++; - plugin->runtime_funcs->stop(plugin->plugin_data); - context->env->in_stop_func_invocation--; - - } - - // Unregister all logger functions - cpi_unregister_loggers(plugin->context->env->loggers, plugin); - - // Unregister all plug-in listeners - cpi_unregister_plisteners(plugin->context->env->plugin_listeners, plugin); - - // Release resolved symbols - if (plugin->context->resolved_symbols != NULL) { - while (!hash_isempty(plugin->context->resolved_symbols)) { - hscan_t scan; - hnode_t *node; - const void *ptr; - - hash_scan_begin(&scan, plugin->context->resolved_symbols); - node = hash_scan_next(&scan); - ptr = hnode_getkey(node); - cp_release_symbol(context, ptr); - } - assert(hash_isempty(plugin->context->resolved_symbols)); - } - if (plugin->context->symbol_providers != NULL) { - assert(hash_isempty(plugin->context->symbol_providers)); - } - - // Release defined symbols - if (plugin->defined_symbols != NULL) { - hscan_t scan; - hnode_t *node; - - hash_scan_begin(&scan, plugin->defined_symbols); - while ((node = hash_scan_next(&scan)) != NULL) { - char *n = (char *) hnode_getkey(node); - hash_scan_delfree(plugin->defined_symbols, node); - free(n); - } - hash_destroy(plugin->defined_symbols); - plugin->defined_symbols = NULL; - } - - } - - // Plug-in stopped - cpi_ptrset_remove(context->env->started_plugins, plugin); - event.old_state = plugin->state; - event.new_state = plugin->state = CP_PLUGIN_RESOLVED; - cpi_deliver_event(context, &event); -} - -/** - * Stops the plug-in and all plug-ins depending on it. - * - * @param context the plug-in context - * @param plugin the plug-in - */ -static void stop_plugin_rec(cp_context_t *context, cp_plugin_t *plugin) { - lnode_t *node; - - // Check if already stopped - if (plugin->state < CP_PLUGIN_ACTIVE) { - return; - } - - // Check for dependency loops - if (plugin->processed) { - return; - } - plugin->processed = 1; - - // Stop the depending plug-ins - node = list_first(plugin->importing); - while (node != NULL) { - stop_plugin_rec(context, lnode_get(node)); - node = list_next(plugin->importing, node); - } - - // Stop this plug-in - assert(plugin->state == CP_PLUGIN_ACTIVE); - stop_plugin_runtime(context, plugin); - assert(plugin->state < CP_PLUGIN_ACTIVE); - - // Clear processed flag - plugin->processed = 0; -} - -static void stop_plugin(cp_context_t *context, cp_plugin_t *plugin) { - stop_plugin_rec(context, plugin); - assert_processed_zero(context); -} - -CP_C_API cp_status_t cp_stop_plugin(cp_context_t *context, const char *id) { - hnode_t *node; - cp_plugin_t *plugin; - cp_status_t status = CP_OK; - - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(id); - - // Look up and stop the plug-in - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_ANY, __func__); - node = hash_lookup(context->env->plugins, id); - if (node != NULL) { - plugin = hnode_get(node); - stop_plugin(context, plugin); - } else { - cpi_warnf(context, N_("Unknown plug-in %s could not be stopped."), id); - status = CP_ERR_UNKNOWN; - } - cpi_unlock_context(context); - - return status; -} - -CP_C_API void cp_stop_plugins(cp_context_t *context) { - lnode_t *node; - - CHECK_NOT_NULL(context); - - // Stop the active plug-ins in the reverse order they were started - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_ANY, __func__); - while ((node = list_last(context->env->started_plugins)) != NULL) { - stop_plugin(context, lnode_get(node)); - } - cpi_unlock_context(context); -} - -static void unresolve_plugin_rec(cp_context_t *context, cp_plugin_t *plugin) { - lnode_t *node; - cpi_plugin_event_t event; - - // Check if already unresolved - if (plugin->state < CP_PLUGIN_RESOLVED) { - return; - } - assert(plugin->state == CP_PLUGIN_RESOLVED); - - // Clear the list of imported plug-ins (also breaks dependency loops) - while ((node = list_first(plugin->imported)) != NULL) { - cp_plugin_t *ip = lnode_get(node); - - cpi_ptrset_remove(ip->importing, plugin); - list_delete(plugin->imported, node); - lnode_destroy(node); - } - assert(list_isempty(plugin->imported)); - list_destroy(plugin->imported); - plugin->imported = NULL; - - // Unresolve depending plugins - while ((node = list_first(plugin->importing)) != NULL) { - unresolve_plugin_rec(context, lnode_get(node)); - } - - // Unresolve this plug-in - unresolve_plugin_runtime(plugin); - event.plugin_id = plugin->plugin->identifier; - event.old_state = plugin->state; - event.new_state = plugin->state = CP_PLUGIN_INSTALLED; - cpi_deliver_event(context, &event); -} - -/** - * Unresolves a plug-in. - * - * @param context the plug-in context - * @param plug-in the plug-in to be unresolved - */ -static void unresolve_plugin(cp_context_t *context, cp_plugin_t *plugin) { - stop_plugin(context, plugin); - unresolve_plugin_rec(context, plugin); -} - -static void free_plugin_import_content(cp_plugin_import_t *import) { - assert(import != NULL); - free(import->plugin_id); - free(import->version); -} - -static void free_ext_point_content(cp_ext_point_t *ext_point) { - free(ext_point->name); - free(ext_point->local_id); - free(ext_point->identifier); - free(ext_point->schema_path); -} - -static void free_extension_content(cp_extension_t *extension) { - free(extension->name); - free(extension->local_id); - free(extension->identifier); - free(extension->ext_point_id); -} - -static void free_cfg_element_content(cp_cfg_element_t *ce) { - unsigned int i; - - assert(ce != NULL); - free(ce->name); - if (ce->atts != NULL) { - free(ce->atts[0]); - free(ce->atts); - } - free(ce->value); - for (i = 0; i < ce->num_children; i++) { - free_cfg_element_content(ce->children + i); - } - free(ce->children); -} - -CP_HIDDEN void cpi_free_plugin(cp_plugin_info_t *plugin) { - unsigned int i; - - assert(plugin != NULL); - free(plugin->name); - free(plugin->identifier); - free(plugin->version); - free(plugin->provider_name); - free(plugin->plugin_path); - free(plugin->abi_bw_compatibility); - free(plugin->api_bw_compatibility); - free(plugin->req_cpluff_version); - for (i = 0; i < plugin->num_imports; i++) { - free_plugin_import_content(plugin->imports + i); - } - free(plugin->imports); - free(plugin->runtime_lib_name); - free(plugin->runtime_funcs_symbol); - for (i = 0; i < plugin->num_ext_points; i++) { - free_ext_point_content(plugin->ext_points + i); - } - free(plugin->ext_points); - for (i = 0; i < plugin->num_extensions; i++) { - free_extension_content(plugin->extensions + i); - if (plugin->extensions[i].configuration != NULL) { - free_cfg_element_content(plugin->extensions[i].configuration); - free(plugin->extensions[i].configuration); - } - } - free(plugin->extensions); - free(plugin); -} - -/** - * Frees any memory allocated for a registered plug-in. - * - * @param context the plug-in context - * @param plugin the plug-in to be freed - */ -static void free_registered_plugin(cp_context_t *context, cp_plugin_t *plugin) { - assert(context != NULL); - assert(plugin != NULL); - - // Release plug-in information - cpi_release_info(context, plugin->plugin); - - // Release data structures - if (plugin->importing != NULL) { - assert(list_isempty(plugin->importing)); - list_destroy(plugin->importing); - } - assert(plugin->imported == NULL); - - free(plugin); -} - -/** - * Uninstalls a plug-in associated with the specified hash node. - * - * @param context the plug-in context - * @param node the hash node of the plug-in to be uninstalled - */ -static void uninstall_plugin(cp_context_t *context, hnode_t *node) { - cp_plugin_t *plugin; - cpi_plugin_event_t event; - - // Check if already uninstalled - plugin = (cp_plugin_t *) hnode_get(node); - if (plugin->state <= CP_PLUGIN_UNINSTALLED) { - // TODO: Is this possible state? - return; - } - - // Make sure the plug-in is not in resolved state - unresolve_plugin(context, plugin); - assert(plugin->state == CP_PLUGIN_INSTALLED); - - // Plug-in uninstalled - event.plugin_id = plugin->plugin->identifier; - event.old_state = plugin->state; - event.new_state = plugin->state = CP_PLUGIN_UNINSTALLED; - cpi_deliver_event(context, &event); - - // Unregister extension objects - unregister_extensions(context, plugin->plugin); - - // Unregister the plug-in - hash_delete_free(context->env->plugins, node); - - // Free the plug-in data structures - free_registered_plugin(context, plugin); -} - -CP_C_API cp_status_t cp_uninstall_plugin(cp_context_t *context, const char *id) { - hnode_t *node; - cp_status_t status = CP_OK; - - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(id); - - // Look up and unload the plug-in - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_ANY, __func__); - node = hash_lookup(context->env->plugins, id); - if (node != NULL) { - uninstall_plugin(context, node); - } else { - cpi_warnf(context, N_("Unknown plug-in %s could not be uninstalled."), id); - status = CP_ERR_UNKNOWN; - } - cpi_unlock_context(context); - - return status; -} - -CP_C_API void cp_uninstall_plugins(cp_context_t *context) { - hscan_t scan; - hnode_t *node; - - CHECK_NOT_NULL(context); - - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_ANY, __func__); - cp_stop_plugins(context); - while (1) { - hash_scan_begin(&scan, context->env->plugins); - if ((node = hash_scan_next(&scan)) != NULL) { - uninstall_plugin(context, node); - } else { - break; - } - } - cpi_unlock_context(context); -} diff --git a/lib/cpluff/libcpluff/pinfo.c b/lib/cpluff/libcpluff/pinfo.c deleted file mode 100644 index 6262c74b48..0000000000 --- a/lib/cpluff/libcpluff/pinfo.c +++ /dev/null @@ -1,726 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Plug-in information functions - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> -#include <stdlib.h> -#include <assert.h> -#include "../kazlib/hash.h" -#include "cpluff.h" -#include "defines.h" -#include "util.h" -#include "internal.h" - - -/* ------------------------------------------------------------------------ - * Data types - * ----------------------------------------------------------------------*/ - -/// Registration of a dynamically allocated information object -typedef struct info_resource_t { - - /// Pointer to the resource - void *resource; - - /// Usage count for the resource - int usage_count; - - /// Deallocation function - cpi_dealloc_func_t dealloc_func; - -} info_resource_t; - -/// A plug-in listener registration -typedef struct el_holder_t { - - /// The plug-in listener - cp_plugin_listener_func_t plugin_listener; - - /// The registering plug-in or NULL for the client program - cp_plugin_t *plugin; - - /// Associated user data - void *user_data; - -} el_holder_t; - - - -/* ------------------------------------------------------------------------ - * Function definitions - * ----------------------------------------------------------------------*/ - -// General information object management - -CP_HIDDEN cp_status_t cpi_register_info(cp_context_t *context, void *res, cpi_dealloc_func_t df) { - cp_status_t status = CP_OK; - info_resource_t *ir = NULL; - - assert(context != NULL); - assert(res != NULL); - assert(df != NULL); - assert(cpi_is_context_locked(context)); - do { - if ((ir = malloc(sizeof(info_resource_t))) == NULL) { - status = CP_ERR_RESOURCE; - break; - } - ir->resource = res; - ir->usage_count = 1; - ir->dealloc_func = df; - if (!hash_alloc_insert(context->env->infos, res, ir)) { - status = CP_ERR_RESOURCE; - break; - } - } while (0); - - // Report success - if (status == CP_OK) { - cpi_debugf(context, N_("Registered a new reference counted object at address %p."), res); - } - - // Release resources on failure - if (status != CP_OK) { - if (ir != NULL) { - free(ir); - } - } - - return status; -} - -CP_HIDDEN void cpi_use_info(cp_context_t *context, void *res) { - hnode_t *node; - - assert(context != NULL); - assert(res != NULL); - assert(cpi_is_context_locked(context)); - if ((node = hash_lookup(context->env->infos, res)) != NULL) { - info_resource_t *ir = hnode_get(node); - ir->usage_count++; - cpi_debugf(context, N_("Reference count of the object at address %p increased to %d."), res, ir->usage_count); - } else { - cpi_fatalf(_("Attempt to increase the reference count of an unknown object at address %p."), res); - } -} - -CP_HIDDEN void cpi_release_info(cp_context_t *context, void *info) { - hnode_t *node; - - assert(context != NULL); - assert(info != NULL); - assert(cpi_is_context_locked(context)); - if ((node = hash_lookup(context->env->infos, info)) != NULL) { - info_resource_t *ir = hnode_get(node); - assert(ir != NULL && info == ir->resource); - ir->usage_count--; - cpi_debugf(context, N_("Reference count of the object at address %p decreased to %d."), info, ir->usage_count); - if (ir->usage_count == 0) { - hash_delete_free(context->env->infos, node); - ir->dealloc_func(context, info); - cpi_debugf(context, N_("Deallocated the reference counted object at address %p."), info); - free(ir); - } - } else { - cpi_fatalf(_("Attempt to release an unknown reference counted object at address %p."), info); - } -} - -CP_C_API void cp_release_info(cp_context_t *context, void *info) { - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(info); - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_LOGGER, __func__); - cpi_release_info(context, info); - cpi_unlock_context(context); -} - -CP_HIDDEN void cpi_release_infos(cp_context_t *context) { - hscan_t scan; - hnode_t *node; - - hash_scan_begin(&scan, context->env->infos); - while ((node = hash_scan_next(&scan)) != NULL) { - info_resource_t *ir = hnode_get(node); - cpi_lock_context(context); - cpi_errorf(context, N_("An unreleased information object was encountered at address %p with reference count %d when destroying the associated plug-in context. Not releasing the object."), ir->resource, ir->usage_count); - cpi_unlock_context(context); - hash_scan_delfree(context->env->infos, node); - free(ir); - } -} - - -// Information acquiring functions - -CP_C_API cp_plugin_info_t * cp_get_plugin_info(cp_context_t *context, const char *id, cp_status_t *error) { - hnode_t *node; - cp_plugin_info_t *plugin = NULL; - cp_status_t status = CP_OK; - - CHECK_NOT_NULL(context); - if (id == NULL && context->plugin == NULL) { - cpi_fatalf(_("The plug-in identifier argument to cp_get_plugin_info must not be NULL when the main program calls it.")); - } - - // Look up the plug-in and return information - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_LOGGER, __func__); - do { - - // Lookup plug-in information - if (id != NULL) { - if ((node = hash_lookup(context->env->plugins, id)) == NULL) { - // cpi_warnf(context, N_("Could not return information about unknown plug-in %s."), id); - status = CP_ERR_UNKNOWN; - break; - } - plugin = ((cp_plugin_t *) hnode_get(node))->plugin; - } else { - plugin = context->plugin->plugin; - assert(plugin != NULL); - } - cpi_use_info(context, plugin); - } while (0); - cpi_unlock_context(context); - - if (error != NULL) { - *error = status; - } - return plugin; -} - -static void dealloc_plugins_info(cp_context_t *context, cp_plugin_info_t **plugins) { - int i; - - assert(context != NULL); - assert(plugins != NULL); - for (i = 0; plugins[i] != NULL; i++) { - cpi_release_info(context, plugins[i]); - } - free(plugins); -} - -CP_C_API cp_plugin_info_t ** cp_get_plugins_info(cp_context_t *context, cp_status_t *error, int *num) { - cp_plugin_info_t **plugins = NULL; - int i, n; - cp_status_t status = CP_OK; - - CHECK_NOT_NULL(context); - - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_LOGGER, __func__); - do { - hscan_t scan; - hnode_t *node; - - // Allocate space for pointer array - n = hash_count(context->env->plugins); - if ((plugins = malloc(sizeof(cp_plugin_info_t *) * (n + 1))) == NULL) { - status = CP_ERR_RESOURCE; - break; - } - - // Get plug-in information structures - hash_scan_begin(&scan, context->env->plugins); - i = 0; - while ((node = hash_scan_next(&scan)) != NULL) { - cp_plugin_t *rp = hnode_get(node); - - assert(i < n); - cpi_use_info(context, rp->plugin); - plugins[i] = rp->plugin; - i++; - } - plugins[i] = NULL; - - // Register the array - status = cpi_register_info(context, plugins, (void (*)(cp_context_t *, void *)) dealloc_plugins_info); - - } while (0); - - // Report error - if (status != CP_OK) { - cpi_error(context, N_("Plug-in information could not be returned due to insufficient memory.")); - } - cpi_unlock_context(context); - - // Release resources on error - if (status != CP_OK) { - if (plugins != NULL) { - dealloc_plugins_info(context, plugins); - plugins = NULL; - } - } - - assert(status != CP_OK || n == 0 || plugins[n - 1] != NULL); - if (error != NULL) { - *error = status; - } - if (num != NULL && status == CP_OK) { - *num = n; - } - return plugins; -} - -CP_C_API cp_plugin_state_t cp_get_plugin_state(cp_context_t *context, const char *id) { - cp_plugin_state_t state = CP_PLUGIN_UNINSTALLED; - hnode_t *hnode; - - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(id); - - // Look up the plug-in state - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_LOGGER, __func__); - if ((hnode = hash_lookup(context->env->plugins, id)) != NULL) { - cp_plugin_t *rp = hnode_get(hnode); - state = rp->state; - } - cpi_unlock_context(context); - return state; -} - -static void dealloc_ext_points_info(cp_context_t *context, cp_ext_point_t **ext_points) { - int i; - - assert(context != NULL); - assert(ext_points != NULL); - for (i = 0; ext_points[i] != NULL; i++) { - cpi_release_info(context, ext_points[i]->plugin); - } - free(ext_points); -} - -CP_C_API cp_ext_point_t ** cp_get_ext_points_info(cp_context_t *context, cp_status_t *error, int *num) { - cp_ext_point_t **ext_points = NULL; - int i, n; - cp_status_t status = CP_OK; - - CHECK_NOT_NULL(context); - - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_LOGGER, __func__); - do { - hscan_t scan; - hnode_t *node; - - // Allocate space for pointer array - n = hash_count(context->env->ext_points); - if ((ext_points = malloc(sizeof(cp_ext_point_t *) * (n + 1))) == NULL) { - status = CP_ERR_RESOURCE; - break; - } - - // Get extension point information structures - hash_scan_begin(&scan, context->env->ext_points); - i = 0; - while ((node = hash_scan_next(&scan)) != NULL) { - cp_ext_point_t *ep = hnode_get(node); - - assert(i < n); - cpi_use_info(context, ep->plugin); - ext_points[i] = ep; - i++; - } - ext_points[i] = NULL; - - // Register the array - status = cpi_register_info(context, ext_points, (void (*)(cp_context_t *, void *)) dealloc_ext_points_info); - - } while (0); - - // Report error - if (status != CP_OK) { - cpi_error(context, N_("Extension point information could not be returned due to insufficient memory.")); - } - cpi_unlock_context(context); - - // Release resources on error - if (status != CP_OK) { - if (ext_points != NULL) { - dealloc_ext_points_info(context, ext_points); - ext_points = NULL; - } - } - - assert(status != CP_OK || n == 0 || ext_points[n - 1] != NULL); - if (error != NULL) { - *error = status; - } - if (num != NULL && status == CP_OK) { - *num = n; - } - return ext_points; -} - -static void dealloc_extensions_info(cp_context_t *context, cp_extension_t **extensions) { - int i; - - assert(context != NULL); - assert(extensions != NULL); - for (i = 0; extensions[i] != NULL; i++) { - cpi_release_info(context, extensions[i]->plugin); - } - free(extensions); -} - -CP_C_API cp_extension_t ** cp_get_extensions_info(cp_context_t *context, const char *extpt_id, cp_status_t *error, int *num) { - cp_extension_t **extensions = NULL; - int i, n; - cp_status_t status = CP_OK; - - CHECK_NOT_NULL(context); - - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_LOGGER, __func__); - do { - hscan_t scan; - hnode_t *hnode; - - // Count the number of extensions - if (extpt_id != NULL) { - if ((hnode = hash_lookup(context->env->extensions, extpt_id)) != NULL) { - n = list_count((list_t *) hnode_get(hnode)); - } else { - n = 0; - } - } else { - hscan_t scan; - - n = 0; - hash_scan_begin(&scan, context->env->extensions); - while ((hnode = hash_scan_next(&scan)) != NULL) { - n += list_count((list_t *) hnode_get(hnode)); - } - } - - // Allocate space for pointer array - if ((extensions = malloc(sizeof(cp_extension_t *) * (n + 1))) == NULL) { - status = CP_ERR_RESOURCE; - break; - } - - // Get extension information structures - if (extpt_id != NULL) { - i = 0; - if ((hnode = hash_lookup(context->env->extensions, extpt_id)) != NULL) { - list_t *el = hnode_get(hnode); - lnode_t *lnode; - - lnode = list_first(el); - while (lnode != NULL) { - cp_extension_t *e = lnode_get(lnode); - - assert(i < n); - cpi_use_info(context, e->plugin); - extensions[i] = e; - i++; - lnode = list_next(el, lnode); - } - } - extensions[i] = NULL; - } else { - hash_scan_begin(&scan, context->env->extensions); - i = 0; - while ((hnode = hash_scan_next(&scan)) != NULL) { - list_t *el = hnode_get(hnode); - lnode_t *lnode; - - lnode = list_first(el); - while (lnode != NULL) { - cp_extension_t *e = lnode_get(lnode); - - assert(i < n); - cpi_use_info(context, e->plugin); - extensions[i] = e; - i++; - lnode = list_next(el, lnode); - } - } - } - extensions[i] = NULL; - - // Register the array - status = cpi_register_info(context, extensions, (void (*)(cp_context_t *, void *)) dealloc_extensions_info); - - } while (0); - - // Report error - if (status != CP_OK) { - cpi_error(context, N_("Extension information could not be returned due to insufficient memory.")); - } - cpi_unlock_context(context); - - // Release resources on error - if (status != CP_OK) { - if (extensions != NULL) { - dealloc_extensions_info(context, extensions); - extensions = NULL; - } - } - - assert(status != CP_OK || n == 0 || extensions[n - 1] != NULL); - if (error != NULL) { - *error = status; - } - if (num != NULL && status == CP_OK) { - *num = n; - } - return extensions; -} - - -// Plug-in listeners - -/** - * Compares plug-in listener holders. - * - * @param h1 the first holder to be compared - * @param h2 the second holder to be compared - * @return zero if the holders point to the same function, otherwise non-zero - */ -static int comp_el_holder(const void *h1, const void *h2) { - const el_holder_t *plh1 = h1; - const el_holder_t *plh2 = h2; - - return (plh1->plugin_listener != plh2->plugin_listener); -} - -/** - * Processes a node by delivering the specified event to the associated - * plug-in listener. - * - * @param list the list being processed - * @param node the node being processed - * @param event the event - */ -static void process_event(list_t *list, lnode_t *node, void *event) { - el_holder_t *h = lnode_get(node); - cpi_plugin_event_t *e = event; - h->plugin_listener(e->plugin_id, e->old_state, e->new_state, h->user_data); -} - -/** - * Processes a node by unregistering the associated plug-in listener. - * - * @param list the list being processed - * @param node the node being processed - * @param plugin plugin whose listeners are to be unregistered or NULL for all - */ -static void process_unregister_plistener(list_t *list, lnode_t *node, void *plugin) { - el_holder_t *h = lnode_get(node); - if (plugin == NULL || h->plugin == plugin) { - list_delete(list, node); - lnode_destroy(node); - free(h); - } -} - -CP_HIDDEN void cpi_unregister_plisteners(list_t *listeners, cp_plugin_t *plugin) { - list_process(listeners, plugin, process_unregister_plistener); -} - -CP_C_API cp_status_t cp_register_plistener(cp_context_t *context, cp_plugin_listener_func_t listener, void *user_data) { - cp_status_t status = CP_ERR_RESOURCE; - el_holder_t *holder; - lnode_t *node; - - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(listener); - - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_LOGGER | CPI_CF_LISTENER, __func__); - if ((holder = malloc(sizeof(el_holder_t))) != NULL) { - holder->plugin_listener = listener; - holder->plugin = context->plugin; - holder->user_data = user_data; - if ((node = lnode_create(holder)) != NULL) { - list_append(context->env->plugin_listeners, node); - status = CP_OK; - } else { - free(holder); - } - } - - // Report error or success - if (status != CP_OK) { - cpi_error(context, N_("A plug-in listener could not be registered due to insufficient memory.")); - } else if (cpi_is_logged(context, CP_LOG_DEBUG)) { - char owner[64]; - /* TRANSLATORS: %s is the context owner */ - cpi_debugf(context, N_("%s registered a plug-in listener."), cpi_context_owner(context, owner, sizeof(owner))); - } - cpi_unlock_context(context); - - return status; -} - -CP_C_API void cp_unregister_plistener(cp_context_t *context, cp_plugin_listener_func_t listener) { - el_holder_t holder; - lnode_t *node; - - CHECK_NOT_NULL(context); - holder.plugin_listener = listener; - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_LOGGER | CPI_CF_LISTENER, __func__); - node = list_find(context->env->plugin_listeners, &holder, comp_el_holder); - if (node != NULL) { - process_unregister_plistener(context->env->plugin_listeners, node, NULL); - } - if (cpi_is_logged(context, CP_LOG_DEBUG)) { - char owner[64]; - /* TRANSLATORS: %s is the context owner */ - cpi_debugf(context, N_("%s unregistered a plug-in listener."), cpi_context_owner(context, owner, sizeof(owner))); - } - cpi_unlock_context(context); -} - -CP_HIDDEN void cpi_deliver_event(cp_context_t *context, const cpi_plugin_event_t *event) { - assert(event != NULL); - assert(event->plugin_id != NULL); - cpi_lock_context(context); - context->env->in_event_listener_invocation++; - list_process(context->env->plugin_listeners, (void *) event, process_event); - context->env->in_event_listener_invocation--; - cpi_unlock_context(context); - if (cpi_is_logged(context, CP_LOG_INFO)) { - char *str; - switch (event->new_state) { - case CP_PLUGIN_UNINSTALLED: - str = N_("Plug-in %s has been uninstalled."); - break; - case CP_PLUGIN_INSTALLED: - if (event->old_state < CP_PLUGIN_INSTALLED) { - str = N_("Plug-in %s has been installed."); - } else { - str = N_("Plug-in %s runtime library has been unloaded."); - } - break; - case CP_PLUGIN_RESOLVED: - if (event->old_state < CP_PLUGIN_RESOLVED) { - str = N_("Plug-in %s runtime library has been loaded."); - } else { - str = N_("Plug-in %s has been stopped."); - } - break; - case CP_PLUGIN_STARTING: - str = N_("Plug-in %s is starting."); - break; - case CP_PLUGIN_STOPPING: - str = N_("Plug-in %s is stopping."); - break; - case CP_PLUGIN_ACTIVE: - str = N_("Plug-in %s has been started."); - break; - default: - str = NULL; - break; - } - if (str != NULL) { - cpi_infof(context, str, event->plugin_id); - } - } -} - - -// Configuration element helpers - -static cp_cfg_element_t * lookup_cfg_element(cp_cfg_element_t *base, const char *path, int len) { - int start = 0; - - CHECK_NOT_NULL(base); - CHECK_NOT_NULL(path); - - // Traverse the path - while (base != NULL && path[start] != '\0' && (len == -1 || start < len)) { - int end = start; - while (path[end] != '\0' && path[end] != '/' && (len == -1 || end < len)) - end++; - if (end - start == 2 && !strncmp(path + start, "..", 2)) { - base = base->parent; - } else { - unsigned int i; - int found = 0; - - for (i = 0; !found && i < base->num_children; i++) { - cp_cfg_element_t *e = base->children + i; - if (end - start == strlen(e->name) - && !strncmp(path + start, e->name, end - start)) { - base = e; - found = 1; - } - } - if (!found) { - base = NULL; - } - } - start = end; - if (path[start] == '/') { - start++; - } - } - return base; -} - -CP_C_API cp_cfg_element_t * cp_lookup_cfg_element(cp_cfg_element_t *base, const char *path) { - return lookup_cfg_element(base, path, -1); -} - -CP_C_API char * cp_lookup_cfg_value(cp_cfg_element_t *base, const char *path) { - cp_cfg_element_t *e; - const char *attr; - - CHECK_NOT_NULL(base); - CHECK_NOT_NULL(path); - - if ((attr = strrchr(path, '@')) == NULL) { - e = lookup_cfg_element(base, path, -1); - } else { - e = lookup_cfg_element(base, path, attr - path); - attr++; - } - if (e != NULL) { - if (attr == NULL) { - return e->value; - } else { - unsigned int i; - - for (i = 0; i < e->num_atts; i++) { - if (!strcmp(attr, e->atts[2*i])) { - return e->atts[2*i + 1]; - } - } - return NULL; - } - } else { - return NULL; - } -} diff --git a/lib/cpluff/libcpluff/ploader.c b/lib/cpluff/libcpluff/ploader.c deleted file mode 100644 index 66249381ab..0000000000 --- a/lib/cpluff/libcpluff/ploader.c +++ /dev/null @@ -1,1296 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Plug-in descriptor loader - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> -#include <stdarg.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <expat.h> -#include "cpluff.h" -#include "defines.h" -#include "util.h" -#include "internal.h" -#if defined(_WIN32) -#include "win32_utils.h" -#endif - -// Use XMLCALL if available -#ifdef XMLCALL -#define CP_XMLCALL XMLCALL -#else -#define CP_XMLCALL -#endif - - -/* ------------------------------------------------------------------------ - * Constants - * ----------------------------------------------------------------------*/ - -/// XML parser buffer size (in bytes) -#define CP_XML_PARSER_BUFFER_SIZE 4096 - -/// Initial configuration element value size -#define CP_CFG_ELEMENT_VALUE_INITSIZE 64 - -/// Plugin descriptor name -#define CP_PLUGIN_DESCRIPTOR "addon.xml" - - -/* ------------------------------------------------------------------------ - * Internal data types - * ----------------------------------------------------------------------*/ - -typedef struct ploader_context_t ploader_context_t; - -/// Parser states -typedef enum parser_state_t { - PARSER_BEGIN, - PARSER_PLUGIN, - PARSER_REQUIRES, - PARSER_EXTENSION, - PARSER_END, - PARSER_UNKNOWN, - PARSER_ERROR -} parser_state_t; - -/// Plug-in loader context -struct ploader_context_t { - - /// The plug-in context, or NULL if none - cp_context_t *context; - - /// The XML parser being used - XML_Parser parser; - - /// The file being parsed - char *file; - - /// The plug-in being constructed - cp_plugin_info_t *plugin; - - /// The configuration element being constructed - cp_cfg_element_t *configuration; - - /// The current parser state - parser_state_t state; - - /// The saved parser state (used in PARSER_UNKNOWN) - parser_state_t saved_state; - - /** - * The current parser depth (used in PARSER_UNKNOWN and PARSER_EXTENSION) - */ - unsigned int depth; - - /// The number of skipped configuration elements - unsigned int skippedCEs; - - /// Size of allocated imports table - size_t imports_size; - - /// Size of allocated extension points table - size_t ext_points_size; - - /// Size of allocated extensions table - size_t extensions_size; - - /// Buffer for a value being read - char *value; - - /// Size of allocated value field - size_t value_size; - - /// Current length of value string - size_t value_length; - - /// The number of parsing errors that have occurred - unsigned int error_count; - - /// The number of resource errors that have occurred - unsigned int resource_error_count; -}; - - -/* ------------------------------------------------------------------------ - * Function definitions - * ----------------------------------------------------------------------*/ - -/** - * Reports a descriptor error. Does not set the parser to error state but - * increments the error count, unless this is merely a warning. - * - * @param context the parsing context - * @param warn whether this is only a warning - * @param error_msg the error message - * @param ... parameters for the error message - */ -static void descriptor_errorf(ploader_context_t *plcontext, int warn, - const char *error_msg, ...) { - va_list ap; - char message[128]; - - va_start(ap, error_msg); - vsnprintf(message, sizeof(message), error_msg, ap); - va_end(ap); - message[127] = '\0'; - if (warn) { - cpi_warnf(plcontext->context, - N_("Suspicious plug-in descriptor content in %s, line %d, column %d (%s)."), - plcontext->file, - (int) XML_GetCurrentLineNumber(plcontext->parser), - (int) XML_GetCurrentColumnNumber(plcontext->parser) + 1, - message); - } else { - cpi_errorf(plcontext->context, - N_("Invalid plug-in descriptor content in %s, line %d, column %d (%s)."), - plcontext->file, - (int) XML_GetCurrentLineNumber(plcontext->parser), - (int) XML_GetCurrentColumnNumber(plcontext->parser) + 1, - message); - } - if (!warn) { - plcontext->error_count++; - } -} - -/** - * Reports insufficient system resources while parsing and increments the - * resource error count. - * - * @param context the parsing context - */ -static void resource_error(ploader_context_t *plcontext) { - if (plcontext->resource_error_count == 0) { - cpi_errorf(plcontext->context, - N_("Insufficient system resources to parse plug-in descriptor content in %s, line %d, column %d."), - plcontext->file, - (int) XML_GetCurrentLineNumber(plcontext->parser), - (int) XML_GetCurrentColumnNumber(plcontext->parser) + 1); - } - plcontext->resource_error_count++; -} - -/** - * Returns whether the specified NULL-terminated list of strings includes - * the specified string. - * - * @param list the NULL-terminated list of strings, or NULL if none - * @param str the string - * @param step the stepping (1 to check every string or 2 to check every - * other string) - * @return pointer to the location of the string or NULL if not found - */ -static const XML_Char * const *contains_str(const XML_Char * const *list, - const XML_Char *str, int step) { - if (list != NULL) { - while (*list != NULL) { - if (!strcmp(*list, str)) { - return list; - } - list += step; - } - } - return NULL; -} - -/** - * Checks that an element has non-empty values for required attributes. - * Increments the error count for each missing attribute. - * - * @param context the parsing context - * @param elem the element being checked - * @param atts the attribute list for the element - * @param req_atts the required attributes (NULL terminated list, or NULL) - * @return whether the required attributes are present - */ -static int check_req_attributes(ploader_context_t *plcontext, - const XML_Char *elem, const XML_Char * const *atts, - const XML_Char * const *req_atts) { - const XML_Char * const *a; - int error = 0; - - // Check that required attributes have non-empty values - for (a = req_atts; a != NULL && *a != NULL; a++) { - const XML_Char * const *av; - - if ((av = contains_str(atts, *a, 2)) != NULL) { - if ((*(av + 1))[0] == '\0') { - descriptor_errorf(plcontext, 0, - _("required attribute %s for element %s has an empty value"), - *a, elem); - error = 1; - } - } else { - descriptor_errorf(plcontext, 0, - _("required attribute %s missing for element %s"), - *a, elem); - error = 1; - } - } - - return !error; -} - -/** - * Checks that an element has non-empty values for required attributes and - * warns if there are unknown attributes. Increments the error count for - * each missing required attribute. - * - * @param context the parsing context - * @param elem the element being checked - * @param atts the attribute list for the element - * @param req_atts the required attributes (NULL terminated list, or NULL) - * @param opt_atts the optional attributes (NULL terminated list, or NULL) - * @return whether the required attributes are present - */ -static int check_attributes(ploader_context_t *plcontext, - const XML_Char *elem, const XML_Char * const *atts, - const XML_Char * const *req_atts, const XML_Char * const *opt_atts) { - int error = 0; - - // Check required attributes - error = !check_req_attributes(plcontext, elem, atts, req_atts); - - // Warn if there are unknown attributes - for (; *atts != NULL; atts += 2) { - if (contains_str(req_atts, *atts, 1) == NULL - && contains_str(opt_atts, *atts, 1) == NULL) { - descriptor_errorf(plcontext, 1, - _("ignoring unknown attribute %s for element %s"), - *atts, elem); - } - } - - return !error; -} - -/** - * Allocates memory using malloc. Reports a resource error if there is not - * enough available memory. - * - * @param context the parsing context - * @param size the number of bytes to allocate - * @return pointer to the allocated memory, or NULL if memory allocation failed - */ -static void *parser_malloc(ploader_context_t *plcontext, size_t size) { - void *ptr; - - if ((ptr = malloc(size)) == NULL) { - resource_error(plcontext); - } - return ptr; -} - -/** - * Makes a copy of the specified string. The memory is allocated using malloc. - * Reports a resource error if there is not enough available memory. - * - * @param context the parsing context - * @param src the source string to be copied - * @return copy of the string, or NULL if memory allocation failed - */ -static char *parser_strdup(ploader_context_t *plcontext, const char *src) { - char *dup; - - if ((dup = strdup(src)) == NULL) { - resource_error(plcontext); - } - return dup; -} - -/** - * Concatenates the specified strings into a new string. The memory for the concatenated - * string is allocated using malloc. Reports a resource error if there is not - * enough available memory. - * - * @param context the parsing context - * @param ... the strings to be concatenated, terminated by NULL - * @return the concatenated string, or NULL if memory allocation failed - */ -static char *parser_strscat(ploader_context_t *plcontext, ...) { - va_list ap; - const char *str; - char *dst; - size_t len; - - // Calculate the length of the concatenated string - va_start(ap, plcontext); - len = 0; - while ((str = va_arg(ap, const char *)) != NULL) { - len += strlen(str); - } - va_end(ap); - - // Allocate space for the concatenated string - if ((dst = parser_malloc(plcontext, sizeof(char) * (len + 1))) == NULL) { - return NULL; - } - - // Copy the strings - len = 0; - va_start(ap, plcontext); - while ((str = va_arg(ap, const char *)) != NULL) { - strcpy(dst + len, str); - len += strlen(str); - } - va_end(ap); - dst[len] = '\0'; - return dst; -} - -/** - * Puts the parser to a state in which it skips an unknown element. - * Warns error handlers about the unknown element. - * - * @param context the parsing context - * @param elem the element name - */ -static void unexpected_element(ploader_context_t *plcontext, const XML_Char *elem) { - plcontext->saved_state = plcontext->state; - plcontext->state = PARSER_UNKNOWN; - plcontext->depth = 0; - descriptor_errorf(plcontext, 1, _("ignoring unexpected element %s and its contents"), elem); -} - -/** - * Creates a copy of the specified attributes. Reports failed memory - * allocation. - * - * @param context the parser context - * @param src the source attributes to be copied - * @param num pointer to the location where number of attributes is stored, - * or NULL for none - * @return the duplicated attribute array, or NULL if empty or failed - */ -static char **parser_attsdup(ploader_context_t *plcontext, const XML_Char * const *src, - unsigned int *num_atts) { - char **atts = NULL, *attr_data = NULL; - unsigned int i; - unsigned int num; - size_t attr_size; - - // Calculate the number of attributes and the amount of space required - for (num = 0, attr_size = 0; src[num] != NULL; num++) { - attr_size += strlen(src[num]) + 1; - } - assert((num & 1) == 0); - - // Allocate necessary memory and copy attribute data - if (num > 0) { - if ((atts = parser_malloc(plcontext, num * sizeof(char *))) != NULL) { - if ((attr_data = parser_malloc(plcontext, attr_size * sizeof(char))) != NULL) { - size_t offset; - - for (i = 0, offset = 0; i < num; i++) { - strcpy(attr_data + offset, src[i]); - atts[i] = attr_data + offset; - offset += strlen(src[i]) + 1; - } - } - } - } - - // If successful then return duplicates, otherwise free any allocations - if (num == 0 || (atts != NULL && attr_data != NULL)) { - if (num_atts != NULL) { - *num_atts = num / 2; - } - return atts; - } else { - free(attr_data); - free(atts); - return NULL; - } -} - -/** - * Initializes a configuration element. Reports an error if memory allocation fails. - * - * @param context the parser context - * @param ce the configuration element to be initialized - * @param name the element name - * @param atts the element attributes - * @param parent the parent element - */ -static void init_cfg_element(ploader_context_t *plcontext, cp_cfg_element_t *ce, - const XML_Char *name, const XML_Char * const *atts, cp_cfg_element_t *parent) { - - // Initialize the configuration element - memset(ce, 0, sizeof(cp_cfg_element_t)); - ce->name = parser_strdup(plcontext, name); - ce->atts = parser_attsdup(plcontext, atts, &(ce->num_atts)); - ce->value = NULL; - plcontext->value = NULL; - plcontext->value_size = 0; - plcontext->value_length = 0; - ce->parent = parent; - ce->children = NULL; -} - -/** - * Processes the character data while parsing. - * - * @param userData the parsing context - * @param str the string data - * @param len the string length - */ -static void CP_XMLCALL character_data_handler( - void *userData, const XML_Char *str, int len) { - ploader_context_t *plcontext = userData; - - // Ignore leading whitespace - if (plcontext->value == NULL) { - int i; - - for (i = 0; i < len; i++) { - if (str[i] != ' ' && str[i] != '\n' && str[i] != '\r' && str[i] != '\t') { - break; - } - } - str += i; - len -= i; - if (len == 0) { - return; - } - } - - // Allocate more memory for the character data if needed - if (plcontext->value_length + len >= plcontext->value_size) { - size_t ns; - char *nv; - - ns = plcontext->value_size; - while (plcontext->value_length + len >= ns) { - if (ns == 0) { - ns = CP_CFG_ELEMENT_VALUE_INITSIZE; - } else { - ns = 2 * ns; - } - } - if ((nv = realloc(plcontext->value, ns * sizeof(char))) != NULL) { - plcontext->value = nv; - plcontext->value_size = ns; - } else { - resource_error(plcontext); - return; - } - } - - // Copy character data - strncpy(plcontext->value + plcontext->value_length, str, len * sizeof(char)); - plcontext->value_length += len; -} - -/** - * Processes the start of element events while parsing. - * - * @param userData the parsing context - * @param name the element name - * @param atts the element attributes - */ -static void CP_XMLCALL start_element_handler( - void *userData, const XML_Char *name, const XML_Char **atts) { - static const XML_Char * const req_plugin_atts[] = { "id", NULL }; - static const XML_Char * const opt_plugin_atts[] = { "name", "version", "provider-name", NULL }; - static const XML_Char * const req_bwcompatibility_atts[] = { NULL }; - static const XML_Char * const opt_bwcompatibility_atts[] = { "abi", "api", NULL }; - static const XML_Char * const req_cpluff_atts[] = { "version", NULL }; - static const XML_Char * const opt_cpluff_atts[] = { NULL }; - static const XML_Char * const req_import_atts[] = { "addon", NULL }; - static const XML_Char * const opt_import_atts[] = { "version", "optional", NULL }; - static const XML_Char * const req_runtime_atts[] = { "library", NULL }; - static const XML_Char * const opt_runtime_atts[] = { "funcs", NULL }; - static const XML_Char * const req_ext_point_atts[] = { "id", NULL }; - static const XML_Char * const opt_ext_point_atts[] = { "name", "schema", NULL }; - static const XML_Char * const req_extension_atts[] = { "point", NULL }; - //static const XML_Char * const opt_extension_atts[] = { "id", "name", NULL }; - ploader_context_t *plcontext = userData; - unsigned int i; - - // Process element start - switch (plcontext->state) { - - case PARSER_BEGIN: - if (!strcmp(name, "addon")) { - plcontext->state = PARSER_PLUGIN; - if (!check_attributes(plcontext, name, atts, - req_plugin_atts, opt_plugin_atts)) { - break; - } - for (i = 0; atts[i] != NULL; i += 2) { - if (!strcmp(atts[i], "name")) { - plcontext->plugin->name - = parser_strdup(plcontext, atts[i+1]); - } else if (!strcmp(atts[i], "id")) { - plcontext->plugin->identifier - = parser_strdup(plcontext, atts[i+1]); - } else if (!strcmp(atts[i], "version")) { - plcontext->plugin->version - = parser_strdup(plcontext, atts[i+1]); - } else if (!strcmp(atts[i], "provider-name")) { - plcontext->plugin->provider_name - = parser_strdup(plcontext, atts[i+1]); - } - } - } else { - unexpected_element(plcontext, name); - } - break; - - case PARSER_PLUGIN: - if (!strcmp(name, "backwards-compatibility")) { - if (check_attributes(plcontext, name, atts, - req_bwcompatibility_atts, opt_bwcompatibility_atts)) { - for (i = 0; atts[i] != NULL; i += 2) { - if (!strcmp(atts[i], "abi")) { - plcontext->plugin->abi_bw_compatibility = parser_strdup(plcontext, atts[i+1]); - } else if (!strcmp(atts[i], "api")) { - plcontext->plugin->api_bw_compatibility = parser_strdup(plcontext, atts[i+1]); - } - } - } - } else if (!strcmp(name, "requires")) { - plcontext->state = PARSER_REQUIRES; - } else if (!strcmp(name, "runtime")) { - if (check_attributes(plcontext, name, atts, - req_runtime_atts, opt_runtime_atts)) { - for (i = 0; atts[i] != NULL; i += 2) { - if (!strcmp(atts[i], "library")) { - plcontext->plugin->runtime_lib_name - = parser_strdup(plcontext, atts[i+1]); - } else if (!strcmp(atts[i], "funcs")) { - plcontext->plugin->runtime_funcs_symbol - = parser_strdup(plcontext, atts[i+1]); - } - } - } - } else if (!strcmp(name, "extension-point")) { - if (check_attributes(plcontext, name, atts, - req_ext_point_atts, opt_ext_point_atts)) { - cp_ext_point_t *ext_point; - - // Allocate space for extension points, if necessary - if (plcontext->plugin->num_ext_points == plcontext->ext_points_size) { - cp_ext_point_t *nep; - size_t ns; - - if (plcontext->ext_points_size == 0) { - ns = 4; - } else { - ns = plcontext->ext_points_size * 2; - } - if ((nep = realloc(plcontext->plugin->ext_points, - ns * sizeof(cp_ext_point_t))) == NULL) { - resource_error(plcontext); - break; - } - plcontext->plugin->ext_points = nep; - plcontext->ext_points_size = ns; - } - - // Parse extension point specification - ext_point = plcontext->plugin->ext_points - + plcontext->plugin->num_ext_points; - memset(ext_point, 0, sizeof(cp_ext_point_t)); - ext_point->plugin = plcontext->plugin; - ext_point->name = NULL; - ext_point->local_id = NULL; - ext_point->identifier = NULL; - ext_point->schema_path = NULL; - for (i = 0; atts[i] != NULL; i += 2) { - if (!strcmp(atts[i], "name")) { - ext_point->name - = parser_strdup(plcontext, atts[i+1]); - } else if (!strcmp(atts[i], "id")) { - ext_point->local_id - = parser_strdup(plcontext, atts[i+1]); - ext_point->identifier - = parser_strscat(plcontext, - plcontext->plugin->identifier, ".", atts[i+1], NULL); - } else if (!strcmp(atts[i], "schema")) { - ext_point->schema_path - = parser_strdup(plcontext, atts[i+1]); - } - } - plcontext->plugin->num_ext_points++; - - } - } else if (!(strcmp(name, "extension"))) { - plcontext->state = PARSER_EXTENSION; - plcontext->depth = 0; - if (check_req_attributes( - plcontext, name, atts, req_extension_atts)) { - cp_extension_t *extension; - - // Allocate space for extensions, if necessary - if (plcontext->plugin->num_extensions == plcontext->extensions_size) { - cp_extension_t *ne; - size_t ns; - - if (plcontext->extensions_size == 0) { - ns = 16; - } else { - ns = plcontext->extensions_size * 2; - } - if ((ne = realloc(plcontext->plugin->extensions, - ns * sizeof(cp_extension_t))) == NULL) { - resource_error(plcontext); - break; - } - plcontext->plugin->extensions = ne; - plcontext->extensions_size = ns; - } - - // Parse extension attributes - extension = plcontext->plugin->extensions - + plcontext->plugin->num_extensions; - memset(extension, 0, sizeof(cp_extension_t)); - extension->plugin = plcontext->plugin; - extension->name = NULL; - extension->local_id = NULL; - extension->identifier = NULL; - extension->ext_point_id = NULL; - extension->configuration = NULL; - for (i = 0; atts[i] != NULL; i += 2) { - if (!strcmp(atts[i], "point")) { - extension->ext_point_id - = parser_strdup(plcontext, atts[i+1]); - } else if (!strcmp(atts[i], "id")) { - extension->local_id - = parser_strdup(plcontext, atts[i+1]); - extension->identifier - = parser_strscat(plcontext, - plcontext->plugin->identifier, ".", atts[i+1], NULL); - } else if (!strcmp(atts[i], "name")) { - extension->name - = parser_strdup(plcontext, atts[i+1]); - } - } - plcontext->plugin->num_extensions++; - - // Initialize configuration parsing - if ((extension->configuration = plcontext->configuration - = parser_malloc(plcontext, sizeof(cp_cfg_element_t))) != NULL) { - init_cfg_element(plcontext, plcontext->configuration, name, atts, NULL); - } - XML_SetCharacterDataHandler(plcontext->parser, character_data_handler); - } - } else { - unexpected_element(plcontext, name); - } - break; - - case PARSER_REQUIRES: - if (!strcmp(name, "c-pluff")) { - if (check_attributes(plcontext, name, atts, - req_cpluff_atts, opt_cpluff_atts)) { - for (i = 0; atts[i] != NULL; i += 2) { - if (!strcmp(atts[i], "version")) { - plcontext->plugin->req_cpluff_version = parser_strdup(plcontext, atts[i+1]); - } - } - } - } else if (!strcmp(name, "import")) { - if (check_attributes(plcontext, name, atts, - req_import_atts, opt_import_atts)) { - cp_plugin_import_t *import = NULL; - - // Allocate space for imports, if necessary - if (plcontext->plugin->num_imports == plcontext->imports_size) { - cp_plugin_import_t *ni; - size_t ns; - - if (plcontext->imports_size == 0) { - ns = 16; - } else { - ns = plcontext->imports_size * 2; - } - if ((ni = realloc(plcontext->plugin->imports, - ns * sizeof(cp_plugin_import_t))) == NULL) { - resource_error(plcontext); - break; - } - plcontext->plugin->imports = ni; - plcontext->imports_size = ns; - } - - // Parse import specification - import = plcontext->plugin->imports - + plcontext->plugin->num_imports; - memset(import, 0, sizeof(cp_plugin_import_t)); - import->plugin_id = NULL; - import->version = NULL; - for (i = 0; atts[i] != NULL; i += 2) { - if (!strcmp(atts[i], "addon")) { - import->plugin_id - = parser_strdup(plcontext, atts[i+1]); - } else if (!strcmp(atts[i], "version")) { - import->version = parser_strdup(plcontext, atts[i+1]); - } else if (!strcmp(atts[i], "optional")) { - if (!strcmp(atts[i+1], "true") - || !strcmp(atts[i+1], "1")) { - import->optional = 1; - } else if (strcmp(atts[i+1], "false") - && strcmp(atts[i+1], "0")) { - descriptor_errorf(plcontext, 0, _("unknown boolean value: %s"), atts[i+1]); - } - } - } - plcontext->plugin->num_imports++; - } - } else { - unexpected_element(plcontext, name); - } - break; - - case PARSER_EXTENSION: - plcontext->depth++; - if (plcontext->configuration != NULL && plcontext->skippedCEs == 0) { - cp_cfg_element_t *ce; - - // Allocate more space for children, if necessary - if (plcontext->configuration->num_children == plcontext->configuration->index) { - cp_cfg_element_t *nce; - size_t ns; - - if (plcontext->configuration->index == 0) { - ns = 16; - } else { - ns = plcontext->configuration->index * 2; - } - if ((nce = realloc(plcontext->configuration->children, - ns * sizeof(cp_cfg_element_t))) == NULL) { - plcontext->skippedCEs++; - resource_error(plcontext); - break; - } - plcontext->configuration->children = nce; - plcontext->configuration->index = ns; - } - - // Save possible value - if (plcontext->value != NULL) { - plcontext->value[plcontext->value_length] = '\0'; - plcontext->configuration->value = plcontext->value; - } - - ce = plcontext->configuration->children + plcontext->configuration->num_children; - init_cfg_element(plcontext, ce, name, atts, plcontext->configuration); - plcontext->configuration->num_children++; - plcontext->configuration = ce; - } - break; - - case PARSER_UNKNOWN: - plcontext->depth++; - break; - default: - unexpected_element(plcontext, name); - break; - } -} - -/** - * Processes the end of element events while parsing. - * - * @param context the parsing context - * @param name the element name - */ -static void CP_XMLCALL end_element_handler( - void *userData, const XML_Char *name) { - ploader_context_t *plcontext = userData; - - // Process element end - switch (plcontext->state) { - - case PARSER_PLUGIN: - if (!strcmp(name, "addon")) { - - // Readjust memory allocated for extension points, if necessary - if (plcontext->ext_points_size != plcontext->plugin->num_ext_points) { - cp_ext_point_t *nep; - - if ((nep = realloc(plcontext->plugin->ext_points, - plcontext->plugin->num_ext_points * - sizeof(cp_ext_point_t))) != NULL - || plcontext->plugin->num_ext_points == 0) { - plcontext->plugin->ext_points = nep; - plcontext->ext_points_size = plcontext->plugin->num_ext_points; - } - } - - // Readjust memory allocated for extensions, if necessary - if (plcontext->extensions_size != plcontext->plugin->num_extensions) { - cp_extension_t *ne; - - if ((ne = realloc(plcontext->plugin->extensions, - plcontext->plugin->num_extensions * - sizeof(cp_extension_t))) != NULL - || plcontext->plugin->num_extensions == 0) { - plcontext->plugin->extensions = ne; - plcontext->extensions_size = plcontext->plugin->num_extensions; - } - } - - plcontext->state = PARSER_END; - } - break; - - case PARSER_REQUIRES: - if (!strcmp(name, "requires")) { - - // Readjust memory allocated for imports, if necessary - if (plcontext->imports_size != plcontext->plugin->num_imports) { - cp_plugin_import_t *ni; - - if ((ni = realloc(plcontext->plugin->imports, - plcontext->plugin->num_imports * - sizeof(cp_plugin_import_t))) != NULL - || plcontext->plugin->num_imports == 0) { - plcontext->plugin->imports = ni; - plcontext->imports_size = plcontext->plugin->num_imports; - } - } - - plcontext->state = PARSER_PLUGIN; - } - break; - - case PARSER_UNKNOWN: - if (plcontext->depth-- == 0) { - plcontext->state = plcontext->saved_state; - } - break; - - case PARSER_EXTENSION: - if (plcontext->skippedCEs > 0) { - plcontext->skippedCEs--; - } else if (plcontext->configuration != NULL) { - - // Readjust memory allocated for children, if necessary - if (plcontext->configuration->index != plcontext->configuration->num_children) { - cp_cfg_element_t *nce; - - if ((nce = realloc(plcontext->configuration->children, - plcontext->configuration->num_children * - sizeof(cp_cfg_element_t))) != NULL - || plcontext->configuration->num_children == 0) { - plcontext->configuration->children = nce; - } - } - - if (plcontext->configuration->parent != NULL) { - plcontext->configuration->index = plcontext->configuration->parent->num_children - 1; - } else { - plcontext->configuration->index = 0; - } - if (plcontext->value != NULL) { - char *v = plcontext->value; - int i; - - // Ignore trailing whitespace - for (i = plcontext->value_length - 1; i >= 0; i--) { - if (v[i] != ' ' && v[i] != '\n' && v[i] != '\r' && v[i] != '\t') { - break; - } - } - if (i < 0) { - free(plcontext->value); - plcontext->value = NULL; - plcontext->value_length = 0; - plcontext->value_size = 0; - } else { - plcontext->value_length = i + 1; - } - } - if (plcontext->value != NULL) { - - // Readjust memory allocated for value, if necessary - if (plcontext->value_size > plcontext->value_length + 1) { - char *nv; - - if ((nv = realloc(plcontext->value, (plcontext->value_length + 1) * sizeof(char))) != NULL) { - plcontext->value = nv; - } - } - - plcontext->value[plcontext->value_length] = '\0'; - plcontext->configuration->value = plcontext->value; - plcontext->value = NULL; - plcontext->value_size = 0; - plcontext->value_length = 0; - } - plcontext->configuration = plcontext->configuration->parent; - - // Restore possible value - if (plcontext->configuration != NULL - && plcontext->configuration->value != NULL) { - plcontext->value = plcontext->configuration->value; - plcontext->value_length = strlen(plcontext->value); - plcontext->value_size = CP_CFG_ELEMENT_VALUE_INITSIZE; - while (plcontext->value_size < plcontext->value_length + 1) { - plcontext->value_size *= 2; - } - } - - } - if (plcontext->depth-- == 0) { - assert(!strcmp(name, "extension")); - plcontext->state = PARSER_PLUGIN; - XML_SetCharacterDataHandler(plcontext->parser, NULL); - } - break; - - default: - descriptor_errorf(plcontext, 0, _("unexpected closing tag for %s"), - name); - return; - } -} - -static void dealloc_plugin_info(cp_context_t *ctx, cp_plugin_info_t *plugin) { - cpi_free_plugin(plugin); -} - -static cp_status_t init_descriptor_parsing(cp_context_t *context, ploader_context_t **plcontextptr, XML_Parser *parserptr, char *file) { - XML_Parser parser; - ploader_context_t *plcontext; - - // Initialize the XML parsing - *parserptr = parser = XML_ParserCreate(NULL); - if (parser == NULL) { - return CP_ERR_RESOURCE; - } - XML_SetElementHandler(parser, - start_element_handler, - end_element_handler); - - // Initialize the parsing context - if ((*plcontextptr = plcontext = malloc(sizeof(ploader_context_t))) == NULL) { - return CP_ERR_RESOURCE; - } - memset(plcontext, 0, sizeof(ploader_context_t)); - if ((plcontext->plugin = malloc(sizeof(cp_plugin_info_t))) == NULL) { - return CP_ERR_RESOURCE; - } - plcontext->context = context; - plcontext->configuration = NULL; - plcontext->value = NULL; - plcontext->parser = parser; - plcontext->file = file; - plcontext->state = PARSER_BEGIN; - memset(plcontext->plugin, 0, sizeof(cp_plugin_info_t)); - plcontext->plugin->name = NULL; - plcontext->plugin->identifier = NULL; - plcontext->plugin->version = NULL; - plcontext->plugin->provider_name = NULL; - plcontext->plugin->abi_bw_compatibility = NULL; - plcontext->plugin->api_bw_compatibility = NULL; - plcontext->plugin->plugin_path = NULL; - plcontext->plugin->req_cpluff_version = NULL; - plcontext->plugin->imports = NULL; - plcontext->plugin->runtime_lib_name = NULL; - plcontext->plugin->runtime_funcs_symbol = NULL; - plcontext->plugin->ext_points = NULL; - plcontext->plugin->extensions = NULL; - XML_SetUserData(parser, plcontext); - - return CP_OK; -} - -static cp_status_t do_descriptor_parsing(XML_Parser parser, cp_context_t *context, ploader_context_t *plcontext, char *file, unsigned int buffer_len) { - int i; - - // Parse the data - if (!(i = XML_ParseBuffer(parser, buffer_len, buffer_len == 0)) - && context != NULL) { - cpi_lock_context(context); - cpi_errorf(context, - N_("XML parsing error in %s, line %d, column %d (%s)."), - file, - (int) XML_GetErrorLineNumber(parser), - (int) (XML_GetErrorColumnNumber(parser) + 1), - XML_ErrorString(XML_GetErrorCode(parser))); - cpi_unlock_context(context); - } - if (!i || plcontext->state == PARSER_ERROR) { - return CP_ERR_MALFORMED; - } else { - return CP_OK; - } -} - -static cp_status_t finish_descriptor_parsing(cp_status_t status, cp_context_t *context, ploader_context_t *plcontext, char **path) { - if (status == CP_OK) { - if (plcontext->state != PARSER_END || plcontext->error_count > 0) { - status = CP_ERR_MALFORMED; - } - if (plcontext->resource_error_count > 0) { - status = CP_ERR_RESOURCE; - } - } - if (status != CP_OK) { - return status; - } - - // Initialize the plug-in path - plcontext->plugin->plugin_path = *path; - *path = NULL; - - // Increase plug-in usage count - status = cpi_register_info(context, plcontext->plugin, (void (*)(cp_context_t *, void *)) dealloc_plugin_info); - return status; - -} - -static void check_cleanup_descriptor_parsing(cp_status_t status, cp_context_t *context, ploader_context_t *plcontext, XML_Parser parser, const char *path, char *file, cp_plugin_info_t **plugin) { - - // Report possible errors - if (status != CP_OK) { - switch (status) { - case CP_ERR_MALFORMED: - cpi_errorf(context, - N_("Plug-in descriptor in %s is invalid."), path); - break; - case CP_ERR_IO: - cpi_debugf(context, - N_("An I/O error occurred while loading a plug-in descriptor from %s."), path); - break; - case CP_ERR_RESOURCE: - cpi_errorf(context, - N_("Insufficient system resources to load a plug-in descriptor from %s."), path); - break; - default: - cpi_errorf(context, - N_("Failed to load a plug-in descriptor from %s."), path); - break; - } - } - cpi_unlock_context(context); - - // Release persistently allocated data on failure - if (status != CP_OK) { - if (file != NULL) { - free(file); - } - if (plcontext != NULL && plcontext->plugin != NULL) { - cpi_free_plugin(plcontext->plugin); - plcontext->plugin = NULL; - } - } - - // Otherwise copy the plug-in pointer - else { - *plugin = plcontext->plugin; - } - - // Release data allocated for parsing - if (parser != NULL) { - XML_ParserFree(parser); - } - if (plcontext != NULL) { - if (plcontext->value != NULL) { - free(plcontext->value); - } - free(plcontext); - plcontext = NULL; - } - -} - -CP_C_API cp_plugin_info_t * cp_load_plugin_descriptor(cp_context_t *context, const char *path, cp_status_t *error) { - char *file = NULL; - cp_status_t status = CP_OK; - FILE *fh = NULL; - XML_Parser parser = NULL; - ploader_context_t *plcontext = NULL; - cp_plugin_info_t *plugin = NULL; - - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(path); - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_ANY, __func__); - do { - int path_len; - - // Construct the file name for the plug-in descriptor - path_len = strlen(path); - if (path_len == 0) { - status = CP_ERR_IO; - break; - } - if (path[path_len - 1] == CP_FNAMESEP_CHAR) { - path_len--; - } - file = malloc((path_len + strlen(CP_PLUGIN_DESCRIPTOR) + 2) * sizeof(char)); - if (file == NULL) { - status = CP_ERR_RESOURCE; - break; - } - strcpy(file, path); - file[path_len] = CP_FNAMESEP_CHAR; - strcpy(file + path_len + 1, CP_PLUGIN_DESCRIPTOR); - -#if defined(_WIN32) - wchar_t* fileW = to_utf16(file, 0); - fh = _wfopen(fileW, L"rb"); - free(fileW); - if (!fh) - { - status = CP_ERR_IO; - break; - } -#else - // Open the file - if ((fh = fopen(file, "rb")) == NULL) { - status = CP_ERR_IO; - break; - } -#endif - - // Initialize descriptor parsing - status = init_descriptor_parsing(context, &plcontext, &parser, file); - if (status != CP_OK) { - break; - } - - // Parse the plug-in descriptor - while (1) { - unsigned int bytes_read; - void *xml_buffer; - - // Get buffer from Expat - if ((xml_buffer = XML_GetBuffer(parser, CP_XML_PARSER_BUFFER_SIZE)) - == NULL) { - status = CP_ERR_RESOURCE; - break; - } - - // Read data into buffer - bytes_read = fread(xml_buffer, 1, CP_XML_PARSER_BUFFER_SIZE, fh); - if (ferror(fh)) { - status = CP_ERR_IO; - break; - } - - // Parse the data - status = do_descriptor_parsing(parser, context, plcontext, file, bytes_read); - if (status != CP_OK || bytes_read == 0) { - break; - } - } - - // Finish parsing - *(file + path_len) = '\0'; - status = finish_descriptor_parsing(status, context, plcontext, &file); - } while (0); - - // Check and clean up - check_cleanup_descriptor_parsing(status, context, plcontext, parser, path, file, &plugin); - if (fh != NULL) { - fclose(fh); - } - - // Return error code - if (error != NULL) { - *error = status; - } - - return plugin; -} - -CP_C_API cp_plugin_info_t * cp_load_plugin_descriptor_from_memory(cp_context_t *context, const char *buffer, unsigned int buffer_len, cp_status_t *error) { - char *file = NULL; - const char *path = "memory"; - cp_status_t status = CP_OK; - XML_Parser parser = NULL; - ploader_context_t *plcontext = NULL; - cp_plugin_info_t *plugin = NULL; - - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(buffer); - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_ANY, __func__); - do { - int path_len = 6; - file = malloc((path_len + 1) * sizeof(char)); - if (file == NULL) { - status = CP_ERR_RESOURCE; - break; - } - strcpy(file, path); - - // Initialize descriptor parsing - status = init_descriptor_parsing(context, &plcontext, &parser, file); - if (status != CP_OK) { - break; - } - - // Parse the plug-in descriptor - do { - void *xml_buffer; - - // Get buffer from Expat - if ((xml_buffer = XML_GetBuffer(parser, buffer_len)) - == NULL) { - status = CP_ERR_RESOURCE; - break; - } - - // Read data into buffer - memcpy(xml_buffer, buffer, buffer_len); - - // Parse the data - status = do_descriptor_parsing(parser, context, plcontext, file, buffer_len); - if (status == CP_OK) { - status = do_descriptor_parsing(parser, context, plcontext, file, 0); - } - } while (0); - - // Finish parsing - *(file + path_len) = '\0'; - status = finish_descriptor_parsing(status, context, plcontext, &file); - - } while (0); - - // Check and clean up - check_cleanup_descriptor_parsing(status, context, plcontext, parser, path, file, &plugin); - - // Return error code - if (error != NULL) { - *error = status; - } - - return plugin; -} diff --git a/lib/cpluff/libcpluff/pscan.c b/lib/cpluff/libcpluff/pscan.c deleted file mode 100644 index 921c8e365f..0000000000 --- a/lib/cpluff/libcpluff/pscan.c +++ /dev/null @@ -1,311 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Plug-in scanning functionality - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdlib.h> -#include <string.h> -#include <assert.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <dirent.h> -#include <errno.h> -#include "cpluff.h" -#include "defines.h" -#include "util.h" -#include "internal.h" - - -/* ------------------------------------------------------------------------ - * Function definitions - * ----------------------------------------------------------------------*/ - -CP_C_API cp_status_t cp_scan_plugins(cp_context_t *context, int flags) { - hash_t *avail_plugins = NULL; - list_t *started_plugins = NULL; - cp_plugin_info_t **plugins = NULL; - char *pdir_path = NULL; - int pdir_path_size = 0; - int plugins_stopped = 0; - cp_status_t status = CP_OK; - - CHECK_NOT_NULL(context); - - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_ANY, __func__); - cpi_debug(context, N_("Plug-in scan is starting.")); - do { - lnode_t *lnode; - hscan_t hscan; - hnode_t *hnode; - - // Create a hash for available plug-ins - if ((avail_plugins = hash_create(HASHCOUNT_T_MAX, (int (*)(const void *, const void *)) strcmp, NULL)) == NULL) { - status = CP_ERR_RESOURCE; - break; - } - - // Scan plug-in directories for available plug-ins - lnode = list_first(context->env->plugin_dirs); - while (lnode != NULL) { - const char *dir_path; - DIR *dir; - - dir_path = lnode_get(lnode); - dir = opendir(dir_path); - if (dir != NULL) { - int dir_path_len; - struct dirent *de; - - dir_path_len = strlen(dir_path); - if (dir_path[dir_path_len - 1] == CP_FNAMESEP_CHAR) { - dir_path_len--; - } - errno = 0; - while ((de = readdir(dir)) != NULL) { - if (de->d_name[0] != '\0' && de->d_name[0] != '.') { - int pdir_path_len = dir_path_len + 1 + strlen(de->d_name) + 1; - cp_plugin_info_t *plugin; - cp_status_t s; - hnode_t *hnode; - - // Allocate memory for plug-in descriptor path - if (pdir_path_size <= pdir_path_len) { - char *new_pdir_path; - - if (pdir_path_size == 0) { - pdir_path_size = 128; - } - while (pdir_path_size <= pdir_path_len) { - pdir_path_size *= 2; - } - new_pdir_path = realloc(pdir_path, pdir_path_size * sizeof(char)); - if (new_pdir_path == NULL) { - cpi_errorf(context, N_("Could not check possible plug-in location %s%c%s due to insufficient system resources."), dir_path, CP_FNAMESEP_CHAR, de->d_name); - status = CP_ERR_RESOURCE; - // continue loading plug-ins from other directories - continue; - } - pdir_path = new_pdir_path; - } - - // Construct plug-in descriptor path - strcpy(pdir_path, dir_path); - pdir_path[dir_path_len] = CP_FNAMESEP_CHAR; - strcpy(pdir_path + dir_path_len + 1, de->d_name); - - // Try to load a plug-in - plugin = cp_load_plugin_descriptor(context, pdir_path, &s); - if (plugin == NULL) { - status = s; - // continue loading plug-ins from other directories - continue; - } - - // Insert plug-in to the list of available plug-ins - if ((hnode = hash_lookup(avail_plugins, plugin->identifier)) != NULL) { - cp_plugin_info_t *plugin2 = hnode_get(hnode); - if (cpi_vercmp(plugin->version, plugin2->version) > 0) { - hash_delete_free(avail_plugins, hnode); - cp_release_info(context, plugin2); - hnode = NULL; - } - } - if (hnode == NULL) { - if (!hash_alloc_insert(avail_plugins, plugin->identifier, plugin)) { - cpi_errorf(context, N_("Plug-in %s version %s could not be loaded due to insufficient system resources."), plugin->identifier, plugin->version); - cp_release_info(context, plugin); - status = CP_ERR_RESOURCE; - // continue loading plug-ins from other directories - continue; - } - } - - } - errno = 0; - } - if (errno) { - cpi_errorf(context, N_("Could not read plug-in directory %s: %s"), dir_path, strerror(errno)); - status = CP_ERR_IO; - // continue loading plug-ins from other directories - } - closedir(dir); - } else { - cpi_errorf(context, N_("Could not open plug-in directory %s: %s"), dir_path, strerror(errno)); - status = CP_ERR_IO; - // continue loading plug-ins from other directories - } - - lnode = list_next(context->env->plugin_dirs, lnode); - } - - // Copy the list of started plug-ins, if necessary - if ((flags & CP_SP_RESTART_ACTIVE) - && (flags & (CP_SP_UPGRADE | CP_SP_STOP_ALL_ON_INSTALL))) { - int i; - cp_status_t s; - - if ((plugins = cp_get_plugins_info(context, &s, NULL)) == NULL) { - status = s; - break; - } - if ((started_plugins = list_create(LISTCOUNT_T_MAX)) == NULL) { - status = CP_ERR_RESOURCE; - break; - } - for (i = 0; plugins[i] != NULL; i++) { - cp_plugin_state_t state; - - state = cp_get_plugin_state(context, plugins[i]->identifier); - if (state == CP_PLUGIN_STARTING || state == CP_PLUGIN_ACTIVE) { - char *pid; - - if ((pid = strdup(plugins[i]->identifier)) == NULL) { - status = CP_ERR_RESOURCE; - break; - } - if ((lnode = lnode_create(pid)) == NULL) { - free(pid); - status = CP_ERR_RESOURCE; - break; - } - list_append(started_plugins, lnode); - } - } - cpi_release_info(context, plugins); - plugins = NULL; - } - - // Install/upgrade plug-ins - hash_scan_begin(&hscan, avail_plugins); - while ((hnode = hash_scan_next(&hscan)) != NULL) { - cp_plugin_info_t *plugin; - cp_plugin_t *ip = NULL; - hnode_t *hn2; - int s; - - plugin = hnode_get(hnode); - hn2 = hash_lookup(context->env->plugins, plugin->identifier); - if (hn2 != NULL) { - ip = hnode_get(hn2); - } - - // Unload the installed plug-in if it is to be upgraded - if (ip != NULL - && (flags & CP_SP_UPGRADE) - && ((ip->plugin->version == NULL && plugin->version != NULL) - || (ip->plugin->version != NULL - && plugin->version != NULL - && cpi_vercmp(plugin->version, ip->plugin->version) > 0))) { - if ((flags & (CP_SP_STOP_ALL_ON_UPGRADE | CP_SP_STOP_ALL_ON_INSTALL)) - && !plugins_stopped) { - plugins_stopped = 1; - cp_stop_plugins(context); - } - s = cp_uninstall_plugin(context, plugin->identifier); - assert(s == CP_OK); - ip = NULL; - } - - // Install the plug-in, if to be installed - if (ip == NULL) { - if ((flags & CP_SP_STOP_ALL_ON_INSTALL) && !plugins_stopped) { - plugins_stopped = 1; - cp_stop_plugins(context); - } - if ((s = cp_install_plugin(context, plugin)) != CP_OK) { - status = s; - break; - } - } - - // Remove the plug-in from the hash - hash_scan_delfree(avail_plugins, hnode); - cp_release_info(context, plugin); - } - - // Restart stopped plug-ins if necessary - if (started_plugins != NULL) { - lnode = list_first(started_plugins); - while (lnode != NULL) { - char *pid; - int s; - - pid = lnode_get(lnode); - s = cp_start_plugin(context, pid); - if (s != CP_OK) { - status = s; - } - lnode = list_next(started_plugins, lnode); - } - } - - } while (0); - - // Report error - switch (status) { - case CP_OK: - cpi_info(context, N_("Plug-in scan has completed successfully.")); - break; - case CP_ERR_RESOURCE: - cpi_error(context, N_("Could not scan plug-ins due to insufficient system resources.")); - break; - default: - cpi_warn(context, N_("Not all directories were successfully scanned.")); - break; - } - cpi_unlock_context(context); - - // Release resources - if (pdir_path != NULL) { - free(pdir_path); - } - if (avail_plugins != NULL) { - hscan_t hscan; - hnode_t *hnode; - - hash_scan_begin(&hscan, avail_plugins); - while ((hnode = hash_scan_next(&hscan)) != NULL) { - cp_plugin_info_t *p = hnode_get(hnode); - hash_scan_delfree(avail_plugins, hnode); - cp_release_info(context, p); - } - hash_destroy(avail_plugins); - } - if (started_plugins != NULL) { - list_process(started_plugins, NULL, cpi_process_free_ptr); - list_destroy(started_plugins); - } - if (plugins != NULL) { - cp_release_info(context, plugins); - } - - return status; -} diff --git a/lib/cpluff/libcpluff/psymbol.c b/lib/cpluff/libcpluff/psymbol.c deleted file mode 100644 index 988d903790..0000000000 --- a/lib/cpluff/libcpluff/psymbol.c +++ /dev/null @@ -1,343 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Dynamic plug-in symbols - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdlib.h> -#include <string.h> -#include <assert.h> -#include "../kazlib/hash.h" -#include "cpluff.h" -#include "defines.h" -#include "internal.h" -#include "util.h" -#ifdef _WIN32 -#include <windows.h> -#endif - - -/* ------------------------------------------------------------------------ - * Data structures - * ----------------------------------------------------------------------*/ - -/// Information about symbol providing plug-in -typedef struct symbol_provider_info_t { - - // The providing plug-in - cp_plugin_t *plugin; - - // Whether there is also an import dependency for the plug-in - int imported; - - // Total symbol usage count - int usage_count; - -} symbol_provider_info_t; - -/// Information about used symbol -typedef struct symbol_info_t { - - // Symbol usage count - int usage_count; - - // Information about providing plug-in - symbol_provider_info_t *provider_info; - -} symbol_info_t; - - -/* ------------------------------------------------------------------------ - * Function definitions - * ----------------------------------------------------------------------*/ - -CP_C_API cp_status_t cp_define_symbol(cp_context_t *context, const char *name, void *ptr) { - cp_status_t status = CP_OK; - - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(name); - CHECK_NOT_NULL(ptr); - if (context->plugin == NULL) { - cpi_fatalf(_("Only plug-ins can define context specific symbols.")); - } - - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_LOGGER | CPI_CF_LISTENER, __func__); - do { - char *n; - - // Create a symbol hash if necessary - if (context->plugin->defined_symbols == NULL) { - if ((context->plugin->defined_symbols = hash_create(HASHCOUNT_T_MAX, (int (*)(const void *, const void *)) strcmp, NULL)) == NULL) { - status = CP_ERR_RESOURCE; - break; - } - } - - // Check for a previously defined symbol - if (hash_lookup(context->plugin->defined_symbols, name) != NULL) { - status = CP_ERR_CONFLICT; - break; - } - - // Insert the symbol into the symbol hash - n = strdup(name); - if (n == NULL || !hash_alloc_insert(context->plugin->defined_symbols, n, ptr)) { - free(n); - status = CP_ERR_RESOURCE; - break; - } - - } while (0); - - // Report error - if (status != CP_OK) { - switch (status) { - case CP_ERR_RESOURCE: - cpi_errorf(context, N_("Plug-in %s could not define symbol %s due to insufficient memory."), context->plugin->plugin->identifier, name); - break; - case CP_ERR_CONFLICT: - cpi_errorf(context, N_("Plug-in %s tried to redefine symbol %s."), context->plugin->plugin->identifier, name); - break; - default: - break; - } - } - cpi_unlock_context(context); - - return status; -} - -CP_C_API void * cp_resolve_symbol(cp_context_t *context, const char *id, const char *name, cp_status_t *error) { - cp_status_t status = CP_OK; - int error_reported = 1; - hnode_t *node; - void *symbol = NULL; - symbol_info_t *symbol_info = NULL; - symbol_provider_info_t *provider_info = NULL; - cp_plugin_t *pp = NULL; - - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(id); - CHECK_NOT_NULL(name); - - // Resolve the symbol - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_LOGGER | CPI_CF_LISTENER | CPI_CF_STOP, __func__); - do { - - // Allocate space for symbol hashes, if necessary - if (context->resolved_symbols == NULL) { - context->resolved_symbols = hash_create(HASHCOUNT_T_MAX, cpi_comp_ptr, cpi_hashfunc_ptr); - } - if (context->symbol_providers == NULL) { - context->symbol_providers = hash_create(HASHCOUNT_T_MAX, cpi_comp_ptr, cpi_hashfunc_ptr); - } - if (context->resolved_symbols == NULL - || context->symbol_providers == NULL) { - status = CP_ERR_RESOURCE; - break; - } - - // Look up the symbol defining plug-in - node = hash_lookup(context->env->plugins, id); - if (node == NULL) { - cpi_warnf(context, N_("Symbol %s in unknown plug-in %s could not be resolved."), name, id); - status = CP_ERR_UNKNOWN; - break; - } - pp = hnode_get(node); - - // Make sure the plug-in has been started - if ((status = cpi_start_plugin(context, pp)) != CP_OK) { - cpi_errorf(context, N_("Symbol %s in plug-in %s could not be resolved because the plug-in could not be started."), name, id); - error_reported = 1; - break; - } - - // Check for a context specific symbol - if (pp->defined_symbols != NULL && (node = hash_lookup(pp->defined_symbols, name)) != NULL) { - symbol = hnode_get(node); - } - - // Fall back to global symbols, if necessary - if (symbol == NULL && pp->runtime_lib != NULL) { - symbol = DLSYM(pp->runtime_lib, name); - } - if (symbol == NULL) { - const char *error = DLERROR(); - if (error == NULL) { - error = _("Unspecified error."); - } - cpi_warnf(context, N_("Symbol %s in plug-in %s could not be resolved: %s"), name, id, error); - status = CP_ERR_UNKNOWN; - break; - } - - // Lookup or initialize symbol provider information - if ((node = hash_lookup(context->symbol_providers, pp)) != NULL) { - provider_info = hnode_get(node); - } else { - if ((provider_info = malloc(sizeof(symbol_provider_info_t))) == NULL) { - status = CP_ERR_RESOURCE; - break; - } - memset(provider_info, 0, sizeof(symbol_provider_info_t)); - provider_info->plugin = pp; - provider_info->imported = (context->plugin == NULL || cpi_ptrset_contains(context->plugin->imported, pp)); - if (!hash_alloc_insert(context->symbol_providers, pp, provider_info)) { - status = CP_ERR_RESOURCE; - break; - } - } - - // Lookup or initialize symbol information - if ((node = hash_lookup(context->resolved_symbols, symbol)) != NULL) { - symbol_info = hnode_get(node); - } else { - if ((symbol_info = malloc(sizeof(symbol_info_t))) == NULL) { - status = CP_ERR_RESOURCE; - break; - } - memset(symbol_info, 0, sizeof(symbol_info_t)); - symbol_info->provider_info = provider_info; - if (!hash_alloc_insert(context->resolved_symbols, symbol, symbol_info)) { - status = CP_ERR_RESOURCE; - break; - } - } - - // Add dependencies (for plug-in) - if (provider_info != NULL - && !provider_info->imported - && provider_info->usage_count == 0) { - if (!cpi_ptrset_add(context->plugin->imported, pp)) { - status = CP_ERR_RESOURCE; - break; - } - if (!cpi_ptrset_add(pp->importing, context->plugin)) { - cpi_ptrset_remove(context->plugin->imported, pp); - status = CP_ERR_RESOURCE; - break; - } - cpi_debugf(context, N_("A dynamic dependency was created from plug-in %s to plug-in %s."), context->plugin->plugin->identifier, pp->plugin->identifier); - } - - // Increase usage counts - symbol_info->usage_count++; - provider_info->usage_count++; - - if (cpi_is_logged(context, CP_LOG_DEBUG)) { - char owner[64]; - /* TRANSLATORS: First %s is the context owner */ - cpi_debugf(context, N_("%s resolved symbol %s defined by plug-in %s."), cpi_context_owner(context, owner, sizeof(owner)), name, id); - } - } while (0); - - // Clean up - if (symbol_info != NULL && symbol_info->usage_count == 0) { - if ((node = hash_lookup(context->resolved_symbols, symbol)) != NULL) { - hash_delete_free(context->resolved_symbols, node); - } - free(symbol_info); - } - if (provider_info != NULL && provider_info->usage_count == 0) { - if ((node = hash_lookup(context->symbol_providers, pp)) != NULL) { - hash_delete_free(context->symbol_providers, node); - } - free(provider_info); - } - - // Report insufficient memory error - if (status == CP_ERR_RESOURCE && !error_reported) { - cpi_errorf(context, N_("Symbol %s in plug-in %s could not be resolved due to insufficient memory."), name, id); - } - cpi_unlock_context(context); - - // Return error code - if (error != NULL) { - *error = status; - } - - // Return symbol - return symbol; -} - -CP_C_API void cp_release_symbol(cp_context_t *context, const void *ptr) { - hnode_t *node; - symbol_info_t *symbol_info; - symbol_provider_info_t *provider_info; - - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(ptr); - - cpi_lock_context(context); - cpi_check_invocation(context, CPI_CF_LOGGER | CPI_CF_LISTENER, __func__); - do { - - // Look up the symbol - if ((node = hash_lookup(context->resolved_symbols, ptr)) == NULL) { - cpi_errorf(context, N_("Could not release unknown symbol at address %p."), ptr); - break; - } - symbol_info = hnode_get(node); - provider_info = symbol_info->provider_info; - - // Decrease usage count - assert(symbol_info->usage_count > 0); - symbol_info->usage_count--; - assert(provider_info->usage_count > 0); - provider_info->usage_count--; - - // Check if the symbol is not being used anymore - if (symbol_info->usage_count == 0) { - hash_delete_free(context->resolved_symbols, node); - free(symbol_info); - if (cpi_is_logged(context, CP_LOG_DEBUG)) { - char owner[64]; - /* TRANSLATORS: First %s is the context owner */ - cpi_debugf(context, N_("%s released the symbol at address %p defined by plug-in %s."), cpi_context_owner(context, owner, sizeof(owner)), ptr, provider_info->plugin->plugin->identifier); - } - } - - // Check if the symbol providing plug-in is not being used anymore - if (provider_info->usage_count == 0) { - node = hash_lookup(context->symbol_providers, provider_info->plugin); - assert(node != NULL); - hash_delete_free(context->symbol_providers, node); - if (!provider_info->imported) { - cpi_ptrset_remove(context->plugin->imported, provider_info->plugin); - cpi_ptrset_remove(provider_info->plugin->importing, context->plugin); - cpi_debugf(context, N_("A dynamic dependency from plug-in %s to plug-in %s was removed."), context->plugin->plugin->identifier, provider_info->plugin->plugin->identifier); - } - free(provider_info); - } - - } while (0); - cpi_unlock_context(context); -} diff --git a/lib/cpluff/libcpluff/serial.c b/lib/cpluff/libcpluff/serial.c deleted file mode 100644 index a7885888c8..0000000000 --- a/lib/cpluff/libcpluff/serial.c +++ /dev/null @@ -1,205 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Serial execution implementation - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdlib.h> -#include <string.h> -#include "cpluff.h" -#include "internal.h" - - -/* ------------------------------------------------------------------------ - * Data types - * ----------------------------------------------------------------------*/ - -/// A holder structure for a run function. -typedef struct run_func_t { - - /// The run function - cp_run_func_t runfunc; - - /// The registering plug-in instance - cp_plugin_t *plugin; - - /// Whether currently in execution - int in_execution; - -} run_func_t; - -CP_C_API cp_status_t cp_run_function(cp_context_t *ctx, cp_run_func_t runfunc) { - lnode_t *node = NULL; - run_func_t *rf = NULL; - cp_status_t status = CP_OK; - - CHECK_NOT_NULL(ctx); - CHECK_NOT_NULL(runfunc); - if (ctx->plugin == NULL) { - cpi_fatalf(_("Only plug-ins can register run functions.")); - } - if (ctx->plugin->state != CP_PLUGIN_ACTIVE - && ctx->plugin->state != CP_PLUGIN_STARTING) { - cpi_fatalf(_("Only starting or active plug-ins can register run functions.")); - } - - cpi_lock_context(ctx); - cpi_check_invocation(ctx, CPI_CF_STOP | CPI_CF_LOGGER, __func__); - do { - int found = 0; - lnode_t *n; - - // Check if already registered - n = list_first(ctx->env->run_funcs); - while (n != NULL && !found) { - run_func_t *r = lnode_get(n); - if (runfunc == r->runfunc && ctx->plugin == r->plugin) { - found = 1; - } - n = list_next(ctx->env->run_funcs, n); - } - if (found) { - break; - } - - // Allocate memory for a new run function entry - if ((rf = malloc(sizeof(run_func_t))) == NULL) { - status = CP_ERR_RESOURCE; - break; - } - if ((node = lnode_create(rf)) == NULL) { - status = CP_ERR_RESOURCE; - break; - } - - // Initialize run function entry - memset(rf, 0, sizeof(run_func_t)); - rf->runfunc = runfunc; - rf->plugin = ctx->plugin; - - // Append the run function to queue - list_append(ctx->env->run_funcs, node); - if (ctx->env->run_wait == NULL) { - ctx->env->run_wait = node; - } - - } while (0); - - // Log error - if (status == CP_ERR_RESOURCE) { - cpi_error(ctx, N_("Could not register a run function due to insufficient memory.")); - } - cpi_unlock_context(ctx); - - // Free resources on error - if (status != CP_OK) { - if (node != NULL) { - lnode_destroy(node); - } - if (rf != NULL) { - free(rf); - } - } - - return status; -} - -CP_C_API void cp_run_plugins(cp_context_t *ctx) { - while (cp_run_plugins_step(ctx)); -} - -CP_C_API int cp_run_plugins_step(cp_context_t *ctx) { - int runnables; - - CHECK_NOT_NULL(ctx); - cpi_lock_context(ctx); - if (ctx->env->run_wait != NULL) { - lnode_t *node = ctx->env->run_wait; - run_func_t *rf = lnode_get(node); - int rerun; - - ctx->env->run_wait = list_next(ctx->env->run_funcs, node); - rf->in_execution = 1; - cpi_unlock_context(ctx); - rerun = rf->runfunc(rf->plugin->plugin_data); - cpi_lock_context(ctx); - rf->in_execution = 0; - list_delete(ctx->env->run_funcs, node); - if (rerun) { - list_append(ctx->env->run_funcs, node); - if (ctx->env->run_wait == NULL) { - ctx->env->run_wait = node; - } - } else { - lnode_destroy(node); - free(rf); - } - cpi_signal_context(ctx); - } - runnables = (ctx->env->run_wait != NULL); - cpi_unlock_context(ctx); - return runnables; -} - -CP_HIDDEN void cpi_stop_plugin_run(cp_plugin_t *plugin) { - int stopped = 0; - cp_context_t *ctx; - - CHECK_NOT_NULL(plugin); - ctx = plugin->context; - assert(cpi_is_context_locked(ctx)); - while (!stopped) { - lnode_t *node; - - stopped = 1; - node = list_first(ctx->env->run_funcs); - while (node != NULL) { - run_func_t *rf = lnode_get(node); - lnode_t *next_node = list_next(ctx->env->run_funcs, node); - - if (rf->plugin == plugin) { - if (rf->in_execution) { - stopped = 0; - } else { - if (ctx->env->run_wait == node) { - ctx->env->run_wait = list_next(ctx->env->run_funcs, node); - } - list_delete(ctx->env->run_funcs, node); - lnode_destroy(node); - free(rf); - } - } - node = next_node; - } - - // If some run functions were in execution, wait for them to finish - if (!stopped) { - cpi_wait_context(ctx); - } - } -} diff --git a/lib/cpluff/libcpluff/thread.h b/lib/cpluff/libcpluff/thread.h deleted file mode 100644 index fff9e39b50..0000000000 --- a/lib/cpluff/libcpluff/thread.h +++ /dev/null @@ -1,120 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Declarations for generic mutex functions and types - */ - -#ifndef THREAD_H_ -#define THREAD_H_ -#ifdef CP_THREADS - -#include "defines.h" - -#ifdef __cplusplus -extern "C" { -#endif //__cplusplus - - -/* ------------------------------------------------------------------------ - * Data types - * ----------------------------------------------------------------------*/ - -// A generic mutex implementation -typedef struct cpi_mutex_t cpi_mutex_t; - - -/* ------------------------------------------------------------------------ - * Function declarations - * ----------------------------------------------------------------------*/ - -// Mutex functions - -/** - * Creates a mutex. The mutex is initially available. - * - * @return the created mutex or NULL if no resources available - */ -CP_HIDDEN cpi_mutex_t * cpi_create_mutex(void); - -/** - * Destroys the specified mutex. - * - * @param mutex the mutex - */ -CP_HIDDEN void cpi_destroy_mutex(cpi_mutex_t *mutex); - -/** - * Waits for the specified mutex to become available and locks it. - * If the calling thread has already locked the mutex then the - * lock count of the mutex is increased. - * - * @param mutex the mutex - */ -CP_HIDDEN void cpi_lock_mutex(cpi_mutex_t *mutex); - -/** - * Unlocks the specified mutex which must have been previously locked - * by this thread. If there has been several calls to cpi_lock_mutex - * by the same thread then the mutex is unlocked only after corresponding - * number of unlock requests. - * - * @param mutex the mutex - */ -CP_HIDDEN void cpi_unlock_mutex(cpi_mutex_t *mutex); - -/** - * Waits on the specified mutex until it is signaled. The calling thread - * must hold the mutex. The mutex is released on call to this function and - * it is reacquired before the function returns. - * - * @param mutex the mutex to wait on - */ -CP_HIDDEN void cpi_wait_mutex(cpi_mutex_t *mutex); - -/** - * Signals the specified mutex waking all the threads currently waiting on - * the mutex. The calling thread must hold the mutex. The mutex is not - * released. - * - * @param mutex the mutex to be signaled - */ -CP_HIDDEN void cpi_signal_mutex(cpi_mutex_t *mutex); - -#if !defined(NDEBUG) - -/** - * Returns whether the mutex is currently locked. This function - * is only intended to be used for assertions. The returned state - * reflects the state of the mutex only at the time of inspection. - */ -CP_HIDDEN int cpi_is_mutex_locked(cpi_mutex_t *mutex); - -#endif - -#ifdef __cplusplus -} -#endif //__cplusplus - -#endif //CP_THREADS -#endif //THREAD_H_ diff --git a/lib/cpluff/libcpluff/thread_posix.c b/lib/cpluff/libcpluff/thread_posix.c deleted file mode 100644 index 7a77889a63..0000000000 --- a/lib/cpluff/libcpluff/thread_posix.c +++ /dev/null @@ -1,232 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Posix implementation for generic mutex functions - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> -#include <pthread.h> -#include "cpluff.h" -#include "defines.h" -#include "util.h" -#include "internal.h" -#include "thread.h" - - -/* ------------------------------------------------------------------------ - * Data types - * ----------------------------------------------------------------------*/ - -// A generic recursive mutex implementation -struct cpi_mutex_t { - - /// The current lock count - int lock_count; - - /// The underlying operating system mutex - pthread_mutex_t os_mutex; - - /// The condition variable for signaling availability - pthread_cond_t os_cond_lock; - - /// The condition variable for broadcasting a wake request - pthread_cond_t os_cond_wake; - - /// The locking thread if currently locked - pthread_t os_thread; - -}; - - -/* ------------------------------------------------------------------------ - * Function definitions - * ----------------------------------------------------------------------*/ - -CP_HIDDEN cpi_mutex_t * cpi_create_mutex(void) { - cpi_mutex_t *mutex; - - if ((mutex = malloc(sizeof(cpi_mutex_t))) == NULL) { - return NULL; - } - memset(mutex, 0, sizeof(cpi_mutex_t)); - if (pthread_mutex_init(&(mutex->os_mutex), NULL)) { - return NULL; - } else if (pthread_cond_init(&(mutex->os_cond_lock), NULL)) { - int ec; - - ec = pthread_mutex_destroy(&(mutex->os_mutex)); - assert(!ec); - return NULL; - } else if (pthread_cond_init(&(mutex->os_cond_wake), NULL)) { - int ec; - - ec = pthread_mutex_destroy(&(mutex->os_mutex)); - assert(!ec); - ec = pthread_cond_destroy(&(mutex->os_cond_wake)); - assert(!ec); - return NULL; - } - return mutex; -} - -CP_HIDDEN void cpi_destroy_mutex(cpi_mutex_t *mutex) { - int ec; - - assert(mutex != NULL); - assert(mutex->lock_count == 0); - ec = pthread_mutex_destroy(&(mutex->os_mutex)); - assert(!ec); - ec = pthread_cond_destroy(&(mutex->os_cond_lock)); - assert(!ec); - ec = pthread_cond_destroy(&(mutex->os_cond_wake)); - assert(!ec); - free(mutex); -} - -static void lock_mutex(pthread_mutex_t *mutex) { - int ec; - - if ((ec = pthread_mutex_lock(mutex))) { - cpi_fatalf(_("Could not lock a mutex due to error %d."), ec); - } -} - -static void unlock_mutex(pthread_mutex_t *mutex) { - int ec; - - if ((ec = pthread_mutex_unlock(mutex))) { - cpi_fatalf(_("Could not unlock a mutex due to error %d."), ec); - } -} - -static void lock_mutex_holding(cpi_mutex_t *mutex) { - pthread_t self = pthread_self(); - - while (mutex->lock_count != 0 - && !pthread_equal(self, mutex->os_thread)) { - int ec; - - if ((ec = pthread_cond_wait(&(mutex->os_cond_lock), &(mutex->os_mutex)))) { - cpi_fatalf(_("Could not wait for a condition variable due to error %d."), ec); - } - } - mutex->os_thread = self; - mutex->lock_count++; -} - -CP_HIDDEN void cpi_lock_mutex(cpi_mutex_t *mutex) { - assert(mutex != NULL); - lock_mutex(&(mutex->os_mutex)); - lock_mutex_holding(mutex); - unlock_mutex(&(mutex->os_mutex)); -} - -CP_HIDDEN void cpi_unlock_mutex(cpi_mutex_t *mutex) { - pthread_t self = pthread_self(); - - assert(mutex != NULL); - lock_mutex(&(mutex->os_mutex)); - if (mutex->lock_count > 0 - && pthread_equal(self, mutex->os_thread)) { - if (--mutex->lock_count == 0) { - int ec; - - if ((ec = pthread_cond_signal(&(mutex->os_cond_lock)))) { - cpi_fatalf(_("Could not signal a condition variable due to error %d."), ec); - } - } - } else { - cpi_fatalf(_("Internal C-Pluff error: Unauthorized attempt at unlocking a mutex.")); - } - unlock_mutex(&(mutex->os_mutex)); -} - -CP_HIDDEN void cpi_wait_mutex(cpi_mutex_t *mutex) { - pthread_t self = pthread_self(); - - assert(mutex != NULL); - lock_mutex(&(mutex->os_mutex)); - if (mutex->lock_count > 0 - && pthread_equal(self, mutex->os_thread)) { - int ec; - int lc = mutex->lock_count; - - // Release mutex - mutex->lock_count = 0; - if ((ec = pthread_cond_signal(&(mutex->os_cond_lock)))) { - cpi_fatalf(_("Could not signal a condition variable due to error %d."), ec); - } - - // Wait for signal - if ((ec = pthread_cond_wait(&(mutex->os_cond_wake), &(mutex->os_mutex)))) { - cpi_fatalf(_("Could not wait for a condition variable due to error %d."), ec); - } - - // Re-acquire mutex and restore lock count for this thread - lock_mutex_holding(mutex); - mutex->lock_count = lc; - - } else { - cpi_fatalf(_("Internal C-Pluff error: Unauthorized attempt at waiting on a mutex.")); - } - unlock_mutex(&(mutex->os_mutex)); -} - -CP_HIDDEN void cpi_signal_mutex(cpi_mutex_t *mutex) { - pthread_t self = pthread_self(); - - assert(mutex != NULL); - lock_mutex(&(mutex->os_mutex)); - if (mutex->lock_count > 0 - && pthread_equal(self, mutex->os_thread)) { - int ec; - - // Signal the mutex - if ((ec = pthread_cond_broadcast(&(mutex->os_cond_wake)))) { - cpi_fatalf(_("Could not broadcast a condition variable due to error %d."), ec); - } - - } else { - cpi_fatalf(_("Internal C-Pluff error: Unauthorized attempt at signaling a mutex.")); - } - unlock_mutex(&(mutex->os_mutex)); -} - -#if !defined(NDEBUG) -CP_HIDDEN int cpi_is_mutex_locked(cpi_mutex_t *mutex) { - int locked; - - lock_mutex(&(mutex->os_mutex)); - locked = (mutex->lock_count != 0); - unlock_mutex(&(mutex->os_mutex)); - return locked; -} -#endif diff --git a/lib/cpluff/libcpluff/thread_windows.c b/lib/cpluff/libcpluff/thread_windows.c deleted file mode 100644 index de1f37ed88..0000000000 --- a/lib/cpluff/libcpluff/thread_windows.c +++ /dev/null @@ -1,272 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Windows implementation for generic mutex functions - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> -#include <windows.h> -#include "cpluff.h" -#include "defines.h" -#include "util.h" -#include "internal.h" -#include "thread.h" - - -/* ------------------------------------------------------------------------ - * Data types - * ----------------------------------------------------------------------*/ - -// A generic recursive mutex implementation -struct cpi_mutex_t { - - /// The current lock count - int lock_count; - - /// The underlying operating system mutex - HANDLE os_mutex; - - /// The condition variable for signaling availability - HANDLE os_cond_lock; - - /// The condition variable for signaling a wake request - HANDLE os_cond_wake; - - /// Number of threads currently waiting on this mutex - int num_wait_threads; - - /// The locking thread if currently locked - DWORD os_thread; - -}; - - -/* ------------------------------------------------------------------------ - * Function definitions - * ----------------------------------------------------------------------*/ - -CP_HIDDEN cpi_mutex_t * cpi_create_mutex(void) { - cpi_mutex_t *mutex; - - if ((mutex = malloc(sizeof(cpi_mutex_t))) == NULL) { - return NULL; - } - memset(mutex, 0, sizeof(cpi_mutex_t)); - if ((mutex->os_mutex = CreateMutex(NULL, FALSE, NULL)) == NULL) { - return NULL; - } else if ((mutex->os_cond_lock = CreateEvent(NULL, FALSE, FALSE, NULL)) == NULL) { - int ec; - - ec = CloseHandle(mutex->os_mutex); - assert(ec); - return NULL; - } else if ((mutex->os_cond_wake = CreateEvent(NULL, TRUE, FALSE, NULL)) == NULL) { - int ec; - - ec = CloseHandle(mutex->os_mutex); - assert(ec); - ec = CloseHandle(mutex->os_cond_lock); - assert(ec); - return NULL; - } - return mutex; -} - -CP_HIDDEN void cpi_destroy_mutex(cpi_mutex_t *mutex) { - int ec; - - assert(mutex != NULL); - assert(mutex->lock_count == 0); - ec = CloseHandle(mutex->os_mutex); - assert(ec); - ec = CloseHandle(mutex->os_cond_lock); - assert(ec); - ec = CloseHandle(mutex->os_cond_wake); - assert(ec); - free(mutex); -} - -static char *get_win_errormsg(DWORD error, char *buffer, size_t size) { - if (!FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS - | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - error, - 0, - buffer, - size / sizeof(char), - NULL)) { - strncpy(buffer, _("unknown error"), size); - } - buffer[size/sizeof(char) - 1] = '\0'; - return buffer; -} - -static void lock_mutex(HANDLE mutex) { - DWORD ec; - - if ((ec = WaitForSingleObject(mutex, INFINITE)) != WAIT_OBJECT_0) { - char buffer[256]; - ec = GetLastError(); - cpi_fatalf(_("Could not lock a mutex due to error %ld: %s"), - (long) ec, get_win_errormsg(ec, buffer, sizeof(buffer))); - } -} - -static void unlock_mutex(HANDLE mutex) { - if (!ReleaseMutex(mutex)) { - char buffer[256]; - DWORD ec = GetLastError(); - cpi_fatalf(_("Could not release a mutex due to error %ld: %s"), - (long) ec, get_win_errormsg(ec, buffer, sizeof(buffer))); - } -} - -static void wait_for_event(HANDLE event) { - if (WaitForSingleObject(event, INFINITE) != WAIT_OBJECT_0) { - char buffer[256]; - DWORD ec = GetLastError(); - cpi_fatalf(_("Could not wait for an event due to error %ld: %s"), - (long) ec, get_win_errormsg(ec, buffer, sizeof(buffer))); - } -} - -static void set_event(HANDLE event) { - if (!SetEvent(event)) { - char buffer[256]; - DWORD ec = GetLastError(); - cpi_fatalf(_("Could not set an event due to error %ld: %s"), - (long) ec, get_win_errormsg(ec, buffer, sizeof(buffer))); - } -} - -static void reset_event(HANDLE event) { - if (!ResetEvent(event)) { - char buffer[256]; - DWORD ec = GetLastError(); - cpi_fatalf(_("Could not reset an event due to error %ld: %s"), - (long) ec, get_win_errormsg(ec, buffer, sizeof(buffer))); - } -} - -static void lock_mutex_holding(cpi_mutex_t *mutex) { - DWORD self = GetCurrentThreadId(); - - while (mutex->lock_count != 0 - && self != mutex->os_thread) { - unlock_mutex(mutex->os_mutex); - wait_for_event(mutex->os_cond_lock); - lock_mutex(mutex->os_mutex); - } - mutex->os_thread = self; - mutex->lock_count++; -} - -CP_HIDDEN void cpi_lock_mutex(cpi_mutex_t *mutex) { - assert(mutex != NULL); - lock_mutex(mutex->os_mutex); - lock_mutex_holding(mutex); - unlock_mutex(mutex->os_mutex); -} - -CP_HIDDEN void cpi_unlock_mutex(cpi_mutex_t *mutex) { - DWORD self = GetCurrentThreadId(); - - assert(mutex != NULL); - lock_mutex(mutex->os_mutex); - if (mutex->lock_count > 0 - && self == mutex->os_thread) { - if (--mutex->lock_count == 0) { - set_event(mutex->os_cond_lock); - } - } else { - cpi_fatalf(_("Internal C-Pluff error: Unauthorized attempt at unlocking a mutex.")); - } - unlock_mutex(mutex->os_mutex); -} - -CP_HIDDEN void cpi_wait_mutex(cpi_mutex_t *mutex) { - DWORD self = GetCurrentThreadId(); - - assert(mutex != NULL); - lock_mutex(mutex->os_mutex); - if (mutex->lock_count > 0 - && self == mutex->os_thread) { - int lc = mutex->lock_count; - - // Release mutex - mutex->lock_count = 0; - mutex->num_wait_threads++; - set_event(mutex->os_cond_lock); - unlock_mutex(mutex->os_mutex); - - // Wait for signal - wait_for_event(mutex->os_cond_wake); - - // Reset wake signal if last one waking up - lock_mutex(mutex->os_mutex); - if (--mutex->num_wait_threads == 0) { - reset_event(mutex->os_cond_wake); - } - - // Re-acquire mutex and restore lock count for this thread - lock_mutex_holding(mutex); - mutex->lock_count = lc; - - } else { - cpi_fatalf(_("Internal C-Pluff error: Unauthorized attempt at waiting on a mutex.")); - } - unlock_mutex(mutex->os_mutex); -} - -CP_HIDDEN void cpi_signal_mutex(cpi_mutex_t *mutex) { - DWORD self = GetCurrentThreadId(); - - assert(mutex != NULL); - lock_mutex(mutex->os_mutex); - if (mutex->lock_count > 0 - && self == mutex->os_thread) { - set_event(mutex->os_cond_wake); - } else { - cpi_fatalf(_("Internal C-Pluff error: Unauthorized attempt at signaling a mutex.")); - } - unlock_mutex(mutex->os_mutex); -} - -#if !defined(NDEBUG) -CP_HIDDEN int cpi_is_mutex_locked(cpi_mutex_t *mutex) { - int locked; - - lock_mutex(mutex->os_mutex); - locked = (mutex->lock_count != 0); - unlock_mutex(mutex->os_mutex); - return locked; -} -#endif diff --git a/lib/cpluff/libcpluff/util.c b/lib/cpluff/libcpluff/util.c deleted file mode 100644 index e5ff7cfcfa..0000000000 --- a/lib/cpluff/libcpluff/util.c +++ /dev/null @@ -1,216 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Internal utility functions - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <limits.h> -#include <assert.h> -#include "../kazlib/list.h" -#include "cpluff.h" -#include "defines.h" -#include "util.h" - - -/* ------------------------------------------------------------------------ - * Function definitions - * ----------------------------------------------------------------------*/ - -CP_HIDDEN int cpi_comp_ptr(const void *ptr1, const void *ptr2) { - return !(ptr1 == ptr2); -} - -CP_HIDDEN hash_val_t cpi_hashfunc_ptr(const void *ptr) { - return (hash_val_t) ptr; -} - -CP_HIDDEN int cpi_ptrset_add(list_t *set, void *ptr) { - - - // Only add the pointer if it is not already included - if (cpi_ptrset_contains(set, ptr)) { - return 1; - } else { - lnode_t *node; - - /* Add the pointer to the list */ - node = lnode_create(ptr); - if (node == NULL) { - return 0; - } - list_append(set, node); - return 1; - } - -} - -CP_HIDDEN int cpi_ptrset_remove(list_t *set, const void *ptr) { - lnode_t *node; - - // Find the pointer if it is in the set - node = list_find(set, ptr, cpi_comp_ptr); - if (node != NULL) { - list_delete(set, node); - lnode_destroy(node); - return 1; - } else { - return 0; - } -} - -CP_HIDDEN int cpi_ptrset_contains(list_t *set, const void *ptr) { - return list_find(set, ptr, cpi_comp_ptr) != NULL; -} - -CP_HIDDEN void cpi_process_free_ptr(list_t *list, lnode_t *node, void *dummy) { - void *ptr = lnode_get(node); - list_delete(list, node); - lnode_destroy(node); - free(ptr); -} - -static const char *vercmp_nondigit_end(const char *v) { - while (*v != '\0' && (*v < '0' || *v > '9')) { - v++; - } - return v; -} - -static const char *vercmp_digit_end(const char *v) { - while (*v >= '0' && *v <= '9') { - v++; - } - return v; -} - -static int vercmp_char_value(char c) { - if (c == '\0') { - return 0; - } else if (c >= 'A' && c <= 'Z') { - return 1 + (c - 'A'); - } else if (c >= 'a' && c <= 'z') { - return 1 + ('Z' - 'A' + 1) + (c - 'a'); - } else { - int i = 1 + ('Z' - 'A' + 1) + ('z' - 'a' + 1) + ((int) c - CHAR_MIN); - if (c > 'z') { - i -= 'z' - 'a' + 1; - } - if (c > 'Z') { - i -= 'Z' - 'A' + 1; - } - if (c > '\0') { - i--; - } - return i; - } -} - -static int vercmp_num_value(const char *v, const char *vn) { - - // Skip leading zeros - while (v < vn && *v == '0') { - v++; - } - - // Empty string equals to zero - if (v == vn) { - return 0; - } - - // Otherwise return the integer value - else { - char str[16]; - strncpy(str, v, vn - v < 16 ? vn - v : 16); - str[vn - v < 16 ? vn - v : 15] = '\0'; - return atoi(str); - } -} - -CP_HIDDEN int cpi_vercmp(const char *v1, const char *v2) { - const char *v1n; - const char *v2n; - int diff; - - // Check for NULL versions - if (v1 == NULL && v2 != NULL) { - return -1; - } else if (v1 == NULL && v2 == NULL) { - return 0; - } else if (v1 != NULL && v2 == NULL) { - return 1; - } - assert(v1 != NULL && v2 != NULL); - - // Component comparison loop - while (*v1 != '\0' || *v2 != '\0') { - - // Determine longest non-digit prefix - v1n = vercmp_nondigit_end(v1); - v2n = vercmp_nondigit_end(v2); - - // Compare the non-digit strings - while (v1 < v1n || v2 < v2n) { - char c1 = '\0'; - char c2 = '\0'; - - if (v1 < v1n) { - c1 = *v1++; - } - if (v2 < v2n) { - c2 = *v2++; - } - diff = vercmp_char_value(c1) - vercmp_char_value(c2); - if (diff != 0) { - return diff; - } - assert(v1 <= v1n && v2 <= v2n); - } - assert(v1 == v1n && v2 == v2n); - - // Determine the longest digit prefix - v1n = vercmp_digit_end(v1); - v2n = vercmp_digit_end(v2); - - // Compare the digit strings - { - int i1 = vercmp_num_value(v1, v1n); - int i2 = vercmp_num_value(v2, v2n); - int diff = i1 - i2; - if (diff != 0) { - return diff; - } - } - v1 = v1n; - v2 = v2n; - - } - return 0; -} diff --git a/lib/cpluff/libcpluff/util.h b/lib/cpluff/libcpluff/util.h deleted file mode 100644 index 837580a4cb..0000000000 --- a/lib/cpluff/libcpluff/util.h +++ /dev/null @@ -1,131 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Declarations for internal utility functions - */ - -#ifndef UTIL_H_ -#define UTIL_H_ - -#include "../kazlib/list.h" -#include "../kazlib/hash.h" -#include "cpluff.h" -#include "defines.h" - -#ifdef __cplusplus -extern "C" { -#endif //__cplusplus - - -/* ------------------------------------------------------------------------ - * Function declarations - * ----------------------------------------------------------------------*/ - -// For operating on smallish pointer sets implemented as lists - -/** - * Compares pointers. - * - * @param ptr1 the first pointer - * @param ptr2 the second pointer - * @return zero if the pointers are equal, otherwise non-zero - */ -CP_HIDDEN int cpi_comp_ptr(const void *ptr1, const void *ptr2) CP_GCC_CONST; - -/** - * Returns a hash value for a pointer. - * - * @param ptr the pointer being hashed - * @return the corresponding hash value - */ -CP_HIDDEN hash_val_t cpi_hashfunc_ptr(const void *ptr) CP_GCC_CONST; - -/** - * Adds a new pointer to a list if the pointer is not yet included. - * - * @param set the set being operated on - * @param ptr the pointer being added - * @return non-zero if the operation was successful, zero if allocation failed - */ -CP_HIDDEN int cpi_ptrset_add(list_t *set, void *ptr); - -/** - * Removes a pointer from a pointer set, if it is included. - * - * @param set the set being operated on - * @param ptr the pointer being removed - * @return whether the pointer was contained in the set - */ -CP_HIDDEN int cpi_ptrset_remove(list_t *set, const void *ptr); - -/** - * Returns whether a pointer is included in a pointer set. - * - * @param set the set being operated on - * @param ptr the pointer - * @return non-zero if the pointer is included, zero otherwise - */ -CP_HIDDEN int cpi_ptrset_contains(list_t *set, const void *ptr) CP_GCC_PURE; - - -// Other list processing utility functions - -/** - * Processes a node of the list by freeing the associated pointer and - * deleting and destroying the node. - * - * @param list the list being processed - * @param node the list node being processed - * @param dummy a dummy argument to comply with prototype - */ -CP_HIDDEN void cpi_process_free_ptr(list_t *list, lnode_t *node, void *dummy); - - -// Version strings - -/** - * Compares two version strings. The comparison algorithm is derived from the - * way Debian package management system compares package versions. First the - * the longest prefix of each string composed entirely of non-digit characters - * is determined. These are compared lexically so that all the letters sort - * earlier than all the non-letters and otherwise the ordering is based on - * ASCII values. If there is a difference it is returned. Otherwise the longest - * prefix of remainder of each string composed entirely of digit characters - * is determined. These are compared numerically with empty string interpreted - * as zero. Again, if there is different it is returned. Otherwise the - * comparison continues with a non-digit component and so on. A NULL version - * is earlier than any non-NULL version. Two NULL versions are equal. - * - * @param v1 the first version string to compare or NULL - * @param v2 the second version string to compare or NULL - * @return less than, equal to or greater than zero when @a v1 < @a v2, @a v1 == @a v2 or @a v1 > @a v2, correspondingly - */ -CP_HIDDEN int cpi_vercmp(const char *v1, const char *v2) CP_GCC_PURE; - - -#ifdef __cplusplus -} -#endif //__cplusplus - -#endif //UTIL_H_ diff --git a/lib/cpluff/libcpluff/win32/cpluffdef.h b/lib/cpluff/libcpluff/win32/cpluffdef.h deleted file mode 100644 index 7e3d55f269..0000000000 --- a/lib/cpluff/libcpluff/win32/cpluffdef.h +++ /dev/null @@ -1,216 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -/** @file - * Common defines shared by C-Pluff C and C++ APIs. - * This file is automatically included by the top level C and C++ - * API header files. There should be no need to include it explicitly. - */ - -#ifndef CPLUFFDEF_H_ -#define CPLUFFDEF_H_ - - -/* ------------------------------------------------------------------------ - * Version information - * ----------------------------------------------------------------------*/ - -/** - * @defgroup versionInfo Version information - * @ingroup cDefines cxxDefines - * - * C-Pluff version information. Notice that this version information - * is static version information included in header files. The - * macros introduced here can be used for compile time checks. - */ -/*@{*/ - -/** - * The C-Pluff release version string. This string identifies a specific - * version of the C-Pluff distribution. Compile time software compatibility - * checks should use #CP_VERSION_MAJOR and #CP_VERSION_MINOR instead. - */ -#define CP_VERSION "0.1.4" - -/** - * The major version number component of the release version. This is an - * integer. - */ -#define CP_VERSION_MAJOR 0 - -/** - * The minor version number component of the release version. This is an - * integer. - */ -#define CP_VERSION_MINOR 1 - -/*@}*/ - - -/* ------------------------------------------------------------------------ - * Symbol visibility - * ----------------------------------------------------------------------*/ - -/** - * @defgroup symbolVisibility Symbol visibility - * @ingroup cDefines cxxDefines - * - * Macros for controlling inter-module symbol visibility and linkage. These - * macros have platform specific values. #CP_EXPORT, #CP_IMPORT and #CP_HIDDEN - * can be reused by plug-in implementations for better portability. The - * complexity is mostly due to Windows DLL exports and imports. - * - * @anchor symbolVisibilityExample - * Each module should usually define its own macro to declare API symbols with - * #CP_EXPORT and #CP_IMPORT as necessary. For example, a mobule could define - * a macro @c MY_API in the API header file as follows. - * - * @code - * #ifndef MY_API - * # define MY_API CP_IMPORT - * #endif - * @endcode - * - * By default the API symbols would then be marked for import which is correct - * when client modules are including the API header file. When compiling the - * module itself the option @c -DMY_API=CP_EXPORT would be passed to the compiler to - * override the API header file and to mark the API symbols for export. - * The overriding definition could also be included in module source files or - * in an internal header file before including the API header file. - */ -/*@{*/ - -/** - * @def CP_EXPORT - * - * Declares a symbol to be exported for inter-module usage. When compiling the - * module which defines the symbol this macro should be placed - * at the start of the symbol declaration to ensure that the symbol is exported - * to other modules. However, when compiling other modules the declaration of - * the symbol should start with #CP_IMPORT. - * See @ref symbolVisibilityExample "the example" of how to do this. - */ - -/** - * @def CP_IMPORT - * - * Declares a symbol to be imported from another module. When compiling a - * module which uses the symbol this macro should be placed at the start of - * the symbol declaration to ensure that the symbol is imported from the - * defining module. However, when compiling the defining module the declaration - * of the symbol should start with #CP_EXPORT. - * See @ref symbolVisibilityExample "the example" of how to do this. - */ - -/** - * @def CP_HIDDEN - * - * Declares a symbol hidden from other modules. This macro should be - * placed at the start of the symbol declaration to hide the symbol from other - * modules (if supported by the platform). This macro is not intended to be - * used with symbols declared as "static" which are already internal to the - * object file. Some platforms do not support hiding of symbols and therefore - * unique prefixes should be used for global symbols internal to the module - * even when they are declared using this macro. - */ - -#if defined(_WIN32) -# define CP_EXPORT __declspec(dllexport) -#if defined(_WINDLL) -# define CP_IMPORT extern __declspec(dllimport) -#else -# define CP_IMPORT -#endif -# define CP_HIDDEN -#elif defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) -# define CP_EXPORT -# define CP_IMPORT extern -# define CP_HIDDEN __attribute__ ((visibility ("hidden"))) -#else -# define CP_EXPORT -# define CP_IMPORT extern -# define CP_HIDDEN -#endif - -/*@}*/ - - -/* ------------------------------------------------------------------------ - * GCC attributes - * ----------------------------------------------------------------------*/ - -/** - * @defgroup cDefinesGCCAttributes GCC attributes - * @ingroup cDefines cxxDefines - * - * These macros conditionally define GCC attributes for declarations. - * They are used in C-Pluff API declarations to enable better optimization - * and error checking when using GCC. In non-GCC platforms they have - * empty values. - */ -/*@{*/ - -/** - * @def CP_GCC_PURE - * - * Declares a function as pure function having no side effects. - * This attribute is supported in GCC since version 2.96. - * Such functions can be subject to common subexpression elimination - * and loop optimization. - */ - -/** - * @def CP_GCC_NONNULL - * - * Specifies that some pointer arguments to a function should have - * non-NULL values. Takes a variable length list of argument indexes as - * arguments. This attribute is supported in GCC since version 3.3. - * It can be used for enhanced error checking and some optimizations. - */ - -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -#define CP_GCC_PURE __attribute__((pure)) -#else -#define CP_GCC_PURE -#endif -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) -#define CP_GCC_NONNULL(...) __attribute__((nonnull (__VA_ARGS__))) -#else -#define CP_GCC_NONNULL(...) -#endif - -/*@}*/ - -#ifdef _WIN32 -#ifndef __func__ -# define __func__ __FUNCTION__ -#endif -#ifndef snprintf -#define snprintf _snprintf -#endif -#define CP_HOST "win32" -#define CP_SHREXT ".dll" -#define CP_FNAMESEP_CHAR '\\' // If we switch back to special:// paths then this can be '/' instead -#define CP_THREADS -#endif -#endif /*CPLUFFDEF_H_*/ diff --git a/lib/cpluff/libcpluff/win32/dirent.c b/lib/cpluff/libcpluff/win32/dirent.c deleted file mode 100644 index ead41848f9..0000000000 --- a/lib/cpluff/libcpluff/win32/dirent.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - - Implementation of POSIX directory browsing functions and types for Win32. - - Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com) - History: Created March 1997. Updated June 2003. - Rights: See end of file. - -*/ - -#include "dirent.h" -#include "win32_utils.h" -#include <errno.h> -#include <io.h> /* _findfirst and _findnext set errno iff they return -1 */ -#include <stdlib.h> -#include <string.h> - -#ifdef __cplusplus -extern "C" -{ -#endif - -struct DIR -{ - HANDLE handle; /* -1 for failed rewind */ - struct dirent result; /* d_name null iff first time */ - wchar_t* name; - WIN32_FIND_DATAW info; -}; - -DIR *opendir(const char *name) -{ - DIR *dir = 0; - - if(name && name[0]) - { - if ((dir = (DIR *)malloc(sizeof *dir)) != 0) - { - dir->handle = INVALID_HANDLE_VALUE; - int len = strlen(name); - size_t newLength = len + 2; //add an extra for null and another for a * at the end - if (!(name[0] == '\\' && name[1] == '\\' && name[2] == '?' && name[3] == '\\')) - newLength += 4; - if (name[len - 1] != '\\') - newLength += 1; - - char* newDir = (char*)malloc(newLength); - strcpy_s(newDir, newLength, "\\\\?\\"); - strcat_s(newDir, newLength, name); - if (name[len - 1] != '\\') - strcat_s(newDir, newLength, "\\"); - strcat_s(newDir, newLength, "*"); - newDir[newLength - 1] = '\0'; - - dir->name = to_utf16(newDir, newLength); - free(newDir); - - dir->handle = FindFirstFileW(dir->name, &dir->info); - if (dir->handle != INVALID_HANDLE_VALUE) - { - dir->result.d_name = 0; - } - else /* rollback */ - { - free(dir->name); - free(dir); - dir = 0; - } - } - else /* rollback */ - { - free(dir->name); - free(dir); - dir = 0; - errno = ENOMEM; - } - } - else - { - errno = EINVAL; - } - - return dir; -} - -int closedir(DIR *dir) -{ - int result = -1; - - if(dir && dir->handle != INVALID_HANDLE_VALUE) - { - FindClose(dir->handle); - - free(dir->name); - free(dir); - } - - if(result == -1) /* map all errors to EBADF */ - { - errno = EBADF; - } - - return result; -} - -struct dirent *readdir(DIR *dir) -{ - struct dirent *result = 0; - - if(dir && dir->handle != INVALID_HANDLE_VALUE) - { - if (FindNextFileW(dir->handle, &dir->info)) - { - result = &dir->result; - result->d_name = to_utf8(dir->info.cFileName, 0); - } - } - else - { - errno = EBADF; - } - - return result; -} - -// helper for scandir below -static void scandir_free_dir_entries(struct dirent*** namelist, int entries) { - int i; - if (!*namelist) return; - for (i = 0; i < entries; ++i) { - free((*namelist)[i]); - } - free(*namelist); - *namelist = 0; -} - -// returns the number of directory entries select or -1 if an error occurs -int scandir( - const char* dir, - struct dirent*** namelist, - int(*filter)(const struct dirent*), - int(*compar)(const void*, const void*) -) { - int entries = 0; - int max_entries = 1024; // assume 2*512 = 1024 entries (used for allocation) - DIR* d; - - *namelist = 0; - - // open directory - d = opendir(dir); - if (!d) return -1; - - // iterate - while (1) { - struct dirent* ent = readdir(d); - if (!ent) break; - - // add if no filter or filter returns non-zero - if (filter && (0 == filter(ent))) continue; - - // resize our buffer if there is not enough room - if (!*namelist || entries >= max_entries) { - struct dirent** new_entries; - - max_entries *= 2; - new_entries = (struct dirent **)realloc(*namelist, max_entries); - if (!new_entries) { - scandir_free_dir_entries(namelist, entries); - closedir(d); - errno = ENOMEM; - return -1; - } - - *namelist = new_entries; - } - - // allocate new entry - (*namelist)[entries] = (struct dirent *)malloc(sizeof(struct dirent) + strlen(ent->d_name) + 1); - if (!(*namelist)[entries]) { - scandir_free_dir_entries(namelist, entries); - closedir(d); - errno = ENOMEM; - return -1; - } - - // copy entry info - *(*namelist)[entries] = *ent; - - // and then we tack the string onto the end - { - char* dest = (char*)((*namelist)[entries]) + sizeof(struct dirent); - strcpy(dest, ent->d_name); - (*namelist)[entries]->d_name = dest; - } - - ++entries; - } - - closedir(d); - - // sort - if (*namelist && compar) qsort(*namelist, entries, sizeof((*namelist)[0]), compar); - - return entries; -} - -int alphasort(const void* lhs, const void* rhs) { - const struct dirent* lhs_ent = *(struct dirent**)lhs; - const struct dirent* rhs_ent = *(struct dirent**)rhs; - return _strcmpi(lhs_ent->d_name, rhs_ent->d_name); -} - -#ifdef __cplusplus -} -#endif - -/* - - Copyright Kevlin Henney, 1997, 2003. All rights reserved. - - Permission to use, copy, modify, and distribute this software and its - documentation for any purpose is hereby granted without fee, provided - that this copyright and permissions notice appear in all copies and - derivatives. - - This software is supplied "as is" without express or implied warranty. - - But that said, if there are any problems please get in touch. - -*/ diff --git a/lib/cpluff/libcpluff/win32/dirent.h b/lib/cpluff/libcpluff/win32/dirent.h deleted file mode 100644 index c250bfdb28..0000000000 --- a/lib/cpluff/libcpluff/win32/dirent.h +++ /dev/null @@ -1,57 +0,0 @@ - -#ifndef DIRENT_INCLUDED -#define DIRENT_INCLUDED - -/* - - Declaration of POSIX directory browsing functions and types for Win32. - - Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com) - History: Created March 1997. Updated June 2003. - Rights: See end of file. - -*/ - -#ifdef __cplusplus -extern "C" -{ -#endif - -typedef struct DIR DIR; - -struct dirent -{ - char *d_name; -}; - -DIR *opendir(const char *); -int closedir(DIR *); -struct dirent *readdir(DIR *); -void rewinddir(DIR *); -int scandir( - const char* dir, - struct dirent*** namelist, - int(*filter)(const struct dirent*), - int(*compar)(const void*, const void*) ); -int alphasort(const void* lhs, const void* rhs); - -/* - - Copyright Kevlin Henney, 1997, 2003. All rights reserved. - - Permission to use, copy, modify, and distribute this software and its - documentation for any purpose is hereby granted without fee, provided - that this copyright and permissions notice appear in all copies and - derivatives. - - This software is supplied "as is" without express or implied warranty. - - But that said, if there are any problems please get in touch. - -*/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/lib/cpluff/libcpluff/win32/win32_utils.c b/lib/cpluff/libcpluff/win32/win32_utils.c deleted file mode 100644 index 52cf353c13..0000000000 --- a/lib/cpluff/libcpluff/win32/win32_utils.c +++ /dev/null @@ -1,73 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2016 Team Kodi - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#include <stdlib.h> - -#include "win32_utils.h" - -wchar_t* to_utf16(const char* str, size_t length) -{ - if (length == 0) - length = strlen(str); - int result = MultiByteToWideChar(CP_UTF8, 0, str, length, NULL, 0); - if (result == 0) - { - return NULL; - } - - int newLen = result + 1; - wchar_t* dirPath = malloc(newLen * 2); - result = MultiByteToWideChar(CP_UTF8, 0, str, length, dirPath, newLen); - - if (result == 0) - { - free(dirPath); - return NULL; - } - - dirPath[newLen - 1] = L'\0'; - return dirPath; -} - -char* to_utf8(const wchar_t* str, size_t length) -{ - if (length == 0) - length = wcslen(str); - - int result = WideCharToMultiByte(CP_UTF8, 0, str, length, NULL, 0, NULL, NULL); - if (result == 0) - return NULL; - - int newLen = result + 1; - char *newStr = malloc(newLen); - result = WideCharToMultiByte(CP_UTF8, 0, str, length, newStr, result, NULL, NULL); - if (result == 0) - { - free(newStr); - return NULL; - } - - newStr[newLen - 1] = '\0'; - - return newStr; -} diff --git a/lib/cpluff/libcpluff/win32/win32_utils.h b/lib/cpluff/libcpluff/win32/win32_utils.h deleted file mode 100644 index f4074f3745..0000000000 --- a/lib/cpluff/libcpluff/win32/win32_utils.h +++ /dev/null @@ -1,30 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2016 Team Kodi - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#if !defined(WIN32_LEAN_AND_MEAN) - #define WIN32_LEAN_AND_MEAN -#endif -#include <windows.h> - -wchar_t* to_utf16(const char* str, size_t length); -char* to_utf8(const wchar_t* str, size_t length); diff --git a/lib/cpluff/loader/Makefile.am b/lib/cpluff/loader/Makefile.am deleted file mode 100644 index 6cf899546f..0000000000 --- a/lib/cpluff/loader/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -LIBS = @LIBS_OTHER@ @LTLIBINTL@ @LIBS@ - -bin_PROGRAMS = cpluff-loader - -cpluff_loader_SOURCES = loader.c diff --git a/lib/cpluff/loader/loader.c b/lib/cpluff/loader/loader.c deleted file mode 100644 index c2e1175970..0000000000 --- a/lib/cpluff/loader/loader.c +++ /dev/null @@ -1,416 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <unistd.h> -#ifdef HAVE_GETTEXT -#include <libintl.h> -#include <locale.h> -#endif -#include <cpluff.h> - - -/* ----------------------------------------------------------------------- - * Defines - * ---------------------------------------------------------------------*/ - -// Gettext defines -#ifdef HAVE_GETTEXT -#define _(String) gettext(String) -#define gettext_noop(String) String -#define N_(String) gettext_noop(String) -#else -#define _(String) (String) -#define N_(String) String -#define textdomain(Domain) -#define bindtextdomain(Package, Directory) -#endif - -// GNU C attribute defines -#ifndef CP_GCC_NORETURN -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5) -#define CP_GCC_NORETURN __attribute__((noreturn)) -#else -#define CP_GCC_NORETURN -#endif -#endif - -// Initializer for empty list -#define STR_LIST_INITIALIZER { NULL, NULL } - - -/* ----------------------------------------------------------------------- - * Data types - * ---------------------------------------------------------------------*/ - -/// A type for str_list_t structure -typedef struct str_list_t str_list_t; - -/// A type for str_list_entry_t structure -typedef struct str_list_entry_t str_list_entry_t; - -/// A string list container -struct str_list_t { - - /// The first entry or NULL if empty - str_list_entry_t *first; - - /// The last entry or NULL if empty - str_list_entry_t *last; - -}; - -/// A holder for a string list entry -struct str_list_entry_t { - - /// The string - const char *str; - - /// Next entry - str_list_entry_t *next; -}; - - -/* ----------------------------------------------------------------------- - * Variables - * ---------------------------------------------------------------------*/ - -/// The level of verbosity -static int verbosity = 1; - - -/* ----------------------------------------------------------------------- - * Functions - * ---------------------------------------------------------------------*/ - -/** - * Prints an error message and exits. In quiet mode the error message is - * not printed. - * - * @param msg the error message - */ -CP_GCC_NORETURN static void error(const char *msg) { - if (verbosity >= 1) { - /* TRANSLATORS: A formatting string for loader error messages. */ - fprintf(stderr, _("C-Pluff Loader: ERROR: %s\n"), msg); - } - exit(1); -} - -/** - * Formats and prints an error message and exits. In quiet mode the error - * message is not printed. - * - * @param msg the error message - */ -CP_GCC_NORETURN static void errorf(const char *msg, ...) { - char buffer[256]; - va_list va; - - va_start(va, msg); - vsnprintf(buffer, sizeof(buffer), _(msg), va); - va_end(va); - strcpy(buffer + sizeof(buffer)/sizeof(char) - 4, "..."); - error(buffer); -} - -/** - * Allocates memory using malloc and checks for failures. - * - * @param size the amount of memory to allocate - * @return the allocated memory (always non-NULL) - */ -static void *chk_malloc(size_t size) { - void *ptr = malloc(size); - if (ptr == NULL) { - error(_("Memory allocation failed.")); - } else { - return ptr; - } -} - -/** - * Appends a new string to a string list. Copies strings by pointers. - */ -static void str_list_append(str_list_t *list, const char *str) { - str_list_entry_t *entry = chk_malloc(sizeof(str_list_entry_t)); - entry->str = str; - entry->next = NULL; - if (list->last != NULL) { - list->last->next = entry; - } - if (list->first == NULL) { - list->first = entry; - } - list->last = entry; -} - -/** - * Removes all entries from a string list. Does not free contained strings. - */ -static void str_list_clear(str_list_t *list) { - str_list_entry_t *entry = list->first; - while (entry != NULL) { - str_list_entry_t *n = entry->next; - free(entry); - entry = n; - } - list->first = NULL; - list->last = NULL; -} - -/** - * Prints the help text. - */ -static void print_help(void) { - printf(_("C-Pluff Loader, version %s\n"), PACKAGE_VERSION); - putchar('\n'); - fputs(_("usage: cpluff-loader <option>... [--] <arguments passed to plug-ins>\n" - "options:\n" - " -h print this help text\n" - " -c DIR add plug-in collection in directory DIR\n" - " -p DIR add plug-in in directory DIR\n" - " -s PID start plug-in PID\n" - " -v be more verbose (repeat for increased verbosity)\n" - " -q be quiet\n" - " -V print C-Pluff version number and exit\n" - ), stdout); -} - -static void logger(cp_log_severity_t severity, const char *msg, const char *apid, void *dummy) { - const char *level; - int minv; - switch (severity) { - case CP_LOG_DEBUG: - /* TRANSLATORS: A tag for debug level log entries. */ - level = _("DEBUG"); - minv = 4; - break; - case CP_LOG_INFO: - /* TRANSLATORS: A tag for info level log entries. */ - level = _("INFO"); - minv = 3; - break; - case CP_LOG_WARNING: - /* TRANSLATORS: A tag for warning level log entries. */ - level = _("WARNING"); - minv = 2; - break; - case CP_LOG_ERROR: - /* TRANSLATORS: A tag for error level log entries. */ - level = _("ERROR"); - minv = 1; - break; - default: - /* TRANSLATORS: A tag for unknown severity level. */ - level = _("UNKNOWN"); - minv = 1; - break; - } - if (verbosity >= minv) { - if (apid != NULL) { - /* TRANSLATORS: A formatting string for log messages caused by plug-in activity. */ - fprintf(stderr, _("C-Pluff: %s: [%s] %s\n"), level, apid, msg); - } else { - /* TRANSLATORS: A formatting string for log messages caused by loader activity. */ - fprintf(stderr, _("C-Pluff: %s: [loader] %s\n"), level, msg); - } - } -} - -/// The main function -int main(int argc, char *argv[]) { - int i; - str_list_t lst_plugin_collections = STR_LIST_INITIALIZER; - str_list_t lst_plugin_dirs = STR_LIST_INITIALIZER; - str_list_t lst_start = STR_LIST_INITIALIZER; - cp_context_t *context; - char **ctx_argv; - str_list_entry_t *entry; - - // Set locale -#ifdef HAVE_GETTEXT - setlocale(LC_ALL, ""); -#endif - - // Initialize the framework - if (cp_init() != CP_OK) { - error(_("The C-Pluff initialization failed.")); - } - - // Set gettext domain -#ifdef HAVE_GETTEXT - textdomain(PACKAGE); -#endif - - // Parse arguments - while ((i = getopt(argc, argv, "hc:p:s:vqV")) != -1) { - switch (i) { - - // Display help and exit - case 'h': - print_help(); - exit(0); - - // Add a plug-in collection - case 'c': - str_list_append(&lst_plugin_collections, optarg); - break; - - // Add a single plug-in - case 'p': - str_list_append(&lst_plugin_dirs, optarg); - break; - - // Add a plug-in to be started - case 's': - str_list_append(&lst_start, optarg); - break; - - // Be more verbose - case 'v': - if (verbosity < 1) { - error(_("Quiet and verbose modes are mutually exclusive.")); - } - verbosity++; - break; - - // Quiet mode - case 'q': - if (verbosity > 1) { - error(_("Quiet and verbose modes are mutually exclusive.")); - } - verbosity--; - break; - - // Display release version and exit - case 'V': - fputs(cp_get_version(), stdout); - putchar('\n'); - exit(0); - - // Unrecognized option - default: - error(_("Unrecognized option or argument. Try option -h for help.")); - } - } - - // Display startup information - if (verbosity >= 1) { - - /* TRANSLATORS: This is a version string displayed on startup. */ - fprintf(stderr, _("C-Pluff Loader, version %s\n"), PACKAGE_VERSION); - - /* TRANSLATORS: This is a version string displayed on startup. - The first %s is version and the second %s is platform type. */ - fprintf(stderr, _("C-Pluff Library, version %s for %s\n"), - cp_get_version(), cp_get_host_type()); - } - - // Check arguments - if (lst_plugin_dirs.first == NULL && lst_plugin_collections.first == NULL) { - error(_("No plug-ins to load. Try option -h for help.")); - } - - // Create the context - if ((context = cp_create_context(NULL)) == NULL) { - error(_("Plug-in context creation failed.")); - } - - // Register logger - if (verbosity >= 1) { - cp_log_severity_t mv = CP_LOG_DEBUG; - switch (verbosity) { - case 1: - mv = CP_LOG_ERROR; - break; - case 2: - mv = CP_LOG_WARNING; - break; - case 3: - mv = CP_LOG_INFO; - break; - } - cp_register_logger(context, logger, NULL, mv); - } - - // Set context arguments - ctx_argv = chk_malloc((argc - optind + 2) * sizeof(char *)); - ctx_argv[0] = ""; - for (i = optind; i < argc; i++) { - ctx_argv[i - optind + 1] = argv[i]; - } - ctx_argv[argc - optind + 1] = NULL; - cp_set_context_args(context, ctx_argv); - - // Load individual plug-ins - for (entry = lst_plugin_dirs.first; entry != NULL; entry = entry->next) { - cp_plugin_info_t *pi = cp_load_plugin_descriptor(context, entry->str, NULL); - if (pi == NULL) { - errorf(_("Failed to load a plug-in from path %s."), entry->str); - } - if (cp_install_plugin(context, pi) != CP_OK) { - errorf(_("Failed to install plug-in %s."), pi->identifier); - } - cp_release_info(context, pi); - } - str_list_clear(&lst_plugin_dirs); - - // Load plug-in collections - for (entry = lst_plugin_collections.first; entry != NULL; entry = entry->next) { - if (cp_register_pcollection(context, entry->str) != CP_OK) { - errorf(_("Failed to register a plug-in collection at path %s."), entry->str); - } - } - if (lst_plugin_collections.first != NULL - && cp_scan_plugins(context, 0) != CP_OK) { - error(_("Failed to load and install plug-ins from plug-in collections.")); - } - str_list_clear(&lst_plugin_collections); - - // Start plug-ins - for (entry = lst_start.first; entry != NULL; entry = entry->next) { - if (cp_start_plugin(context, entry->str) != CP_OK) { - errorf(_("Failed to start plug-in %s."), entry->str); - } - } - str_list_clear(&lst_start); - - // Run plug-ins - cp_run_plugins(context); - - // Destroy framework - cp_destroy(); - - // Release context argument data - free(ctx_argv); - - // Return from the main program - return 0; -} diff --git a/lib/cpluff/patches/0001-all-Change-plugin-to-addon-tags.patch b/lib/cpluff/patches/0001-all-Change-plugin-to-addon-tags.patch deleted file mode 100644 index b45630e66f..0000000000 --- a/lib/cpluff/patches/0001-all-Change-plugin-to-addon-tags.patch +++ /dev/null @@ -1,61 +0,0 @@ -From ae1cfb84339c8247ac1705fa7f5e8556c6157314 Mon Sep 17 00:00:00 2001 -From: "h.udo" <hudokkow@gmail.com> -Date: Thu, 20 Oct 2016 13:59:00 +0100 -Subject: [PATCH 01/12] [all] Change plugin to addon tags - ---- - libcpluff/ploader.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/libcpluff/ploader.c b/libcpluff/ploader.c -index cea541f..c4e251b 100644 ---- a/libcpluff/ploader.c -+++ b/libcpluff/ploader.c -@@ -61,7 +61,7 @@ - #define CP_CFG_ELEMENT_VALUE_INITSIZE 64 - - /// Plugin descriptor name --#define CP_PLUGIN_DESCRIPTOR "plugin.xml" -+#define CP_PLUGIN_DESCRIPTOR "addon.xml" - - - /* ------------------------------------------------------------------------ -@@ -524,7 +524,7 @@ static void CP_XMLCALL start_element_handler( - static const XML_Char * const opt_bwcompatibility_atts[] = { "abi", "api", NULL }; - static const XML_Char * const req_cpluff_atts[] = { "version", NULL }; - static const XML_Char * const opt_cpluff_atts[] = { NULL }; -- static const XML_Char * const req_import_atts[] = { "plugin", NULL }; -+ static const XML_Char * const req_import_atts[] = { "addon", NULL }; - static const XML_Char * const opt_import_atts[] = { "version", "optional", NULL }; - static const XML_Char * const req_runtime_atts[] = { "library", NULL }; - static const XML_Char * const opt_runtime_atts[] = { "funcs", NULL }; -@@ -539,7 +539,7 @@ static void CP_XMLCALL start_element_handler( - switch (plcontext->state) { - - case PARSER_BEGIN: -- if (!strcmp(name, "plugin")) { -+ if (!strcmp(name, "addon")) { - plcontext->state = PARSER_PLUGIN; - if (!check_attributes(plcontext, name, atts, - req_plugin_atts, opt_plugin_atts)) { -@@ -749,7 +749,7 @@ static void CP_XMLCALL start_element_handler( - import->plugin_id = NULL; - import->version = NULL; - for (i = 0; atts[i] != NULL; i += 2) { -- if (!strcmp(atts[i], "plugin")) { -+ if (!strcmp(atts[i], "addon")) { - import->plugin_id - = parser_strdup(plcontext, atts[i+1]); - } else if (!strcmp(atts[i], "version")) { -@@ -832,7 +832,7 @@ static void CP_XMLCALL end_element_handler( - switch (plcontext->state) { - - case PARSER_PLUGIN: -- if (!strcmp(name, "plugin")) { -+ if (!strcmp(name, "addon")) { - - // Readjust memory allocated for extension points, if necessary - if (plcontext->ext_points_size != plcontext->plugin->num_ext_points) { --- -2.14.1 - diff --git a/lib/cpluff/patches/0002-osx-Fix-include.patch b/lib/cpluff/patches/0002-osx-Fix-include.patch deleted file mode 100644 index 291aa8b08b..0000000000 --- a/lib/cpluff/patches/0002-osx-Fix-include.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 838c4364ee95eae2ef565406b89a8e62bbe969f1 Mon Sep 17 00:00:00 2001 -From: "h.udo" <hudokkow@gmail.com> -Date: Thu, 20 Oct 2016 14:03:00 +0100 -Subject: [PATCH 02/12] [osx] Fix include - ---- - libcpluff/cpluff.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libcpluff/cpluff.h b/libcpluff/cpluff.h -index 6b238bc..a798ee4 100644 ---- a/libcpluff/cpluff.h -+++ b/libcpluff/cpluff.h -@@ -38,7 +38,7 @@ - * Preprocessor defines. - */ - --#include <cpluffdef.h> -+#include "cpluffdef.h" - - #ifdef __cplusplus - extern "C" { --- -2.14.1 - diff --git a/lib/cpluff/patches/0003-win32-Fix-compile.-Missing-cpluff.dll-will-crash-Kod.patch b/lib/cpluff/patches/0003-win32-Fix-compile.-Missing-cpluff.dll-will-crash-Kod.patch deleted file mode 100644 index 88fc300f72..0000000000 --- a/lib/cpluff/patches/0003-win32-Fix-compile.-Missing-cpluff.dll-will-crash-Kod.patch +++ /dev/null @@ -1,644 +0,0 @@ -From e3c3cf0fa229c3568f6c06cd4b507b60cc1629be Mon Sep 17 00:00:00 2001 -From: "h.udo" <hudokkow@gmail.com> -Date: Thu, 20 Oct 2016 14:14:50 +0100 -Subject: [PATCH 03/12] [win32] Fix compile. Missing cpluff.dll will crash Kodi - ---- - kazlib/hash.h | 4 + - kazlib/list.h | 4 + - libcpluff/cpluff.h | 6 +- - libcpluff/internal.h | 8 +- - libcpluff/pcontrol.c | 3 + - libcpluff/psymbol.c | 3 + - libcpluff/win32/cpluffdef.h | 212 ++++++++++++++++++++++++++++++++++++++++ - libcpluff/win32/dirent.c | 233 ++++++++++++++++++++++++++++++++++++++++++++ - libcpluff/win32/dirent.h | 61 ++++++++++++ - 9 files changed, 532 insertions(+), 2 deletions(-) - create mode 100644 libcpluff/win32/cpluffdef.h - create mode 100644 libcpluff/win32/dirent.c - create mode 100644 libcpluff/win32/dirent.h - -diff --git a/kazlib/hash.h b/kazlib/hash.h -index 1fbd246..50297ee 100644 ---- a/kazlib/hash.h -+++ b/kazlib/hash.h -@@ -27,7 +27,11 @@ - #ifndef HASH_H - #define HASH_H - -+#ifdef _WIN32 -+#include "../libcpluff/win32/cpluffdef.h" -+#else - #include "../libcpluff/cpluffdef.h" -+#endif - - #include <limits.h> - #ifdef KAZLIB_SIDEEFFECT_DEBUG -diff --git a/kazlib/list.h b/kazlib/list.h -index c449acb..ccad262 100644 ---- a/kazlib/list.h -+++ b/kazlib/list.h -@@ -27,7 +27,11 @@ - #ifndef LIST_H - #define LIST_H - -+#ifdef _WIN32 -+#include "../libcpluff/win32/cpluffdef.h" -+#else - #include "../libcpluff/cpluffdef.h" -+#endif - - #include <limits.h> - -diff --git a/libcpluff/cpluff.h b/libcpluff/cpluff.h -index a798ee4..d497af3 100644 ---- a/libcpluff/cpluff.h -+++ b/libcpluff/cpluff.h -@@ -37,8 +37,12 @@ - * @defgroup cDefines Defines - * Preprocessor defines. - */ -- -+ -+#ifdef _WIN32 -+#include "win32/cpluffdef.h" -+#else - #include "cpluffdef.h" -+#endif - - #ifdef __cplusplus - extern "C" { -diff --git a/libcpluff/internal.h b/libcpluff/internal.h -index 91989e8..161ba6d 100644 ---- a/libcpluff/internal.h -+++ b/libcpluff/internal.h -@@ -83,7 +83,13 @@ extern "C" { - * Macros - * ----------------------------------------------------------------------*/ - --#if defined(DLOPEN_POSIX) -+#if defined(_WIN32) -+#define DLHANDLE void * -+#define DLOPEN(name) LoadLibraryA(name) -+#define DLSYM(handle, symbol) GetProcAddress(handle, symbol) -+#define DLCLOSE(handle) CloseHandle(handle) -+#define DLERROR() "WIN32 - TODO" -+#elif defined(DLOPEN_POSIX) - #define DLHANDLE void * - #define DLOPEN(name) dlopen((name), RTLD_LAZY | RTLD_GLOBAL) - #define DLSYM(handle, symbol) dlsym((handle), (symbol)) -diff --git a/libcpluff/pcontrol.c b/libcpluff/pcontrol.c -index 78a425e..130a3a2 100644 ---- a/libcpluff/pcontrol.c -+++ b/libcpluff/pcontrol.c -@@ -40,6 +40,9 @@ - #include "defines.h" - #include "util.h" - #include "internal.h" -+#ifdef _WIN32 -+#include <windows.h> -+#endif - - - /* ------------------------------------------------------------------------ -diff --git a/libcpluff/psymbol.c b/libcpluff/psymbol.c -index 93c9f12..988d903 100644 ---- a/libcpluff/psymbol.c -+++ b/libcpluff/psymbol.c -@@ -37,6 +37,9 @@ - #include "defines.h" - #include "internal.h" - #include "util.h" -+#ifdef _WIN32 -+#include <windows.h> -+#endif - - - /* ------------------------------------------------------------------------ -diff --git a/libcpluff/win32/cpluffdef.h b/libcpluff/win32/cpluffdef.h -new file mode 100644 -index 0000000..891e95a ---- /dev/null -+++ b/libcpluff/win32/cpluffdef.h -@@ -0,0 +1,212 @@ -+/*------------------------------------------------------------------------- -+ * C-Pluff, a plug-in framework for C -+ * Copyright 2007 Johannes Lehtinen -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be included -+ * in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ *-----------------------------------------------------------------------*/ -+ -+/** @file -+ * Common defines shared by C-Pluff C and C++ APIs. -+ * This file is automatically included by the top level C and C++ -+ * API header files. There should be no need to include it explicitly. -+ */ -+ -+#ifndef CPLUFFDEF_H_ -+#define CPLUFFDEF_H_ -+ -+ -+/* ------------------------------------------------------------------------ -+ * Version information -+ * ----------------------------------------------------------------------*/ -+ -+/** -+ * @defgroup versionInfo Version information -+ * @ingroup cDefines cxxDefines -+ * -+ * C-Pluff version information. Notice that this version information -+ * is static version information included in header files. The -+ * macros introduced here can be used for compile time checks. -+ */ -+/*@{*/ -+ -+/** -+ * The C-Pluff release version string. This string identifies a specific -+ * version of the C-Pluff distribution. Compile time software compatibility -+ * checks should use #CP_VERSION_MAJOR and #CP_VERSION_MINOR instead. -+ */ -+#define CP_VERSION "0.1.4" -+ -+/** -+ * The major version number component of the release version. This is an -+ * integer. -+ */ -+#define CP_VERSION_MAJOR 0 -+ -+/** -+ * The minor version number component of the release version. This is an -+ * integer. -+ */ -+#define CP_VERSION_MINOR 1 -+ -+/*@}*/ -+ -+ -+/* ------------------------------------------------------------------------ -+ * Symbol visibility -+ * ----------------------------------------------------------------------*/ -+ -+/** -+ * @defgroup symbolVisibility Symbol visibility -+ * @ingroup cDefines cxxDefines -+ * -+ * Macros for controlling inter-module symbol visibility and linkage. These -+ * macros have platform specific values. #CP_EXPORT, #CP_IMPORT and #CP_HIDDEN -+ * can be reused by plug-in implementations for better portability. The -+ * complexity is mostly due to Windows DLL exports and imports. -+ * -+ * @anchor symbolVisibilityExample -+ * Each module should usually define its own macro to declare API symbols with -+ * #CP_EXPORT and #CP_IMPORT as necessary. For example, a mobule could define -+ * a macro @c MY_API in the API header file as follows. -+ * -+ * @code -+ * #ifndef MY_API -+ * # define MY_API CP_IMPORT -+ * #endif -+ * @endcode -+ * -+ * By default the API symbols would then be marked for import which is correct -+ * when client modules are including the API header file. When compiling the -+ * module itself the option @c -DMY_API=CP_EXPORT would be passed to the compiler to -+ * override the API header file and to mark the API symbols for export. -+ * The overriding definition could also be included in module source files or -+ * in an internal header file before including the API header file. -+ */ -+/*@{*/ -+ -+/** -+ * @def CP_EXPORT -+ * -+ * Declares a symbol to be exported for inter-module usage. When compiling the -+ * module which defines the symbol this macro should be placed -+ * at the start of the symbol declaration to ensure that the symbol is exported -+ * to other modules. However, when compiling other modules the declaration of -+ * the symbol should start with #CP_IMPORT. -+ * See @ref symbolVisibilityExample "the example" of how to do this. -+ */ -+ -+/** -+ * @def CP_IMPORT -+ * -+ * Declares a symbol to be imported from another module. When compiling a -+ * module which uses the symbol this macro should be placed at the start of -+ * the symbol declaration to ensure that the symbol is imported from the -+ * defining module. However, when compiling the defining module the declaration -+ * of the symbol should start with #CP_EXPORT. -+ * See @ref symbolVisibilityExample "the example" of how to do this. -+ */ -+ -+/** -+ * @def CP_HIDDEN -+ * -+ * Declares a symbol hidden from other modules. This macro should be -+ * placed at the start of the symbol declaration to hide the symbol from other -+ * modules (if supported by the platform). This macro is not intended to be -+ * used with symbols declared as "static" which are already internal to the -+ * object file. Some platforms do not support hiding of symbols and therefore -+ * unique prefixes should be used for global symbols internal to the module -+ * even when they are declared using this macro. -+ */ -+ -+#if defined(_WIN32) -+# define CP_EXPORT __declspec(dllexport) -+# define CP_IMPORT extern __declspec(dllimport) -+# define CP_HIDDEN -+#elif defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) -+# define CP_EXPORT -+# define CP_IMPORT extern -+# define CP_HIDDEN __attribute__ ((visibility ("hidden"))) -+#else -+# define CP_EXPORT -+# define CP_IMPORT extern -+# define CP_HIDDEN -+#endif -+ -+/*@}*/ -+ -+ -+/* ------------------------------------------------------------------------ -+ * GCC attributes -+ * ----------------------------------------------------------------------*/ -+ -+/** -+ * @defgroup cDefinesGCCAttributes GCC attributes -+ * @ingroup cDefines cxxDefines -+ * -+ * These macros conditionally define GCC attributes for declarations. -+ * They are used in C-Pluff API declarations to enable better optimization -+ * and error checking when using GCC. In non-GCC platforms they have -+ * empty values. -+ */ -+/*@{*/ -+ -+/** -+ * @def CP_GCC_PURE -+ * -+ * Declares a function as pure function having no side effects. -+ * This attribute is supported in GCC since version 2.96. -+ * Such functions can be subject to common subexpression elimination -+ * and loop optimization. -+ */ -+ -+/** -+ * @def CP_GCC_NONNULL -+ * -+ * Specifies that some pointer arguments to a function should have -+ * non-NULL values. Takes a variable length list of argument indexes as -+ * arguments. This attribute is supported in GCC since version 3.3. -+ * It can be used for enhanced error checking and some optimizations. -+ */ -+ -+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -+#define CP_GCC_PURE __attribute__((pure)) -+#else -+#define CP_GCC_PURE -+#endif -+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) -+#define CP_GCC_NONNULL(...) __attribute__((nonnull (__VA_ARGS__))) -+#else -+#define CP_GCC_NONNULL(...) -+#endif -+ -+/*@}*/ -+ -+#ifdef _WIN32 -+#ifndef __func__ -+# define __func__ __FUNCTION__ -+#endif -+#ifndef snprintf -+#define snprintf _snprintf -+#endif -+#define CP_HOST "win32" -+#define CP_SHREXT ".dll" -+#define CP_FNAMESEP_CHAR '\\' // If we switch back to special:// paths then this can be '/' instead -+#define CP_THREADS -+#endif -+#endif /*CPLUFFDEF_H_*/ -diff --git a/libcpluff/win32/dirent.c b/libcpluff/win32/dirent.c -new file mode 100644 -index 0000000..3254b22 ---- /dev/null -+++ b/libcpluff/win32/dirent.c -@@ -0,0 +1,233 @@ -+/* -+ -+ Implementation of POSIX directory browsing functions and types for Win32. -+ -+ Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com) -+ History: Created March 1997. Updated June 2003. -+ Rights: See end of file. -+ -+*/ -+ -+#include "dirent.h" -+#include <errno.h> -+#include <io.h> /* _findfirst and _findnext set errno iff they return -1 */ -+#include <stdlib.h> -+#include <string.h> -+ -+#ifdef __cplusplus -+extern "C" -+{ -+#endif -+ -+struct DIR -+{ -+ long handle; /* -1 for failed rewind */ -+ struct _finddata_t info; -+ struct dirent result; /* d_name null iff first time */ -+ char *name; /* null-terminated char string */ -+}; -+ -+DIR *opendir(const char *name) -+{ -+ DIR *dir = 0; -+ -+ if(name && name[0]) -+ { -+ size_t base_length = strlen(name); -+ const char *all = /* search pattern must end with suitable wildcard */ -+ strchr("/\\", name[base_length - 1]) ? "*" : "/*"; -+ -+ if((dir = (DIR *) malloc(sizeof *dir)) != 0 && -+ (dir->name = (char *) malloc(base_length + strlen(all) + 1)) != 0) -+ { -+ strcat(strcpy(dir->name, name), all); -+ -+ if((dir->handle = (long) _findfirst(dir->name, &dir->info)) != -1) -+ { -+ dir->result.d_name = 0; -+ } -+ else /* rollback */ -+ { -+ free(dir->name); -+ free(dir); -+ dir = 0; -+ } -+ } -+ else /* rollback */ -+ { -+ free(dir); -+ dir = 0; -+ errno = ENOMEM; -+ } -+ } -+ else -+ { -+ errno = EINVAL; -+ } -+ -+ return dir; -+} -+ -+int closedir(DIR *dir) -+{ -+ int result = -1; -+ -+ if(dir) -+ { -+ if(dir->handle != -1) -+ { -+ result = _findclose(dir->handle); -+ } -+ -+ free(dir->name); -+ free(dir); -+ } -+ -+ if(result == -1) /* map all errors to EBADF */ -+ { -+ errno = EBADF; -+ } -+ -+ return result; -+} -+ -+struct dirent *readdir(DIR *dir) -+{ -+ struct dirent *result = 0; -+ -+ if(dir && dir->handle != -1) -+ { -+ if(!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1) -+ { -+ result = &dir->result; -+ result->d_name = dir->info.name; -+ } -+ } -+ else -+ { -+ errno = EBADF; -+ } -+ -+ return result; -+} -+ -+void rewinddir(DIR *dir) -+{ -+ if(dir && dir->handle != -1) -+ { -+ _findclose(dir->handle); -+ dir->handle = (long) _findfirst(dir->name, &dir->info); -+ dir->result.d_name = 0; -+ } -+ else -+ { -+ errno = EBADF; -+ } -+} -+ -+// helper for scandir below -+static void scandir_free_dir_entries(struct dirent*** namelist, int entries) { -+ int i; -+ if (!*namelist) return; -+ for (i = 0; i < entries; ++i) { -+ free((*namelist)[i]); -+ } -+ free(*namelist); -+ *namelist = 0; -+} -+ -+// returns the number of directory entries select or -1 if an error occurs -+int scandir( -+ const char* dir, -+ struct dirent*** namelist, -+ int(*filter)(const struct dirent*), -+ int(*compar)(const void*, const void*) -+) { -+ int entries = 0; -+ int max_entries = 1024; // assume 2*512 = 1024 entries (used for allocation) -+ DIR* d; -+ -+ *namelist = 0; -+ -+ // open directory -+ d = opendir(dir); -+ if (!d) return -1; -+ -+ // iterate -+ while (1) { -+ struct dirent* ent = readdir(d); -+ if (!ent) break; -+ -+ // add if no filter or filter returns non-zero -+ if (filter && (0 == filter(ent))) continue; -+ -+ // resize our buffer if there is not enough room -+ if (!*namelist || entries >= max_entries) { -+ struct dirent** new_entries; -+ -+ max_entries *= 2; -+ new_entries = (struct dirent **)realloc(*namelist, max_entries); -+ if (!new_entries) { -+ scandir_free_dir_entries(namelist, entries); -+ closedir(d); -+ errno = ENOMEM; -+ return -1; -+ } -+ -+ *namelist = new_entries; -+ } -+ -+ // allocate new entry -+ (*namelist)[entries] = (struct dirent *)malloc(sizeof(struct dirent) + strlen(ent->d_name) + 1); -+ if (!(*namelist)[entries]) { -+ scandir_free_dir_entries(namelist, entries); -+ closedir(d); -+ errno = ENOMEM; -+ return -1; -+ } -+ -+ // copy entry info -+ *(*namelist)[entries] = *ent; -+ -+ // and then we tack the string onto the end -+ { -+ char* dest = (char*)((*namelist)[entries]) + sizeof(struct dirent); -+ strcpy(dest, ent->d_name); -+ (*namelist)[entries]->d_name = dest; -+ } -+ -+ ++entries; -+ } -+ -+ closedir(d); -+ -+ // sort -+ if (*namelist && compar) qsort(*namelist, entries, sizeof((*namelist)[0]), compar); -+ -+ return entries; -+} -+ -+int alphasort(const void* lhs, const void* rhs) { -+ const struct dirent* lhs_ent = *(struct dirent**)lhs; -+ const struct dirent* rhs_ent = *(struct dirent**)rhs; -+ return _strcmpi(lhs_ent->d_name, rhs_ent->d_name); -+} -+ -+#ifdef __cplusplus -+} -+#endif -+ -+/* -+ -+ Copyright Kevlin Henney, 1997, 2003. All rights reserved. -+ -+ Permission to use, copy, modify, and distribute this software and its -+ documentation for any purpose is hereby granted without fee, provided -+ that this copyright and permissions notice appear in all copies and -+ derivatives. -+ -+ This software is supplied "as is" without express or implied warranty. -+ -+ But that said, if there are any problems please get in touch. -+ -+*/ -diff --git a/libcpluff/win32/dirent.h b/libcpluff/win32/dirent.h -new file mode 100644 -index 0000000..b41998c ---- /dev/null -+++ b/libcpluff/win32/dirent.h -@@ -0,0 +1,61 @@ -+ -+#ifndef DIRENT_INCLUDED -+#define DIRENT_INCLUDED -+ -+/* -+ -+ Declaration of POSIX directory browsing functions and types for Win32. -+ -+ Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com) -+ History: Created March 1997. Updated June 2003. -+ Rights: See end of file. -+ -+*/ -+ -+#ifdef __cplusplus -+extern "C" -+{ -+#endif -+ -+typedef struct DIR DIR; -+ -+#ifndef WIN32 -+static int errno; -+#endif -+ -+struct dirent -+{ -+ char *d_name; -+}; -+ -+DIR *opendir(const char *); -+int closedir(DIR *); -+struct dirent *readdir(DIR *); -+void rewinddir(DIR *); -+int scandir( -+ const char* dir, -+ struct dirent*** namelist, -+ int(*filter)(const struct dirent*), -+ int(*compar)(const void*, const void*) ); -+int alphasort(const void* lhs, const void* rhs); -+ -+/* -+ -+ Copyright Kevlin Henney, 1997, 2003. All rights reserved. -+ -+ Permission to use, copy, modify, and distribute this software and its -+ documentation for any purpose is hereby granted without fee, provided -+ that this copyright and permissions notice appear in all copies and -+ derivatives. -+ -+ This software is supplied "as is" without express or implied warranty. -+ -+ But that said, if there are any problems please get in touch. -+ -+*/ -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif --- -2.14.1 - diff --git a/lib/cpluff/patches/0004-all-Fix-log-level-inconsistencies.patch b/lib/cpluff/patches/0004-all-Fix-log-level-inconsistencies.patch deleted file mode 100644 index 7e780242f5..0000000000 --- a/lib/cpluff/patches/0004-all-Fix-log-level-inconsistencies.patch +++ /dev/null @@ -1,46 +0,0 @@ -From ece6f7080c4613b2781f47e32479fb57dddd7494 Mon Sep 17 00:00:00 2001 -From: "h.udo" <hudokkow@gmail.com> -Date: Thu, 20 Oct 2016 14:19:44 +0100 -Subject: [PATCH 04/12] [all] Fix log level inconsistencies - ---- - libcpluff/ploader.c | 2 +- - libcpluff/pscan.c | 4 ++-- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/libcpluff/ploader.c b/libcpluff/ploader.c -index c4e251b..5c01add 100644 ---- a/libcpluff/ploader.c -+++ b/libcpluff/ploader.c -@@ -1081,7 +1081,7 @@ static void check_cleanup_descriptor_parsing(cp_status_t status, cp_context_t *c - N_("Plug-in descriptor in %s is invalid."), path); - break; - case CP_ERR_IO: -- cpi_errorf(context, -+ cpi_debugf(context, - N_("An I/O error occurred while loading a plug-in descriptor from %s."), path); - break; - case CP_ERR_RESOURCE: -diff --git a/libcpluff/pscan.c b/libcpluff/pscan.c -index 50dcff8..921c8e3 100644 ---- a/libcpluff/pscan.c -+++ b/libcpluff/pscan.c -@@ -272,13 +272,13 @@ CP_C_API cp_status_t cp_scan_plugins(cp_context_t *context, int flags) { - // Report error - switch (status) { - case CP_OK: -- cpi_debug(context, N_("Plug-in scan has completed successfully.")); -+ cpi_info(context, N_("Plug-in scan has completed successfully.")); - break; - case CP_ERR_RESOURCE: - cpi_error(context, N_("Could not scan plug-ins due to insufficient system resources.")); - break; - default: -- cpi_error(context, N_("Could not scan plug-ins.")); -+ cpi_warn(context, N_("Not all directories were successfully scanned.")); - break; - } - cpi_unlock_context(context); --- -2.14.1 - diff --git a/lib/cpluff/patches/0005-all-Fix-unsigned-signed-warnings.patch b/lib/cpluff/patches/0005-all-Fix-unsigned-signed-warnings.patch deleted file mode 100644 index 1657962de2..0000000000 --- a/lib/cpluff/patches/0005-all-Fix-unsigned-signed-warnings.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 6956744aa9e38f961eef0b6bffbc59690d153b64 Mon Sep 17 00:00:00 2001 -From: "h.udo" <hudokkow@gmail.com> -Date: Thu, 20 Oct 2016 14:24:32 +0100 -Subject: [PATCH 05/12] [all] Fix unsigned/signed warnings - ---- - libcpluff/pcontrol.c | 10 +++++----- - libcpluff/pinfo.c | 4 ++-- - 2 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/libcpluff/pcontrol.c b/libcpluff/pcontrol.c -index 130a3a2..2f47591 100644 ---- a/libcpluff/pcontrol.c -+++ b/libcpluff/pcontrol.c -@@ -67,7 +67,7 @@ static void assert_processed_zero(cp_context_t *context) { - #endif - - static void unregister_extensions(cp_context_t *context, cp_plugin_info_t *plugin) { -- int i; -+ unsigned int i; - - for (i = 0; i < plugin->num_ext_points; i++) { - cp_ext_point_t *ep = plugin->ext_points + i; -@@ -109,7 +109,7 @@ CP_C_API cp_status_t cp_install_plugin(cp_context_t *context, cp_plugin_info_t * - cp_plugin_t *rp = NULL; - cp_status_t status = CP_OK; - cpi_plugin_event_t event; -- int i; -+ unsigned int i; - - CHECK_NOT_NULL(context); - CHECK_NOT_NULL(plugin); -@@ -421,7 +421,7 @@ static int resolve_plugin_prel_rec(cp_context_t *context, cp_plugin_t *plugin) { - cp_status_t status = CP_OK; - int error_reported = 0; - lnode_t *node = NULL; -- int i; -+ unsigned int i; - - // Check if already resolved - if (plugin->state >= CP_PLUGIN_RESOLVED) { -@@ -1092,7 +1092,7 @@ static void free_extension_content(cp_extension_t *extension) { - } - - static void free_cfg_element_content(cp_cfg_element_t *ce) { -- int i; -+ unsigned int i; - - assert(ce != NULL); - free(ce->name); -@@ -1108,7 +1108,7 @@ static void free_cfg_element_content(cp_cfg_element_t *ce) { - } - - CP_HIDDEN void cpi_free_plugin(cp_plugin_info_t *plugin) { -- int i; -+ unsigned int i; - - assert(plugin != NULL); - free(plugin->name); -diff --git a/libcpluff/pinfo.c b/libcpluff/pinfo.c -index 6492712..29c629b 100644 ---- a/libcpluff/pinfo.c -+++ b/libcpluff/pinfo.c -@@ -667,7 +667,7 @@ static cp_cfg_element_t * lookup_cfg_element(cp_cfg_element_t *base, const char - if (end - start == 2 && !strncmp(path + start, "..", 2)) { - base = base->parent; - } else { -- int i; -+ unsigned int i; - int found = 0; - - for (i = 0; !found && i < base->num_children; i++) { -@@ -711,7 +711,7 @@ CP_C_API char * cp_lookup_cfg_value(cp_cfg_element_t *base, const char *path) { - if (attr == NULL) { - return e->value; - } else { -- int i; -+ unsigned int i; - - for (i = 0; i < e->num_atts; i++) { - if (!strcmp(attr, e->atts[2*i])) { --- -2.14.1 - diff --git a/lib/cpluff/patches/0006-all-Fix-scoping-error.patch b/lib/cpluff/patches/0006-all-Fix-scoping-error.patch deleted file mode 100644 index 5e8e09a23b..0000000000 --- a/lib/cpluff/patches/0006-all-Fix-scoping-error.patch +++ /dev/null @@ -1,33 +0,0 @@ -From f4a0c37a69c62965f93a697ea3b8565bbabf5b9b Mon Sep 17 00:00:00 2001 -From: "h.udo" <hudokkow@gmail.com> -Date: Thu, 20 Oct 2016 14:26:29 +0100 -Subject: [PATCH 06/12] [all] Fix scoping error - ---- - libcpluff/util.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/libcpluff/util.c b/libcpluff/util.c -index a5f437b..e5ff7cf 100644 ---- a/libcpluff/util.c -+++ b/libcpluff/util.c -@@ -157,6 +157,7 @@ static int vercmp_num_value(const char *v, const char *vn) { - CP_HIDDEN int cpi_vercmp(const char *v1, const char *v2) { - const char *v1n; - const char *v2n; -+ int diff; - - // Check for NULL versions - if (v1 == NULL && v2 != NULL) { -@@ -186,7 +187,7 @@ CP_HIDDEN int cpi_vercmp(const char *v1, const char *v2) { - if (v2 < v2n) { - c2 = *v2++; - } -- int diff = vercmp_char_value(c1) - vercmp_char_value(c2); -+ diff = vercmp_char_value(c1) - vercmp_char_value(c2); - if (diff != 0) { - return diff; - } --- -2.14.1 - diff --git a/lib/cpluff/patches/0007-all-Comment-log-line-to-reduce-log-spew.patch b/lib/cpluff/patches/0007-all-Comment-log-line-to-reduce-log-spew.patch deleted file mode 100644 index 8fab2edd1f..0000000000 --- a/lib/cpluff/patches/0007-all-Comment-log-line-to-reduce-log-spew.patch +++ /dev/null @@ -1,25 +0,0 @@ -From e06c8af2d8141b675f2719edf48af84e1445e1b5 Mon Sep 17 00:00:00 2001 -From: "h.udo" <hudokkow@gmail.com> -Date: Thu, 20 Oct 2016 15:01:11 +0100 -Subject: [PATCH 07/12] [all] Comment log line to reduce log spew - ---- - libcpluff/pinfo.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libcpluff/pinfo.c b/libcpluff/pinfo.c -index 29c629b..6262c74 100644 ---- a/libcpluff/pinfo.c -+++ b/libcpluff/pinfo.c -@@ -198,7 +198,7 @@ CP_C_API cp_plugin_info_t * cp_get_plugin_info(cp_context_t *context, const char - // Lookup plug-in information - if (id != NULL) { - if ((node = hash_lookup(context->env->plugins, id)) == NULL) { -- cpi_warnf(context, N_("Could not return information about unknown plug-in %s."), id); -+ // cpi_warnf(context, N_("Could not return information about unknown plug-in %s."), id); - status = CP_ERR_UNKNOWN; - break; - } --- -2.14.1 - diff --git a/lib/cpluff/patches/0008-configure-Handle-libdl-only-being-needed-on-Linux-fo.patch b/lib/cpluff/patches/0008-configure-Handle-libdl-only-being-needed-on-Linux-fo.patch deleted file mode 100644 index 9baf70b6f2..0000000000 --- a/lib/cpluff/patches/0008-configure-Handle-libdl-only-being-needed-on-Linux-fo.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 40e6a7d6aa122b99b65ad0f034ee2d90214779a9 Mon Sep 17 00:00:00 2001 -From: "h.udo" <hudokkow@gmail.com> -Date: Thu, 20 Oct 2016 15:05:58 +0100 -Subject: [PATCH 08/12] [configure] Handle libdl only being needed on Linux for - dlopen - ---- - configure.ac | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 0700af9..c391dfb 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -179,7 +179,8 @@ dlmechanism=none - if test "$with_dlopen" != no && test "$with_libltdl" != yes; then - AC_CHECK_HEADER([dlfcn.h], - AC_CHECK_LIB([dl], [dlopen], -- [LIBS_DL="-ldl $LIBS_DL"; dlmechanism=dlopen])) -+ [LIBS_DL="-ldl $LIBS_DL"; dlmechanism=dlopen], -+ AC_CHECK_LIB([c], [dlopen], [dlmechanism=dlopen]))) - fi - if test "$dlmechanism" = none && test "$with_libltdl" != no && test "$with_dlopen" != yes; then - AC_CHECK_HEADER([ltdl.h], --- -2.14.1 - diff --git a/lib/cpluff/patches/0009-configure-Add-silent-rules-to-shut-it-up-a-little.patch b/lib/cpluff/patches/0009-configure-Add-silent-rules-to-shut-it-up-a-little.patch deleted file mode 100644 index fa7765aa87..0000000000 --- a/lib/cpluff/patches/0009-configure-Add-silent-rules-to-shut-it-up-a-little.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 2a63458669637b8646e97e47b1384926760cb632 Mon Sep 17 00:00:00 2001 -From: "h.udo" <hudokkow@gmail.com> -Date: Thu, 20 Oct 2016 15:08:49 +0100 -Subject: [PATCH 09/12] [configure] Add silent rules to shut it up a little - ---- - configure.ac | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/configure.ac b/configure.ac -index c391dfb..3ada0ae 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -45,6 +45,7 @@ AC_SUBST([CP_CXX_LIB_VERSION]) - # Automake initialization - # ----------------------- - AM_INIT_AUTOMAKE([foreign subdir-objects]) -+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - AM_GNU_GETTEXT([external]) - AM_GNU_GETTEXT_VERSION([0.16.1]) - --- -2.14.1 - diff --git a/lib/cpluff/patches/0010-configure-Fix-build-with-xcode5.patch b/lib/cpluff/patches/0010-configure-Fix-build-with-xcode5.patch deleted file mode 100644 index 1ab98d10c4..0000000000 --- a/lib/cpluff/patches/0010-configure-Fix-build-with-xcode5.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 763a3322e981e0493106b87ae1c86c0054f0da2d Mon Sep 17 00:00:00 2001 -From: "h.udo" <hudokkow@gmail.com> -Date: Thu, 20 Oct 2016 15:22:30 +0100 -Subject: [PATCH 10/12] [configure] Fix build with xcode5 - ---- - configure.ac | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 3ada0ae..d9a1771 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -119,7 +119,7 @@ if test "$enable_threads" != no; then - [AC_LINK_IFELSE( - [AC_LANG_SOURCE([#include <pthread.h> - --int main(int argc, char *argv[]) { -+int main(int argc, char **argv) { - pthread_mutex_t mutex; - - pthread_mutex_init(&mutex, NULL); -@@ -138,7 +138,7 @@ int main(int argc, char *argv[]) { - [AC_LINK_IFELSE( - [AC_LANG_SOURCE([#include <windows.h> - --int main(int argc, char *argv[]) { -+int main(int argc, char **argv) { - CreateMutex(NULL, FALSE, NULL); - return 0; - } --- -2.14.1 - diff --git a/lib/cpluff/patches/0011-docs-We-don-t-need-them.patch b/lib/cpluff/patches/0011-docs-We-don-t-need-them.patch deleted file mode 100644 index 35d6a87b4b..0000000000 --- a/lib/cpluff/patches/0011-docs-We-don-t-need-them.patch +++ /dev/null @@ -1,25 +0,0 @@ -From c2e5e32cc956ab3bb58199f6d1606f3532b86519 Mon Sep 17 00:00:00 2001 -From: "h.udo" <hudokkow@gmail.com> -Date: Mon, 29 Jan 2018 20:45:51 +0000 -Subject: [PATCH 11/12] [docs] We don't need them - ---- - Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile.am b/Makefile.am -index 695448a..dcba780 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -6,7 +6,7 @@ - - ACLOCAL_AMFLAGS = -I m4 - --SUBDIRS = libcpluff loader console po test docsrc doc -+SUBDIRS = libcpluff loader console po test - DIST_SUBDIRS = $(SUBDIRS) examples - - EXTRA_DIST = COPYRIGHT.txt INSTALL.txt ChangeLog.txt Roadmap.txt autogen.sh plugin.xsd --- -2.14.1 - diff --git a/lib/cpluff/patches/0012-Kill-implicit-function-declaration-warning.patch b/lib/cpluff/patches/0012-Kill-implicit-function-declaration-warning.patch deleted file mode 100644 index 6a878f8d2e..0000000000 --- a/lib/cpluff/patches/0012-Kill-implicit-function-declaration-warning.patch +++ /dev/null @@ -1,28 +0,0 @@ -From c16649382e3b89264aada598b07a3980aa7e42e4 Mon Sep 17 00:00:00 2001 -From: "h.udo" <hudokkow@gmail.com> -Date: Fri, 2 Feb 2018 20:48:30 +0000 -Subject: [PATCH 12/12] Kill implicit-function-declaration warning - ---- - console/cmdinput_basic.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/console/cmdinput_basic.c b/console/cmdinput_basic.c -index 033c35d..71977fe 100644 ---- a/console/cmdinput_basic.c -+++ b/console/cmdinput_basic.c -@@ -25,10 +25,10 @@ - - #include <stdio.h> - #include <string.h> -+#include "console.h" - #if defined(HAVE_ISATTY_FILENO) - #include <unistd.h> - #endif --#include "console.h" - - #define CMDLINE_SIZE 256 - --- -2.14.1 - diff --git a/lib/cpluff/patches/0013-Kill-implicit-function-declaration-warning-2.patch b/lib/cpluff/patches/0013-Kill-implicit-function-declaration-warning-2.patch deleted file mode 100644 index 1e3ae2ea73..0000000000 --- a/lib/cpluff/patches/0013-Kill-implicit-function-declaration-warning-2.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/lib/cpluff/console/cmdinput_readline.c b/lib/cpluff/console/cmdinput_readline.c -index e383c8faba..b8d78af005 100644 ---- a/lib/cpluff/console/cmdinput_readline.c -+++ b/lib/cpluff/console/cmdinput_readline.c -@@ -26,6 +26,7 @@ - #include <stdio.h> - #include <stdlib.h> - #include <ctype.h> -+#include <string.h> - #include <readline/readline.h> - #include <readline/history.h> - #include "console.h" diff --git a/lib/cpluff/plugin.xsd b/lib/cpluff/plugin.xsd deleted file mode 100644 index 8fcf0e6f8f..0000000000 --- a/lib/cpluff/plugin.xsd +++ /dev/null @@ -1,95 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "http://www.w3.org/2001/XMLSchema.dtd"> -<!-- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ---> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:element name="plugin"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" ref="backwards-compatibility"/> - <xs:element minOccurs="0" ref="requires"/> - <xs:element minOccurs="0" ref="runtime"/> - <xs:element minOccurs="0" maxOccurs="unbounded" ref="extension-point"/> - <xs:element minOccurs="0" maxOccurs="unbounded" ref="extension"/> - </xs:sequence> - <xs:attribute name="id" type="xs:string" use="required"/> - <xs:attribute name="name" type="xs:string"/> - <xs:attribute name="version" type="xs:string"/> - <xs:attribute name="provider-name" type="xs:string"/> - </xs:complexType> - </xs:element> - <xs:element name="backwards-compatibility"> - <xs:complexType> - <xs:attribute name="abi" type="xs:string"/> - <xs:attribute name="api" type="xs:string"/> - </xs:complexType> - </xs:element> - <xs:element name="requires"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" ref="c-pluff"/> - <xs:element minOccurs="0" maxOccurs="unbounded" ref="import"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="c-pluff"> - <xs:complexType> - <xs:attribute name="version" type="xs:string" use="required"/> - </xs:complexType> - </xs:element> - <xs:element name="import"> - <xs:complexType> - <xs:attribute name="plugin" type="xs:string" use="required"/> - <xs:attribute name="version" type="xs:integer"/> - <xs:attribute name="optional" type="xs:boolean" default="false"/> - </xs:complexType> - </xs:element> - <xs:element name="runtime"> - <xs:complexType> - <xs:attribute name="library" type="xs:string" use="required"/> - <xs:attribute name="funcs" type="xs:string"/> - </xs:complexType> - </xs:element> - <xs:element name="extension-point"> - <xs:complexType> - <xs:attribute name="id" type="simpleIdentifier" use="required"/> - <xs:attribute name="name" type="xs:string"/> - <xs:attribute name="schema" type="xs:string"/> - </xs:complexType> - </xs:element> - <xs:element name="extension"> - <xs:complexType> - <xs:sequence> - <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/> - </xs:sequence> - <xs:attribute name="point" type="xs:string" use="required"/> - <xs:attribute name="id" type="simpleIdentifier"/> - <xs:attribute name="name" type="xs:string"/> - </xs:complexType> - </xs:element> - <xs:simpleType name="simpleIdentifier"> - <xs:restriction base="xs:string"> - <xs:pattern value="[^.]+"/> - </xs:restriction> - </xs:simpleType> -</xs:schema> diff --git a/lib/cpluff/po/.gitignore b/lib/cpluff/po/.gitignore deleted file mode 100644 index 6918634233..0000000000 --- a/lib/cpluff/po/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.gmo -*.pot -en@boldquot.po -en@quot.po -Rules-quot -insert-header.sin -Makevars.template -remove-potcdate.sin -Makefile.in.in -quot.sed -en@quot.header -en@boldquot.header -boldquot.sed -ChangeLog -Makefile -Makefile.in -POTFILES -stamp-po -*~ diff --git a/lib/cpluff/po/LINGUAS b/lib/cpluff/po/LINGUAS deleted file mode 100644 index 31c5215387..0000000000 --- a/lib/cpluff/po/LINGUAS +++ /dev/null @@ -1,5 +0,0 @@ -# Available languages -en@quot -en@boldquot -de -fi diff --git a/lib/cpluff/po/Makevars b/lib/cpluff/po/Makevars deleted file mode 100644 index 399e783aa4..0000000000 --- a/lib/cpluff/po/Makevars +++ /dev/null @@ -1,41 +0,0 @@ -# Makefile variables for PO directory in any package using GNU gettext. - -# Usually the message domain is the same as the package name. -DOMAIN = $(PACKAGE) - -# These two variables depend on the location of this directory. -subdir = po -top_builddir = .. - -# These options get passed to xgettext. -XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ - -# This is the copyright holder that gets inserted into the header of the -# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding -# package. (Note that the msgstr strings, extracted from the package's -# sources, belong to the copyright holder of the package.) Translators are -# expected to transfer the copyright for their translations to this person -# or entity, or to disclaim their copyright. The empty string stands for -# the public domain; in this case the translators are expected to disclaim -# their copyright. -COPYRIGHT_HOLDER = Johannes Lehtinen - -# This is the email address or URL to which the translators shall report -# bugs in the untranslated strings: -# - Strings which are not entire sentences, see the maintainer guidelines -# in the GNU gettext documentation, section 'Preparing Strings'. -# - Strings which use unclear terms or require additional context to be -# understood. -# - Strings which make invalid assumptions about notation of date, time or -# money. -# - Pluralisation problems. -# - Incorrect English spelling. -# - Incorrect formatting. -# It can be your email address, or a mailing list address where translators -# can write to without being subscribed, or the URL of a web page through -# which the translators can contact you. -MSGID_BUGS_ADDRESS = johannes.lehtinen@iki.fi - -# This is the list of locale categories, beyond LC_MESSAGES, for which the -# message catalogs shall be used. It is usually empty. -EXTRA_LOCALE_CATEGORIES = diff --git a/lib/cpluff/po/POTFILES.in b/lib/cpluff/po/POTFILES.in deleted file mode 100644 index abe52a1d88..0000000000 --- a/lib/cpluff/po/POTFILES.in +++ /dev/null @@ -1,19 +0,0 @@ -# List of source files which contain translatable strings. -#console/console.h -console/cmdinput_basic.c -console/cmdinput_readline.c -console/console.c -#libcpluff/defines.h -libcpluff/context.c -libcpluff/cpluff.c -libcpluff/logging.c -libcpluff/pcontrol.c -libcpluff/pinfo.c -libcpluff/ploader.c -libcpluff/pscan.c -libcpluff/psymbol.c -libcpluff/serial.c -libcpluff/thread_posix.c -libcpluff/thread_windows.c -libcpluff/util.c -loader/loader.c diff --git a/lib/cpluff/po/de.po b/lib/cpluff/po/de.po deleted file mode 100644 index 9b6a58c5bf..0000000000 --- a/lib/cpluff/po/de.po +++ /dev/null @@ -1,1257 +0,0 @@ -# German translation of xbmc/cpluff. -# This file is distributed under the same license as the xbmc package. -# Copyright © of this file Chris Leick <c.leick@vollbio.de>, 2013. -# -msgid "" -msgstr "" -"Project-Id-Version: xbmc 12.0\n" -"Report-Msgid-Bugs-To: johannes.lehtinen@iki.fi\n" -"POT-Creation-Date: 2016-01-01 22:47+0200\n" -"PO-Revision-Date: 2013-03-11 21:24+0200\n" -"Last-Translator: Chris Leick <c.leick@vollbio.de>\n" -"Language-Team: German <debian-l10n-german@lists.debian.org>\n" -"Language: de\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -# FIXME s/line/ // -#: console/cmdinput_basic.c:52 -msgid "ERROR: Command line is too long.\n" -msgstr "FEHLER: Befehlszeile ist zu lang.\n" - -#: console/console.c:77 -msgid "displays available commands" -msgstr "zeigt verfügbare Befehle" - -#: console/console.c:78 -msgid "sets the displayed log level" -msgstr "setzt die angezeigte Protokollierungsstufe" - -#: console/console.c:79 -msgid "registers a plug-in collection" -msgstr "registriert eine Sammlung von Plug-ins" - -#: console/console.c:80 -msgid "unregisters a plug-in collection" -msgstr "entfernt die Registrierung einer Sammlung von Plug-ins" - -#: console/console.c:81 -msgid "unregisters all plug-in collections" -msgstr "entfernt die Registrierung aller Plug-in-Sammlungen" - -#: console/console.c:82 -msgid "loads and installs a plug-in from the specified path" -msgstr "lädt und installiert ein Plug-in aus dem angegebenen Pfad" - -#: console/console.c:83 -msgid "scans plug-ins in the registered plug-in collections" -msgstr "durchsucht Plug-ins in den registrierten Plug-in-Sammlungen" - -#: console/console.c:84 -msgid "sets context startup arguments" -msgstr "setzt kontextabhängige Startargumente" - -#: console/console.c:85 -msgid "starts a plug-in" -msgstr "startet ein Plug-in" - -#: console/console.c:86 -msgid "runs one plug-in run function" -msgstr "führt eine Plug-in-Ausführungsfunktion aus" - -#: console/console.c:87 -msgid "runs plug-in run functions until all work is done" -msgstr "führt Plug-in-Ausführungsfunktionen aus, bis alles erledigt ist" - -#: console/console.c:88 -msgid "stops a plug-in" -msgstr "stoppt ein Plug-in" - -#: console/console.c:89 -msgid "stops all plug-ins" -msgstr "stoppt alle Plug-ins" - -#: console/console.c:90 -msgid "uninstalls a plug-in" -msgstr "deinstalliert ein Plug-in" - -#: console/console.c:91 -msgid "uninstalls all plug-ins" -msgstr "deinstalliert alle Plug-ins" - -#: console/console.c:92 -msgid "lists the installed plug-ins" -msgstr "listet die installierten Plug-ins auf" - -#: console/console.c:93 -msgid "lists the installed extension points" -msgstr "listet die installierten Erweiterungspunkte auf" - -#: console/console.c:94 -msgid "lists the installed extensions" -msgstr "listet alle installierten Erweiterungen auf" - -#: console/console.c:95 -msgid "shows static plug-in information" -msgstr "zeigt eine feststehende Plug-in-Information" - -#: console/console.c:96 console/console.c:97 -msgid "quits the program" -msgstr "beendet das Programm" - -#: console/console.c:103 -msgid "enables upgrades of installed plug-ins" -msgstr "aktiviert Upgrades installierter Plug-ins" - -#: console/console.c:104 -msgid "stops all plug-ins on first upgrade" -msgstr "stoppt beim ersten Upgrade alle Plug-ins" - -#: console/console.c:105 -msgid "stops all plug-ins on first install or upgrade" -msgstr "stoppt beim ersten Installieren oder Upgrade alle Plug-ins" - -#: console/console.c:106 -msgid "restarts the currently active plug-ins after the scan" -msgstr "startet das derzeit aktive Plug-in nach dem Scan wieder" - -#: console/console.c:112 -msgid "detailed debug messages" -msgstr "detaillierte Debug-Meldungen" - -#: console/console.c:113 -msgid "informational messages" -msgstr "mitteilsame Meldungen" - -#: console/console.c:114 -msgid "warnings about possible problems" -msgstr "Warnungen vor möglichen Problemen" - -#: console/console.c:115 -msgid "error messages" -msgstr "Fehlermeldungen" - -#: console/console.c:116 -msgid "disable logging" -msgstr "deaktiviert Protokollierung" - -#: console/console.c:153 -msgid "Command has too many arguments.\n" -msgstr "Befehl hat zu viele Argumente.\n" - -#: console/console.c:176 -msgid "The following commands are available:\n" -msgstr "Die folgenden Befehle sind verfügbar:\n" - -#. TRANSLATORS: A tag for debug level log entries. -#: console/console.c:187 loader/loader.c:212 -msgid "DEBUG" -msgstr "DEBUG" - -#. TRANSLATORS: A tag for info level log entries. -#: console/console.c:191 loader/loader.c:217 -msgid "INFO" -msgstr "INFO" - -#. TRANSLATORS: A tag for warning level log entries. -#: console/console.c:195 loader/loader.c:222 -msgid "WARNING" -msgstr "WARNUNG" - -#. TRANSLATORS: A tag for error level log entries. -#: console/console.c:199 loader/loader.c:227 -msgid "ERROR" -msgstr "FEHLER" - -#. TRANSLATORS: A tag for unknown severity level. -#: console/console.c:203 loader/loader.c:232 -msgid "UNKNOWN" -msgstr "UNBEKANNT" - -#. TRANSLATORS: Used when displaying log messages originating -#. from console activities. -#: console/console.c:211 -msgid "console" -msgstr "Konsole" - -#. TRANSLATORS: Usage instructions for setting log level -#: console/console.c:218 -#, c-format -msgid "Usage: %s <level>\n" -msgstr "Aufruf: %s <Stufe>\n" - -#: console/console.c:228 -#, c-format -msgid "Unknown log level %s.\n" -msgstr "unbekannte Protokollierungsstufe %s\n" - -#: console/console.c:229 -msgid "Available log levels are:\n" -msgstr "Folgende Protokollierungsstufen sind verfügbar:\n" - -#. TRANSLATORS: The first %s is the log level name and the second the localized log level description. -#: console/console.c:240 console/console.c:893 -#, c-format -msgid "Using display log level %s (%s).\n" -msgstr "Protokollierungsstufe %s (%s) wird benutzt.\n" - -#. TRANSLATORS: Return status for a successfull API call -#: console/console.c:249 -msgid "success" -msgstr "erfolgreich" - -#: console/console.c:251 -msgid "insufficient system resources" -msgstr "unzureichende Systemressourcen" - -#: console/console.c:253 -msgid "an unknown object was specified" -msgstr "Es wurde ein unbekanntes Objekt angegeben." - -#: console/console.c:255 -msgid "an input or output error" -msgstr "ein Ein- oder Ausgabefehler" - -#: console/console.c:257 -msgid "a malformed plug-in descriptor" -msgstr "ein missgestalteter Plug-in-Descriptor" - -#: console/console.c:259 -msgid "a plug-in or symbol conflicts with an existing one" -msgstr "Ein Plug-in oder Symbol steht mit einem vorhandenen in Konflikt." - -#: console/console.c:261 -msgid "unsatisfiable dependencies" -msgstr "nicht aufgelöste Abhängigkeiten" - -#: console/console.c:263 -msgid "a plug-in runtime library encountered an error" -msgstr "In einer Plug-in-Laufzeitbibliothek trat ein Fehler auf." - -#: console/console.c:265 -msgid "unknown error code" -msgstr "unbekannter Fehlercode" - -#: console/console.c:270 -#, c-format -msgid "API function %s failed with error code %d (%s).\n" -msgstr "API-Funktion %s schlug mit Fehlercode %d (%s) fehl.\n" - -#. TRANSLATORS: Usage instructions for registering a plug-in collection -#. TRANSLATORS: Usage instructions for unregistering a plug-in collection -#. TRANSLATORS: Usage instructios for loading a plug-in -#: console/console.c:281 console/console.c:292 console/console.c:315 -#, c-format -msgid "Usage: %s <path>\n" -msgstr "Aufruf: %s <Pfad>\n" - -#: console/console.c:285 -#, c-format -msgid "Registered a plug-in collection in path %s.\n" -msgstr "Eine Plug-in-Sammlung wurde in Pfad %s registriert.\n" - -#: console/console.c:295 -#, c-format -msgid "Unregistered a plug-in collection in path %s.\n" -msgstr "Die Registrierung einer Plug-in-Sammlung wurde in Pfad %s entfernt.\n" - -#. TRANSLATORS: Usage instructions for unregistering all plug-in collections -#. TRANSLATORS: Usage instructions for listing plug-ins -#. TRANSLATORS: Usage instructions for listing extension points -#. TRANSLATORS: Usage instructions for listing extensions -#. TRANSLATORS: Usage instructions for running one plug-in run function -#. TRANSLATORS: Usage instructions for running plug-in run functions until all work is done -#. TRANSLATORS: Usage instructions for stopping all plug-ins -#. TRANSLATORS: Usage instructions for uninstalling all plug-ins -#: console/console.c:302 console/console.c:387 console/console.c:682 -#: console/console.c:707 console/console.c:786 console/console.c:800 -#: console/console.c:823 console/console.c:846 -#, c-format -msgid "Usage: %s\n" -msgstr "Aufruf: %s\n" - -#: console/console.c:305 -msgid "Unregistered all plug-in collections.\n" -msgstr "Die Registrierung aller Plug-in-Sammlungen wurde entfernt.\n" - -#: console/console.c:322 -#, c-format -msgid "Installed plug-in %s.\n" -msgstr "Plug-in %s wurde installiert.\n" - -#: console/console.c:343 -#, c-format -msgid "Unknown flag %s.\n" -msgstr "unbekannter Schalter %s\n" - -#. TRANSLATORS: Usage instructions for scanning plug-ins -#: console/console.c:345 -#, c-format -msgid "Usage: %s [<flag>...]\n" -msgstr "Aufruf: %s [<Schalter> …]\n" - -#: console/console.c:346 -msgid "Available flags are:\n" -msgstr "Folgende Schalter sind verfügbar:\n" - -#: console/console.c:358 -msgid "Plug-ins loaded.\n" -msgstr "Plug-ins geladen\n" - -#: console/console.c:364 -msgid "uninstalled" -msgstr "deinstalliert" - -#: console/console.c:366 -msgid "installed" -msgstr "installiert" - -# Es geht hier um Kompilersymbole wie #define __i386__ 1 -#: console/console.c:368 -msgid "resolved" -msgstr "aufgelöst" - -#: console/console.c:370 -msgid "starting" -msgstr "wird gestartet" - -#: console/console.c:372 -msgid "stopping" -msgstr "wird gestoppt" - -#: console/console.c:374 -msgid "active" -msgstr "aktiv" - -#: console/console.c:376 -msgid "unknown" -msgstr "unbekannt" - -#: console/console.c:392 -msgid "Installed plug-ins:\n" -msgstr "installierte Plug-ins:\n" - -#: console/console.c:394 console/console.c:689 console/console.c:714 -msgid "IDENTIFIER" -msgstr "BEZEICHNER" - -#: console/console.c:395 -msgid "VERSION" -msgstr "VERSION" - -#: console/console.c:396 -msgid "STATE" -msgstr "STATUS" - -#: console/console.c:397 console/console.c:690 console/console.c:715 -msgid "NAME" -msgstr "NAME" - -#: console/console.c:421 console/console.c:539 console/console.c:762 -msgid "Memory allocation failed.\n" -msgstr "Speicherreservierung fehlgeschlagen\n" - -#. TRANSLATORS: Usage instructions for showing plug-in information -#. TRANSLATORS: Usage instructions for starting a plug-in -#. TRANSLATORS: Usage instructions for stopping a plug-in -#. TRANSLATORS: Usage instructions for uninstalling a plug-in -#: console/console.c:611 console/console.c:774 console/console.c:812 -#: console/console.c:835 -#, c-format -msgid "Usage: %s <plugin>\n" -msgstr "Aufruf: %s <Plug-in>\n" - -#: console/console.c:687 -msgid "Installed extension points:\n" -msgstr "installierte Erweiterungspunkte:\n" - -#: console/console.c:712 -msgid "Installed extensions:\n" -msgstr "installierte Erweiterungen:\n" - -#: console/console.c:719 -msgid ".<anonymous>" -msgstr ".<anonym>" - -#. TRANSLATORS: Usage instructions for setting context arguments -#: console/console.c:760 -#, c-format -msgid "Usage: %s [<arg>...]\n" -msgstr "Aufruf: %s [<Argument> …]\n" - -#: console/console.c:765 -msgid "Plug-in context startup arguments have been set.\n" -msgstr "Kontextabhängige Startargumente des Plug-ins wurden gesetzt.\n" - -#: console/console.c:778 -#, c-format -msgid "Started plug-in %s.\n" -msgstr "Plug-in %s gestartet\n" - -#: console/console.c:790 -msgid "Ran one plug-in run function. There are pending run functions.\n" -msgstr "" -"Eine Plug-in-Ausführungsfunktion lief. Es stehen noch Ausführungsfunktionen " -"an.\n" - -#: console/console.c:792 -msgid "Ran one plug-in run function. No more pending run functions.\n" -msgstr "" -"Eine Plug-in-Ausführungsfunktion lief. Es stehen keine Ausführungsfunktionen " -"mehr an.\n" - -#: console/console.c:803 -msgid "Ran plug-in run functions. No more pending run functions.\n" -msgstr "" -"Es liefen Plug-in-Ausführungsfunktionen. Es stehen keine " -"Ausführungsfunktionen mehr an.\n" - -#: console/console.c:816 -#, c-format -msgid "Stopped plug-in %s.\n" -msgstr "Plug-in %s gestoppt\n" - -#: console/console.c:826 -msgid "Stopped all plug-ins.\n" -msgstr "alle Plug-ins gestoppt\n" - -#: console/console.c:839 -#, c-format -msgid "Uninstalled plug-in %s.\n" -msgstr "Plug-in %s deinstalliert\n" - -#: console/console.c:849 -msgid "Uninstalled all plug-ins.\n" -msgstr "alle Plug-ins deinstalliert\n" - -#. TRANSLATORS: This is a version string displayed on startup. -#: console/console.c:877 -#, c-format -msgid "C-Pluff Console, version %s\n" -msgstr "C-Pluff-Konsole, Version %s\n" - -#. TRANSLATORS: This is a version string displayed on startup. -#. The first %s is version and the second %s is platform type. -#: console/console.c:881 loader/loader.c:332 -#, c-format -msgid "C-Pluff Library, version %s for %s\n" -msgstr "C-Pluff-Bibliothek, Version %s für %s\n" - -#: console/console.c:896 -msgid "Type \"help\" for help on available commands.\n" -msgstr "Geben Sie »help« ein, um Hilfe über verfügbare Befehle zu erhalten.\n" - -#. TRANSLATORS: This is the input prompt for cpluff-console. -#: console/console.c:900 -msgid "C-Pluff Console > " -msgstr "C-Pluff-Konsole > " - -#: console/console.c:928 -#, c-format -msgid "Unknown command %s.\n" -msgstr "unbekannter Befehl %s\n" - -#: libcpluff/context.c:274 -msgid "Only the main program can destroy a plug-in context." -msgstr "Nur das Hauptprogramm kann den Kontext eines Plug-ins zerstören." - -#: libcpluff/context.c:362 -#, c-format -msgid "" -"The plug-in collection in path %s could not be registered due to " -"insufficient memory." -msgstr "" -"Die Plug-in-Sammlung in Pfad %s konnte aufgrund unzureichenden Speichers " -"nicht registriert werden." - -#: libcpluff/context.c:364 -#, c-format -msgid "The plug-in collection in path %s was registered." -msgstr "Die Plug-in-Sammlung in Pfad %s wurde registriert." - -#: libcpluff/context.c:397 -#, c-format -msgid "The plug-in collection in path %s was unregistered." -msgstr "Die Registrierung der Plug-in-Sammlung in Pfad %s wurde entfernt." - -#: libcpluff/context.c:406 -msgid "All plug-in collections were unregistered." -msgstr "Die Registrierung aller Plug-in-Sammlungen wurde entfernt." - -#: libcpluff/context.c:420 -#, c-format -msgid "At least one startup argument must be given in call to function %s." -msgstr "" -"Beim Aufruf der Funktion %s muss mindestens ein Startargument angegeben " -"werden." - -#: libcpluff/context.c:451 -#, c-format -msgid "Function %s was called from within a logger invocation." -msgstr "" -"Funktion %s wurde im Aufruf eines Protokollierungsprogramms aufgerufen." - -#: libcpluff/context.c:455 -#, c-format -msgid "Function %s was called from within an event listener invocation." -msgstr "" -"Funktion %s wurde im Aufruf einer Ereignisbehandlungsroutine aufgerufen." - -#: libcpluff/context.c:459 -#, c-format -msgid "Function %s was called from within a plug-in start function invocation." -msgstr "Funktion %s wurde im Aufruf einer Plug-in-Startfunktion aufgerufen." - -#: libcpluff/context.c:463 -#, c-format -msgid "Function %s was called from within a plug-in stop function invocation." -msgstr "Funktion %s wurde im Aufruf einer Plug-in-Stoppfunktion aufgerufen." - -#: libcpluff/context.c:466 -#, c-format -msgid "" -"Function %s was called from within a plug-in create function invocation." -msgstr "" -"Funktion %s wurde im Aufruf einer Plug-in-Erstellungsfunktion aufgerufen." - -#: libcpluff/context.c:469 -#, c-format -msgid "" -"Function %s was called from within a plug-in destroy function invocation." -msgstr "" -"Funktion %s wurde im Aufruf einer Plug-in-Zerstörungsfunktion aufgerufen." - -#. TRANSLATORS: The context owner (when it is a plug-in) used in some strings. -#. Search for "context owner" to find these strings. -#: libcpluff/context.c:519 -#, c-format -msgid "Plug-in %s" -msgstr "Plug-in %s" - -#. TRANSLATORS: The context owner (when it is the main program) used in some strings. -#. Search for "context owner" to find these strings. -#: libcpluff/context.c:523 -msgid "The main program" -msgstr "das Hauptprogramm" - -#: libcpluff/cpluff.c:143 -msgid "Attempt to destroy uninitialized framework." -msgstr "" - -#: libcpluff/cpluff.c:179 -#, c-format -msgid "C-Pluff: FATAL ERROR: %s\n" -msgstr "C-Pluff: SCHWERWIEGENDER FEHLER: %s\n" - -#: libcpluff/cpluff.c:187 -#, c-format -msgid "Argument %s has illegal NULL value in call to function %s." -msgstr "" -"Argument %s enthält beim Aufruf der Funktion %s einen ungültigen NULL-Wert." - -#: libcpluff/logging.c:135 -msgid "Logger could not be registered due to insufficient memory." -msgstr "" -"Protokollierungsprogramm konnte aufgrund unzureichenden Speichers nicht " -"registriert werden." - -#. TRANSLATORS: %s is the context owner -#: libcpluff/logging.c:139 -#, c-format -msgid "%s registered a logger." -msgstr "%s registrierte ein Protokollierungsprogramm." - -#. TRANSLATORS: %s is the context owner -#: libcpluff/logging.c:176 -#, c-format -msgid "%s unregistered a logger." -msgstr "%s entfernte die Registrierung eines Protokollierungsprogramms." - -#: libcpluff/logging.c:187 -msgid "Encountered a recursive logging request within a logger invocation." -msgstr "" -"Innerhalb eines Protokollierungsprogrammaufrufs wurde eine rekursive " -"Protokollierungsanfrage gefunden." - -#: libcpluff/logging.c:245 -#, c-format -msgid "Illegal severity value in call to %s." -msgstr "ungültiger Schweregrad im Aufruf von %s" - -#: libcpluff/pcontrol.c:121 -#, c-format -msgid "" -"Plug-in %s could not be installed because a plug-in with the same identifier " -"is already installed." -msgstr "" -"Plug-in %s konnte nicht installiert werden, da bereits ein Plug-in mit dem " -"gleichen Bezeichner installiert ist." - -#: libcpluff/pcontrol.c:161 -#, c-format -msgid "" -"Plug-in %s could not be installed because extension point %s conflicts with " -"an already installed extension point." -msgstr "" -"Plug-in %s konnte nicht installiert werden, da der Erweiterungspunkt %s in " -"Konflikt mit einem bereits installierten Erweiterungspunkt steht." - -#: libcpluff/pcontrol.c:229 -#, c-format -msgid "Plug-in %s could not be installed due to insufficient system resources." -msgstr "" -"Plug-in %s konnte aufgrund unzureichender Systemressourcen nicht installiert " -"werden." - -#: libcpluff/pcontrol.c:293 -#, c-format -msgid "" -"Plug-in %s could not be resolved due to version incompatibility with C-Pluff." -msgstr "" -"Plug-in %s konnte nicht gelöst werden, da die Version mit der von C-Pluff " -"inkompatibel ist." - -#: libcpluff/pcontrol.c:304 -#, c-format -msgid "" -"Plug-in %s runtime library could not be loaded due to insufficient memory." -msgstr "" -"Die Laufzeitbibliothek von Plug-in %s konnte aufgrund unzureichenden " -"Speichers nicht geladen werden." - -#: libcpluff/pcontrol.c:319 libcpluff/pcontrol.c:332 libcpluff/psymbol.c:192 -msgid "Unspecified error." -msgstr "nicht spezifizierter Fehler" - -#: libcpluff/pcontrol.c:321 -#, c-format -msgid "Plug-in %s runtime library %s could not be opened: %s" -msgstr "" -"Von Plug-in %s konnte die Laufzeitbibliothek %s nicht geöffnet werden: %s" - -#: libcpluff/pcontrol.c:334 -#, c-format -msgid "" -"Plug-in %s symbol %s containing plug-in runtime information could not be " -"resolved: %s" -msgstr "" -"Plug-in %s: Symbol %s, das Laufzeitinformationen des Plug-ins enthält, kann " -"nicht aufgelöst werden: %s" - -#: libcpluff/pcontrol.c:340 -#, c-format -msgid "Plug-in %s is missing a constructor or destructor function." -msgstr "Plug-in %s fehlt eine Konstruktor- oder Destruktor-Funktion." - -#: libcpluff/pcontrol.c:387 -#, c-format -msgid "" -"Plug-in %s could not be resolved due to version incompatibility with plug-in " -"%s." -msgstr "" -"Plug-in %s konnte nicht gelöst werden, da die Version mit der des Plug-ins " -"%s inkompatibel ist." - -#: libcpluff/pcontrol.c:397 -#, c-format -msgid "" -"Plug-in %s could not be resolved because it depends on plug-in %s which is " -"not installed." -msgstr "" -"Plug-in %s konnte nicht gelöst werden, da es vom nicht installierten Plug-in " -"%s abhängt." - -#: libcpluff/pcontrol.c:463 -#, c-format -msgid "" -"Plug-in %s could not be resolved because it depends on plug-in %s which " -"could not be resolved." -msgstr "" -"Plug-in %s konnte nicht gelöst werden, da es vom Plug-in %s abhängt, das " -"nicht gelöst werden konnte." - -#: libcpluff/pcontrol.c:505 -#, c-format -msgid "Plug-in %s could not be resolved because of insufficient memory." -msgstr "" -"Plug-in %s konnte aufgrund unzureichenden Speichers nicht gelöst werden." - -#: libcpluff/pcontrol.c:709 libcpluff/pcontrol.c:800 libcpluff/pcontrol.c:836 -#, c-format -msgid "Plug-in %s could not be started due to insufficient memory." -msgstr "" -"Plug-in %s konnte aufgrund unzureichenden Speichers nicht gestartet werden." - -#: libcpluff/pcontrol.c:714 -#, c-format -msgid "Plug-in %s failed to start due to plug-in runtime error." -msgstr "Start des Plug-ins %s aufgrund eines Laufzeitfehlers gescheitert" - -#: libcpluff/pcontrol.c:732 -#, c-format -msgid "Detected a runtime plug-in dependency loop: %s" -msgstr "" -"In einem Laufzeit-Plug-in wurde eine Abhängigkeitsschleife entdeckt: %s" - -#: libcpluff/pcontrol.c:734 -#, c-format -msgid "Detected a static plug-in dependency loop: %s" -msgstr "Es wurde eine statische Abhängigkeitsschleife entdeckt: %s" - -#: libcpluff/pcontrol.c:858 -#, c-format -msgid "Unknown plug-in %s could not be started." -msgstr "Das unbekannte Plug-in %s konnte nicht gestartet werden." - -#: libcpluff/pcontrol.c:1003 -#, c-format -msgid "Unknown plug-in %s could not be stopped." -msgstr "Das unbekannte Plug-in %s konnte nicht gestoppt werden." - -#: libcpluff/pcontrol.c:1214 -#, c-format -msgid "Unknown plug-in %s could not be uninstalled." -msgstr "Das unbekannte Plug-in %s konnte nicht deinstalliert werden." - -# FIXME Changed English version -#: libcpluff/pinfo.c:106 -#, c-format -msgid "Registered a new reference counted object at address %p." -msgstr "Es wurde ein Informationsobjekt mit der Adresse %p registriert." - -# FIXME Changed English version -#: libcpluff/pinfo.c:128 -#, fuzzy, c-format -msgid "Reference count of the object at address %p increased to %d." -msgstr "" -"Die Referenzzahl des Informationsobjekts mit der Adresse %p wurde auf %d " -"erhöht." - -# FIXME Changed English version -#: libcpluff/pinfo.c:130 -#, fuzzy, c-format -msgid "" -"Attempt to increase the reference count of an unknown object at address %p." -msgstr "" -"Die Referenzzahl eines unbekannten Informationsobjekts mit der Adresse %p " -"konnte nicht erhöht werden." - -# FIXME Changed English version -#: libcpluff/pinfo.c:144 -#, fuzzy, c-format -msgid "Reference count of the object at address %p decreased to %d." -msgstr "" -"Die Referenzzahl eines Informationsobjekts mit der Adresse %p konnte nicht " -"auf %d vermindert werden." - -# FIXME Changed English version -#: libcpluff/pinfo.c:148 -#, fuzzy, c-format -msgid "Deallocated the reference counted object at address %p." -msgstr "" -"Die Registrierung des Informationsobjekts an Adresse %p wurde entfernt." - -# FIXME Changed English version -#: libcpluff/pinfo.c:152 -#, fuzzy, c-format -msgid "Attempt to release an unknown reference counted object at address %p." -msgstr "" -"Ein unbekanntes Informationsobjekt mit der Adresse %p konnte nicht " -"veröffentlicht werden." - -# FIXME Changed English version -#: libcpluff/pinfo.c:173 -#, c-format -msgid "" -"An unreleased information object was encountered at address %p with " -"reference count %d when destroying the associated plug-in context. Not " -"releasing the object." -msgstr "" -"An Adresse %p wurde ein unveröffentlichtes Informationsobjekt mit der " -"Referenzzahl %d beim Zerstören des zugehörigen Plug-in-Kontexts vorgefunden. " -"Das Objekt wird nicht veröffentlicht." - -#: libcpluff/pinfo.c:190 -msgid "" -"The plug-in identifier argument to cp_get_plugin_info must not be NULL when " -"the main program calls it." -msgstr "" -"Das Plug-in-Bezeichnerargument für »cp_get_plugin_info« darf nicht NULL " -"sein, wenn es vom Hauptprogramm aufgerufen wird." - -#: libcpluff/pinfo.c:201 -#, c-format -msgid "Could not return information about unknown plug-in %s." -msgstr "" -"Es konnten keine Informationen über das unbekannte Plug-in %s zurückgegeben " -"werden." - -#: libcpluff/pinfo.c:271 -msgid "Plug-in information could not be returned due to insufficient memory." -msgstr "" -"Aufgrund unzureichenden Speichers konnten keine Plug-in-Informationen " -"zurückgegeben werden." - -#: libcpluff/pinfo.c:362 -msgid "" -"Extension point information could not be returned due to insufficient memory." -msgstr "" -"Aufgrund unzureichenden Speichers konnten keine " -"Erweiterungspunktinformationen zurückgegeben werden." - -#: libcpluff/pinfo.c:478 -msgid "Extension information could not be returned due to insufficient memory." -msgstr "" -"Aufgrund unzureichenden Speichers konnten keine Erweiterungsinformationen " -"zurückgegeben werden." - -#: libcpluff/pinfo.c:575 -msgid "A plug-in listener could not be registered due to insufficient memory." -msgstr "" -"Aufgrund unzureichenden Speichers konnte ein Programm, das auf Plug-ins " -"wartet, nicht registriert werden." - -#. TRANSLATORS: %s is the context owner -#: libcpluff/pinfo.c:579 -#, c-format -msgid "%s registered a plug-in listener." -msgstr "%s registrierte ein Programm, das auf Plug-ins wartet." - -#. TRANSLATORS: %s is the context owner -#: libcpluff/pinfo.c:601 -#, c-format -msgid "%s unregistered a plug-in listener." -msgstr "" -"%s entfernte die Registrierung eines Programms, das auf Plug-ins wartet." - -#: libcpluff/pinfo.c:618 -#, c-format -msgid "Plug-in %s has been uninstalled." -msgstr "Plug-in %s wurde deinstalliert." - -#: libcpluff/pinfo.c:622 -#, c-format -msgid "Plug-in %s has been installed." -msgstr "Plug-in %s wurde installiert." - -#: libcpluff/pinfo.c:624 -#, c-format -msgid "Plug-in %s runtime library has been unloaded." -msgstr "" -"Die Laufzeitbibliothek des Plug-ins %s wurde aus dem Speicher entfernt." - -#: libcpluff/pinfo.c:629 -#, c-format -msgid "Plug-in %s runtime library has been loaded." -msgstr "Die Laufzeitbibliothek des Plug-ins %s wurde geladen." - -#: libcpluff/pinfo.c:631 -#, c-format -msgid "Plug-in %s has been stopped." -msgstr "Plug-in %s wurde gestoppt." - -#: libcpluff/pinfo.c:635 -#, c-format -msgid "Plug-in %s is starting." -msgstr "Plug-in %s ist gestartet." - -#: libcpluff/pinfo.c:638 -#, c-format -msgid "Plug-in %s is stopping." -msgstr "Plug-in %s wird gestoppt." - -#: libcpluff/pinfo.c:641 -#, c-format -msgid "Plug-in %s has been started." -msgstr "Plug-in %s wurde gestartet." - -#: libcpluff/ploader.c:166 -#, c-format -msgid "Suspicious plug-in descriptor content in %s, line %d, column %d (%s)." -msgstr "verdächtiger Plug-in-Deskriptorinhalt in %s, Zeile %d, Spalte %d (%s)" - -#: libcpluff/ploader.c:173 -#, c-format -msgid "Invalid plug-in descriptor content in %s, line %d, column %d (%s)." -msgstr "ungültiger Plug-in-Deskriptorinhalt in %s, Zeile %d, Spalte %d (%s)" - -#: libcpluff/ploader.c:193 -#, c-format -msgid "" -"Insufficient system resources to parse plug-in descriptor content in %s, " -"line %d, column %d." -msgstr "" -"Die Systemressourcen reichen nicht zum Auswerten des Plug-in-" -"Deskriptorinhalts in %s, Zeile %d, Spalte %d aus." - -#: libcpluff/ploader.c:247 -#, c-format -msgid "required attribute %s for element %s has an empty value" -msgstr "Wert des benötigten Attributs %s für Element %s ist leer" - -#: libcpluff/ploader.c:253 -#, c-format -msgid "required attribute %s missing for element %s" -msgstr "benötigtes Attribut %s für Element %s fehlt" - -#: libcpluff/ploader.c:287 -#, c-format -msgid "ignoring unknown attribute %s for element %s" -msgstr "unbekanntes Attribut %s für Element %s wird ignoriert" - -#: libcpluff/ploader.c:380 -#, c-format -msgid "ignoring unexpected element %s and its contents" -msgstr "unerwartetes Element %s und sein Inhalt werden ignoriert" - -#: libcpluff/ploader.c:763 -#, c-format -msgid "unknown boolean value: %s" -msgstr "unbekannter boolescher Wert: %s" - -#: libcpluff/ploader.c:973 -#, c-format -msgid "unexpected closing tag for %s" -msgstr "unerwartete schließende Kennzeichnung für %s" - -#: libcpluff/ploader.c:1037 -#, c-format -msgid "XML parsing error in %s, line %d, column %d (%s)." -msgstr "XML-Auswertungsfehler in %s, Zeile %d, Spalte %d (%s)" - -#: libcpluff/ploader.c:1081 -#, c-format -msgid "Plug-in descriptor in %s is invalid." -msgstr "Plug-in-Deskriptor in %s ist ungültig." - -#: libcpluff/ploader.c:1085 -#, c-format -msgid "An I/O error occurred while loading a plug-in descriptor from %s." -msgstr "" -"Beim Laden eines Plug-in-Deskriptors von %s ist ein E/A-Fehler aufgetreten." - -#: libcpluff/ploader.c:1089 -#, c-format -msgid "Insufficient system resources to load a plug-in descriptor from %s." -msgstr "" -"Die Systemressourcen reichen nicht aus, um einen Plug-in-Deskriptor von %s " -"zu laden." - -#: libcpluff/ploader.c:1093 -#, c-format -msgid "Failed to load a plug-in descriptor from %s." -msgstr "Laden eines Plug-in-Deskriptors von %s fehlgeschlagen" - -#: libcpluff/pscan.c:64 -msgid "Plug-in scan is starting." -msgstr "Plug-in-Scan startet." - -#: libcpluff/pscan.c:112 -#, c-format -msgid "" -"Could not check possible plug-in location %s%c%s due to insufficient system " -"resources." -msgstr "" -"Möglicher Plug-in-Speicherort %s%c%s konnte aufgrund unzureichender " -"Systemressourcen nicht überprüft werden." - -#: libcpluff/pscan.c:144 -#, c-format -msgid "" -"Plug-in %s version %s could not be loaded due to insufficient system " -"resources." -msgstr "" -"Von Plug-in %s konnte die Version %s aufgrund unzureichender " -"Systemressourcen nicht geladen werden." - -#: libcpluff/pscan.c:156 -#, c-format -msgid "Could not read plug-in directory %s: %s" -msgstr "Plug-in-Verzeichnis %s konnte nicht gelesen werden: %s" - -#: libcpluff/pscan.c:162 -#, c-format -msgid "Could not open plug-in directory %s: %s" -msgstr "Plug-in-Verzeichnis %s konnte nicht geöffnet werden: %s" - -#: libcpluff/pscan.c:276 -msgid "Plug-in scan has completed successfully." -msgstr "Plug-in-Scan erfolgreich abgeschlossen" - -#: libcpluff/pscan.c:279 -msgid "Could not scan plug-ins due to insufficient system resources." -msgstr "" -"Plug-ins konnten aufgrund unzureichender Systemressourcen nicht gescannt " -"werden." - -#: libcpluff/pscan.c:282 -msgid "Could not scan plug-ins." -msgstr "Plug-ins konnten nicht gescannt werden." - -#: libcpluff/psymbol.c:83 -msgid "Only plug-ins can define context specific symbols." -msgstr "Nur Plug-ins können kontextspezifische Symbole definieren." - -#: libcpluff/psymbol.c:119 -#, c-format -msgid "Plug-in %s could not define symbol %s due to insufficient memory." -msgstr "" -"Plug-in %s konnte Symbol %s aufgrund unzureichenden Speichers nicht " -"definieren." - -#: libcpluff/psymbol.c:122 -#, c-format -msgid "Plug-in %s tried to redefine symbol %s." -msgstr "Plug-in %s versuchte, das Symbol %s neu zu definieren." - -#: libcpluff/psymbol.c:167 -#, c-format -msgid "Symbol %s in unknown plug-in %s could not be resolved." -msgstr "Symbol %s in unbekanntem Plug-in %s konnte nicht aufgelöst werden." - -#: libcpluff/psymbol.c:175 -#, c-format -msgid "" -"Symbol %s in plug-in %s could not be resolved because the plug-in could not " -"be started." -msgstr "" -"Symbol %s in Plug-in %s konnte nicht aufgelöst werden, da das Plug-in nicht " -"gestartet werden konnte." - -#: libcpluff/psymbol.c:194 -#, c-format -msgid "Symbol %s in plug-in %s could not be resolved: %s" -msgstr "Symbol %s in Plug-in %s konnte nicht aufgelöst werden: %s" - -#: libcpluff/psymbol.c:245 -#, fuzzy, c-format -msgid "A dynamic dependency was created from plug-in %s to plug-in %s." -msgstr "" -"Eine dynamische Abhängigkeit des Plug-ins %s von Plugin %s wurde entfernt." - -#. TRANSLATORS: First %s is the context owner -#: libcpluff/psymbol.c:255 -#, fuzzy, c-format -msgid "%s resolved symbol %s defined by plug-in %s." -msgstr "" -"%s veröffentlichte das Symbol an Adresse %p, das durch das Plug-in %s " -"definiert wurde." - -#: libcpluff/psymbol.c:275 -#, c-format -msgid "" -"Symbol %s in plug-in %s could not be resolved due to insufficient memory." -msgstr "" -"Symbol %s in Plug-in %s konnte aufgrund unzureichenden Speichers nicht " -"aufgelöst werden." - -#: libcpluff/psymbol.c:302 -#, c-format -msgid "Could not release unknown symbol at address %p." -msgstr "Unbekanntes Symbol an Adresse %p konnte nicht aufgelöst werden." - -#. TRANSLATORS: First %s is the context owner -#: libcpluff/psymbol.c:321 -#, c-format -msgid "%s released the symbol at address %p defined by plug-in %s." -msgstr "" -"%s veröffentlichte das Symbol an Adresse %p, das durch das Plug-in %s " -"definiert wurde." - -#: libcpluff/psymbol.c:333 -#, c-format -msgid "A dynamic dependency from plug-in %s to plug-in %s was removed." -msgstr "" -"Eine dynamische Abhängigkeit des Plug-ins %s von Plugin %s wurde entfernt." - -#: libcpluff/serial.c:64 -msgid "Only plug-ins can register run functions." -msgstr "Nur Plug-ins können Ausführungsfunktionen registrieren." - -#: libcpluff/serial.c:68 -msgid "Only starting or active plug-ins can register run functions." -msgstr "" -"Nur startende oder aktive Plug-ins können Ausführungsfunktionen registrieren." - -#: libcpluff/serial.c:115 -msgid "Could not register a run function due to insufficient memory." -msgstr "" -"Eine Ausführungsfunktion konnte aufgrund unzureichenden Speichers nicht " -"registriert werden." - -#: libcpluff/thread_posix.c:118 -#, c-format -msgid "Could not lock a mutex due to error %d." -msgstr "Ein Mutex konnte aufgrund des Fehlers %d nicht gesperrt werden." - -#: libcpluff/thread_posix.c:126 -#, c-format -msgid "Could not unlock a mutex due to error %d." -msgstr "" -"Die Sperre eines Mutex konnte aufgrund des Fehlers %d nicht aufgehoben " -"werden." - -#: libcpluff/thread_posix.c:138 libcpluff/thread_posix.c:190 -#, c-format -msgid "Could not wait for a condition variable due to error %d." -msgstr "" -"Aufgrund des Fehlers %d konnte nicht auf eine Bedingungsvariable gewartet " -"werden." - -#: libcpluff/thread_posix.c:163 libcpluff/thread_posix.c:185 -#, c-format -msgid "Could not signal a condition variable due to error %d." -msgstr "" -"Aufgrund des Fehlers %d konnte einer Bedingungsvariable nichts gemeldet " -"werden." - -#: libcpluff/thread_posix.c:167 libcpluff/thread_windows.c:210 -msgid "Internal C-Pluff error: Unauthorized attempt at unlocking a mutex." -msgstr "" -"Interner C-Pluff-Fehler: unautorisierter Versuch die Sperre eines Mutex " -"aufzuheben" - -#: libcpluff/thread_posix.c:198 libcpluff/thread_windows.c:244 -msgid "Internal C-Pluff error: Unauthorized attempt at waiting on a mutex." -msgstr "" -"Interner C-Pluff-Fehler: unautorisierter Versuch auf einen Mutex zu warten" - -#: libcpluff/thread_posix.c:214 -#, c-format -msgid "Could not broadcast a condition variable due to error %d." -msgstr "" -"Aufgrund des Fehlers %d konnte eine Bedingungsvariable nicht übertragen " -"werden." - -#: libcpluff/thread_posix.c:218 libcpluff/thread_windows.c:258 -msgid "Internal C-Pluff error: Unauthorized attempt at signaling a mutex." -msgstr "" -"Interner C-Pluff-Fehler: unautorisierter Versuch beim Melden eines Mutex." - -#: libcpluff/thread_windows.c:126 -msgid "unknown error" -msgstr "unbekannter Fehler" - -#: libcpluff/thread_windows.c:138 -#, c-format -msgid "Could not lock a mutex due to error %ld: %s" -msgstr "Ein Mutex konnte aufgrund des Fehlers %ld nicht blockiert werden: %s" - -#: libcpluff/thread_windows.c:147 -#, c-format -msgid "Could not release a mutex due to error %ld: %s" -msgstr "" -"Ein Mutex konnte aufgrund des Fehlers %ld nicht veröffentlicht werden: %s" - -#: libcpluff/thread_windows.c:156 -#, c-format -msgid "Could not wait for an event due to error %ld: %s" -msgstr "" -"Aufgrund des Fehlers %ld konnte nicht auf ein Ereignis gewartet werden: %s." - -#: libcpluff/thread_windows.c:165 -#, c-format -msgid "Could not set an event due to error %ld: %s" -msgstr "Aufgrund des Fehlers %ld konnte kein Ereignis gesetzt werden: %s" - -#: libcpluff/thread_windows.c:174 -#, c-format -msgid "Could not reset an event due to error %ld: %s" -msgstr "Aufgrund des Fehlers %ld konnte kein Ereignis zurückgesetzt werden: %s" - -#. TRANSLATORS: A formatting string for loader error messages. -#: loader/loader.c:121 -#, c-format -msgid "C-Pluff Loader: ERROR: %s\n" -msgstr "C-Pluff-Lader: FEHLER: %s\n" - -#: loader/loader.c:152 -msgid "Memory allocation failed." -msgstr "Speicherreservierung fehlgeschlagen" - -#. TRANSLATORS: This is a version string displayed on startup. -#: loader/loader.c:192 loader/loader.c:328 -#, c-format -msgid "C-Pluff Loader, version %s\n" -msgstr "C-Pluff-Lader, Version %s\n" - -#: loader/loader.c:194 -msgid "" -"usage: cpluff-loader <option>... [--] <arguments passed to plug-ins>\n" -"options:\n" -" -h print this help text\n" -" -c DIR add plug-in collection in directory DIR\n" -" -p DIR add plug-in in directory DIR\n" -" -s PID start plug-in PID\n" -" -v be more verbose (repeat for increased verbosity)\n" -" -q be quiet\n" -" -V print C-Pluff version number and exit\n" -msgstr "" -"Aufruf: cpluff-loader <Option> … [--] <an Plug-ins übergebene Argumente>\n" -"Optionen:\n" -" -h gibt diesen Hilfetext aus\n" -" -c VERZ fügt die Plug-in-Sammlung dem Verzeichnis VERZ hinzu\n" -" -p VERZ fügt das Plug-in dem Verzeichnis VERZ hinzu\n" -" -s PID startet Plug-in PID\n" -" -v detailliertere Ausgabe (wiederholen, um Detailgrad zu erhöhen)\n" -" -q stiller Modus\n" -" -V gibt die Versionsnummer von C-Pluff aus und beendet sich\n" - -#. TRANSLATORS: A formatting string for log messages caused by plug-in activity. -#: loader/loader.c:239 -#, c-format -msgid "C-Pluff: %s: [%s] %s\n" -msgstr "C-Pluff: %s: [%s] %s\n" - -#. TRANSLATORS: A formatting string for log messages caused by loader activity. -#: loader/loader.c:242 -#, c-format -msgid "C-Pluff: %s: [loader] %s\n" -msgstr "C-Pluff: %s: [Lader] %s\n" - -#: loader/loader.c:264 -msgid "The C-Pluff initialization failed." -msgstr "Die Initialisierung von C-Pluff ist fehlgeschlagen." - -#: loader/loader.c:299 loader/loader.c:307 -msgid "Quiet and verbose modes are mutually exclusive." -msgstr "Stiller und detailierter Modus schließen sich gegenseitig aus." - -#: loader/loader.c:320 -msgid "Unrecognized option or argument. Try option -h for help." -msgstr "Option oder Argumente unbekannt. Mit der Option -h erhalten Sie Hilfe." - -#: loader/loader.c:338 -msgid "No plug-ins to load. Try option -h for help." -msgstr "keine Plug-ins zu Laden. Mit der Option -h erhalten Sie Hilfe." - -#: loader/loader.c:343 -msgid "Plug-in context creation failed." -msgstr "Die Erstellung des Plug-in-Kontextes schlug fehl." - -#: loader/loader.c:376 -#, c-format -msgid "Failed to load a plug-in from path %s." -msgstr "Das Laden des Plug-ins aus dem Pfad %s ist fehlgeschlagen." - -#: loader/loader.c:379 -#, c-format -msgid "Failed to install plug-in %s." -msgstr "Installieren des Plug-ins %s ist fehlgeschlagen." - -#: loader/loader.c:388 -#, c-format -msgid "Failed to register a plug-in collection at path %s." -msgstr "Registrieren einer Plug-in-Sammlung in Pfad %s ist fehlgeschlagen." - -#: loader/loader.c:393 -msgid "Failed to load and install plug-ins from plug-in collections." -msgstr "" -"Das Laden und Installieren von Plug-ins einer Plug-in-Sammlung ist " -"fehlgeschlagen." - -#: loader/loader.c:400 -#, c-format -msgid "Failed to start plug-in %s." -msgstr "Starten von Plug-in %s fehlgeschlagen." diff --git a/lib/cpluff/po/fi.po b/lib/cpluff/po/fi.po deleted file mode 100644 index beb85893d6..0000000000 --- a/lib/cpluff/po/fi.po +++ /dev/null @@ -1,1207 +0,0 @@ -# Finnish translations for C-Pluff package. -# Copyright (C) 2007 Johannes Lehtinen -# This file is distributed under the same license as the C-Pluff package. -# Johannes Lehtinen <johannes.lehtinen@iki.fi>, 2007. -# -msgid "" -msgstr "" -"Project-Id-Version: C-Pluff 0.1.1\n" -"Report-Msgid-Bugs-To: johannes.lehtinen@iki.fi\n" -"POT-Creation-Date: 2016-01-01 22:47+0200\n" -"PO-Revision-Date: 2007-03-26 08:40+0300\n" -"Last-Translator: Johannes Lehtinen <johannes.lehtinen@iki.fi>\n" -"Language-Team: Finnish <translation-team-fi@lists.sourceforge.net>\n" -"Language: fi\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: console/cmdinput_basic.c:52 -msgid "ERROR: Command line is too long.\n" -msgstr "VIRHE: Komentorivi on liian pitkä.\n" - -#: console/console.c:77 -msgid "displays available commands" -msgstr "näyttää mahdolliset komennot" - -#: console/console.c:78 -msgid "sets the displayed log level" -msgstr "asettaa näytettävien lokiviestien vakavuustason" - -#: console/console.c:79 -msgid "registers a plug-in collection" -msgstr "rekisteröi liitännäiskokoelman" - -#: console/console.c:80 -msgid "unregisters a plug-in collection" -msgstr "poistaa liitännäiskokoelman rekisteröinnin" - -#: console/console.c:81 -msgid "unregisters all plug-in collections" -msgstr "poistaa kaikkien liitännäiskokoelmien rekisteröinnin" - -#: console/console.c:82 -msgid "loads and installs a plug-in from the specified path" -msgstr "lataa ja asentaa annetusta polusta löytyvän liitännäisen" - -#: console/console.c:83 -msgid "scans plug-ins in the registered plug-in collections" -msgstr "etsii liitännäisiä rekisteröidyistä liitännäiskokoelmista" - -#: console/console.c:84 -msgid "sets context startup arguments" -msgstr "asettaa ympäristön käynnistysparametrit" - -#: console/console.c:85 -msgid "starts a plug-in" -msgstr "käynnistää liitännäisen" - -#: console/console.c:86 -msgid "runs one plug-in run function" -msgstr "ajaa yhden liitännäistehtävän" - -#: console/console.c:87 -msgid "runs plug-in run functions until all work is done" -msgstr "ajaa liitännäistehtäviä kunnes kaikki tehtävät on suoritettu" - -#: console/console.c:88 -msgid "stops a plug-in" -msgstr "pysäyttää liitännäisen" - -#: console/console.c:89 -msgid "stops all plug-ins" -msgstr "pysäyttää kaikki liitännäiset" - -#: console/console.c:90 -msgid "uninstalls a plug-in" -msgstr "poistaa liitännäisen muistista" - -#: console/console.c:91 -msgid "uninstalls all plug-ins" -msgstr "poistaa kaikki liitännäiset muistista" - -#: console/console.c:92 -msgid "lists the installed plug-ins" -msgstr "listaa asennetut liitännäiset" - -#: console/console.c:93 -msgid "lists the installed extension points" -msgstr "listaa asennetut laajennuskohteet" - -#: console/console.c:94 -msgid "lists the installed extensions" -msgstr "listaa asennetut laajennokset" - -#: console/console.c:95 -msgid "shows static plug-in information" -msgstr "näyttää staattista tietoa liitännäisestä" - -#: console/console.c:96 console/console.c:97 -msgid "quits the program" -msgstr "lopettaa ohjelman" - -#: console/console.c:103 -msgid "enables upgrades of installed plug-ins" -msgstr "sallii asennettujen liitännäisten päivittämisen" - -#: console/console.c:104 -msgid "stops all plug-ins on first upgrade" -msgstr "pysäyttää kaikki liitännäiset päivityksen yhteydessä" - -#: console/console.c:105 -msgid "stops all plug-ins on first install or upgrade" -msgstr "pysäyttää kaikki liitännäiset asennuksen tai päivityksen yhteydessä" - -#: console/console.c:106 -msgid "restarts the currently active plug-ins after the scan" -msgstr "käynnistää aktiiviset liitännäiset uudelleen virkistyksen jälkeen" - -#: console/console.c:112 -msgid "detailed debug messages" -msgstr "yksityiskohtaiset vianpaikannusviestit" - -#: console/console.c:113 -msgid "informational messages" -msgstr "informatiiviset viestit" - -#: console/console.c:114 -msgid "warnings about possible problems" -msgstr "mahdollisista ongelmista varoittavat viestit" - -#: console/console.c:115 -msgid "error messages" -msgstr "virheilmoitukset" - -#: console/console.c:116 -msgid "disable logging" -msgstr "estä lokiviestit" - -#: console/console.c:153 -msgid "Command has too many arguments.\n" -msgstr "Komennolla on liikaa parametreja.\n" - -#: console/console.c:176 -msgid "The following commands are available:\n" -msgstr "Seuraavat komennot ovat käytettävissä:\n" - -#. TRANSLATORS: A tag for debug level log entries. -#: console/console.c:187 loader/loader.c:212 -msgid "DEBUG" -msgstr "DEBUG" - -#. TRANSLATORS: A tag for info level log entries. -#: console/console.c:191 loader/loader.c:217 -msgid "INFO" -msgstr "INFO" - -#. TRANSLATORS: A tag for warning level log entries. -#: console/console.c:195 loader/loader.c:222 -msgid "WARNING" -msgstr "VAROITUS" - -#. TRANSLATORS: A tag for error level log entries. -#: console/console.c:199 loader/loader.c:227 -msgid "ERROR" -msgstr "VIRHE" - -#. TRANSLATORS: A tag for unknown severity level. -#: console/console.c:203 loader/loader.c:232 -msgid "UNKNOWN" -msgstr "TUNTEMATON" - -#. TRANSLATORS: Used when displaying log messages originating -#. from console activities. -#: console/console.c:211 -msgid "console" -msgstr "konsoli" - -#. TRANSLATORS: Usage instructions for setting log level -#: console/console.c:218 -#, c-format -msgid "Usage: %s <level>\n" -msgstr "Käyttö: %s <taso>\n" - -#: console/console.c:228 -#, c-format -msgid "Unknown log level %s.\n" -msgstr "Tuntematon lokiviestien taso %s.\n" - -#: console/console.c:229 -msgid "Available log levels are:\n" -msgstr "Mahdolliset lokiviestien tasot ovat:\n" - -#. TRANSLATORS: The first %s is the log level name and the second the localized log level description. -#: console/console.c:240 console/console.c:893 -#, c-format -msgid "Using display log level %s (%s).\n" -msgstr "Näytetään lokiviestit tasolla %s (%s).\n" - -#. TRANSLATORS: Return status for a successfull API call -#: console/console.c:249 -msgid "success" -msgstr "onnistui" - -#: console/console.c:251 -msgid "insufficient system resources" -msgstr "riittämättömät järjestelmäresurssit" - -#: console/console.c:253 -msgid "an unknown object was specified" -msgstr "annettu tuntematon objekti" - -#: console/console.c:255 -msgid "an input or output error" -msgstr "luku- tai kirjoitusvirhe" - -#: console/console.c:257 -msgid "a malformed plug-in descriptor" -msgstr "viallinen liitännäiskuvaus" - -#: console/console.c:259 -msgid "a plug-in or symbol conflicts with an existing one" -msgstr "" -"liitännäinen tai symboli on ristiriidassa olemassaolevan liitännäisen tai " -"symbolin kanssa" - -#: console/console.c:261 -msgid "unsatisfiable dependencies" -msgstr "riippuvuuksia ei pystytä täyttämään" - -#: console/console.c:263 -msgid "a plug-in runtime library encountered an error" -msgstr "liitännäisen ajonaikainen kirjasto kohtasi virheen" - -#: console/console.c:265 -msgid "unknown error code" -msgstr "tuntematon virhekoodi" - -#: console/console.c:270 -#, c-format -msgid "API function %s failed with error code %d (%s).\n" -msgstr "Rajapintafunktio %s epäonnistui palauttaen virhekoodin %d (%s).\n" - -#. TRANSLATORS: Usage instructions for registering a plug-in collection -#. TRANSLATORS: Usage instructions for unregistering a plug-in collection -#. TRANSLATORS: Usage instructios for loading a plug-in -#: console/console.c:281 console/console.c:292 console/console.c:315 -#, c-format -msgid "Usage: %s <path>\n" -msgstr "Käyttö: %s <polku>\n" - -#: console/console.c:285 -#, c-format -msgid "Registered a plug-in collection in path %s.\n" -msgstr "Rekisteröitiin liitännäiskokoelma polussa %s.\n" - -#: console/console.c:295 -#, c-format -msgid "Unregistered a plug-in collection in path %s.\n" -msgstr "Poistettiin polussa %s olevan liitännäiskokoelman rekisteröinti.\n" - -#. TRANSLATORS: Usage instructions for unregistering all plug-in collections -#. TRANSLATORS: Usage instructions for listing plug-ins -#. TRANSLATORS: Usage instructions for listing extension points -#. TRANSLATORS: Usage instructions for listing extensions -#. TRANSLATORS: Usage instructions for running one plug-in run function -#. TRANSLATORS: Usage instructions for running plug-in run functions until all work is done -#. TRANSLATORS: Usage instructions for stopping all plug-ins -#. TRANSLATORS: Usage instructions for uninstalling all plug-ins -#: console/console.c:302 console/console.c:387 console/console.c:682 -#: console/console.c:707 console/console.c:786 console/console.c:800 -#: console/console.c:823 console/console.c:846 -#, c-format -msgid "Usage: %s\n" -msgstr "Käyttö: %s\n" - -#: console/console.c:305 -msgid "Unregistered all plug-in collections.\n" -msgstr "Poistettiin kaikkien liitännäiskokoelmien rekisteröinnit.\n" - -#: console/console.c:322 -#, c-format -msgid "Installed plug-in %s.\n" -msgstr "Asennettiin liitännäinen %s.\n" - -#: console/console.c:343 -#, c-format -msgid "Unknown flag %s.\n" -msgstr "Tuntematon lippu %s.\n" - -#. TRANSLATORS: Usage instructions for scanning plug-ins -#: console/console.c:345 -#, c-format -msgid "Usage: %s [<flag>...]\n" -msgstr "Käyttö: %s [<lippu>...]\n" - -#: console/console.c:346 -msgid "Available flags are:\n" -msgstr "Käytettävissä olevat liput ovat:\n" - -#: console/console.c:358 -msgid "Plug-ins loaded.\n" -msgstr "Liitännäiset ladattiin.\n" - -#: console/console.c:364 -msgid "uninstalled" -msgstr "poistettu" - -#: console/console.c:366 -msgid "installed" -msgstr "asennettu" - -#: console/console.c:368 -msgid "resolved" -msgstr "valmiudessa" - -#: console/console.c:370 -msgid "starting" -msgstr "käynnistymässä" - -#: console/console.c:372 -msgid "stopping" -msgstr "pysähtymässä" - -#: console/console.c:374 -msgid "active" -msgstr "aktiivinen" - -#: console/console.c:376 -msgid "unknown" -msgstr "tuntematon" - -#: console/console.c:392 -msgid "Installed plug-ins:\n" -msgstr "Asennetut liitännäiset:\n" - -#: console/console.c:394 console/console.c:689 console/console.c:714 -msgid "IDENTIFIER" -msgstr "TUNNISTE" - -#: console/console.c:395 -msgid "VERSION" -msgstr "VERSIO" - -#: console/console.c:396 -msgid "STATE" -msgstr "TILA" - -#: console/console.c:397 console/console.c:690 console/console.c:715 -msgid "NAME" -msgstr "NIMI" - -#: console/console.c:421 console/console.c:539 console/console.c:762 -msgid "Memory allocation failed.\n" -msgstr "Muistin varaaminen epäonnistui.\n" - -#. TRANSLATORS: Usage instructions for showing plug-in information -#. TRANSLATORS: Usage instructions for starting a plug-in -#. TRANSLATORS: Usage instructions for stopping a plug-in -#. TRANSLATORS: Usage instructions for uninstalling a plug-in -#: console/console.c:611 console/console.c:774 console/console.c:812 -#: console/console.c:835 -#, c-format -msgid "Usage: %s <plugin>\n" -msgstr "Käyttö: %s <liitännäinen>\n" - -#: console/console.c:687 -msgid "Installed extension points:\n" -msgstr "Asennetut laajennuskohteet:\n" - -#: console/console.c:712 -msgid "Installed extensions:\n" -msgstr "Asennetut laajennokset:\n" - -#: console/console.c:719 -msgid ".<anonymous>" -msgstr ".<nimetön>" - -#. TRANSLATORS: Usage instructions for setting context arguments -#: console/console.c:760 -#, c-format -msgid "Usage: %s [<arg>...]\n" -msgstr "Käyttö: %s [<param>...]\n" - -#: console/console.c:765 -msgid "Plug-in context startup arguments have been set.\n" -msgstr "Liitännäisympäristön käynnistysparametrit on asetettu.\n" - -#: console/console.c:778 -#, c-format -msgid "Started plug-in %s.\n" -msgstr "Käynnistettiin liitännäinen %s.\n" - -#: console/console.c:790 -msgid "Ran one plug-in run function. There are pending run functions.\n" -msgstr "Suoritettiin yksi liitännäistehtävä. Lisää tehtäviä on odottamassa.\n" - -#: console/console.c:792 -msgid "Ran one plug-in run function. No more pending run functions.\n" -msgstr "Suoritettiin yksi liitännäistehtävä. Kaikki tehtävät suoritettu.\n" - -#: console/console.c:803 -msgid "Ran plug-in run functions. No more pending run functions.\n" -msgstr "Suoritettiin kaikki liitännäistehtävät.\n" - -#: console/console.c:816 -#, c-format -msgid "Stopped plug-in %s.\n" -msgstr "Pysäytettiin liitännäinen %s.\n" - -#: console/console.c:826 -msgid "Stopped all plug-ins.\n" -msgstr "Pysäytettiin kaikki liitännäiset.\n" - -#: console/console.c:839 -#, c-format -msgid "Uninstalled plug-in %s.\n" -msgstr "Poistettiin liitännäinen %s muistista.\n" - -#: console/console.c:849 -msgid "Uninstalled all plug-ins.\n" -msgstr "Poistettiin kaikki liitännäiset muistista.\n" - -#. TRANSLATORS: This is a version string displayed on startup. -#: console/console.c:877 -#, c-format -msgid "C-Pluff Console, version %s\n" -msgstr "C-Pluff -konsoli, versio %s\n" - -#. TRANSLATORS: This is a version string displayed on startup. -#. The first %s is version and the second %s is platform type. -#: console/console.c:881 loader/loader.c:332 -#, c-format -msgid "C-Pluff Library, version %s for %s\n" -msgstr "C-Pluff -kirjasto, versio %s alustalle %s\n" - -#: console/console.c:896 -msgid "Type \"help\" for help on available commands.\n" -msgstr "Kirjoita \"help\" saadaksesi tietoja mahdollisista komennoista.\n" - -#. TRANSLATORS: This is the input prompt for cpluff-console. -#: console/console.c:900 -msgid "C-Pluff Console > " -msgstr "C-Pluff -konsoli > " - -#: console/console.c:928 -#, c-format -msgid "Unknown command %s.\n" -msgstr "Tuntematon komento %s.\n" - -#: libcpluff/context.c:274 -msgid "Only the main program can destroy a plug-in context." -msgstr "Vain pääohjelma voi tuhota liitännäisympäristön." - -#: libcpluff/context.c:362 -#, c-format -msgid "" -"The plug-in collection in path %s could not be registered due to " -"insufficient memory." -msgstr "" -"Liitännäiskokoelmaa polussa %s ei voitu rekisteröidä riittämättömän muistin " -"takia." - -#: libcpluff/context.c:364 -#, c-format -msgid "The plug-in collection in path %s was registered." -msgstr "Liitännäiskokoelma polussa %s rekisteröitiin." - -#: libcpluff/context.c:397 -#, c-format -msgid "The plug-in collection in path %s was unregistered." -msgstr "Polussa %s olevan liitännäiskokoelman rekisteröinti poistettiin." - -#: libcpluff/context.c:406 -msgid "All plug-in collections were unregistered." -msgstr "Kaikkien liitännäiskokoelmien rekisteröinnit poistettiin." - -#: libcpluff/context.c:420 -#, c-format -msgid "At least one startup argument must be given in call to function %s." -msgstr "" -"Käynnistysparametreja pitää olla vähintään yksi kutsuttaessa funktiota %s." - -#: libcpluff/context.c:451 -#, c-format -msgid "Function %s was called from within a logger invocation." -msgstr "Funktiota %s kutsuttiin lokitietojen käsittelijän kautta." - -#: libcpluff/context.c:455 -#, c-format -msgid "Function %s was called from within an event listener invocation." -msgstr "Funktiota %s kutsuttiin tapahtumakuuntelijan kautta." - -#: libcpluff/context.c:459 -#, c-format -msgid "Function %s was called from within a plug-in start function invocation." -msgstr "Funktiota %s kutsuttiin liitännäisen käynnistysfunktion kautta." - -#: libcpluff/context.c:463 -#, c-format -msgid "Function %s was called from within a plug-in stop function invocation." -msgstr "Funktiota %s kutsuttiin liitännäisen pysäytysfunktion kautta." - -#: libcpluff/context.c:466 -#, c-format -msgid "" -"Function %s was called from within a plug-in create function invocation." -msgstr "Funktiota %s kutsuttiin liitännäisen luontifunktion kautta." - -#: libcpluff/context.c:469 -#, c-format -msgid "" -"Function %s was called from within a plug-in destroy function invocation." -msgstr "Funktiota %s kutsuttiin liitännäisen tuhoamisfunktion kautta." - -#. TRANSLATORS: The context owner (when it is a plug-in) used in some strings. -#. Search for "context owner" to find these strings. -#: libcpluff/context.c:519 -#, c-format -msgid "Plug-in %s" -msgstr "Liitännäinen %s" - -#. TRANSLATORS: The context owner (when it is the main program) used in some strings. -#. Search for "context owner" to find these strings. -#: libcpluff/context.c:523 -msgid "The main program" -msgstr "Pääohjelma" - -#: libcpluff/cpluff.c:143 -msgid "Attempt to destroy uninitialized framework." -msgstr "Yritettiin tuhota alustamatonta liitännäisalustaa." - -#: libcpluff/cpluff.c:179 -#, c-format -msgid "C-Pluff: FATAL ERROR: %s\n" -msgstr "C-Pluff: LOPULLINEN VIRHE: %s\n" - -#: libcpluff/cpluff.c:187 -#, c-format -msgid "Argument %s has illegal NULL value in call to function %s." -msgstr "Parametrilla %s on virheellinen NULL-arvo kutsuttaessa funktiota %s." - -#: libcpluff/logging.c:135 -msgid "Logger could not be registered due to insufficient memory." -msgstr "" -"Lokitietojen käsittelijää ei pystytty rekisteröimään riittämättömän muistin " -"takia." - -#. TRANSLATORS: %s is the context owner -#: libcpluff/logging.c:139 -#, c-format -msgid "%s registered a logger." -msgstr "%s rekisteröi lokitietojen käsittelijän." - -#. TRANSLATORS: %s is the context owner -#: libcpluff/logging.c:176 -#, c-format -msgid "%s unregistered a logger." -msgstr "%s poisti lokitietojen käsittelijän rekisteröinnin." - -#: libcpluff/logging.c:187 -msgid "Encountered a recursive logging request within a logger invocation." -msgstr "Kohdattiin rekursiivinen lokimerkintä lokitietojen käsittelijässä." - -#: libcpluff/logging.c:245 -#, c-format -msgid "Illegal severity value in call to %s." -msgstr "Laiton vakavuustaso kutsuttaessa funktiota %s." - -#: libcpluff/pcontrol.c:121 -#, c-format -msgid "" -"Plug-in %s could not be installed because a plug-in with the same identifier " -"is already installed." -msgstr "" -"Liitännäistä %s ei voitu asentaa, koska saman tunnisteen omaava liitännäinen " -"on jo asennettu." - -#: libcpluff/pcontrol.c:161 -#, c-format -msgid "" -"Plug-in %s could not be installed because extension point %s conflicts with " -"an already installed extension point." -msgstr "" -"Liitännäistä %s ei voitu asentaa, koska laajennuskohde %s on ristiriidassa " -"olemassaolevan laajennuskohteen kanssa." - -#: libcpluff/pcontrol.c:229 -#, c-format -msgid "Plug-in %s could not be installed due to insufficient system resources." -msgstr "" -"Liitännäistä %s ei voitu asentaa riittämättömien järjestelmäresurssien takia." - -#: libcpluff/pcontrol.c:293 -#, c-format -msgid "" -"Plug-in %s could not be resolved due to version incompatibility with C-Pluff." -msgstr "" -"Liitännäistä %s ei pystytty valmistelemaan, koska se ei ole yhteensopiva " -"käytetyn C-Pluff -version kanssa." - -#: libcpluff/pcontrol.c:304 -#, c-format -msgid "" -"Plug-in %s runtime library could not be loaded due to insufficient memory." -msgstr "" -"Liitännäisen %s ohjelmakoodia ei pystytty lataamaan riittämättömän muistin " -"takia." - -#: libcpluff/pcontrol.c:319 libcpluff/pcontrol.c:332 libcpluff/psymbol.c:192 -msgid "Unspecified error." -msgstr "Määrittelemätön virhe." - -#: libcpluff/pcontrol.c:321 -#, c-format -msgid "Plug-in %s runtime library %s could not be opened: %s" -msgstr "Liitännäisen %s ohjelmakoodikirjastoa %s ei pystytty avaamaan: %s" - -#: libcpluff/pcontrol.c:334 -#, c-format -msgid "" -"Plug-in %s symbol %s containing plug-in runtime information could not be " -"resolved: %s" -msgstr "" -"Liitännäisen %s ajonaikaiset tiedot sisältävää symbolia %s ei pystytty " -"selvittämään: %s" - -#: libcpluff/pcontrol.c:340 -#, c-format -msgid "Plug-in %s is missing a constructor or destructor function." -msgstr "Liitännäiseltä %s puuttuu luonti- tai tuhoamisfunktio." - -#: libcpluff/pcontrol.c:387 -#, c-format -msgid "" -"Plug-in %s could not be resolved due to version incompatibility with plug-in " -"%s." -msgstr "" -"Liitännäistä %s ei pystytty valmistelemaan, koska se ei ole yhteensopiva " -"käytetyn liitännäisen %s version kanssa." - -#: libcpluff/pcontrol.c:397 -#, c-format -msgid "" -"Plug-in %s could not be resolved because it depends on plug-in %s which is " -"not installed." -msgstr "" -"Liitännäistä %s ei pystytty valmistelemaan, koska se on riippuvainen " -"liitännäisestä %s, jota ei ole asennettu." - -#: libcpluff/pcontrol.c:463 -#, c-format -msgid "" -"Plug-in %s could not be resolved because it depends on plug-in %s which " -"could not be resolved." -msgstr "" -"Liitännäistä %s ei pystytty valmistelemaan, koska se on riippuvainen " -"liitännäisestä %s, jota ei pystytty valmistelemaan." - -#: libcpluff/pcontrol.c:505 -#, c-format -msgid "Plug-in %s could not be resolved because of insufficient memory." -msgstr "" -"Liitännäistä %s ei pystytty valmistelemaan riittämättömän muistin takia." - -#: libcpluff/pcontrol.c:709 libcpluff/pcontrol.c:800 libcpluff/pcontrol.c:836 -#, c-format -msgid "Plug-in %s could not be started due to insufficient memory." -msgstr "" -"Liitännäistä %s ei pystytty käynnistämään riittämättömän muistin takia." - -#: libcpluff/pcontrol.c:714 -#, c-format -msgid "Plug-in %s failed to start due to plug-in runtime error." -msgstr "" -"Liitännäisen %s käynnistäminen epäonnistui liitännäisessä tapahtuneen " -"ajonaikaisen virheen takia." - -#: libcpluff/pcontrol.c:732 -#, c-format -msgid "Detected a runtime plug-in dependency loop: %s" -msgstr "Havaittiin ajonaikainen liitännäisten riippuvuussilmukka: %s" - -#: libcpluff/pcontrol.c:734 -#, c-format -msgid "Detected a static plug-in dependency loop: %s" -msgstr "Havaittiin staattinen liitännäisten riippuvuussilmukka: %s" - -#: libcpluff/pcontrol.c:858 -#, c-format -msgid "Unknown plug-in %s could not be started." -msgstr "Tuntematonta liitännäistä %s ei voitu käynnistää." - -#: libcpluff/pcontrol.c:1003 -#, c-format -msgid "Unknown plug-in %s could not be stopped." -msgstr "Tuntematonta liitännäistä %s ei voitu pysäyttää." - -#: libcpluff/pcontrol.c:1214 -#, c-format -msgid "Unknown plug-in %s could not be uninstalled." -msgstr "Tuntematonta liitännäistä %s ei voitu poistaa muistista." - -#: libcpluff/pinfo.c:106 -#, c-format -msgid "Registered a new reference counted object at address %p." -msgstr "Rekisteröitiin automaattisesti vapautettava olio osoitteessa %p." - -#: libcpluff/pinfo.c:128 -#, c-format -msgid "Reference count of the object at address %p increased to %d." -msgstr "Osoitteessa %p olevan olion viittausmäärä kasvoi ja on nyt %d." - -#: libcpluff/pinfo.c:130 -#, c-format -msgid "" -"Attempt to increase the reference count of an unknown object at address %p." -msgstr "" -"Yritettiin korottaa viittausmäärää tuntemattomalle automaattisesti " -"vapautettavalle oliolle osoitteessa %p." - -#: libcpluff/pinfo.c:144 -#, c-format -msgid "Reference count of the object at address %p decreased to %d." -msgstr "Osoitteessa %p olevan olion viittausmäärä laski ja on nyt %d." - -#: libcpluff/pinfo.c:148 -#, c-format -msgid "Deallocated the reference counted object at address %p." -msgstr "Vapautettiin automaattisesti vapautettava olio osoitteessa %p." - -#: libcpluff/pinfo.c:152 -#, c-format -msgid "Attempt to release an unknown reference counted object at address %p." -msgstr "" -"Yritettiin vapauttaa tuntematonta automaattisesti vapautettavaa oliota " -"osoitteessa %p." - -#: libcpluff/pinfo.c:173 -#, c-format -msgid "" -"An unreleased information object was encountered at address %p with " -"reference count %d when destroying the associated plug-in context. Not " -"releasing the object." -msgstr "" -"Kohdattiin vapauttamatta jäänyt informaatio-objekti osoitteessa %p " -"viittausmäärällä %d tuhottaessa liitännäisympäristöä. Informaatio-objektia " -"ei vapauteta." - -#: libcpluff/pinfo.c:190 -msgid "" -"The plug-in identifier argument to cp_get_plugin_info must not be NULL when " -"the main program calls it." -msgstr "" -"Liitännäistunnisteparametri ei saa olla NULL pääohjelman kutsuessa funktiota " -"cp_get_plugin_info." - -#: libcpluff/pinfo.c:201 -#, c-format -msgid "Could not return information about unknown plug-in %s." -msgstr "Ei voitu palauttaa tietoa tuntemattomasta liitännäisestä %s." - -#: libcpluff/pinfo.c:271 -msgid "Plug-in information could not be returned due to insufficient memory." -msgstr "Liitännäisen tietoja ei voitu palauttaa riittämättömän muistin takia." - -#: libcpluff/pinfo.c:362 -msgid "" -"Extension point information could not be returned due to insufficient memory." -msgstr "" -"Laajennuskohteen tietoja ei voitu palauttaa riittämättömän muistin takia." - -#: libcpluff/pinfo.c:478 -msgid "Extension information could not be returned due to insufficient memory." -msgstr "Laajennoksen tietoja ei voitu palauttaa riittämättömän muistin takia." - -#: libcpluff/pinfo.c:575 -msgid "A plug-in listener could not be registered due to insufficient memory." -msgstr "" -"Liitännäistapahtumien kuuntelijaa ei voitu rekisteröidä riittämättömän " -"muistin takia." - -#. TRANSLATORS: %s is the context owner -#: libcpluff/pinfo.c:579 -#, c-format -msgid "%s registered a plug-in listener." -msgstr "%s rekisteröi liitännäistapahtumien kuuntelijan." - -#. TRANSLATORS: %s is the context owner -#: libcpluff/pinfo.c:601 -#, c-format -msgid "%s unregistered a plug-in listener." -msgstr "%s poisti liitännäistapahtumien kuuntelijan rekisteröinnin" - -#: libcpluff/pinfo.c:618 -#, c-format -msgid "Plug-in %s has been uninstalled." -msgstr "Liitännäinen %s on poistettu muistista." - -#: libcpluff/pinfo.c:622 -#, c-format -msgid "Plug-in %s has been installed." -msgstr "Liitännäinen %s on asennettu." - -#: libcpluff/pinfo.c:624 -#, c-format -msgid "Plug-in %s runtime library has been unloaded." -msgstr "Liitännäisen %s ajonaikainen kirjasto on poistettu muistista." - -#: libcpluff/pinfo.c:629 -#, c-format -msgid "Plug-in %s runtime library has been loaded." -msgstr "Liitännäisen %s ajonaikainen kirjasto on ladattu." - -#: libcpluff/pinfo.c:631 -#, c-format -msgid "Plug-in %s has been stopped." -msgstr "Liitännäinen %s on pysäytetty." - -#: libcpluff/pinfo.c:635 -#, c-format -msgid "Plug-in %s is starting." -msgstr "Liitännäinen %s on käynnistymässä." - -#: libcpluff/pinfo.c:638 -#, c-format -msgid "Plug-in %s is stopping." -msgstr "Liitännäinen %s on pysähtymässä." - -#: libcpluff/pinfo.c:641 -#, c-format -msgid "Plug-in %s has been started." -msgstr "Liitännäinen %s on käynnistetty." - -#: libcpluff/ploader.c:166 -#, c-format -msgid "Suspicious plug-in descriptor content in %s, line %d, column %d (%s)." -msgstr "" -"Epäilyttävää sisältöä liitännäiskuvauksessa tiedostossa %s rivillä %d " -"sarakkeessa %d (%s)." - -#: libcpluff/ploader.c:173 -#, c-format -msgid "Invalid plug-in descriptor content in %s, line %d, column %d (%s)." -msgstr "" -"Laitonta sisältöä liitännäiskuvauksessa tiedostossa %s rivillä %d " -"sarakkeessa %d (%s)." - -#: libcpluff/ploader.c:193 -#, c-format -msgid "" -"Insufficient system resources to parse plug-in descriptor content in %s, " -"line %d, column %d." -msgstr "" -"Järjestelmäresurssit eivät riitä tulkittaessa liitännäiskuvausta tiedostossa " -"%s rivillä %d sarakkeessa %d." - -#: libcpluff/ploader.c:247 -#, c-format -msgid "required attribute %s for element %s has an empty value" -msgstr "elementin %2$s vaaditulla attribuutilla %1$s on tyhjä arvo" - -#: libcpluff/ploader.c:253 -#, c-format -msgid "required attribute %s missing for element %s" -msgstr "elementin %2$s vaadittu attribuutti %1$s puuttuu" - -#: libcpluff/ploader.c:287 -#, c-format -msgid "ignoring unknown attribute %s for element %s" -msgstr "jätetään huomioimatta elementin %2$s tuntematon attribuutti %1$s" - -#: libcpluff/ploader.c:380 -#, c-format -msgid "ignoring unexpected element %s and its contents" -msgstr "jätetään huomioimatta odottamaton elementti %s sisältöineen" - -#: libcpluff/ploader.c:763 -#, c-format -msgid "unknown boolean value: %s" -msgstr "tuntematon totuusarvo: %s" - -#: libcpluff/ploader.c:973 -#, c-format -msgid "unexpected closing tag for %s" -msgstr "elementti %s sulkeutuu odottamattomasti" - -#: libcpluff/ploader.c:1037 -#, c-format -msgid "XML parsing error in %s, line %d, column %d (%s)." -msgstr "XML-tulkintavirhe tiedostossa %s rivillä %d sarakkeessa %d (%s)" - -#: libcpluff/ploader.c:1081 -#, c-format -msgid "Plug-in descriptor in %s is invalid." -msgstr "Liitännäiskuvaus tiedostossa %s on viallinen." - -#: libcpluff/ploader.c:1085 -#, c-format -msgid "An I/O error occurred while loading a plug-in descriptor from %s." -msgstr "" -"Luku- tai kirjoitusvirhe tapahtui ladattaessa liitännäiskuvausta tiedostosta " -"%s." - -#: libcpluff/ploader.c:1089 -#, c-format -msgid "Insufficient system resources to load a plug-in descriptor from %s." -msgstr "" -"Järjestelmäresurssit eivät riitä liitännäiskuvauksen lataamiseksi " -"tiedostosta %s." - -#: libcpluff/ploader.c:1093 -#, c-format -msgid "Failed to load a plug-in descriptor from %s." -msgstr "Liitännäiskuvauksen lataaminen tiedostosta %s epäonnistui." - -#: libcpluff/pscan.c:64 -msgid "Plug-in scan is starting." -msgstr "Liitännäisten etsintä alkaa." - -#: libcpluff/pscan.c:112 -#, c-format -msgid "" -"Could not check possible plug-in location %s%c%s due to insufficient system " -"resources." -msgstr "" -"Mahdollisen liitännäissijainnin %s%c%s tarkistaminen ei onnistunut " -"riittämättömien järjestelmäresurssien takia." - -#: libcpluff/pscan.c:144 -#, c-format -msgid "" -"Plug-in %s version %s could not be loaded due to insufficient system " -"resources." -msgstr "" -"Liitännäisen %s versiota %s ei voitu ladata riittämättömien " -"järjestelmäresurssien takia." - -#: libcpluff/pscan.c:156 -#, c-format -msgid "Could not read plug-in directory %s: %s" -msgstr "Liitännäishakemistoa %s ei voitu lukea: %s" - -#: libcpluff/pscan.c:162 -#, c-format -msgid "Could not open plug-in directory %s: %s" -msgstr "Liitännäishakemistoa %s ei voitu avata: %s" - -#: libcpluff/pscan.c:276 -msgid "Plug-in scan has completed successfully." -msgstr "Liitännäisten etsiminen on päättynyt onnistuneesti." - -#: libcpluff/pscan.c:279 -msgid "Could not scan plug-ins due to insufficient system resources." -msgstr "" -"Liitännäisiä ei voitu etsiä riittämättömien järjestelmäresurssien takia." - -#: libcpluff/pscan.c:282 -msgid "Could not scan plug-ins." -msgstr "Liitännäisiä ei voitu etsiä." - -#: libcpluff/psymbol.c:83 -msgid "Only plug-ins can define context specific symbols." -msgstr "Vain liitännäiset voivat asettaa ympäristökohtaisia symboleja." - -#: libcpluff/psymbol.c:119 -#, c-format -msgid "Plug-in %s could not define symbol %s due to insufficient memory." -msgstr "" -"Liitännäinen %s ei voinut asettaa symbolia %s riittämättömän muistin takia." - -#: libcpluff/psymbol.c:122 -#, c-format -msgid "Plug-in %s tried to redefine symbol %s." -msgstr "Liitännäinen %s yritti uudelleenmäärittää symbolin %s." - -#: libcpluff/psymbol.c:167 -#, c-format -msgid "Symbol %s in unknown plug-in %s could not be resolved." -msgstr "Symbolia %s tuntemattomassa liitännäisessä %s ei voitu selvittää." - -#: libcpluff/psymbol.c:175 -#, c-format -msgid "" -"Symbol %s in plug-in %s could not be resolved because the plug-in could not " -"be started." -msgstr "" -"Symbolia %s liitännäisessä %s ei voitu selvittää, koska liitännäistä ei " -"pystytty käynnistämään." - -#: libcpluff/psymbol.c:194 -#, c-format -msgid "Symbol %s in plug-in %s could not be resolved: %s" -msgstr "Symbolia %s tuntemattomassa liitännäisessä %s ei voitu selvittää: %s" - -#: libcpluff/psymbol.c:245 -#, c-format -msgid "A dynamic dependency was created from plug-in %s to plug-in %s." -msgstr "Luotiin dynaaminen riippuvuus liitännäisestä %s liitännäiseen %s." - -#. TRANSLATORS: First %s is the context owner -#: libcpluff/psymbol.c:255 -#, c-format -msgid "%s resolved symbol %s defined by plug-in %s." -msgstr "%1$s latasi liitännäisen %3$s määrittelemän symbolin %2$s." - -#: libcpluff/psymbol.c:275 -#, c-format -msgid "" -"Symbol %s in plug-in %s could not be resolved due to insufficient memory." -msgstr "" -"Symbolia %s liitännäisessä %s ei voitu selvittää riittämättömän muistin " -"takia." - -#: libcpluff/psymbol.c:302 -#, c-format -msgid "Could not release unknown symbol at address %p." -msgstr "Ei voitu vapauttaa tuntematonta symbolia osoitteessa %p." - -#. TRANSLATORS: First %s is the context owner -#: libcpluff/psymbol.c:321 -#, c-format -msgid "%s released the symbol at address %p defined by plug-in %s." -msgstr "" -"%1$s vapautti liitännäisen %3$s määrittelemän symbolin osoitteessa %2$p." - -#: libcpluff/psymbol.c:333 -#, c-format -msgid "A dynamic dependency from plug-in %s to plug-in %s was removed." -msgstr "Liitännäisen %s dynaaminen riippuvuus liitännäiseen %s poistettiin." - -#: libcpluff/serial.c:64 -msgid "Only plug-ins can register run functions." -msgstr "Vain liitännäiset voivat rekisteröidä suoritettavia tehtäviä." - -#: libcpluff/serial.c:68 -msgid "Only starting or active plug-ins can register run functions." -msgstr "" -"Vain käynnistyvät tai aktiiviset liitännäiset voivat rekisteröidä " -"suoritettavia tehtäviä." - -#: libcpluff/serial.c:115 -msgid "Could not register a run function due to insufficient memory." -msgstr "" -"Suoritettavaa tehtävää ei voitu rekisteröidä riittämättömän muistin takia." - -#: libcpluff/thread_posix.c:118 -#, c-format -msgid "Could not lock a mutex due to error %d." -msgstr "Mutexia ei voitu lukita virheen %d takia." - -#: libcpluff/thread_posix.c:126 -#, c-format -msgid "Could not unlock a mutex due to error %d." -msgstr "Mutexia ei voitu vapauttaa virheen %d takia." - -#: libcpluff/thread_posix.c:138 libcpluff/thread_posix.c:190 -#, c-format -msgid "Could not wait for a condition variable due to error %d." -msgstr "Ehtomuuttujaa ei voitu odottaa virheen %d takia." - -#: libcpluff/thread_posix.c:163 libcpluff/thread_posix.c:185 -#, c-format -msgid "Could not signal a condition variable due to error %d." -msgstr "Ehtomuuttujaa ei voitu signaloida virheen %d takia." - -#: libcpluff/thread_posix.c:167 libcpluff/thread_windows.c:210 -msgid "Internal C-Pluff error: Unauthorized attempt at unlocking a mutex." -msgstr "Sisäinen virhe C-Pluffissa: Laiton yritys vapauttaa mutexia." - -#: libcpluff/thread_posix.c:198 libcpluff/thread_windows.c:244 -msgid "Internal C-Pluff error: Unauthorized attempt at waiting on a mutex." -msgstr "Sisäinen virhe C-Pluffissa: Laiton yritys odottaa mutexia." - -#: libcpluff/thread_posix.c:214 -#, c-format -msgid "Could not broadcast a condition variable due to error %d." -msgstr "" -"Ehtomuuttujan signalointi yleislähetyksenä epäonnistui virheen %d takia." - -#: libcpluff/thread_posix.c:218 libcpluff/thread_windows.c:258 -msgid "Internal C-Pluff error: Unauthorized attempt at signaling a mutex." -msgstr "Sisäinen virhe C-Pluffissa: Laiton yritys signaloida mutexia." - -#: libcpluff/thread_windows.c:126 -msgid "unknown error" -msgstr "tuntematon virhe" - -#: libcpluff/thread_windows.c:138 -#, c-format -msgid "Could not lock a mutex due to error %ld: %s" -msgstr "Mutexin lukitseminen epäonnistui johtuen virheestä %ld: %s" - -#: libcpluff/thread_windows.c:147 -#, c-format -msgid "Could not release a mutex due to error %ld: %s" -msgstr "Mutexin vapauttaminen epäonnistui johtuen virheestä %ld: %s" - -#: libcpluff/thread_windows.c:156 -#, c-format -msgid "Could not wait for an event due to error %ld: %s" -msgstr "Tapahtuman odottaminen epäonnistui johtuen virheestä %ld: %s" - -#: libcpluff/thread_windows.c:165 -#, c-format -msgid "Could not set an event due to error %ld: %s" -msgstr "Tapahtuman asettaminen epäonnistui johtuen virheestä %ld: %s" - -#: libcpluff/thread_windows.c:174 -#, c-format -msgid "Could not reset an event due to error %ld: %s" -msgstr "Tapahtuman nollaus epäonnistui johtuen virheestä %ld: %s" - -#. TRANSLATORS: A formatting string for loader error messages. -#: loader/loader.c:121 -#, c-format -msgid "C-Pluff Loader: ERROR: %s\n" -msgstr "C-Pluff -latain: VIRHE: %s\n" - -#: loader/loader.c:152 -msgid "Memory allocation failed." -msgstr "Muistin varaaminen epäonnistui." - -#. TRANSLATORS: This is a version string displayed on startup. -#: loader/loader.c:192 loader/loader.c:328 -#, c-format -msgid "C-Pluff Loader, version %s\n" -msgstr "C-Pluff -latain, versio %s\n" - -#: loader/loader.c:194 -msgid "" -"usage: cpluff-loader <option>... [--] <arguments passed to plug-ins>\n" -"options:\n" -" -h print this help text\n" -" -c DIR add plug-in collection in directory DIR\n" -" -p DIR add plug-in in directory DIR\n" -" -s PID start plug-in PID\n" -" -v be more verbose (repeat for increased verbosity)\n" -" -q be quiet\n" -" -V print C-Pluff version number and exit\n" -msgstr "" -"käyttö: cpluff-loader <valitsin>... [--] <parametrit liitännäisille>\n" -"valitsimet:\n" -" -h tulosta tämä ohje\n" -" -c DIR lisää liitännäiskokoelma hakemistosta DIR\n" -" -p DIR lisää liitännäinen hakemistosta DIR\n" -" -s PID käynnistä liitännäinen PID\n" -" -v näytä enemmän tietoja (toista lisätäksesi näytettäviä tietoja)\n" -" -q näytä vähemmän tietoja\n" -" -V tulosta C-Pluff -versionumero ja lopeta\n" - -#. TRANSLATORS: A formatting string for log messages caused by plug-in activity. -#: loader/loader.c:239 -#, c-format -msgid "C-Pluff: %s: [%s] %s\n" -msgstr "C-Pluff: %s: [%s] %s\n" - -#. TRANSLATORS: A formatting string for log messages caused by loader activity. -#: loader/loader.c:242 -#, c-format -msgid "C-Pluff: %s: [loader] %s\n" -msgstr "C-Pluff: %s: [latain] %s\n" - -#: loader/loader.c:264 -msgid "The C-Pluff initialization failed." -msgstr "C-Pluffin alustaminen epäonnistui." - -#: loader/loader.c:299 loader/loader.c:307 -msgid "Quiet and verbose modes are mutually exclusive." -msgstr "Samaan aikaan ei voi näyttää sekä enemmän että vähemmän tietoja." - -#: loader/loader.c:320 -msgid "Unrecognized option or argument. Try option -h for help." -msgstr "Tuntematon valitsin. Kokeile valitsinta -h saadaksesi ohjeita." - -#: loader/loader.c:338 -msgid "No plug-ins to load. Try option -h for help." -msgstr "Ei ladattavia liitännäisiä. Kokeile valitsinta -h saadaksesi ohjeita." - -#: loader/loader.c:343 -msgid "Plug-in context creation failed." -msgstr "Liitännäisympäristön luonti epäonnistui." - -#: loader/loader.c:376 -#, c-format -msgid "Failed to load a plug-in from path %s." -msgstr "Liitännäisen lataaminen polusta %s epäonnistui." - -#: loader/loader.c:379 -#, c-format -msgid "Failed to install plug-in %s." -msgstr "Liitännäisen %s asentaminen epäonnistui." - -#: loader/loader.c:388 -#, c-format -msgid "Failed to register a plug-in collection at path %s." -msgstr "Polussa %s olevan liitännäiskokoelman rekisteröinti epäonnistui." - -#: loader/loader.c:393 -msgid "Failed to load and install plug-ins from plug-in collections." -msgstr "" -"Liitännäisten lataaminen ja asentaminen liitännäiskokoelmista epäonnistui." - -#: loader/loader.c:400 -#, c-format -msgid "Failed to start plug-in %s." -msgstr "Liitännäisen %s käynnistäminen epäonnistui." diff --git a/lib/cpluff/test/Makefile.am b/lib/cpluff/test/Makefile.am deleted file mode 100644 index 8681b3f351..0000000000 --- a/lib/cpluff/test/Makefile.am +++ /dev/null @@ -1,111 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -# This can be defined to a debugging wrapper program such as Valgrind. -TEST_WRAPPER = - -# This can be defined to a subset of test cases to be performed -SELECTED_TESTS = all - -DIST_SUBDIRS = plugins-source - -EXTRA_DIST = tests.txt - -CPPFLAGS = @CPPFLAGS@ -CPPFLAGS += -DCP_HOST="\"$(host)\"" - -LIBS = @LIBS_OTHER@ @LIBS_TESTSUITE@ @LIBS@ - -check_PROGRAMS = testsuite - -testsuite_SOURCES = psymbolusage.c extcfg.c pdependencies.c pcallbacks.c pscanning.c pinstallation.c ploading.c loggers.c collections.c initdestroy.c fatalerror.c cpinfo.c testmain.c test.h -testsuite_LDFLAGS = -dlopen self - -tmpinstalldir = $(CURDIR)/tmp/install - -check-local: install-plugins - @numf=0; numt=0; \ - run_test () { \ - local test="$$1"; \ - if test -x "$(srcdir)/test-$$test"; then \ - srcdir='$(srcdir)' TEST_WRAPPER='$(TEST_WRAPPER)' "$(srcdir)/test-$$test"; \ - rc=$$?; \ - else \ - eval srcdir='$(srcdir)' libtool --mode=execute $(TEST_WRAPPER) ./testsuite "\$$test"; \ - rc=$$?; \ - fi; \ - case $$rc in \ - 77) \ - echo "SKIPPED: $$test"; \ - ;; \ - 0) \ - echo "OK: $$test"; \ - numt=$$(($$numt + 1)); \ - ;; \ - *) \ - echo "FAIL: $$test"; \ - numt=$$(($$numt + 1)); \ - numf=$$(($$numf + 1)); \ - ;; \ - esac; \ - }; \ - echo; \ - echo '===================================================================='; \ - echo 'C-Pluff Test Suite'; \ - echo '===================================================================='; \ - if test '$(SELECTED_TESTS)' = all; then \ - while read test; do \ - run_test "$$test"; \ - done < '$(srcdir)/tests.txt'; \ - else \ - for test in $(SELECTED_TESTS); do \ - run_test "$$test"; \ - done; \ - fi; \ - echo '===================================================================='; \ - if test $$numf -gt 0; then \ - echo "FAILED: $$numf/$$numt"; \ - else \ - echo 'ALL OK!'; \ - fi; \ - echo '===================================================================='; \ - echo; \ - test $$numf -eq 0 - -clean-local: - rm -rf tmp - test ! -f plugins-source/Makefile || (cd plugins-source && $(MAKE) $(AM_MAKEFLAGS) clean) - -dist-hook: - $(MKDIR_P) '$(distdir)' - cp -p '$(srcdir)'/test-* '$(distdir)' - $(MKDIR_P) '$(distdir)/expected' - cp -p '$(srcdir)'/expected/*.txt '$(distdir)'/expected - $(MKDIR_P) '$(distdir)'/plugins - for d in $$(ls '$(srcdir)'/plugins); do \ - ( $(MKDIR_P) '$(distdir)'/plugins/"$$d" && \ - cp -p '$(srcdir)'"/plugins/$$d/plugin.xml" '$(distdir)'/plugins/"$$d" ) \ - || exit 1; \ - done - $(MKDIR_P) '$(distdir)'/pcollections - for d in $$(ls '$(srcdir)'/pcollections); do \ - for d2 in $$(ls '$(srcdir)'"/pcollections/$$d"); do \ - ( $(MKDIR_P) '$(distdir)'/pcollections/"$$d/$$d2" && \ - cp -p '$(srcdir)'"/pcollections/$$d/$$d2/plugin.xml" '$(distdir)'/pcollections/"$$d/$$d2" ) \ - || exit 1; \ - done; \ - done - -install-plugins: build-plugins install-libcpluff - cd plugins-source && $(MAKE) $(AM_MAKEFLAGS) DESTDIR='$(tmpinstalldir)' install - -build-plugins: - cd plugins-source && $(MAKE) - -install-libcpluff: - cd ../libcpluff && $(MAKE) $(AM_MAKEFLAGS) DESTDIR='$(tmpinstalldir)' install - -.PHONY: build-plugins install-plugins install-libcpluff diff --git a/lib/cpluff/test/collections.c b/lib/cpluff/test/collections.c deleted file mode 100644 index 7c1c7405ba..0000000000 --- a/lib/cpluff/test/collections.c +++ /dev/null @@ -1,99 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#include <stdio.h> -#include "test.h" - -void nocollections(void) { - cp_context_t *ctx; - cp_plugin_info_t **plugins; - cp_status_t status; - int errors; - int i; - - ctx = init_context(CP_LOG_ERROR, &errors); - check(cp_scan_plugins(ctx, 0) == CP_OK); - check((plugins = cp_get_plugins_info(ctx, &status, &i)) != NULL && status == CP_OK && i == 0); - cp_release_info(ctx, plugins); - cp_destroy(); - check(errors == 0); -} - -void onecollection(void) { - cp_context_t *ctx; - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK); - check(cp_scan_plugins(ctx, 0) == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_INSTALLED); - cp_destroy(); - check(errors == 0); -} - -void twocollections(void) { - cp_context_t *ctx; - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK); - check(cp_register_pcollection(ctx, pcollectiondir("collection2")) == CP_OK); - check(cp_scan_plugins(ctx, 0) == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_INSTALLED); - check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_INSTALLED); - check(cp_get_plugin_state(ctx, "plugin2b") == CP_PLUGIN_INSTALLED); - cp_destroy(); - check(errors == 0); -} - -void unregcollection(void) { - cp_context_t *ctx; - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK); - check(cp_register_pcollection(ctx, pcollectiondir("collection2")) == CP_OK); - cp_unregister_pcollection(ctx, pcollectiondir("collection2")); - check(cp_scan_plugins(ctx, 0) == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_INSTALLED); - check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_UNINSTALLED); - check(cp_get_plugin_state(ctx, "plugin2b") == CP_PLUGIN_UNINSTALLED); - cp_destroy(); - check(errors == 0); -} - -void unregcollections(void) { - cp_context_t *ctx; - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK); - check(cp_register_pcollection(ctx, pcollectiondir("collection2")) == CP_OK); - cp_unregister_pcollections(ctx); - check(cp_scan_plugins(ctx, 0) == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_UNINSTALLED); - check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_UNINSTALLED); - check(cp_get_plugin_state(ctx, "plugin2b") == CP_PLUGIN_UNINSTALLED); - cp_destroy(); - check(errors == 0); -} diff --git a/lib/cpluff/test/cpinfo.c b/lib/cpluff/test/cpinfo.c deleted file mode 100644 index 10c1bb89fc..0000000000 --- a/lib/cpluff/test/cpinfo.c +++ /dev/null @@ -1,37 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#include <stdio.h> -#include <string.h> -#include "test.h" -#include <cpluff.h> - -void getversion(void) { - check(cp_get_version() != NULL); - check(!strcmp(cp_get_version(), CP_VERSION)); -} - -void gethosttype(void) { - check(cp_get_host_type() != NULL); - check(!strcmp(cp_get_host_type(), CP_HOST)); -} diff --git a/lib/cpluff/test/expected/output-extensions.txt b/lib/cpluff/test/expected/output-extensions.txt deleted file mode 100644 index 8dbd4d4aa1..0000000000 --- a/lib/cpluff/test/expected/output-extensions.txt +++ /dev/null @@ -1,7 +0,0 @@ -Installed extensions: - IDENTIFIER NAME - maximal.ext1 Extension 1 - maximal.<anonymous> - maximal.<anonymous> Extension 3 - maximal.ext2 -C-Pluff Console > diff --git a/lib/cpluff/test/expected/output-extpoints.txt b/lib/cpluff/test/expected/output-extpoints.txt deleted file mode 100644 index f422aa5159..0000000000 --- a/lib/cpluff/test/expected/output-extpoints.txt +++ /dev/null @@ -1,7 +0,0 @@ -Installed extension points: - IDENTIFIER NAME - maximal.extpt4 - maximal.extpt2 Extension Point 2 - maximal.extpt1 Extension Point 1 - maximal.extpt3 -C-Pluff Console > diff --git a/lib/cpluff/test/expected/output-loadmaximal.txt b/lib/cpluff/test/expected/output-loadmaximal.txt deleted file mode 100644 index 7369863054..0000000000 --- a/lib/cpluff/test/expected/output-loadmaximal.txt +++ /dev/null @@ -1,93 +0,0 @@ -{ - identifier = "maximal", - name = "Maximal", - version = "1.0.0.max", - provider_name = "Maximal Provider", - abi_bw_compatibility = "1.0", - api_bw_compatibility = "0.8", - req_cpluff_version = "999.3.4", - imports = {{ - plugin_id = "dependency1", - version = "0.1", - optional = 1, - }, { - plugin_id = "dependency2", - version = "0.2", - optional = 0, - }, { - plugin_id = "dependency3", - version = NULL, - optional = 1, - }, { - plugin_id = "dependency4", - version = NULL, - optional = 0, - }}, - runtime_lib_name = "nonexisting", - runtime_funcs_symbol = "funcs", - ext_points = {{ - local_id = "extpt1", - identifier = "maximal.extpt1", - name = "Extension Point 1", - schema_path = "ext1.xsd", - }, { - local_id = "extpt2", - identifier = "maximal.extpt2", - name = "Extension Point 2", - schema_path = NULL, - }, { - local_id = "extpt3", - identifier = "maximal.extpt3", - name = NULL, - schema_path = "extpt3.xsd", - }, { - local_id = "extpt4", - identifier = "maximal.extpt4", - name = NULL, - schema_path = NULL, - }}, - extensions = {{ - ext_point_id = "nonexisting.extptA", - local_id = "ext1", - identifier = "maximal.ext1", - name = "Extension 1", - configuration = { - <extension point="nonexisting.extptA" id="ext1" name="Extension 1">Extension data begins - <structure>Structure ends - <parameter>parameter</parameter> - <parameter>param2</parameter> - <assertion>1<2</assertion> - <deeper> - <struct> - <is>here</is> - </struct> - </deeper> - </structure> - </extension> - }, - }, { - ext_point_id = "nonexisting.extptB", - local_id = "ext2", - identifier = "maximal.ext2", - name = NULL, - configuration = { - <extension point="nonexisting.extptB" id="ext2"/> - }, - }, { - ext_point_id = "maximal.extpt1", - local_id = NULL, - identifier = NULL, - name = "Extension 3", - configuration = { - <extension point="maximal.extpt1" name="Extension 3"/> - }, - }, { - ext_point_id = "maximal.extpt2", - local_id = NULL, - identifier = NULL, - name = NULL, - configuration = { - <extension point="maximal.extpt2"/> - }, - }} -} diff --git a/lib/cpluff/test/expected/output-loadminimal.txt b/lib/cpluff/test/expected/output-loadminimal.txt deleted file mode 100644 index 8064a25f30..0000000000 --- a/lib/cpluff/test/expected/output-loadminimal.txt +++ /dev/null @@ -1,14 +0,0 @@ -{ - identifier = "minimal", - name = NULL, - version = NULL, - provider_name = NULL, - abi_bw_compatibility = NULL, - api_bw_compatibility = NULL, - req_cpluff_version = NULL, - imports = {}, - runtime_lib_name = NULL, - runtime_funcs_symbol = NULL, - ext_points = {}, - extensions = {}, -} diff --git a/lib/cpluff/test/extcfg.c b/lib/cpluff/test/extcfg.c deleted file mode 100644 index 9e55289ee6..0000000000 --- a/lib/cpluff/test/extcfg.c +++ /dev/null @@ -1,67 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#include <string.h> -#include "test.h" - -void extcfgutils(void) { - cp_context_t *ctx; - cp_plugin_info_t *plugin; - cp_extension_t *ext; - cp_cfg_element_t *ce, *cebase; - const char *str; - int errors; - cp_status_t status; - int i; - - ctx = init_context(CP_LOG_ERROR, &errors); - check((plugin = cp_load_plugin_descriptor(ctx, plugindir("maximal"), &status)) != NULL && status == CP_OK); - for (i = 0, ext = NULL; ext == NULL && i < plugin->num_extensions; i++) { - cp_extension_t *e = plugin->extensions + i; - if (e->identifier != NULL && !strcmp(e->local_id, "ext1")) { - ext = e; - } - } - check(ext != NULL); - - // Look up using forward path - check((ce = cp_lookup_cfg_element(ext->configuration, "structure/parameter")) != NULL && ce->value != NULL && strcmp(ce->value, "parameter") == 0); - check((ce = cebase = cp_lookup_cfg_element(ext->configuration, "structure/deeper/struct/is")) != NULL && ce->value != NULL && strcmp(ce->value, "here") == 0); - check((str = cp_lookup_cfg_value(ext->configuration, "structure/parameter")) != NULL && strcmp(str, "parameter") == 0); - check((str = cp_lookup_cfg_value(ext->configuration, "@name")) != NULL && strcmp(str, "Extension 1") == 0); - - // Look up using reverse path - check((ce = cp_lookup_cfg_element(cebase, "../../../parameter/../deeper")) != NULL && strcmp(ce->name, "deeper") == 0); - check((str = cp_lookup_cfg_value(cebase, "../../../../@name")) != NULL && strcmp(str, "Extension 1") == 0); - - // Look up nonexisting components - check(cp_lookup_cfg_element(ext->configuration, "non/existing") == NULL); - check(cp_lookup_cfg_element(ext->configuration, "structure/../..") == NULL); - check(cp_lookup_cfg_value(ext->configuration, "non/existing") == NULL); - check(cp_lookup_cfg_value(ext->configuration, "structure/../..") == NULL); - check(cp_lookup_cfg_value(ext->configuration, "structure@nonexisting") == NULL); - - cp_release_info(ctx, plugin); - cp_destroy_context(ctx); - check(errors == 0); -} diff --git a/lib/cpluff/test/fatalerror.c b/lib/cpluff/test/fatalerror.c deleted file mode 100644 index fbfc443182..0000000000 --- a/lib/cpluff/test/fatalerror.c +++ /dev/null @@ -1,59 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#include <stdio.h> -#include <stdlib.h> -#include "test.h" - -static int testvar; - -static void cause_fatal_error(void) { - cp_context_t *ctx; - - cp_init(); - ctx = init_context(CP_LOG_ERROR + 1, NULL); - cp_release_info(ctx, &testvar); - cp_destroy(); -} - -void fatalerrordefault(void) { - cause_fatal_error(); -} - -static void error_handler(const char *msg) { - free_test_resources(); - exit(0); -} - -void fatalerrorhandled(void) { - cp_set_fatal_error_handler(error_handler); - cause_fatal_error(); - free_test_resources(); - exit(1); -} - -void fatalerrorreset(void) { - cp_set_fatal_error_handler(error_handler); - cp_set_fatal_error_handler(NULL); - cause_fatal_error(); -} diff --git a/lib/cpluff/test/initdestroy.c b/lib/cpluff/test/initdestroy.c deleted file mode 100644 index 9f0ae57401..0000000000 --- a/lib/cpluff/test/initdestroy.c +++ /dev/null @@ -1,125 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#include <stdio.h> -#include "test.h" -#include <cpluff.h> - -void initdestroy(void) { - int i; - - for (i = 0; i < 10; i++) { - check(cp_init() == CP_OK); - cp_destroy(); - } -} - -void initcreatedestroy(void) { - int i; - - for (i = 0; i < 3; i++) { - int errors; - - init_context(CP_LOG_ERROR, &errors); - cp_destroy(); - check(errors == 0); - } -} - -void initloaddestroy(void) { - int i; - - for (i = 0; i < 3; i++) { - cp_context_t *ctx; - cp_plugin_info_t *pi; - cp_status_t status; - const char *pdir = plugindir("minimal"); - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check((pi = cp_load_plugin_descriptor(ctx, pdir, &status)) != NULL && status == CP_OK); - cp_release_info(ctx, pi); - cp_destroy(); - check(errors == 0); - } -} - -void initinstalldestroy(void) { - int i; - - for (i = 0; i < 3; i++) { - cp_context_t *ctx; - cp_plugin_info_t *pi; - cp_status_t status; - const char *pdir = plugindir("minimal"); - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check((pi = cp_load_plugin_descriptor(ctx, pdir, &status)) != NULL && status == CP_OK); - check(cp_install_plugin(ctx, pi) == CP_OK); - cp_release_info(ctx, pi); - cp_destroy(); - check(errors == 0); - } -} - -void initstartdestroy(void) { - int i; - - for (i = 0; i < 3; i++) { - cp_context_t *ctx; - cp_plugin_info_t *pi; - cp_status_t status; - const char *pdir = plugindir("minimal"); - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check((pi = cp_load_plugin_descriptor(ctx, pdir, &status)) != NULL && status == CP_OK); - check(cp_install_plugin(ctx, pi) == CP_OK); - cp_release_info(ctx, pi); - check(cp_start_plugin(ctx, "minimal") == CP_OK); - cp_destroy(); - check(errors == 0); - } -} - -void initstartdestroyboth(void) { - int i; - - for (i = 0; i < 3; i++) { - cp_context_t *ctx; - cp_plugin_info_t *pi; - cp_status_t status; - const char *pdir = plugindir("minimal"); - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check((pi = cp_load_plugin_descriptor(ctx, pdir, &status)) != NULL && status == CP_OK); - check(cp_install_plugin(ctx, pi) == CP_OK); - cp_release_info(ctx, pi); - check(cp_start_plugin(ctx, "minimal") == CP_OK); - cp_destroy_context(ctx); - cp_destroy(); - check(errors == 0); - } -} diff --git a/lib/cpluff/test/loggers.c b/lib/cpluff/test/loggers.c deleted file mode 100644 index 36f83e353f..0000000000 --- a/lib/cpluff/test/loggers.c +++ /dev/null @@ -1,247 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "test.h" - -void errorlogger(void) { - cp_context_t *ctx; - cp_status_t status; - int errors; - - ctx = init_context(CP_LOG_ERROR + 1, &errors); - check(cp_load_plugin_descriptor(ctx, "nonexisting", &status) == NULL && status != CP_OK); - cp_destroy(); - check(errors > 0); -} - -struct log_count_t { - cp_log_severity_t max_severity; - int count_max; - int count_above_max; -}; - -static void counting_logger(cp_log_severity_t severity, const char *msg, const char *apid, void *user_data) { - struct log_count_t *lc = user_data; - - if (severity <= lc->max_severity) { - lc->count_max++; - } else { - lc->count_above_max++; - } -} - -void warninglogger(void) { - cp_context_t *ctx; - struct log_count_t lc = { CP_LOG_WARNING, 0, 0 }; - - ctx = init_context(CP_LOG_ERROR, NULL); - check(cp_register_logger(ctx, counting_logger, &lc, CP_LOG_WARNING) == CP_OK); - check(cp_start_plugin(ctx, "nonexisting") == CP_ERR_UNKNOWN); - cp_destroy(); - check(lc.count_max > 0 && lc.count_above_max == 0); -} - -void infologger(void) { - cp_context_t *ctx; - cp_plugin_info_t *plugin; - cp_status_t status; - struct log_count_t lc = { CP_LOG_INFO, 0, 0 }; - - ctx = init_context(CP_LOG_WARNING, NULL); - check(cp_register_logger(ctx, counting_logger, &lc, CP_LOG_INFO) == CP_OK); - check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); - check(cp_install_plugin(ctx, plugin) == CP_OK); - cp_release_info(ctx, plugin); - cp_destroy(); - check(lc.count_max > 0 && lc.count_above_max == 0); -} - -void debuglogger(void) { - cp_context_t *ctx; - struct log_count_t lc = { CP_LOG_DEBUG, 0, 0 }; - - ctx = init_context(CP_LOG_INFO, NULL); - check(cp_register_logger(ctx, counting_logger, &lc, CP_LOG_DEBUG) == CP_OK); - cp_destroy(); - check(lc.count_max > 0 && lc.count_above_max == 0); -} - -static void increment_logger(cp_log_severity_t severity, const char *msg, const char *apid, void *user_data) { - (*((int *) user_data))++; -} - -void twologgers(void) { - cp_context_t *ctx; - cp_plugin_info_t *plugin; - cp_status_t status; - struct log_count_t lc = { CP_LOG_DEBUG, 0, 0 }; - int count = 0; - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check(cp_register_logger(ctx, counting_logger, &lc, CP_LOG_DEBUG) == CP_OK); - check(count == 0 && lc.count_max > 0 && lc.count_above_max == 0); - check(cp_register_logger(ctx, increment_logger, &count, CP_LOG_INFO) == CP_OK); - check(count == 0 && lc.count_max > 0 && lc.count_above_max == 0); - check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); - check(cp_install_plugin(ctx, plugin) == CP_OK); - cp_release_info(ctx, plugin); - check(count > 0 && lc.count_max > 0 && lc.count_above_max > 0); - cp_destroy(); - check(errors == 0); -} - -void unreglogger(void) { - cp_context_t *ctx; - cp_plugin_info_t *plugin; - cp_status_t status; - struct log_count_t lc = { CP_LOG_DEBUG, 0, 0 }; - int count = 0; - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check(cp_register_logger(ctx, counting_logger, &lc, CP_LOG_DEBUG) == CP_OK); - check(count == 0 && lc.count_max > 0 && lc.count_above_max == 0); - check(cp_register_logger(ctx, increment_logger, &count, CP_LOG_INFO) == CP_OK); - check(count == 0 && lc.count_max > 0 && lc.count_above_max == 0); - cp_unregister_logger(ctx, counting_logger); - check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); - check(cp_install_plugin(ctx, plugin) == CP_OK); - cp_release_info(ctx, plugin); - check(count > 0 && lc.count_max > 0 && lc.count_above_max == 0); - cp_destroy(); - check(errors == 0); -} - -void updatelogger(void) { - cp_context_t *ctx; - cp_plugin_info_t *plugin; - cp_status_t status; - struct log_count_t lc = { CP_LOG_DEBUG, 0, 0 }; - struct log_count_t lc2 = { CP_LOG_INFO, 0, 0 }; - int count = 0; - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check(cp_register_logger(ctx, counting_logger, &lc, CP_LOG_DEBUG) == CP_OK); - check(count == 0 && lc.count_max > 0 && lc.count_above_max == 0); - check(cp_register_logger(ctx, increment_logger, &count, CP_LOG_INFO) == CP_OK); - check(count == 0 && lc.count_max > 0 && lc.count_above_max == 0); - check(cp_register_logger(ctx, counting_logger, &lc2, CP_LOG_DEBUG) == CP_OK); - check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); - check(cp_install_plugin(ctx, plugin) == CP_OK); - cp_release_info(ctx, plugin); - check(count > 0 && lc.count_max > 0 && lc.count_above_max == 0); - cp_destroy(); - check(errors == 0); -} - -struct log_info_t { - cp_log_severity_t severity; - char *msg; - char *apid; -}; - -static void store_logger(cp_log_severity_t severity, const char *msg, const char *apid, void *user_data) { - struct log_info_t *li = user_data; - - // Free previous data - if (li->msg != NULL) { - free(li->msg); - li->msg = NULL; - } - if (li->apid != NULL) { - free(li->apid); - li->apid = NULL; - } - - // Copy information - li->severity = severity; - if (msg != NULL) { - check((li->msg = strdup(msg)) != NULL); - } - if (apid != NULL) { - check((li->apid = strdup(apid)) != NULL); - } -} - -static void logmsg_sev(cp_context_t *ctx, cp_log_severity_t severity, const char *msg) { - struct log_info_t li = { -1, NULL, NULL }; - - check(cp_register_logger(ctx, store_logger, &li, CP_LOG_DEBUG) == CP_OK); - cp_log(ctx, severity, msg); - check(li.severity == severity); - check(li.msg != NULL && !strcmp(li.msg, msg)); - check(li.apid == NULL); - free(li.msg); - li.msg = NULL; - cp_unregister_logger(ctx, store_logger); -} - -void logmsg(void) { - cp_context_t *ctx; - - ctx = init_context(CP_LOG_ERROR + 1, NULL); - logmsg_sev(ctx, CP_LOG_DEBUG, "debug"); - logmsg_sev(ctx, CP_LOG_INFO, "info"); - logmsg_sev(ctx, CP_LOG_WARNING, "warning"); - logmsg_sev(ctx, CP_LOG_ERROR, "error"); - cp_destroy(); -} - -static void islogged_sev(cp_context_t *ctx, cp_log_severity_t severity) { - int count = 0; - - check(!cp_is_logged(ctx, severity)); - check(cp_register_logger(ctx, increment_logger, &count, severity) == CP_OK); - check(cp_is_logged(ctx, CP_LOG_ERROR)); - check(cp_is_logged(ctx, severity)); - switch (severity) { - case CP_LOG_DEBUG: - break; - case CP_LOG_INFO: - check(!cp_is_logged(ctx, CP_LOG_DEBUG)); - break; - case CP_LOG_WARNING: - check(!cp_is_logged(ctx, CP_LOG_INFO)); - break; - case CP_LOG_ERROR: - check(!cp_is_logged(ctx, CP_LOG_WARNING)); - break; - } - cp_unregister_logger(ctx, increment_logger); -} - -void islogged(void) { - cp_context_t *ctx; - - ctx = init_context(CP_LOG_ERROR + 1, NULL); - islogged_sev(ctx, CP_LOG_DEBUG); - islogged_sev(ctx, CP_LOG_INFO); - islogged_sev(ctx, CP_LOG_WARNING); - islogged_sev(ctx, CP_LOG_ERROR); - cp_destroy(); -} diff --git a/lib/cpluff/test/pcallbacks.c b/lib/cpluff/test/pcallbacks.c deleted file mode 100644 index 0a2340c4ae..0000000000 --- a/lib/cpluff/test/pcallbacks.c +++ /dev/null @@ -1,119 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "plugins-source/callbackcounter/callbackcounter.h" -#include "test.h" - -static char *argv[] = { "testarg0", NULL }; - -void plugincallbacks(void) { - cp_context_t *ctx; - cp_status_t status; - cp_plugin_info_t *plugin; - int errors; - cbc_counters_t *counters; - - ctx = init_context(CP_LOG_ERROR, &errors); - cp_set_context_args(ctx, argv); - check((plugin = cp_load_plugin_descriptor(ctx, "tmp/install/plugins/callbackcounter", &status)) != NULL && status == CP_OK); - check(cp_install_plugin(ctx, plugin) == CP_OK); - cp_release_info(ctx, plugin); - - // Start plug-in implicitly by resolving a symbol - check((counters = cp_resolve_symbol(ctx, "callbackcounter", "cbc_counters", &status)) != NULL && status == CP_OK); - check(counters->create == 1); - check(counters->start == 1); - check(counters->logger == 0); - check(counters->listener == 1); - check(counters->run == 0); - check(counters->stop == 0); - check(counters->destroy == 0); - check(counters->context_arg_0 != NULL && strcmp(counters->context_arg_0, argv[0]) == 0); - - // Cause warning - check(cp_start_plugin(ctx, "nonexisting") == CP_ERR_UNKNOWN); - check(counters->create == 1); - check(counters->start == 1); - check(counters->logger == 1); - check(counters->listener == 1); - check(counters->run == 0); - check(counters->stop == 0); - check(counters->destroy == 0); - - // Run run function once - check(cp_run_plugins_step(ctx)); - check(counters->create == 1); - check(counters->start == 1); - check(counters->logger == 1); - check(counters->listener == 1); - check(counters->run == 1); - check(counters->stop == 0); - check(counters->destroy == 0); - - // Run run function until no more work to be done (run = 3) - cp_run_plugins(ctx); - check(counters->create == 1); - check(counters->start == 1); - check(counters->logger == 1); - check(counters->listener == 1); - check(counters->run == 3); - check(counters->stop == 0); - check(counters->destroy == 0); - - /* - * Normally symbols must not be accessed after they have been released. - * We still access counters here because we know that the plug-in - * implementation does not free the counter data. - */ - cp_release_symbol(ctx, counters); - - // Stop plug-in - check(cp_stop_plugin(ctx, "callbackcounter") == CP_OK); - check(counters->create == 1); - check(counters->start == 1); - check(counters->logger == 1); - check(counters->listener == 2); - check(counters->run == 3); - check(counters->stop == 1); - // for now 1 but might be 0 in future (delay destroy) - check(counters->destroy == 0 || counters->destroy == 1); - - // Uninstall plugin - check(cp_uninstall_plugin(ctx, "callbackcounter") == CP_OK); - check(counters->create == 1); - check(counters->start == 1); - check(counters->logger == 1); - check(counters->listener == 2); - check(counters->run == 3); - check(counters->stop == 1); - check(counters->destroy == 1); - - cp_destroy(); - check(errors == 0); - - /* Free the counter data that was intentionally leaked by the plug-in */ - free(counters); -} diff --git a/lib/cpluff/test/pcollections/collection1/plugin1/plugin.xml b/lib/cpluff/test/pcollections/collection1/plugin1/plugin.xml deleted file mode 100644 index f35bd7add8..0000000000 --- a/lib/cpluff/test/pcollections/collection1/plugin1/plugin.xml +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0"?> -<plugin id="plugin1"/> diff --git a/lib/cpluff/test/pcollections/collection1v2/plugin1/plugin.xml b/lib/cpluff/test/pcollections/collection1v2/plugin1/plugin.xml deleted file mode 100644 index d3858009b6..0000000000 --- a/lib/cpluff/test/pcollections/collection1v2/plugin1/plugin.xml +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0"?> -<plugin id="plugin1" version="2"/> diff --git a/lib/cpluff/test/pcollections/collection1v3/plugin1/plugin.xml b/lib/cpluff/test/pcollections/collection1v3/plugin1/plugin.xml deleted file mode 100644 index f4f2eedbb6..0000000000 --- a/lib/cpluff/test/pcollections/collection1v3/plugin1/plugin.xml +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0"?> -<plugin id="plugin1" version="3"/> diff --git a/lib/cpluff/test/pcollections/collection2/plugin2a/plugin.xml b/lib/cpluff/test/pcollections/collection2/plugin2a/plugin.xml deleted file mode 100644 index 2f8796a3d4..0000000000 --- a/lib/cpluff/test/pcollections/collection2/plugin2a/plugin.xml +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0"?> -<plugin id="plugin2a"/> diff --git a/lib/cpluff/test/pcollections/collection2/plugin2b/plugin.xml b/lib/cpluff/test/pcollections/collection2/plugin2b/plugin.xml deleted file mode 100644 index 2d24170610..0000000000 --- a/lib/cpluff/test/pcollections/collection2/plugin2b/plugin.xml +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0"?> -<plugin id="plugin2b"/> diff --git a/lib/cpluff/test/pcollections/dependencies/chain1/plugin.xml b/lib/cpluff/test/pcollections/dependencies/chain1/plugin.xml deleted file mode 100644 index 674622a2d1..0000000000 --- a/lib/cpluff/test/pcollections/dependencies/chain1/plugin.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0"?> -<plugin id="chain1"> - <requires> - <import plugin="chain2"/> - </requires> -</plugin>
\ No newline at end of file diff --git a/lib/cpluff/test/pcollections/dependencies/chain2/plugin.xml b/lib/cpluff/test/pcollections/dependencies/chain2/plugin.xml deleted file mode 100644 index a2b3af51cd..0000000000 --- a/lib/cpluff/test/pcollections/dependencies/chain2/plugin.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0"?> -<plugin id="chain2"> - <requires> - <import plugin="chain3"/> - </requires> -</plugin>
\ No newline at end of file diff --git a/lib/cpluff/test/pcollections/dependencies/chain3/plugin.xml b/lib/cpluff/test/pcollections/dependencies/chain3/plugin.xml deleted file mode 100644 index 1825ff9151..0000000000 --- a/lib/cpluff/test/pcollections/dependencies/chain3/plugin.xml +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0"?> -<plugin id="chain3"/> diff --git a/lib/cpluff/test/pcollections/dependencies/chainmissingdep/plugin.xml b/lib/cpluff/test/pcollections/dependencies/chainmissingdep/plugin.xml deleted file mode 100644 index ad9ec9a646..0000000000 --- a/lib/cpluff/test/pcollections/dependencies/chainmissingdep/plugin.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0"?> -<plugin id="chainmissingdep"> - <requires> - <import plugin="missingdep"/> - </requires> -</plugin>
\ No newline at end of file diff --git a/lib/cpluff/test/pcollections/dependencies/loop1/plugin.xml b/lib/cpluff/test/pcollections/dependencies/loop1/plugin.xml deleted file mode 100644 index aa9d2f386c..0000000000 --- a/lib/cpluff/test/pcollections/dependencies/loop1/plugin.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0"?> -<plugin id="loop1"> - <requires> - <import plugin="loop2"/> - </requires> -</plugin> diff --git a/lib/cpluff/test/pcollections/dependencies/loop2/plugin.xml b/lib/cpluff/test/pcollections/dependencies/loop2/plugin.xml deleted file mode 100644 index efdf5013f0..0000000000 --- a/lib/cpluff/test/pcollections/dependencies/loop2/plugin.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0"?> -<plugin id="loop2"> - <requires> - <import plugin="loop3"/> - <import plugin="loop4"/> - </requires> -</plugin> diff --git a/lib/cpluff/test/pcollections/dependencies/loop3/plugin.xml b/lib/cpluff/test/pcollections/dependencies/loop3/plugin.xml deleted file mode 100644 index 2e003936d1..0000000000 --- a/lib/cpluff/test/pcollections/dependencies/loop3/plugin.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0"?> -<plugin id="loop3"> - <requires> - <import plugin="loop1"/> - </requires> -</plugin> diff --git a/lib/cpluff/test/pcollections/dependencies/loop4/plugin.xml b/lib/cpluff/test/pcollections/dependencies/loop4/plugin.xml deleted file mode 100644 index 138c6db891..0000000000 --- a/lib/cpluff/test/pcollections/dependencies/loop4/plugin.xml +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0"?> -<plugin id="loop4"/> diff --git a/lib/cpluff/test/pcollections/dependencies/loop5/plugin.xml b/lib/cpluff/test/pcollections/dependencies/loop5/plugin.xml deleted file mode 100644 index bcb42019cc..0000000000 --- a/lib/cpluff/test/pcollections/dependencies/loop5/plugin.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0"?> -<plugin id="loop5"> - <requires> - <import plugin="loop3"/> - </requires> -</plugin> diff --git a/lib/cpluff/test/pcollections/dependencies/missingdep/plugin.xml b/lib/cpluff/test/pcollections/dependencies/missingdep/plugin.xml deleted file mode 100644 index dbdfd6b235..0000000000 --- a/lib/cpluff/test/pcollections/dependencies/missingdep/plugin.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0"?> -<plugin id="missingdep"> - <requires> - <import plugin="nonexisting"/> - </requires> -</plugin>
\ No newline at end of file diff --git a/lib/cpluff/test/pcollections/dependencies/sloop1/plugin.xml b/lib/cpluff/test/pcollections/dependencies/sloop1/plugin.xml deleted file mode 100644 index e8c48eec53..0000000000 --- a/lib/cpluff/test/pcollections/dependencies/sloop1/plugin.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0"?> -<plugin id="sloop1"> - <requires> - <import plugin="sloop2"/> - </requires> -</plugin> diff --git a/lib/cpluff/test/pcollections/dependencies/sloop2/plugin.xml b/lib/cpluff/test/pcollections/dependencies/sloop2/plugin.xml deleted file mode 100644 index e32b1a4361..0000000000 --- a/lib/cpluff/test/pcollections/dependencies/sloop2/plugin.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0"?> -<plugin id="sloop2"> - <requires> - <import plugin="sloop1"/> - </requires> -</plugin>
\ No newline at end of file diff --git a/lib/cpluff/test/pdependencies.c b/lib/cpluff/test/pdependencies.c deleted file mode 100644 index 9610ea177b..0000000000 --- a/lib/cpluff/test/pdependencies.c +++ /dev/null @@ -1,159 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#include <stdio.h> -#include <string.h> -#include "test.h" - -static int active(cp_context_t *ctx, const char * const * const plugins) { - cp_plugin_info_t **pis; - cp_status_t status; - int i; - int errors = 0; - - check((pis = cp_get_plugins_info(ctx, &status, NULL)) != NULL && status == CP_OK); - for (i = 0; !errors && pis[i] != NULL; i++) { - int j; - int should_be_active = 0; - cp_plugin_state_t state; - - for (j = 0; !should_be_active && plugins[j] != NULL; j++) { - if (!strcmp(pis[i]->identifier, plugins[j])) { - should_be_active = 1; - } - } - state = cp_get_plugin_state(ctx, pis[i]->identifier); - if ((should_be_active && state != CP_PLUGIN_ACTIVE) - || (!should_be_active && state == CP_PLUGIN_ACTIVE)) { - fprintf(stderr, "plug-in %s has unexpected state %d\n", pis[i]->identifier, state); - errors++; - } - } - cp_release_info(ctx, pis); - return errors == 0; -} - -void pluginmissingdep(void) { - cp_context_t *ctx; - const char * const act_none[] = { NULL }; - - ctx = init_context(CP_LOG_ERROR + 1, NULL); - check((cp_register_pcollection(ctx, pcollectiondir("dependencies"))) == CP_OK); - check(cp_scan_plugins(ctx, 0) == CP_OK); - - // Try starting a plugin depending on plug-in missing dependency - check(cp_start_plugin(ctx, "chainmissingdep") == CP_ERR_DEPENDENCY); - check(active(ctx, act_none)); - - // Try starting a plug-in with missing dependency - check(cp_start_plugin(ctx, "missingdep") == CP_ERR_DEPENDENCY); - check(active(ctx, act_none)); - - cp_destroy(); -} - -void plugindepchain(void) { - cp_context_t *ctx; - const char * const act_none[] = { NULL }; - const char * const act_chain123[] = { "chain1", "chain2", "chain3", NULL }; - const char * const act_chain23[] = { "chain2", "chain3", NULL }; - const char * const act_chain3[] = { "chain3", NULL }; - - ctx = init_context(CP_LOG_ERROR, NULL); - check((cp_register_pcollection(ctx, pcollectiondir("dependencies"))) == CP_OK); - check(cp_scan_plugins(ctx, 0) == CP_OK); - - // Try starting and stopping plug-ins in dependency chain - check(cp_start_plugin(ctx, "chain1") == CP_OK); - check(active(ctx, act_chain123)); - check(cp_stop_plugin(ctx, "chain3") == CP_OK); - check(active(ctx, act_none)); - check(cp_start_plugin(ctx, "chain2") == CP_OK); - check(active(ctx, act_chain23)); - check(cp_stop_plugin(ctx, "chain2") == CP_OK); - check(active(ctx, act_chain3)); - check(cp_stop_plugin(ctx, "chain3") == CP_OK); - check(active(ctx, act_none)); - check(cp_start_plugin(ctx, "chain3") == CP_OK); - check(active(ctx, act_chain3)); - - // Check that chain is unresolved when a plug-in is uninstalled - check(cp_uninstall_plugin(ctx, "chain3") == CP_OK); - check(cp_get_plugin_state(ctx, "chain1") == CP_PLUGIN_INSTALLED); - check(cp_get_plugin_state(ctx, "chain2") == CP_PLUGIN_INSTALLED); - check(cp_get_plugin_state(ctx, "chain3") == CP_PLUGIN_UNINSTALLED); - - cp_destroy(); -} - -void plugindeploop(void) { - cp_context_t *ctx; - const char * const act_none[] = { NULL }; - const char * const act_sloop12[] = { "sloop1", "sloop2", NULL }; - const char * const act_loop1234[] = { "loop1", "loop2", "loop3", "loop4", NULL }; - const char * const act_loop4[] = { "loop4", NULL }; - const char * const act_loop12345[] = { "loop1", "loop2", "loop3", "loop4", "loop5", NULL }; - - ctx = init_context(CP_LOG_ERROR, NULL); - check((cp_register_pcollection(ctx, pcollectiondir("dependencies"))) == CP_OK); - check(cp_scan_plugins(ctx, 0) == CP_OK); - - // Start/stop checks for a short loop sloop1 <--> sloop2 - check(active(ctx, act_none)); - check(cp_start_plugin(ctx, "sloop1") == CP_OK); - check(active(ctx, act_sloop12)); - check(cp_stop_plugin(ctx, "sloop1") == CP_OK); - check(active(ctx, act_none)); - - // Start/stop checks for an extended loop - // loop1 --> loop2 - // loop2 --> loop3 - // loop3 --> loop1 - // loop2 --> loop4 - // loop5 --> loop3 - check(cp_start_plugin(ctx, "loop5") == CP_OK); - check(active(ctx, act_loop12345)); - check(cp_stop_plugin(ctx, "loop4") == CP_OK); - check(active(ctx, act_none)); - check(cp_start_plugin(ctx, "loop4") == CP_OK); - check(active(ctx, act_loop4)); - check(cp_start_plugin(ctx, "loop1") == CP_OK); - check(active(ctx, act_loop1234)); - check(cp_stop_plugin(ctx, "loop3") == CP_OK); - check(active(ctx, act_loop4)); - - // Unresolve check for the short loop - check(cp_uninstall_plugin(ctx, "sloop1") == CP_OK); - check(cp_get_plugin_state(ctx, "sloop1") == CP_PLUGIN_UNINSTALLED); - check(cp_get_plugin_state(ctx, "sloop2") == CP_PLUGIN_INSTALLED); - - // Unresolve check for the extended loop - check(cp_uninstall_plugin(ctx, "loop4") == CP_OK); - check(cp_get_plugin_state(ctx, "loop1") == CP_PLUGIN_INSTALLED); - check(cp_get_plugin_state(ctx, "loop2") == CP_PLUGIN_INSTALLED); - check(cp_get_plugin_state(ctx, "loop3") == CP_PLUGIN_INSTALLED); - check(cp_get_plugin_state(ctx, "loop4") == CP_PLUGIN_UNINSTALLED); - check(cp_get_plugin_state(ctx, "loop5") == CP_PLUGIN_INSTALLED); - - cp_destroy(); -} diff --git a/lib/cpluff/test/pinstallation.c b/lib/cpluff/test/pinstallation.c deleted file mode 100644 index 1cc57fc005..0000000000 --- a/lib/cpluff/test/pinstallation.c +++ /dev/null @@ -1,101 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#include <stdio.h> -#include "test.h" - -void install(void) { - cp_context_t *ctx; - cp_plugin_info_t *plugin; - cp_status_t status; - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_UNINSTALLED); - check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); - check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_UNINSTALLED); - check(cp_install_plugin(ctx, plugin) == CP_OK); - cp_release_info(ctx, plugin); - check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_INSTALLED); - cp_destroy(); - check(errors == 0); -} - -void installtwo(void) { - cp_context_t *ctx; - cp_plugin_info_t *plugin; - cp_status_t status; - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_UNINSTALLED); - check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); - check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_UNINSTALLED); - check(cp_install_plugin(ctx, plugin) == CP_OK); - cp_release_info(ctx, plugin); - check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_INSTALLED); - check(cp_get_plugin_state(ctx, "maximal") == CP_PLUGIN_UNINSTALLED); - check((plugin = cp_load_plugin_descriptor(ctx, plugindir("maximal"), &status)) != NULL && status == CP_OK); - check(cp_get_plugin_state(ctx, "maximal") == CP_PLUGIN_UNINSTALLED); - check(cp_install_plugin(ctx, plugin) == CP_OK); - cp_release_info(ctx, plugin); - check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_INSTALLED); - check(cp_get_plugin_state(ctx, "maximal") == CP_PLUGIN_INSTALLED); - cp_destroy(); - check(errors == 0); -} - -void installconflict(void) { - cp_context_t *ctx; - cp_plugin_info_t *plugin; - cp_status_t status; - - ctx = init_context(CP_LOG_ERROR + 1, NULL); - check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_UNINSTALLED); - check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); - check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_UNINSTALLED); - check(cp_install_plugin(ctx, plugin) == CP_OK); - cp_release_info(ctx, plugin); - check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_INSTALLED); - check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); - check(cp_install_plugin(ctx, plugin) == CP_ERR_CONFLICT); - cp_release_info(ctx, plugin); - cp_destroy(); -} - -void uninstall(void) { - cp_context_t *ctx; - cp_plugin_info_t *plugin; - cp_status_t status; - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check((plugin = cp_load_plugin_descriptor(ctx, plugindir("minimal"), &status)) != NULL && status == CP_OK); - check(cp_install_plugin(ctx, plugin) == CP_OK); - cp_release_info(ctx, plugin); - check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_INSTALLED); - check(cp_uninstall_plugin(ctx, "minimal") == CP_OK); - check(cp_get_plugin_state(ctx, "minimal") == CP_PLUGIN_UNINSTALLED); - cp_destroy(); - check(errors == 0); -} diff --git a/lib/cpluff/test/ploading.c b/lib/cpluff/test/ploading.c deleted file mode 100644 index 503516e272..0000000000 --- a/lib/cpluff/test/ploading.c +++ /dev/null @@ -1,77 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "test.h" - -#define MEMBUFFERSIZE 16384 -#define PLUGINFILENAME "plugin.xml" - -void loadonlymaximal(void) { - cp_context_t *ctx; - cp_plugin_info_t *plugin; - cp_status_t status; - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check((plugin = cp_load_plugin_descriptor(ctx, plugindir("maximal"), &status)) != NULL && status == CP_OK); - cp_release_info(ctx, plugin); - cp_destroy(); - check(errors == 0); -} - -void loadonlymaximalfrommemory(void) { - cp_context_t *ctx; - cp_plugin_info_t *plugin; - cp_status_t status; - int errors, bytesloaded = 0, i; - const char *pd; - char *pdfilename, *membuffer; - FILE *f; - - /* Load plugin descriptor to memory buffer */ - pd = plugindir("maximal"); - check((pdfilename = malloc((strlen(pd) + strlen(CP_FNAMESEP_STR) + strlen(PLUGINFILENAME) + 1) * sizeof(char))) != NULL); - strcpy(pdfilename, pd); - strcat(pdfilename, CP_FNAMESEP_STR PLUGINFILENAME); - check((membuffer = malloc(MEMBUFFERSIZE * sizeof(unsigned char))) != NULL); - check((f = fopen(pdfilename, "r")) != NULL); - do { - i = fread(membuffer + bytesloaded, sizeof(char), MEMBUFFERSIZE - bytesloaded, f); - check(!ferror(f)); - bytesloaded += i; - } while (i > 0); - fclose(f); - - /* Load plugin descriptor from memory buffer */ - ctx = init_context(CP_LOG_ERROR, &errors); - check((plugin = cp_load_plugin_descriptor_from_memory(ctx, membuffer, bytesloaded, &status)) != NULL && status == CP_OK); - - /* Clean up */ - free(membuffer); - cp_release_info(ctx, plugin); - cp_destroy(); - check(errors == 0); -} diff --git a/lib/cpluff/test/plugins-source/Makefile.am b/lib/cpluff/test/plugins-source/Makefile.am deleted file mode 100644 index d86583124c..0000000000 --- a/lib/cpluff/test/plugins-source/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -SUBDIRS = callbackcounter symuser symprovider diff --git a/lib/cpluff/test/plugins-source/callbackcounter/Makefile.am b/lib/cpluff/test/plugins-source/callbackcounter/Makefile.am deleted file mode 100644 index aa0c1b04ef..0000000000 --- a/lib/cpluff/test/plugins-source/callbackcounter/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -LIBS = @LIBS_OTHER@ @LIBS@ - -EXTRA_DIST = plugin.xml - -plugindir = /plugins/callbackcounter - -plugin_LTLIBRARIES = libruntime.la -plugin_DATA = plugin.xml - -libruntime_la_SOURCES = callbackcounter.c callbackcounter.h -libruntime_la_LDFLAGS = -module -avoid-version diff --git a/lib/cpluff/test/plugins-source/callbackcounter/callbackcounter.c b/lib/cpluff/test/plugins-source/callbackcounter/callbackcounter.c deleted file mode 100644 index 11cc15a538..0000000000 --- a/lib/cpluff/test/plugins-source/callbackcounter/callbackcounter.c +++ /dev/null @@ -1,124 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> -#include <cpluff.h> -#include "callbackcounter.h" - -struct runtime_data { - cp_context_t *ctx; - cbc_counters_t *counters; -}; - -static void *create(cp_context_t *ctx) { - struct runtime_data *data; - - if ((data = malloc(sizeof(struct runtime_data))) == NULL) { - return NULL; - } - data->ctx = ctx; - - /* - * Normally data->counters would be initialized in start function. - * We do it already here to be able to record count for the create - * function. - */ - if ((data->counters = malloc(sizeof(cbc_counters_t))) == NULL) { - free(data); - return NULL; - } - memset(data->counters, 0, sizeof(cbc_counters_t)); - data->counters->context_arg_0 = NULL; - data->counters->create++; - - return data; -} - -static void logger(cp_log_severity_t severity, const char *msg, const char *apid, void *user_data) { - struct runtime_data *data = user_data; - - data->counters->logger++; -} - -static void listener(const char *plugin_id, cp_plugin_state_t old_state, cp_plugin_state_t new_state, void *user_data) { - struct runtime_data *data = user_data; - - data->counters->listener++; -} - -static int run(void *d) { - struct runtime_data *data = d; - - data->counters->run++; - return (data->counters->run < 3); -} - -static int start(void *d) { - struct runtime_data *data = d; - char **argv; - - data->counters->start++; - argv = cp_get_context_args(data->ctx, NULL); - if (argv != NULL && argv[0] != NULL) { - if ((data->counters->context_arg_0 = strdup(argv[0])) == NULL) { - return CP_ERR_RESOURCE; - } - } - if (cp_define_symbol(data->ctx, "cbc_counters", data->counters) != CP_OK - || cp_register_logger(data->ctx, logger, data, CP_LOG_WARNING) != CP_OK - || cp_register_plistener(data->ctx, listener, data) != CP_OK - || cp_run_function(data->ctx, run) != CP_OK) { - return CP_ERR_RUNTIME; - } else { - return CP_OK; - } -} - -static void stop(void *d) { - struct runtime_data *data = d; - - data->counters->stop++; - - /* - * Normally data->counters would be freed here. However, we do not free - * it so that the test program can read counters after plug-in stops. - */ -} - -static void destroy(void *d) { - struct runtime_data *data = d; - - data->counters->destroy++; - data->counters = NULL; - free(data); -} - -CP_EXPORT cp_plugin_runtime_t cbc_runtime = { - create, - start, - stop, - destroy -}; diff --git a/lib/cpluff/test/plugins-source/callbackcounter/callbackcounter.h b/lib/cpluff/test/plugins-source/callbackcounter/callbackcounter.h deleted file mode 100644 index bbbf79c4c0..0000000000 --- a/lib/cpluff/test/plugins-source/callbackcounter/callbackcounter.h +++ /dev/null @@ -1,66 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#ifndef CALLBACKCOUNTER_H_ -#define CALLBACKCOUNTER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** A type for cbc_counters_t structure */ -typedef struct cbc_counters_t cbc_counters_t; - -/** A container for callback counters */ -struct cbc_counters_t { - - /** Call counter for the create function */ - int create; - - /** Call counter for the start function */ - int start; - - /** Call counter for the logger function */ - int logger; - - /** Call counter for the plug-in listener function */ - int listener; - - /** Call counter for the run function */ - int run; - - /** Call counter for the stop function */ - int stop; - - /** Call counter for the destroy function */ - int destroy; - - /** Copy of context arg 0 from the call to start, or NULL */ - char *context_arg_0; -}; - -#ifdef __cplusplus -} -#endif - -#endif /*CALLBACKCOUNTER_H_*/ diff --git a/lib/cpluff/test/plugins-source/callbackcounter/plugin.xml b/lib/cpluff/test/plugins-source/callbackcounter/plugin.xml deleted file mode 100644 index c5438279af..0000000000 --- a/lib/cpluff/test/plugins-source/callbackcounter/plugin.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0"?> -<plugin id="callbackcounter" name="Callback Call Counter"> - <runtime library="libruntime" funcs="cbc_runtime"/> -</plugin> diff --git a/lib/cpluff/test/plugins-source/symprovider/Makefile.am b/lib/cpluff/test/plugins-source/symprovider/Makefile.am deleted file mode 100644 index ba32ac1b48..0000000000 --- a/lib/cpluff/test/plugins-source/symprovider/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -LIBS = @LIBS_OTHER@ @LIBS@ - -EXTRA_DIST = plugin.xml - -plugindir = /plugins/symprovider - -plugin_LTLIBRARIES = libruntime.la -plugin_DATA = plugin.xml - -libruntime_la_SOURCES = symprovider.c -libruntime_la_LDFLAGS = -module -avoid-version diff --git a/lib/cpluff/test/plugins-source/symprovider/plugin.xml b/lib/cpluff/test/plugins-source/symprovider/plugin.xml deleted file mode 100644 index 3387ca637e..0000000000 --- a/lib/cpluff/test/plugins-source/symprovider/plugin.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0"?> -<plugin id="symprovider" name="Symbol Provider"> - <requires> - <import plugin="symuser"/> - </requires> - <runtime library="libruntime" funcs="sp_runtime"/> - <extension point="symuser.strings" string-symbol="sp_string"/> -</plugin> diff --git a/lib/cpluff/test/plugins-source/symprovider/symprovider.c b/lib/cpluff/test/plugins-source/symprovider/symprovider.c deleted file mode 100644 index 0008712c54..0000000000 --- a/lib/cpluff/test/plugins-source/symprovider/symprovider.c +++ /dev/null @@ -1,71 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#include <stdlib.h> -#include <string.h> -#include <cpluff.h> - -typedef struct plugin_data_t plugin_data_t; - -struct plugin_data_t { - cp_context_t *ctx; - char *str; -}; - -static void *create(cp_context_t *ctx) { - plugin_data_t *data = malloc(sizeof(plugin_data_t)); - - if (data != NULL) { - data->ctx = ctx; - data->str = NULL; - } - return data; -} - -static int start(void *d) { - plugin_data_t *data = d; - - if ((data->str = malloc(sizeof(char) * 16)) == NULL) { - return CP_ERR_RESOURCE; - } - strcpy(data->str, "Provided string"); - cp_define_symbol(data->ctx, "sp_string", data->str); - return CP_OK; -} - -static void destroy(void *d) { - plugin_data_t *data = d; - - if (data->str != NULL) { - strcpy(data->str, "Cleared string"); - free(data->str); - } - free(d); -} - -CP_EXPORT cp_plugin_runtime_t sp_runtime = { - create, - start, - NULL, - destroy -}; diff --git a/lib/cpluff/test/plugins-source/symuser/Makefile.am b/lib/cpluff/test/plugins-source/symuser/Makefile.am deleted file mode 100644 index cc0314077d..0000000000 --- a/lib/cpluff/test/plugins-source/symuser/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -# Copyright 2007 Johannes Lehtinen -# This Makefile is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -LIBS = @LIBS_OTHER@ @LIBS@ - -EXTRA_DIST = plugin.xml - -plugindir = /plugins/symuser - -plugin_LTLIBRARIES = libruntime.la -plugin_DATA = plugin.xml - -libruntime_la_SOURCES = symuser.c -libruntime_la_LDFLAGS = -module -avoid-version diff --git a/lib/cpluff/test/plugins-source/symuser/plugin.xml b/lib/cpluff/test/plugins-source/symuser/plugin.xml deleted file mode 100644 index 57c2d68f95..0000000000 --- a/lib/cpluff/test/plugins-source/symuser/plugin.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0"?> -<plugin id="symuser" name="Symbol User"> - <runtime library="libruntime" funcs="su_runtime"/> - <extension-point id="strings"/> -</plugin> diff --git a/lib/cpluff/test/plugins-source/symuser/symuser.c b/lib/cpluff/test/plugins-source/symuser/symuser.c deleted file mode 100644 index 8e84a6f762..0000000000 --- a/lib/cpluff/test/plugins-source/symuser/symuser.c +++ /dev/null @@ -1,97 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <cpluff.h> - -typedef struct plugin_data_t plugin_data_t; - -struct plugin_data_t { - cp_context_t *ctx; - const char *str; -}; - -static void *create(cp_context_t *ctx) { - plugin_data_t *data; - - if ((data = malloc(sizeof(plugin_data_t))) != NULL) { - data->ctx = ctx; - data->str = NULL; - } - return data; -} - -static int start(void *d) { - plugin_data_t *data = d; - cp_extension_t **exts; - - exts = cp_get_extensions_info(data->ctx, "symuser.strings", NULL, NULL); - if (exts != NULL && exts[0] != NULL) { - const char *symname; - - symname = cp_lookup_cfg_value(exts[0]->configuration, "@string-symbol"); - if (symname != NULL) { - data->str = cp_resolve_symbol(data->ctx, exts[0]->plugin->identifier, symname, NULL); - if (data->str == NULL) { - cp_log(data->ctx, CP_LOG_ERROR, "Could not resolve symbol specified by extension."); - } - } else { - cp_log(data->ctx, CP_LOG_ERROR, "No string-symbol attribute present in extension."); - } - } else { - cp_log(data->ctx, CP_LOG_ERROR, "No extensions available."); - } - if (exts != NULL) { - cp_release_info(data->ctx, exts); - } - if (data->str == NULL) { - return CP_ERR_RUNTIME; - } - return cp_define_symbol(data->ctx, "used_string", (void *) data->str); -} - -static void stop(void *d) { - plugin_data_t *data = d; - - // Check that the provided string is still available - if (data->str != NULL) { - if (strcmp(data->str, "Provided string")) { - fputs("Provided string is not available in symuser stop function.\n", stderr); - abort(); - } - cp_release_symbol(data->ctx, data->str); - } -} - -static void destroy(void *d) { - free(d); -} - -CP_EXPORT cp_plugin_runtime_t su_runtime = { - create, - start, - stop, - destroy -}; diff --git a/lib/cpluff/test/plugins/maximal/plugin.xml b/lib/cpluff/test/plugins/maximal/plugin.xml deleted file mode 100644 index 2bab3c0672..0000000000 --- a/lib/cpluff/test/plugins/maximal/plugin.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0"?> -<plugin id="maximal" name="Maximal" version="1.0.0.max" provider-name="Maximal Provider"> - <backwards-compatibility abi="1.0" api="0.8"/> - <requires> - <c-pluff version="999.3.4"/> - <import plugin="dependency1" version="0.1" optional="true"/> - <import plugin="dependency2" version="0.2"/> - <import plugin="dependency3" optional="true"/> - <import plugin="dependency4"/> - </requires> - <runtime library="nonexisting" funcs="funcs"/> - <extension-point id="extpt1" name="Extension Point 1" schema="ext1.xsd"/> - <extension-point id="extpt2" name="Extension Point 2"/> - <extension-point id="extpt3" schema="extpt3.xsd"/> - <extension-point id="extpt4"/> - <extension point="nonexisting.extptA" id="ext1" name="Extension 1"> - Extension data begins - <structure> - <parameter>parameter</parameter> - <parameter>param2</parameter> - <!-- <parameter>commented out parameter</parameter> --> - <assertion>1<2</assertion> - <deeper> - <struct> - <is>here</is> - </struct> - </deeper> - Structure ends - </structure> - </extension> - <extension point="nonexisting.extptB" id="ext2"/> - <extension point="maximal.extpt1" name="Extension 3"/> - <extension point="maximal.extpt2"/> -</plugin> diff --git a/lib/cpluff/test/plugins/minimal/plugin.xml b/lib/cpluff/test/plugins/minimal/plugin.xml deleted file mode 100644 index d5a0d23d84..0000000000 --- a/lib/cpluff/test/plugins/minimal/plugin.xml +++ /dev/null @@ -1 +0,0 @@ -<plugin id="minimal"/> diff --git a/lib/cpluff/test/pscanning.c b/lib/cpluff/test/pscanning.c deleted file mode 100644 index ae1987a080..0000000000 --- a/lib/cpluff/test/pscanning.c +++ /dev/null @@ -1,181 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#include <stdio.h> -#include <string.h> -#include "test.h" - -/* - * Basic plug-in scanning tests were already performed in collections.c. - * Here we test some more complex things like upgrade and restart behavior. - */ - -static void scanupgrade_checkpver(cp_context_t *ctx, const char *plugin, const char *ver) { - cp_plugin_info_t *pi; - cp_status_t status; - - check((pi = cp_get_plugin_info(ctx, plugin, &status)) != NULL && status == CP_OK); - check(ver == NULL ? pi->version == NULL : (pi->version != NULL && strcmp(pi->version, ver) == 0)); - cp_release_info(ctx, pi); -} - -void scanupgrade(void) { - cp_context_t *ctx; - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK); - check(cp_register_pcollection(ctx, pcollectiondir("collection2")) == CP_OK); - check(cp_scan_plugins(ctx, 0) == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_INSTALLED); - check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_INSTALLED); - check(cp_get_plugin_state(ctx, "plugin2b") == CP_PLUGIN_INSTALLED); - scanupgrade_checkpver(ctx, "plugin1", NULL); - - // Register newer version of plugin1 but do not allow upgrades - check(cp_start_plugin(ctx, "plugin1") == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); - check(cp_register_pcollection(ctx, pcollectiondir("collection1v2")) == CP_OK); - check(cp_scan_plugins(ctx, 0) == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); - scanupgrade_checkpver(ctx, "plugin1", NULL); - - // Now allow upgrade of plugin1 - check(cp_scan_plugins(ctx, CP_SP_UPGRADE) == CP_OK); - scanupgrade_checkpver(ctx, "plugin1", "2"); - - // Register even new version and upgrade while running - check(cp_register_pcollection(ctx, pcollectiondir("collection1v3")) == CP_OK); - check(cp_start_plugin(ctx, "plugin1") == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); - check(cp_scan_plugins(ctx, CP_SP_UPGRADE) == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_INSTALLED); - scanupgrade_checkpver(ctx, "plugin1", "3"); - - // Check that plug-in is not downgraded when newer versions are unregistered - cp_unregister_pcollection(ctx, pcollectiondir("collection1v3")); - check(cp_scan_plugins(ctx, CP_SP_UPGRADE) == CP_OK); - scanupgrade_checkpver(ctx, "plugin1", "3"); - - cp_destroy(); - check(errors == 0); -} - -void scanstoponupgrade(void) { - cp_context_t *ctx; - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK); - check(cp_register_pcollection(ctx, pcollectiondir("collection2")) == CP_OK); - check(cp_scan_plugins(ctx, 0) == CP_OK); - - // First check upgrade without stopping other plug-ins - check(cp_start_plugin(ctx, "plugin1") == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); - check(cp_start_plugin(ctx, "plugin2a") == CP_OK); - check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_ACTIVE); - check(cp_register_pcollection(ctx, pcollectiondir("collection1v2")) == CP_OK); - check(cp_scan_plugins(ctx, CP_SP_UPGRADE) == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_INSTALLED); - check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_ACTIVE); - - // Then check upgrade with stop flag - check(cp_start_plugin(ctx, "plugin1") == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); - check(cp_register_pcollection(ctx, pcollectiondir("collection1v3")) == CP_OK); - check(cp_scan_plugins(ctx, CP_SP_UPGRADE | CP_SP_STOP_ALL_ON_UPGRADE) == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_INSTALLED); - check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_RESOLVED); - - cp_destroy(); - check(errors == 0); -} - -void scanstoponinstall(void) { - cp_context_t *ctx; - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK); - check(cp_scan_plugins(ctx, 0) == CP_OK); - - // First check install without stopping other plug-ins - check(cp_start_plugin(ctx, "plugin1") == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); - check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_UNINSTALLED); - check(cp_register_pcollection(ctx, pcollectiondir("collection2")) == CP_OK); - check(cp_scan_plugins(ctx, 0) == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); - check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_INSTALLED); - - // Then check install and stopping of other plug-ins - check(cp_uninstall_plugin(ctx, "plugin2a") == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); - check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_UNINSTALLED); - check(cp_scan_plugins(ctx, CP_SP_STOP_ALL_ON_INSTALL) == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_RESOLVED); - check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_INSTALLED); - - // Then check upgrade and stopping of other plug-ins - check(cp_start_plugin(ctx, "plugin2a") == CP_OK); - check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_ACTIVE); - check(cp_register_pcollection(ctx, pcollectiondir("collection1v2")) == CP_OK); - check(cp_scan_plugins(ctx, CP_SP_UPGRADE | CP_SP_STOP_ALL_ON_INSTALL) == CP_OK); - check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_RESOLVED); - - cp_destroy(); - check(errors == 0); -} - -void scanrestart(void) { - cp_context_t *ctx; - int errors; - - ctx = init_context(CP_LOG_ERROR, &errors); - check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK); - check(cp_register_pcollection(ctx, pcollectiondir("collection2")) == CP_OK); - check(cp_scan_plugins(ctx, 0) == CP_OK); - check(cp_start_plugin(ctx, "plugin2b") == CP_OK); - check(cp_start_plugin(ctx, "plugin1") == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); - check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_INSTALLED); - check(cp_get_plugin_state(ctx, "plugin2b") == CP_PLUGIN_ACTIVE); - - // Check that upgraded plug-in is correctly restarted after upgrade - check(cp_register_pcollection(ctx, pcollectiondir("collection1v2")) == CP_OK); - check(cp_scan_plugins(ctx, CP_SP_UPGRADE | CP_SP_RESTART_ACTIVE) == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); - check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_INSTALLED); - check(cp_get_plugin_state(ctx, "plugin2b") == CP_PLUGIN_ACTIVE); - - // Check that other plug-ins are correctly restarted after upgrade - check(cp_register_pcollection(ctx, pcollectiondir("collection1v3")) == CP_OK); - check(cp_scan_plugins(ctx, CP_SP_UPGRADE | CP_SP_STOP_ALL_ON_UPGRADE | CP_SP_RESTART_ACTIVE) == CP_OK); - check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_ACTIVE); - check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_INSTALLED); - check(cp_get_plugin_state(ctx, "plugin2b") == CP_PLUGIN_ACTIVE); - - cp_destroy(); - check(errors == 0); -} diff --git a/lib/cpluff/test/psymbolusage.c b/lib/cpluff/test/psymbolusage.c deleted file mode 100644 index d0a1b3ca15..0000000000 --- a/lib/cpluff/test/psymbolusage.c +++ /dev/null @@ -1,51 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "test.h" - -void symbolusage(void) { - cp_context_t *ctx; - cp_status_t status; - int errors; - const char *str; - - ctx = init_context(CP_LOG_ERROR, &errors); - check(cp_register_pcollection(ctx, "tmp/install/plugins") == CP_OK); - check(cp_scan_plugins(ctx, 0) == CP_OK); - - // Start plug-in implicitly by resolving a symbol - check((str = cp_resolve_symbol(ctx, "symuser", "used_string", &status)) != NULL && status == CP_OK); - - // Compare used string to the provided string - check(strcmp(str, "Provided string") == 0); - - // Release string - cp_release_symbol(ctx, str); - - // Shutdown framework - cp_destroy(); - check(errors == 0); -} diff --git a/lib/cpluff/test/test-extensions b/lib/cpluff/test/test-extensions deleted file mode 100755 index 29e25dac72..0000000000 --- a/lib/cpluff/test/test-extensions +++ /dev/null @@ -1,17 +0,0 @@ -#! /bin/sh - -# Copyright 2007 Johannes Lehtinen -# This shell script is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -set -e - -tmpdir="tmp/test-extensions" -mkdir -p "$tmpdir" -LC_ALL=C libtool --mode=execute $TEST_WRAPPER ../console/cpluff-console <<EOI > "$tmpdir"/console-out.txt -set-log-level error -load-plugin $srcdir/plugins/maximal -list-extensions -EOI -sed -n -e '/^Installed extensions:$/,/^C-Pluff/p' < "$tmpdir"/console-out.txt > "$tmpdir"/filtered.txt -diff -u "$srcdir"/expected/output-extensions.txt "$tmpdir"/filtered.txt diff --git a/lib/cpluff/test/test-extpoints b/lib/cpluff/test/test-extpoints deleted file mode 100755 index 5b7824e204..0000000000 --- a/lib/cpluff/test/test-extpoints +++ /dev/null @@ -1,17 +0,0 @@ -#! /bin/sh - -# Copyright 2007 Johannes Lehtinen -# This shell script is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -set -e - -tmpdir="tmp/test-extpoints" -mkdir -p "$tmpdir" -LC_ALL=C libtool --mode=execute $TEST_WRAPPER ../console/cpluff-console <<EOI > "$tmpdir"/console-out.txt -set-log-level error -load-plugin $srcdir/plugins/maximal -list-ext-points -EOI -sed -n -e '/^Installed extension points:$/,/^C-Pluff/p' < "$tmpdir"/console-out.txt > "$tmpdir"/filtered.txt -diff -u "$srcdir"/expected/output-extpoints.txt "$tmpdir"/filtered.txt diff --git a/lib/cpluff/test/test-fatalerrordefault b/lib/cpluff/test/test-fatalerrordefault deleted file mode 100755 index 2c98d5e7ad..0000000000 --- a/lib/cpluff/test/test-fatalerrordefault +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh - -# Copyright 2007 Johannes Lehtinen -# This shell script is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -set -e - -trap '' 6 -! ./testsuite fatalerrordefault 2> /dev/null diff --git a/lib/cpluff/test/test-fatalerrorreset b/lib/cpluff/test/test-fatalerrorreset deleted file mode 100755 index 350763743b..0000000000 --- a/lib/cpluff/test/test-fatalerrorreset +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh - -# Copyright 2007 Johannes Lehtinen -# This shell script is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -set -e - -trap '' 6 -! ./testsuite fatalerrorreset 2> /dev/null diff --git a/lib/cpluff/test/test-loadmaximal b/lib/cpluff/test/test-loadmaximal deleted file mode 100755 index 420dd204cb..0000000000 --- a/lib/cpluff/test/test-loadmaximal +++ /dev/null @@ -1,17 +0,0 @@ -#! /bin/sh - -# Copyright 2007 Johannes Lehtinen -# This shell script is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -set -e - -tmpdir="tmp/test-loadmaximal" -mkdir -p "$tmpdir" -LC_ALL=C libtool --mode=execute $TEST_WRAPPER ../console/cpluff-console <<EOI > "$tmpdir"/console-out.txt -set-log-level error -load-plugin $srcdir/plugins/maximal -show-plugin-info maximal -EOI -sed -n -e '/^{$/,/^}$/{/^ plugin_path =/!p}' < "$tmpdir"/console-out.txt > "$tmpdir"/filtered.txt -diff -u "$srcdir"/expected/output-loadmaximal.txt "$tmpdir"/filtered.txt diff --git a/lib/cpluff/test/test-loadminimal b/lib/cpluff/test/test-loadminimal deleted file mode 100755 index 17df7f8db3..0000000000 --- a/lib/cpluff/test/test-loadminimal +++ /dev/null @@ -1,17 +0,0 @@ -#! /bin/sh - -# Copyright 2007 Johannes Lehtinen -# This shell script is free software; Johannes Lehtinen gives unlimited -# permission to copy, distribute and modify it. - -set -e - -tmpdir="tmp/test-loadminimal" -mkdir -p "$tmpdir" -LC_ALL=C libtool --mode=execute $TEST_WRAPPER ../console/cpluff-console <<EOI > "$tmpdir"/console-out.txt -set-log-level error -load-plugin $srcdir/plugins/minimal -show-plugin-info minimal -EOI -sed -n -e '/^{$/,/^}$/{/^ plugin_path =/!p}' < "$tmpdir"/console-out.txt > "$tmpdir"/filtered.txt -diff -u "$srcdir"/expected/output-loadminimal.txt "$tmpdir"/filtered.txt diff --git a/lib/cpluff/test/test.h b/lib/cpluff/test/test.h deleted file mode 100644 index 1b42e2139c..0000000000 --- a/lib/cpluff/test/test.h +++ /dev/null @@ -1,99 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#ifndef TEST_H_ -#define TEST_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <cpluff.h> - -// GNU C attribute defines -#ifndef CP_GCC_NORETURN -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5) -#define CP_GCC_NORETURN __attribute__((noreturn)) -#else -#define CP_GCC_NORETURN -#endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Prints failure message and aborts the test program. - * - * @param func the test function - * @param file the test source file - * @param line the test source line - * @param msg the failure message - */ -CP_HIDDEN void fail(const char *func, const char *file, int line, const char *msg) CP_GCC_NORETURN CP_GCC_NONNULL(1, 2, 4); - -/** - * Checks that the specified condition is true. - * - * @param cond the condition that should be true - */ -#define check(cond) do { if (!(cond)) { fail(__func__, __FILE__, __LINE__, "Failed condition: " #cond); }} while (0) - -/** - * Returns the plug-in path for the specified test plug-in. - * The returned string is valid until the next call to plugindir. - * - * @return plug-in path for the specified test plug-in - */ -CP_HIDDEN const char *plugindir(const char *plugin) CP_GCC_NONNULL(1); - -/** - * Returns the plug-in collection path for the specified test collection. - * The returned string is valid until the next call to pcollectiondir. - * - * @return plug-in collection path for the specified test collection - */ -CP_HIDDEN const char *pcollectiondir(const char *collection) CP_GCC_NONNULL(1); - -/** - * Initializes the C-Pluff framework and creates a plug-in context. - * Checks for any failures on the way. Also prints out context errors/warnings - * and maintains a count of logged context errors if so requested. - * - * @param min_disp_sev the minimum severity of messages to be displayed - * @param error_counter pointer to the location where the logged error count is to be stored or NULL - * @return the created plug-in context - */ -CP_HIDDEN cp_context_t *init_context(cp_log_severity_t min_disp_sev, int *error_counter); - -/** - * Frees any test resources. This can be called to ensure there are no memory - * leaks due to leaked test resources. - */ -CP_HIDDEN void free_test_resources(void); - -#ifdef __cplusplus -} -#endif - -#endif /*TEST_H_*/ diff --git a/lib/cpluff/test/testmain.c b/lib/cpluff/test/testmain.c deleted file mode 100644 index 60203beab6..0000000000 --- a/lib/cpluff/test/testmain.c +++ /dev/null @@ -1,176 +0,0 @@ -/*------------------------------------------------------------------------- - * C-Pluff, a plug-in framework for C - * Copyright 2007 Johannes Lehtinen - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *-----------------------------------------------------------------------*/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "test.h" -#include "../libcpluff/internal.h" - -static const char *argv0; - -CP_HIDDEN void fail(const char *func, const char *file, int line, const char *msg) { - fprintf(stderr, "%s: %s:%d: %s: %s\n", argv0, file, line, func, msg); - abort(); -} - -static void full_logger(cp_log_severity_t severity, const char *msg, const char *apid, void *user_data) { - const char *sevstr; - switch (severity) { - case CP_LOG_DEBUG: - sevstr = "DEBUG"; - break; - case CP_LOG_INFO: - sevstr = "INFO"; - break; - case CP_LOG_WARNING: - sevstr = "WARNING"; - break; - case CP_LOG_ERROR: - sevstr = "ERROR"; - break; - default: - check((sevstr = "UNKNOWN", 0)); - break; - } - if (apid != NULL) { - fprintf(stderr, "testsuite: %s: [%s] %s\n", sevstr, apid, msg); - } else { - fprintf(stderr, "testsuite: %s: [testsuite] %s\n", sevstr, msg); - } - if (severity >= CP_LOG_ERROR && user_data != NULL) { - (*((int *) user_data))++; - } -} - -static void counting_logger(cp_log_severity_t severity, const char *msg, const char *apid, void *user_data) { - (*((int *) user_data))++; -} - -CP_HIDDEN cp_context_t *init_context(cp_log_severity_t min_disp_sev, int *error_counter) { - cp_context_t *ctx; - cp_status_t status; - - check(cp_init() == CP_OK); - check((ctx = cp_create_context(&status)) != NULL && status == CP_OK); - if (error_counter != NULL) { - *error_counter = 0; - } - if (error_counter != NULL || min_disp_sev <= CP_LOG_ERROR) { - if (min_disp_sev <= CP_LOG_ERROR) { - check(cp_register_logger(ctx, full_logger, error_counter, min_disp_sev) == CP_OK); - } else { - check(cp_register_logger(ctx, counting_logger, error_counter, CP_LOG_ERROR) == CP_OK); - } - } - return ctx; -} - -static char *plugindir_buffer = NULL; - -CP_HIDDEN const char *plugindir(const char *plugin) { - const char *srcdir; - - if (plugindir_buffer != NULL) { - free(plugindir_buffer); - plugindir_buffer = NULL; - } - if ((srcdir = getenv("srcdir")) == NULL) { - srcdir="."; - } - if ((plugindir_buffer = malloc((strlen(srcdir) + 2 * strlen(CP_FNAMESEP_STR) + strlen("plugins") + strlen(plugin) + 1) * sizeof(char))) == NULL) { - fputs("testsuite: ERROR: Insufficient memory.\n", stderr); - exit(2); - } - strcpy(plugindir_buffer, srcdir); - strcat(plugindir_buffer, CP_FNAMESEP_STR "plugins" CP_FNAMESEP_STR); - strcat(plugindir_buffer, plugin); - return plugindir_buffer; -} - -static char *pcollectiondir_buffer = NULL; - -CP_HIDDEN const char *pcollectiondir(const char *collection) { - const char *srcdir; - - if (pcollectiondir_buffer != NULL) { - free(pcollectiondir_buffer); - pcollectiondir_buffer = NULL; - } - if ((srcdir = getenv("srcdir")) == NULL) { - srcdir="."; - } - if ((pcollectiondir_buffer = malloc((strlen(srcdir) + strlen("/pcollections/") + strlen(collection) + 1) * sizeof(char))) == NULL) { - fputs("testsuite: ERROR: Insufficient memory.\n", stderr); - exit(2); - } - strcpy(pcollectiondir_buffer, srcdir); - strcat(pcollectiondir_buffer, CP_FNAMESEP_STR "pcollections" CP_FNAMESEP_STR); - strcat(pcollectiondir_buffer, collection); - return pcollectiondir_buffer; -} - -CP_HIDDEN void free_test_resources(void) { - if (plugindir_buffer != NULL) { - free(plugindir_buffer); - plugindir_buffer = NULL; - } - if (pcollectiondir_buffer != NULL) { - free(pcollectiondir_buffer); - pcollectiondir_buffer = NULL; - } -} - -int main(int argc, char *argv[]) { - DLHANDLE dh; - void *ptr; - - // Check arguments - if (argc != 2) { - fputs("testsuite: ERROR: Usage: testsuite <test>\n", stderr); - exit(2); - } - if ((argv0 = argv[0]) == NULL) { - argv0 = "testsuite"; - } - - // Find the test - if ((dh = DLOPEN(NULL)) == NULL) { - fputs("testsuite: ERROR: Could not open the testsuite binary for symbols.\n", stderr); - exit(2); - } - if ((ptr = DLSYM(dh, argv[1])) == NULL) { - fprintf(stderr, "testsuite: ERROR: Could not resolve symbol %s.\n", argv[1]); - exit(2); - } - - // Execute the test - // (NOTE: This conversion is not ANSI C compatible) - ((void (*)(void)) ptr)(); - - // Free test resources - free_test_resources(); - - // Successfully completed - exit(0); -} diff --git a/lib/cpluff/test/tests.txt b/lib/cpluff/test/tests.txt deleted file mode 100644 index ceed36de03..0000000000 --- a/lib/cpluff/test/tests.txt +++ /dev/null @@ -1,45 +0,0 @@ -getversion -gethosttype -fatalerrordefault -fatalerrorhandled -fatalerrorreset -initdestroy -initcreatedestroy -initloaddestroy -initinstalldestroy -initstartdestroy -initstartdestroyboth -nocollections -onecollection -twocollections -unregcollection -unregcollections -errorlogger -warninglogger -infologger -debuglogger -twologgers -unreglogger -updatelogger -logmsg -islogged -loadonlymaximal -loadonlymaximalfrommemory -loadminimal -loadmaximal -install -installtwo -installconflict -uninstall -scanupgrade -scanstoponupgrade -scanstoponinstall -scanrestart -plugincallbacks -pluginmissingdep -plugindepchain -plugindeploop -extpoints -extensions -extcfgutils -symbolusage |