mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Merge swig-redo branch back into trunk.
g-wrap is gone. I, for one, welcome our new swig overlords. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15024 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
8d27b20661
commit
31e926c486
@ -48,7 +48,7 @@ EXTRA_DIST = \
|
||||
macros/as-scrub-include.m4 \
|
||||
macros/binreloc.m4 \
|
||||
macros/compiler-flags.m4 \
|
||||
macros/g-wrap.m4 \
|
||||
macros/ac_pkg_swig.m4 \
|
||||
macros/gnome-guile-checks.m4 \
|
||||
macros/legacy_macros.m4 \
|
||||
po/gnucash.pot \
|
||||
|
172
configure.in
172
configure.in
@ -151,6 +151,19 @@ if test "x$ac_cv_header_ltdl_h" = xno; then
|
||||
AC_MSG_ERROR([Cannot find ltdl.h -- libtool-devel (or libtool-ltdl-devel) not installed?])
|
||||
fi
|
||||
|
||||
# test whether we are building directly from SVN/SVK
|
||||
${srcdir}/util/gnc-svnversion ${srcdir} >/dev/null 2>&1
|
||||
if test $? = 0 ; then
|
||||
BUILDING_FROM_SVN=yes
|
||||
|
||||
# We need at least version 1.3.28 of SWIG because
|
||||
# that's when SWIG added %delobject
|
||||
AC_PROG_SWIG(1.3.28)
|
||||
else
|
||||
BUILDING_FROM_SVN=no
|
||||
fi
|
||||
AM_CONDITIONAL(BUILDING_FROM_SVN, test "x$BUILDING_FROM_SVN" = "xyes")
|
||||
|
||||
# These are unavailable on windows/mingw32
|
||||
AC_CHECK_HEADERS(X11/Xlib.h glob.h)
|
||||
AC_CHECK_FUNCS(chown gethostname getppid getuid gettimeofday gmtime_r)
|
||||
@ -272,8 +285,7 @@ esac
|
||||
|
||||
|
||||
### --------------------------------------------------------------------------
|
||||
### Guile and g-wrap version checks (should this be something other than
|
||||
### the Gnome check?)
|
||||
### Guile version checks (should this be something other than the Gnome check?)
|
||||
|
||||
# If the user has given these values, cache them to override the
|
||||
# detected values.
|
||||
@ -296,9 +308,6 @@ fi
|
||||
AS_SCRUB_INCLUDE(GUILE_INCS)
|
||||
AC_SUBST(GUILE_LIBS)
|
||||
|
||||
### --------------------------------------------------------------------------
|
||||
### G-wrap (libraries and executable)
|
||||
|
||||
AM_GUILE_VERSION_CHECK(1.6.0, , , [AC_MSG_ERROR([
|
||||
|
||||
guile does not appear to be installed correctly, or is not in the
|
||||
@ -318,92 +327,10 @@ AM_GUILE_VERSION_CHECK(1.8.0, , [
|
||||
AC_DEFINE(HAVE_GUILE18,1,[System has guile 1.8 or better])
|
||||
], )
|
||||
|
||||
AM_PATH_GWRAP(1.3.3, , [AC_MSG_ERROR([
|
||||
|
||||
g-wrap does not appear to be installed correctly, or is not new
|
||||
enough. GnuCash requires at least version 1.3.3 to build,
|
||||
and 1.9.6 to build cleanly with GCC4. If you need to install g-wrap,
|
||||
you can find it at http://www.nongnu.org/g-wrap/ .
|
||||
])])
|
||||
|
||||
# Find out what the g-wrap compile and link flags are.
|
||||
AC_MSG_CHECKING(for g-wrap compile args)
|
||||
if test "x$G_WRAP_COMPILE_ARGS" = "x" ; then
|
||||
G_WRAP_COMPILE_ARGS=`${G_WRAP_CONFIG} --c-compile-args guile`
|
||||
fi
|
||||
AC_MSG_RESULT($G_WRAP_COMPILE_ARGS)
|
||||
|
||||
AC_MSG_CHECKING(for g-wrap link args)
|
||||
if test "x$G_WRAP_LINK_ARGS" = "x" ; then
|
||||
G_WRAP_LINK_ARGS=`${G_WRAP_CONFIG} --c-link-args guile`
|
||||
fi
|
||||
# Dear g-wrap: adding -L/usr/lib is very silly. Do not do this.
|
||||
G_WRAP_LINK_ARGS=`echo ${G_WRAP_LINK_ARGS} | sed -e 's|-L/usr/lib ||'`
|
||||
AC_MSG_RESULT($G_WRAP_LINK_ARGS)
|
||||
|
||||
AC_MSG_CHECKING(for g-wrap module directory)
|
||||
G_WRAP_MODULE_DIR=`${G_WRAP_CONFIG} --guile-module-directory`
|
||||
G_WRAP_LIB_DIR=`echo $G_WRAP_MODULE_DIR | sed -e 's|share/guile.*$|lib|'`
|
||||
AC_MSG_RESULT($G_WRAP_MODULE_DIR)
|
||||
|
||||
AC_GWRAP_CHECK_GUILE($G_WRAP_MODULE_DIR)
|
||||
|
||||
save_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $GUILE_INCS $G_WRAP_COMPILE_ARGS"
|
||||
AC_CHECK_HEADER(g-wrap-wct.h,,
|
||||
[AC_MSG_ERROR([
|
||||
|
||||
cannot find g-wrap-wct.h where g-wrap claims it should be.
|
||||
are you on Debian or Ubuntu and still using g-wrap 1.9.6-2?
|
||||
See: http://bugzilla.gnome.org/show_bug.cgi?id=330539
|
||||
|
||||
])])
|
||||
CPPFLAGS=$save_CPPFLAGS
|
||||
|
||||
AC_SUBST(G_WRAP_CONFIG)
|
||||
AC_SUBST(G_WRAP_COMPILE_ARGS)
|
||||
AC_SUBST(G_WRAP_LINK_ARGS)
|
||||
AC_SUBST(G_WRAP_MODULE_DIR)
|
||||
AC_SUBST(G_WRAP_LIB_DIR)
|
||||
|
||||
AS_SCRUB_INCLUDE(CFLAGS)
|
||||
|
||||
AC_MSG_CHECKING([for (g-wrap) guile module])
|
||||
if LD_LIBRARY_PATH="${G_WRAP_LIB_DIR}:${LD_LIBRARY_PATH}" \
|
||||
GUILE_LOAD_PATH="${G_WRAP_MODULE_DIR}:${GUILE_LOAD_PATH}" \
|
||||
${GUILE} -c "(use-modules (g-wrap))" > /dev/null 2>&1
|
||||
then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
|
||||
Cannot find the (g-wrap) guile module.
|
||||
Are you sure you have g-wrap compile-time environment installed?
|
||||
See http://bugzilla.gnome.org/show_bug.cgi?id=347680
|
||||
|
||||
])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for (g-wrap gw-glib-spec) guile module])
|
||||
if LD_LIBRARY_PATH="${G_WRAP_LIB_DIR}:${LD_LIBRARY_PATH}" \
|
||||
GUILE_LOAD_PATH="${G_WRAP_MODULE_DIR}:${GUILE_LOAD_PATH}" \
|
||||
${GUILE} -c "(use-modules (g-wrap gw-glib-spec))" > /dev/null 2>&1
|
||||
then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
|
||||
Cannot find the (g-wrap gw-glib-spec) guile module.
|
||||
Are you sure you have g-wrap installed with glib support?
|
||||
See http://bugzilla.gnome.org/show_bug.cgi?id=347404
|
||||
|
||||
])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for SLIB support])
|
||||
if LD_LIBRARY_PATH="${G_WRAP_LIB_DIR}:${LD_LIBRARY_PATH}" \
|
||||
GUILE_LOAD_PATH="${G_WRAP_MODULE_DIR}:${GUILE_LOAD_PATH}" \
|
||||
${GUILE} -c "(use-modules (ice-9 slib)) (require 'printf)" > /dev/null 2>&1
|
||||
if ${GUILE} -c "(use-modules (ice-9 slib)) (require 'printf)" > /dev/null 2>&1
|
||||
then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
@ -415,31 +342,6 @@ else
|
||||
])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for (g-wrap gw-standard) guile module])
|
||||
if LD_LIBRARY_PATH="${G_WRAP_LIB_DIR}:${LD_LIBRARY_PATH}" \
|
||||
GUILE_LOAD_PATH="${G_WRAP_MODULE_DIR}:${GUILE_LOAD_PATH}" \
|
||||
${GUILE} -c "(use-modules (g-wrap gw-standard))" > /dev/null 2>&1
|
||||
then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING([for (g-wrap gw standard) guile module])
|
||||
if LD_LIBRARY_PATH="${G_WRAP_LIB_DIR}:${LD_LIBRARY_PATH}" \
|
||||
GUILE_LOAD_PATH="${G_WRAP_MODULE_DIR}:${GUILE_LOAD_PATH}" \
|
||||
${GUILE} -c "(use-modules (g-wrap gw standard))" > /dev/null 2>&1
|
||||
then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_WARN([
|
||||
|
||||
Unable to find the g-wrap standard module, a.k.a. guile-g-wrap.
|
||||
You won't be able to run GnuCash without it!
|
||||
|
||||
])
|
||||
fi
|
||||
fi
|
||||
|
||||
### Check size of long_long - some guile's are broken.
|
||||
AC_MSG_CHECKING(if guile long_long is at least as big as gint64)
|
||||
GNC_OLDCFLAGS="$CFLAGS"
|
||||
@ -648,7 +550,6 @@ GNC_LIBEXECDIR='${libexecdir}/gnucash'
|
||||
GNC_ACCOUNTS_DIR='${GNC_SHAREDIR}/accounts'
|
||||
GNC_GLADE_DIR='${GNC_SHAREDIR}/glade'
|
||||
GNC_UI_DIR='${GNC_SHAREDIR}/ui'
|
||||
GNC_GWRAP_LIBDIR='${GNC_SHAREDIR}/guile-modules/g-wrapped'
|
||||
GNC_MODULE_DIR='${pkglibdir}'
|
||||
GNC_PIXMAP_DIR='${GNC_SHAREDIR}/pixmaps'
|
||||
|
||||
@ -657,7 +558,6 @@ AC_SUBST(GNC_CONFIGDIR)
|
||||
AC_SUBST(GNC_DOC_INSTALL_DIR)
|
||||
AC_SUBST(GNC_GLADE_DIR)
|
||||
AC_SUBST(GNC_UI_DIR)
|
||||
AC_SUBST(GNC_GWRAP_LIBDIR)
|
||||
AC_SUBST(GNC_INCLUDE_DIR)
|
||||
AC_SUBST(GNC_LIBDIR)
|
||||
AC_SUBST(GNC_MODULE_DIR)
|
||||
@ -2050,10 +1950,10 @@ AC_SUBST(LC_MESSAGES_ENUM)
|
||||
### GnuCash flags and libs configuration
|
||||
|
||||
GNUCASH_ENGINE_BASE_LIBS="${GLIB_LIBS}"
|
||||
GNUCASH_ENGINE_LIBS="-L${GNC_MODULE_DIR} -L${GNC_GWRAP_LIBDIR} ${GNUCASH_ENGINE_BASE_LIBS} ${GUILE_LIBS} -lgncmod-engine -lgw-engine -lgw-kvp -lgncmodule"
|
||||
GNUCASH_ENGINE_LIBS="-L${GNC_MODULE_DIR} ${GNUCASH_ENGINE_BASE_LIBS} ${GUILE_LIBS} -lgncmod-engine -lgncmodule"
|
||||
|
||||
GNUCASH_ENGINE_BASE_CFLAGS="-DGNUCASH ${GLIB_CFLAGS} ${G_WRAP_COMPILE_ARGS}"
|
||||
GNUCASH_ENGINE_CFLAGS="${GNUCASH_ENGINE_BASE_CFLAGS} ${GUILE_INCS}"
|
||||
GNUCASH_ENGINE_BASE_CFLAGS="-DGNUCASH ${GLIB_CFLAGS} ${GUILE_INCS}"
|
||||
GNUCASH_ENGINE_CFLAGS="${GNUCASH_ENGINE_BASE_CFLAGS}"
|
||||
|
||||
AC_SUBST(GNUCASH_ENGINE_BASE_LIBS)
|
||||
AC_SUBST(GNUCASH_ENGINE_LIBS)
|
||||
@ -2096,9 +1996,7 @@ AC_MSG_CHECKING(what extra warning flags to pass to the C compiler)
|
||||
if test ${GCC}x = yesx
|
||||
then
|
||||
warnFLAGS=
|
||||
# These two are because of g-wrap -- it can't avoid unused and uninitialized.
|
||||
#warnFLAGS="${warnFLAGS} -Wno-uninitialized"
|
||||
#warnFLAGS="${warnFLAGS} -Wno-unused"
|
||||
CFLAGS="${CFLAGS} -Wno-unused"
|
||||
# other flags...
|
||||
# These next two are included in the GNOME_COMPILE_WARNINGS
|
||||
#warnFLAGS="${warnFLAGS} -Wmissing-prototypes"
|
||||
@ -2106,8 +2004,7 @@ then
|
||||
#warnFLAGS="${warnFLAGS} -Werror-implicit-function-declaration" # In -Wall
|
||||
|
||||
# error-on-warning should not be active in (stable) release tarballs
|
||||
${srcdir}/util/gnc-svnversion ${srcdir} >/dev/null 2>&1
|
||||
if test $? = 0
|
||||
if test "x$BUILDING_FROM_SVN" = "xyes"
|
||||
then
|
||||
# This code is from SVN/SVK, so enable error-on-warning
|
||||
error_on_warning_as_default="yes"
|
||||
@ -2147,36 +2044,11 @@ then
|
||||
warnFLAGS="${warnFLAGS} -Wdeclaration-after-statement -Wno-pointer-sign"
|
||||
# rpmbuild on FC4 forces this flag. Can't hurt to always compile with it.
|
||||
warnFLAGS="${warnFLAGS} -D_FORTIFY_SOURCE=2"
|
||||
if test x$gwrap_major_version = x1 -a "$gwrap_minor_version" -lt 9 ; then
|
||||
# This is g-wrap 1.3 + gcc4. Test error-on-warning
|
||||
case "$gnc_error_on_warning" in
|
||||
auto)
|
||||
AC_MSG_ERROR([
|
||||
|
||||
Sorry, your current configuration will not compile. You are
|
||||
running g-wrap 1.3.x, GCC4, and --enable-error-on-warning, which
|
||||
do not work together. You have three options: You can update
|
||||
g-wrap to 1.9.6, you can downgrade gcc to GCC3, or you can
|
||||
--disable-error-on-warning on the configure line. We recommend
|
||||
you update g-wrap to 1.9.6 so gnucash can compile cleanly on GCC4
|
||||
You can find it at http://www.nongnu.org/g-wrap/ .
|
||||
|
||||
])
|
||||
;;
|
||||
yes)
|
||||
AC_MSG_WARN([
|
||||
|
||||
g-wrap 1.3.x and GCC4 may cause build problems. You have been warned!
|
||||
|
||||
])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
CFLAGS="${CFLAGS} ${warnFLAGS}"
|
||||
CFLAGS="${warnFLAGS} ${CFLAGS}"
|
||||
|
||||
else
|
||||
warnFLAGS=none
|
||||
@ -2331,8 +2203,6 @@ AC_CONFIG_FILES(po/Makefile.in
|
||||
src/network-utils/Makefile
|
||||
src/network-utils/test/Makefile
|
||||
src/optional/Makefile
|
||||
src/optional/swig/Makefile
|
||||
src/optional/swig/examples/Makefile
|
||||
src/optional/xsl/Makefile
|
||||
src/pixmaps/Makefile
|
||||
src/quotes/Makefile
|
||||
|
@ -1253,7 +1253,7 @@ void qof_query_add_guid_list_match (QofQuery *q, GSList *param_list,
|
||||
}
|
||||
|
||||
void qof_query_add_guid_match (QofQuery *q, GSList *param_list,
|
||||
const GUID *guid, QofQueryOp op)
|
||||
const GUID *guid, QofQueryOp op)
|
||||
{
|
||||
GList *g = NULL;
|
||||
|
||||
|
155
macros/ac_pkg_swig.m4
Normal file
155
macros/ac_pkg_swig.m4
Normal file
@ -0,0 +1,155 @@
|
||||
dnl @synopsis AC_PROG_SWIG([major.minor.micro])
|
||||
dnl
|
||||
dnl This macro searches for a SWIG installation on your system. If
|
||||
dnl found you should call SWIG via $(SWIG). You can use the optional
|
||||
dnl first argument to check if the version of the available SWIG is
|
||||
dnl greater than or equal to the value of the argument. It should have
|
||||
dnl the format: N[.N[.N]] (N is a number between 0 and 999. Only the
|
||||
dnl first N is mandatory.)
|
||||
dnl
|
||||
dnl If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks
|
||||
dnl that the swig package is this version number or higher.
|
||||
dnl
|
||||
dnl In configure.in, use as:
|
||||
dnl
|
||||
dnl AC_PROG_SWIG(1.3.17)
|
||||
dnl SWIG_ENABLE_CXX
|
||||
dnl SWIG_MULTI_MODULE_SUPPORT
|
||||
dnl SWIG_PYTHON
|
||||
dnl
|
||||
dnl @category InstalledPackages
|
||||
dnl @author Sebastian Huber <sebastian-huber@web.de>
|
||||
dnl @author Alan W. Irwin <irwin@beluga.phys.uvic.ca>
|
||||
dnl @author Rafael Laboissiere <rafael@laboissiere.net>
|
||||
dnl @author Andrew Collier <abcollier@yahoo.com>
|
||||
dnl @version 2004-09-20
|
||||
dnl @license GPLWithACException
|
||||
|
||||
AC_DEFUN([AC_PROG_SWIG],[
|
||||
AC_PATH_PROG([SWIG],[swig])
|
||||
if test -z "$SWIG" ; then
|
||||
AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org])
|
||||
SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false'
|
||||
elif test -n "$1" ; then
|
||||
AC_MSG_CHECKING([for SWIG version])
|
||||
[swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
|
||||
AC_MSG_RESULT([$swig_version])
|
||||
if test -n "$swig_version" ; then
|
||||
# Calculate the required version number components
|
||||
[required=$1]
|
||||
[required_major=`echo $required | sed 's/[^0-9].*//'`]
|
||||
if test -z "$required_major" ; then
|
||||
[required_major=0]
|
||||
fi
|
||||
[required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
|
||||
[required_minor=`echo $required | sed 's/[^0-9].*//'`]
|
||||
if test -z "$required_minor" ; then
|
||||
[required_minor=0]
|
||||
fi
|
||||
[required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
|
||||
[required_patch=`echo $required | sed 's/[^0-9].*//'`]
|
||||
if test -z "$required_patch" ; then
|
||||
[required_patch=0]
|
||||
fi
|
||||
# Calculate the available version number components
|
||||
[available=$swig_version]
|
||||
[available_major=`echo $available | sed 's/[^0-9].*//'`]
|
||||
if test -z "$available_major" ; then
|
||||
[available_major=0]
|
||||
fi
|
||||
[available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
|
||||
[available_minor=`echo $available | sed 's/[^0-9].*//'`]
|
||||
if test -z "$available_minor" ; then
|
||||
[available_minor=0]
|
||||
fi
|
||||
[available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
|
||||
[available_patch=`echo $available | sed 's/[^0-9].*//'`]
|
||||
if test -z "$available_patch" ; then
|
||||
[available_patch=0]
|
||||
fi
|
||||
if test $available_major -ne $required_major \
|
||||
-o $available_minor -ne $required_minor \
|
||||
-o $available_patch -lt $required_patch ; then
|
||||
AC_MSG_ERROR([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org])
|
||||
SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false'
|
||||
else
|
||||
AC_MSG_NOTICE([SWIG executable is '$SWIG'])
|
||||
SWIG_LIB=`$SWIG -swiglib`
|
||||
AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB'])
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([cannot determine SWIG version])
|
||||
SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false'
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([SWIG_LIB])
|
||||
])
|
||||
|
||||
# SWIG_ENABLE_CXX()
|
||||
#
|
||||
# Enable SWIG C++ support. This affects all invocations of $(SWIG).
|
||||
AC_DEFUN([SWIG_ENABLE_CXX],[
|
||||
AC_REQUIRE([AC_PROG_SWIG])
|
||||
AC_REQUIRE([AC_PROG_CXX])
|
||||
SWIG="$SWIG -c++"
|
||||
])
|
||||
|
||||
# SWIG_MULTI_MODULE_SUPPORT()
|
||||
#
|
||||
# Enable support for multiple modules. This effects all invocations
|
||||
# of $(SWIG). You have to link all generated modules against the
|
||||
# appropriate SWIG runtime library. If you want to build Python
|
||||
# modules for example, use the SWIG_PYTHON() macro and link the
|
||||
# modules against $(SWIG_PYTHON_LIBS).
|
||||
#
|
||||
AC_DEFUN([SWIG_MULTI_MODULE_SUPPORT],[
|
||||
AC_REQUIRE([AC_PROG_SWIG])
|
||||
SWIG="$SWIG -noruntime"
|
||||
])
|
||||
|
||||
# SWIG_PYTHON([use-shadow-classes = {no, yes}])
|
||||
#
|
||||
# Checks for Python and provides the $(SWIG_PYTHON_CPPFLAGS),
|
||||
# and $(SWIG_PYTHON_OPT) output variables.
|
||||
#
|
||||
# $(SWIG_PYTHON_OPT) contains all necessary SWIG options to generate
|
||||
# code for Python. Shadow classes are enabled unless the value of the
|
||||
# optional first argument is exactly 'no'. If you need multi module
|
||||
# support (provided by the SWIG_MULTI_MODULE_SUPPORT() macro) use
|
||||
# $(SWIG_PYTHON_LIBS) to link against the appropriate library. It
|
||||
# contains the SWIG Python runtime library that is needed by the type
|
||||
# check system for example.
|
||||
AC_DEFUN([SWIG_PYTHON],[
|
||||
AC_REQUIRE([AC_PROG_SWIG])
|
||||
AC_REQUIRE([AC_PYTHON_DEVEL])
|
||||
test "x$1" != "xno" || swig_shadow=" -noproxy"
|
||||
AC_SUBST([SWIG_PYTHON_OPT],[-python$swig_shadow])
|
||||
AC_SUBST([SWIG_PYTHON_CPPFLAGS],[$PYTHON_CPPFLAGS])
|
||||
])
|
||||
|
||||
|
||||
dnl @synopsis AC_LIB_WAD
|
||||
dnl
|
||||
dnl This macro searches for installed WAD library.
|
||||
dnl
|
||||
AC_DEFUN([AC_LIB_WAD],
|
||||
[
|
||||
AC_REQUIRE([AC_PYTHON_DEVEL])
|
||||
AC_ARG_ENABLE(wad,
|
||||
AC_HELP_STRING([--enable-wad], [enable wad module]),
|
||||
[
|
||||
case "${enableval}" in
|
||||
no) ;;
|
||||
*) if test "x${enableval}" = xyes;
|
||||
then
|
||||
check_wad="yes"
|
||||
fi ;;
|
||||
esac
|
||||
], [])
|
||||
|
||||
if test -n "$check_wad";
|
||||
then
|
||||
AC_CHECK_LIB(wadpy, _init, [WADPY=-lwadpy], [], $PYTHON_LDFLAGS $PYTHON_EXTRA_LIBS)
|
||||
AC_SUBST(WADPY)
|
||||
fi
|
||||
])
|
@ -1,81 +0,0 @@
|
||||
dnl g-wrap.m4
|
||||
dnl Written by Robert Merkel <rgmerk@mira.net>
|
||||
dnl Parts ripped off from guile.m4 and ORBit.m4
|
||||
|
||||
dnl check whether we use the old or new guile smobs
|
||||
|
||||
AC_DEFUN([AC_GWRAP_CHECK_GUILE],
|
||||
[if test x$GUILE = x ; then
|
||||
AC_PATH_PROG(GUILE, guile, no)
|
||||
fi
|
||||
dnl AC_MSG_WARN(guile is $GUILE)
|
||||
if test "${GUILE}" = "no" ; then
|
||||
AC_MSG_ERROR(g-wrap couldn't find guile.)
|
||||
fi
|
||||
])
|
||||
|
||||
dnl AM_PATH_GWRAP ([MINIMUM-VERSION, [ACTION-IF-FOUND.
|
||||
dnl [ACTION-IF-NOT-FOUND]]])
|
||||
|
||||
dnl tests for minimum version of g-wrap.
|
||||
dnl sets G_WRAP_CONFIG and GWRAP_OLD_GUILE_SMOB if needed.
|
||||
|
||||
AC_DEFUN([AM_PATH_GWRAP],
|
||||
[dnl
|
||||
dnl
|
||||
dnl
|
||||
AC_ARG_WITH(g-wrap-prefix,[ --with-g-wrap-prefix=PFX Prefix where g-wrap is installed (optional)],
|
||||
gwrap_prefix="$withval", g_wrap_prefix="")
|
||||
|
||||
min_gwrap_version=ifelse([$1], , 0.9.1,$1)
|
||||
|
||||
if test x${GUILE} = x ; then
|
||||
AC_PATH_PROG(GUILE, guile, no)
|
||||
fi
|
||||
|
||||
dnl if prefix set, then set them explicitly
|
||||
if test x${gwrap_prefix} != x ; then
|
||||
G_WRAP_CONFIG=${gwrap_prefix}/bin/g-wrap-config
|
||||
else
|
||||
|
||||
AC_PATH_PROG(G_WRAP_CONFIG, g-wrap-config, no)
|
||||
if test x${G_WRAP_CONFIG} = xno ; then
|
||||
CHECK_VERSION="no"
|
||||
ifelse([$3], , true , [AC_MSG_WARN(g-wrap-config failed)
|
||||
$3])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x$CHECK_VERSION != xno ; then
|
||||
AC_MSG_CHECKING(for g-wrap - version >= ${min_gwrap_version})
|
||||
|
||||
gwrap_major_version=`${G_WRAP_CONFIG} --version | \
|
||||
sed 's/g-wrap-config \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
gwrap_minor_version=`${G_WRAP_CONFIG} --version | \
|
||||
sed 's/g-wrap-config \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
gwrap_micro_version=`${G_WRAP_CONFIG} --version | \
|
||||
sed 's/g-wrap-config \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
|
||||
|
||||
major_required=`echo ${min_gwrap_version} |\
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
minor_required=`echo ${min_gwrap_version} |\
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
micro_required=`echo ${min_gwrap_version} |\
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
|
||||
if ${GUILE} -c "(cond ((> ${gwrap_major_version} ${major_required}) (exit 0))\
|
||||
((< ${gwrap_major_version} ${major_required}) (exit 1))\
|
||||
((> ${gwrap_minor_version} ${minor_required}) (exit 0))\
|
||||
((< ${gwrap_minor_version} ${minor_required}) (exit 1))\
|
||||
((< ${gwrap_micro_version} ${micro_required}) (exit 1))\
|
||||
(else (exit 0)))" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , true, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
ifelse([$3], , true , [AC_MSG_WARN(guile check failed)
|
||||
$3])
|
||||
fi
|
||||
dnl check version
|
||||
fi])
|
@ -28,17 +28,24 @@ GUI_SUBDIRS_2 = \
|
||||
DIST_SUBDIRS = $(NONGUI_SUBDIRS) $(GUI_SUBDIRS_1) report $(GUI_SUBDIRS_2)
|
||||
|
||||
if GNUCASH_ENABLE_GUI
|
||||
SUBDIRS = $(DIST_SUBDIRS)
|
||||
SUBDIRS = . $(DIST_SUBDIRS)
|
||||
else
|
||||
SUBDIRS = $(NONGUI_SUBDIRS) report
|
||||
SUBDIRS = . $(NONGUI_SUBDIRS) report
|
||||
endif
|
||||
|
||||
noinst_HEADERS = \
|
||||
RecnWindow.h \
|
||||
swig-runtime.h \
|
||||
gnc-ui.h
|
||||
|
||||
bin_SCRIPTS = gnc-test-env
|
||||
|
||||
if BUILDING_FROM_SVN
|
||||
swig-runtime.h:
|
||||
$(SWIG) -guile -external-runtime $@
|
||||
endif
|
||||
MAINTAINERCLEANFILES = swig-runtime.h
|
||||
|
||||
EXTRA_DIST = \
|
||||
README.modules \
|
||||
gnc-test-env \
|
||||
|
@ -1,7 +1,7 @@
|
||||
SUBDIRS = . test
|
||||
PWD := $(shell pwd)
|
||||
|
||||
pkglib_LTLIBRARIES = libgncmod-app-utils.la libgw-app-utils.la
|
||||
pkglib_LTLIBRARIES = libgncmod-app-utils.la
|
||||
|
||||
AM_CFLAGS = \
|
||||
-I${top_srcdir}/src \
|
||||
@ -10,13 +10,13 @@ AM_CFLAGS = \
|
||||
-I${top_srcdir}/src/core-utils \
|
||||
-I${top_srcdir}/src/engine \
|
||||
${GUILE_INCS} \
|
||||
${G_WRAP_COMPILE_ARGS} \
|
||||
${GLIB_CFLAGS} \
|
||||
${QOF_CFLAGS} \
|
||||
${GCONF_CFLAGS} \
|
||||
${GTK_CFLAGS}
|
||||
|
||||
libgncmod_app_utils_la_SOURCES = \
|
||||
swig-app-utils.c \
|
||||
file-utils.c \
|
||||
gfec.c \
|
||||
gnc-account-merge.c \
|
||||
@ -67,27 +67,19 @@ gncinclude_HEADERS = \
|
||||
libgncmod_app_utils_la_LIBADD = \
|
||||
${top_builddir}/src/gnc-module/libgncmodule.la \
|
||||
${top_builddir}/src/engine/libgncmod-engine.la \
|
||||
${top_builddir}/src/engine/libgw-engine.la \
|
||||
${top_builddir}/src/calculation/libgncmod-calculation.la \
|
||||
${top_builddir}/src/core-utils/libcore-utils.la \
|
||||
${GCONF_LIBS} \
|
||||
${GTK_LIBS} \
|
||||
${G_WRAP_LINK_ARGS} \
|
||||
${GUILE_LIBS} \
|
||||
${QOF_LIBS} \
|
||||
${GLIB_LIBS}
|
||||
|
||||
libgw_app_utils_la_LIBADD = \
|
||||
libgncmod-app-utils.la \
|
||||
${top_builddir}/src/engine/libgncmod-engine.la \
|
||||
${top_builddir}/src/engine/libgw-engine.la \
|
||||
${top_builddir}/src/core-utils/libcore-utils.la \
|
||||
${G_WRAP_LINK_ARGS} \
|
||||
${GUILE_LIBS} \
|
||||
${QOF_LIBS} \
|
||||
${GLIB_LIBS}
|
||||
|
||||
nodist_libgw_app_utils_la_SOURCES = gw-app-utils.c
|
||||
if BUILDING_FROM_SVN
|
||||
swig-app-utils.c: app-utils.i ${gncinclude_HEADERS}
|
||||
$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
|
||||
-I${top_srcdir}/src/engine -I${top_srcdir}/lib/libqof/qof -o $@ $<
|
||||
endif
|
||||
|
||||
gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash
|
||||
gncmod_DATA = app-utils.scm
|
||||
@ -98,34 +90,27 @@ gncscm_DATA = \
|
||||
config-var.scm \
|
||||
date-utilities.scm \
|
||||
hooks.scm \
|
||||
kvp-option-registry.scm \
|
||||
options.scm \
|
||||
prefs.scm \
|
||||
simple-obj.scm
|
||||
|
||||
gwmoddir = ${GNC_GWRAP_LIBDIR}
|
||||
gwmod_DATA = gw-app-utils-spec.scm
|
||||
nodist_gwmod_DATA = gw-app-utils.scm
|
||||
|
||||
noinst_DATA = .scm-links
|
||||
|
||||
EXTRA_DIST = \
|
||||
app-utils.i \
|
||||
${gncmod_DATA} \
|
||||
${gncscm_DATA} \
|
||||
${gwmod_DATA}
|
||||
${gncscm_DATA}
|
||||
|
||||
if GNUCASH_SEPARATE_BUILDDIR
|
||||
#For compiling
|
||||
SCM_FILE_LINKS = gw-app-utils-spec.scm
|
||||
#For executing test cases
|
||||
SCM_FILE_LINKS += \
|
||||
SCM_FILE_LINKS = \
|
||||
${gncmod_DATA} \
|
||||
${gncscm_DATA}
|
||||
endif
|
||||
|
||||
.scm-links:
|
||||
$(RM) -rf gnucash g-wrapped
|
||||
mkdir -p gnucash g-wrapped
|
||||
$(RM) -rf gnucash
|
||||
mkdir -p gnucash
|
||||
if GNUCASH_SEPARATE_BUILDDIR
|
||||
for X in ${SCM_FILE_LINKS} ; do \
|
||||
$(LN_S) -f ${srcdir}/$$X . ; \
|
||||
@ -134,25 +119,5 @@ endif
|
||||
( cd gnucash; for A in $(gncmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
|
||||
touch .scm-links
|
||||
|
||||
clean-local:
|
||||
$(RM) -rf gnucash g-wrapped
|
||||
|
||||
.INTERMEDIATE: gwrap-files
|
||||
|
||||
gw-app-utils.scm gw-app-utils.c gw-app-utils.h: \
|
||||
gwrap-files
|
||||
|
||||
gwrap-files: \
|
||||
.scm-links gw-app-utils-spec.scm ${top_builddir}/config.status
|
||||
FLAVOR=gnome $(GUILE) -c \
|
||||
"(set! %load-path (cons \"${G_WRAP_MODULE_DIR}\" %load-path)) \
|
||||
(set! %load-path (cons \"${PWD}\" %load-path)) \
|
||||
(set! %load-path (cons \"${top_builddir}/src/engine\" %load-path)) \
|
||||
(primitive-load \"./gw-app-utils-spec.scm\") \
|
||||
(gw:generate-wrapset \"gw-app-utils\")"
|
||||
touch $@
|
||||
( cd g-wrapped; $(LN_S) -f ../gw-*.scm . )
|
||||
|
||||
BUILT_SOURCES = gw-app-utils.scm gw-app-utils.c gw-app-utils.h
|
||||
CLEANFILES = $(BUILT_SOURCES) ${SCM_FILE_LINKS} \
|
||||
.scm-links gw-app-utils.html
|
||||
CLEANFILES = ${SCM_FILE_LINKS} gnucash .scm-links
|
||||
MAINTAINERCLEANFILES = swig-app-utils.c
|
||||
|
99
src/app-utils/app-utils.i
Normal file
99
src/app-utils/app-utils.i
Normal file
@ -0,0 +1,99 @@
|
||||
%module sw_app_utils
|
||||
%{
|
||||
/* Includes the header in the wrapper code */
|
||||
#include <config.h>
|
||||
#include <option-util.h>
|
||||
#include <gnc-euro.h>
|
||||
#include <gnc-exp-parser.h>
|
||||
#include <gnc-ui-util.h>
|
||||
#include <gnc-gettext-util.h>
|
||||
#include <gnc-helpers.h>
|
||||
#include <gnc-accounting-period.h>
|
||||
#include <gnc-session.h>
|
||||
#include <gnc-component-manager.h>
|
||||
|
||||
#include "engine-helpers.h"
|
||||
|
||||
SCM scm_init_sw_app_utils_module (void);
|
||||
%}
|
||||
|
||||
//%import "engine.i"
|
||||
|
||||
%typemap(in) GNCPrintAmountInfo "$1 = gnc_scm2printinfo($input);"
|
||||
%typemap(out) GNCPrintAmountInfo "$result = gnc_printinfo2scm($1);"
|
||||
|
||||
%typemap(out) GncCommodityList {
|
||||
SCM list = SCM_EOL;
|
||||
GList *node;
|
||||
|
||||
for (node = $1; node; node = node->next)
|
||||
list = scm_cons(gnc_quoteinfo2scm(node->data), list);
|
||||
|
||||
$result = scm_reverse(list);
|
||||
}
|
||||
|
||||
// Temporary SWIG<->G-wrap converters for engine types
|
||||
%typemap(in) gboolean "$1 = SCM_NFALSEP($input) ? TRUE : FALSE;"
|
||||
%typemap(out) gboolean "$result = $1 ? SCM_BOOL_T : SCM_BOOL_F;"
|
||||
|
||||
%typemap(in) gnc_numeric "$1 = gnc_scm_to_numeric($input);"
|
||||
%typemap(out) gnc_numeric "$result = gnc_numeric_to_scm($1);"
|
||||
|
||||
// End of temporary typemaps.
|
||||
|
||||
typedef void (*GNCOptionChangeCallback) (gpointer user_data);
|
||||
typedef int GNCOptionDBHandle;
|
||||
|
||||
QofBook * gnc_get_current_book (void);
|
||||
AccountGroup * gnc_get_current_group (void);
|
||||
|
||||
char * gnc_gettext_helper(const char *string);
|
||||
|
||||
GNCOptionDB * gnc_option_db_new(SCM guile_options);
|
||||
void gnc_option_db_destroy(GNCOptionDB *odb);
|
||||
|
||||
void gnc_option_db_set_option_selectable_by_name(SCM guile_option,
|
||||
const char *section, const char *name, gboolean selectable);
|
||||
|
||||
%inline %{
|
||||
typedef GList GncCommodityList;
|
||||
|
||||
GncCommodityList *
|
||||
gnc_commodity_table_get_quotable_commodities(const gnc_commodity_table * table);
|
||||
%}
|
||||
|
||||
gnc_commodity * gnc_default_currency (void);
|
||||
gnc_commodity * gnc_default_report_currency (void);
|
||||
|
||||
void gncp_option_invoke_callback(GNCOptionChangeCallback callback, void *data);
|
||||
void gnc_option_db_register_option(GNCOptionDBHandle handle,
|
||||
SCM guile_option);
|
||||
|
||||
const char * gnc_locale_default_iso_currency_code (void);
|
||||
|
||||
char * gnc_account_get_full_name (const Account *account);
|
||||
|
||||
GNCPrintAmountInfo gnc_default_print_info (gboolean use_symbol);
|
||||
GNCPrintAmountInfo gnc_account_print_info (const Account *account,
|
||||
gboolean use_symbol);
|
||||
GNCPrintAmountInfo gnc_commodity_print_info (const gnc_commodity *commodity,
|
||||
gboolean use_symbol);
|
||||
GNCPrintAmountInfo gnc_share_print_info_places (int decplaces);
|
||||
const char * xaccPrintAmount (gnc_numeric val, GNCPrintAmountInfo info);
|
||||
|
||||
gboolean gnc_reverse_balance (const Account *account);
|
||||
|
||||
gboolean gnc_is_euro_currency(const gnc_commodity * currency);
|
||||
gnc_numeric gnc_convert_to_euro(const gnc_commodity * currency,
|
||||
gnc_numeric value);
|
||||
gnc_numeric gnc_convert_from_euro(const gnc_commodity * currency,
|
||||
gnc_numeric value);
|
||||
|
||||
|
||||
typedef int time_t;
|
||||
time_t gnc_accounting_period_fiscal_start(void);
|
||||
time_t gnc_accounting_period_fiscal_end(void);
|
||||
|
||||
SCM gnc_make_kvp_options(QofIdType id_type);
|
||||
void gnc_register_kvp_option_generator(QofIdType id_type, SCM generator);
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
(define-module (gnucash app-utils))
|
||||
(use-modules (g-wrapped gw-app-utils))
|
||||
(use-modules (sw_app_utils))
|
||||
(use-modules (srfi srfi-1))
|
||||
(use-modules (gnucash main) (g-wrapped gw-gnc)) ;; FIXME: delete after we finish modularizing.
|
||||
(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
|
||||
(use-modules (gnucash gnc-module))
|
||||
|
||||
(gnc:module-load "gnucash/engine" 0)
|
||||
@ -125,7 +125,7 @@
|
||||
(export gnc:config-file-format-version)
|
||||
|
||||
;; gw-engine-spec.scm
|
||||
(re-export gnc:*save-options-hook*)
|
||||
(re-export HOOK-SAVE-OPTIONS)
|
||||
|
||||
;; date-utilities.scm
|
||||
|
||||
@ -225,14 +225,9 @@
|
||||
(export gnc:reldate-initialize)
|
||||
|
||||
;; hooks
|
||||
(re-export gnc:hook-define)
|
||||
(export gnc:hook-run-danglers) ;; from hooks.scm
|
||||
(re-export gnc:hook-add-dangler)
|
||||
(re-export gnc:hook-remove-dangler)
|
||||
(re-export gnc:*book-opened-hook*)
|
||||
(re-export gnc:*new-book-hook*)
|
||||
(re-export gnc:*book-closed-hook*)
|
||||
(re-export gnc:*report-hook*)
|
||||
(re-export gnc-hook-add-scm-dangler)
|
||||
(re-export HOOK-REPORT)
|
||||
|
||||
;; simple-obj
|
||||
(export make-simple-class)
|
||||
@ -243,16 +238,12 @@
|
||||
(export simple-obj-from-list)
|
||||
(export make-simple-obj)
|
||||
|
||||
;; kvp-option-registry
|
||||
(export gnc:register-kvp-option-generator)
|
||||
(export gnc:unregister-kvp-option-generator)
|
||||
(export gnc:make-kvp-options)
|
||||
(define gnc:*kvp-option-path* '("options"))
|
||||
(export gnc:*kvp-option-path*)
|
||||
|
||||
(load-from-path "c-interface.scm")
|
||||
(load-from-path "config-var.scm")
|
||||
(load-from-path "options.scm")
|
||||
(load-from-path "kvp-option-registry.scm")
|
||||
(load-from-path "hooks.scm")
|
||||
(load-from-path "prefs.scm")
|
||||
(load-from-path "date-utilities.scm")
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
|
||||
;; gettext functions
|
||||
(define gnc:gettext gnc:gettext-helper)
|
||||
(define gnc:gettext gnc-gettext-helper)
|
||||
(define gnc:_ gnc:gettext)
|
||||
(define _ gnc:gettext)
|
||||
(define-syntax N_
|
||||
|
@ -203,22 +203,22 @@
|
||||
;; date-granularity comparison functions.
|
||||
|
||||
(define (gnc:timepair-earlier-date t1 t2)
|
||||
(gnc:timepair-earlier (gnc:timepair-canonical-day-time t1)
|
||||
(gnc:timepair-canonical-day-time t2)))
|
||||
(gnc:timepair-earlier (timespecCanonicalDayTime t1)
|
||||
(timespecCanonicalDayTime t2)))
|
||||
|
||||
(define (gnc:timepair-later-date t1 t2)
|
||||
(gnc:timepair-earlier-date t2 t1))
|
||||
|
||||
(define (gnc:timepair-le-date t1 t2)
|
||||
(gnc:timepair-le (gnc:timepair-canonical-day-time t1)
|
||||
(gnc:timepair-canonical-day-time t2)))
|
||||
(gnc:timepair-le (timespecCanonicalDayTime t1)
|
||||
(timespecCanonicalDayTime t2)))
|
||||
|
||||
(define (gnc:timepair-ge-date t1 t2)
|
||||
(gnc:timepair-le t2 t1))
|
||||
|
||||
(define (gnc:timepair-eq-date t1 t2)
|
||||
(gnc:timepair-eq (gnc:timepair-canonical-day-time t1)
|
||||
(gnc:timepair-canonical-day-time t2)))
|
||||
(gnc:timepair-eq (timespecCanonicalDayTime t1)
|
||||
(timespecCanonicalDayTime t2)))
|
||||
|
||||
;; Build a list of time intervals.
|
||||
;;
|
||||
@ -454,10 +454,10 @@
|
||||
(gnc:date->timepair now)))
|
||||
|
||||
(define (gnc:get-start-accounting-period)
|
||||
(gnc:secs->timepair (gnc:accounting-period-start)))
|
||||
(gnc:secs->timepair (gnc-accounting-period-fiscal-start)))
|
||||
|
||||
(define (gnc:get-end-accounting-period)
|
||||
(gnc:secs->timepair (gnc:accounting-period-end)))
|
||||
(gnc:secs->timepair (gnc-accounting-period-fiscal-end)))
|
||||
|
||||
(define (gnc:get-start-this-month)
|
||||
(let ((now (localtime (current-time))))
|
||||
|
@ -163,3 +163,26 @@ gfec_apply(SCM proc, SCM arglist, gfec_error_handler error_handler)
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int error_in_scm_eval = FALSE;
|
||||
|
||||
static void
|
||||
error_handler(const char *msg)
|
||||
{
|
||||
g_warning(msg);
|
||||
error_in_scm_eval = TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gfec_try_load(gchar *fn)
|
||||
{
|
||||
g_message("looking for %s", fn);
|
||||
if (g_file_test(fn, G_FILE_TEST_EXISTS)) {
|
||||
g_message("trying to load %s", fn);
|
||||
error_in_scm_eval = FALSE;
|
||||
gfec_eval_file(fn, error_handler);
|
||||
return !error_in_scm_eval;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#define GFEC_H
|
||||
|
||||
#include <libguile.h>
|
||||
#include <glib.h>
|
||||
#include "guile-mappings.h"
|
||||
|
||||
typedef void (*gfec_error_handler)(const char *error_message);
|
||||
@ -17,5 +18,6 @@ typedef void (*gfec_error_handler)(const char *error_message);
|
||||
SCM gfec_eval_file(const char *file, gfec_error_handler error_handler);
|
||||
SCM gfec_eval_string(const char *str, gfec_error_handler error_handler);
|
||||
SCM gfec_apply(SCM proc, SCM arglist, gfec_error_handler error_handler);
|
||||
gboolean gfec_try_load(gchar *fn);
|
||||
|
||||
#endif
|
||||
|
@ -51,9 +51,6 @@ typedef struct
|
||||
GNCComponentCloseHandler close_handler;
|
||||
gpointer user_data;
|
||||
|
||||
SCM refresh_handler_scm;
|
||||
SCM close_handler_scm;
|
||||
|
||||
ComponentEventInfo watch_info;
|
||||
|
||||
char *component_class;
|
||||
@ -404,9 +401,6 @@ gnc_register_gui_component_internal (const char * component_class)
|
||||
/* found one, add the handler */
|
||||
ci = g_new0 (ComponentInfo, 1);
|
||||
|
||||
ci->refresh_handler_scm = SCM_BOOL_F;
|
||||
ci->close_handler_scm = SCM_BOOL_F;
|
||||
|
||||
ci->watch_info.event_masks = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
ci->watch_info.entity_events = guid_hash_table_new ();
|
||||
|
||||
@ -453,32 +447,6 @@ gnc_register_gui_component (const char *component_class,
|
||||
return ci->component_id;
|
||||
}
|
||||
|
||||
gint
|
||||
gnc_register_gui_component_scm (const char * component_class,
|
||||
SCM refresh_handler,
|
||||
SCM close_handler)
|
||||
{
|
||||
ComponentInfo *ci;
|
||||
|
||||
/* sanity check */
|
||||
if (!component_class)
|
||||
{
|
||||
PERR ("no class specified");
|
||||
return NO_COMPONENT;
|
||||
}
|
||||
|
||||
ci = gnc_register_gui_component_internal (component_class);
|
||||
g_return_val_if_fail (ci, NO_COMPONENT);
|
||||
|
||||
ci->refresh_handler_scm = refresh_handler;
|
||||
scm_gc_protect_object (refresh_handler);
|
||||
|
||||
ci->close_handler_scm = close_handler;
|
||||
scm_gc_protect_object (close_handler);
|
||||
|
||||
return ci->component_id;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_gui_component_watch_entity (gint component_id,
|
||||
const GUID *entity,
|
||||
@ -579,14 +547,6 @@ gnc_unregister_gui_component (gint component_id)
|
||||
g_free (ci->component_class);
|
||||
ci->component_class = NULL;
|
||||
|
||||
if (ci->refresh_handler_scm != SCM_BOOL_F)
|
||||
scm_gc_unprotect_object (ci->refresh_handler_scm);
|
||||
ci->refresh_handler_scm = SCM_BOOL_F;
|
||||
|
||||
if (ci->close_handler_scm != SCM_BOOL_F)
|
||||
scm_gc_unprotect_object (ci->close_handler_scm);
|
||||
ci->close_handler_scm = SCM_BOOL_F;
|
||||
|
||||
g_free (ci);
|
||||
|
||||
#if CM_DEBUG
|
||||
@ -745,8 +705,7 @@ gnc_gui_refresh_internal (gboolean force)
|
||||
if (!ci)
|
||||
continue;
|
||||
|
||||
if (!ci->refresh_handler &&
|
||||
!SCM_PROCEDUREP (ci->refresh_handler_scm)) {
|
||||
if (!ci->refresh_handler) {
|
||||
#if CM_DEBUG
|
||||
fprintf (stderr, "no handlers for %s:%d\n", ci->component_class, ci->component_id);
|
||||
#endif
|
||||
@ -760,11 +719,6 @@ gnc_gui_refresh_internal (gboolean force)
|
||||
fprintf (stderr, "calling %s:%d C handler\n", ci->component_class, ci->component_id);
|
||||
#endif
|
||||
ci->refresh_handler (NULL, ci->user_data);
|
||||
} else {
|
||||
#if CM_DEBUG
|
||||
fprintf (stderr, "calling %s:%d SCM handler\n", ci->component_class, ci->component_id);
|
||||
#endif
|
||||
scm_call_0 (ci->refresh_handler_scm);
|
||||
}
|
||||
}
|
||||
else if (changes_match (&ci->watch_info, &changes_backup))
|
||||
@ -774,11 +728,6 @@ gnc_gui_refresh_internal (gboolean force)
|
||||
fprintf (stderr, "calling %s:%d C handler\n", ci->component_class, ci->component_id);
|
||||
#endif
|
||||
ci->refresh_handler (changes_backup.entity_events, ci->user_data);
|
||||
} else {
|
||||
#if CM_DEBUG
|
||||
fprintf (stderr, "calling %s:%d SCM handler\n", ci->component_class, ci->component_id);
|
||||
#endif
|
||||
scm_call_0 (ci->refresh_handler_scm);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -827,14 +776,11 @@ gnc_close_gui_component (gint component_id)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ci->close_handler &&
|
||||
!SCM_PROCEDUREP (ci->close_handler_scm))
|
||||
if (!ci->close_handler)
|
||||
return;
|
||||
|
||||
if (ci->close_handler)
|
||||
ci->close_handler (ci->user_data);
|
||||
else
|
||||
scm_call_0 (ci->close_handler_scm);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -21,8 +21,6 @@
|
||||
#define GNC_COMPONENT_MANAGER_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <libguile.h>
|
||||
#include "guile-mappings.h"
|
||||
|
||||
#include "GNCId.h"
|
||||
#include "qof.h"
|
||||
@ -154,24 +152,6 @@ gint gnc_register_gui_component (const char *component_class,
|
||||
GNCComponentCloseHandler close_handler,
|
||||
gpointer user_data);
|
||||
|
||||
/* gnc_register_gui_component_scm
|
||||
* Register a GUI component with the manager with scheme callbacks.
|
||||
*
|
||||
* component_class: same as gnc_register_gui_component
|
||||
* refresh_cb: refresh handler, may be SCM_BOOL_F, indicating
|
||||
* no handler. the handler is invoked with no
|
||||
* arguments
|
||||
* close_cb: close handler, may be SCM_BOOL_F, invoked
|
||||
* with no arguments
|
||||
*
|
||||
* Notes: The same notes apply as in gnc_register_gui_component.
|
||||
*
|
||||
* Return: id of component, or NO_COMPONENT if error
|
||||
*/
|
||||
gint gnc_register_gui_component_scm (const char * component_class,
|
||||
SCM refresh_handler,
|
||||
SCM close_handler);
|
||||
|
||||
/* gnc_gui_component_set_session
|
||||
* Set the associated session of this component
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/********************************************************************\
|
||||
* gnc-helpers.c -- gnucash g-wrap helper functions *
|
||||
* gnc-helpers.c -- gnucash app-util helper functions *
|
||||
* Copyright (C) 2000 Linas Vepstas *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
@ -26,7 +26,7 @@
|
||||
#include <libguile.h>
|
||||
#include "guile-mappings.h"
|
||||
#include <string.h>
|
||||
#include <g-wrap-wct.h>
|
||||
#include "swig-runtime.h"
|
||||
|
||||
#include "gnc-engine.h"
|
||||
#include "engine-helpers.h"
|
||||
@ -67,10 +67,12 @@ gnc_scm2printinfo(SCM info_scm)
|
||||
info.commodity = gnc_scm_to_commodity (SCM_CAR (info_scm));
|
||||
|
||||
info_scm = SCM_CDR (info_scm);
|
||||
info.max_decimal_places = scm_num2int (SCM_CAR (info_scm), SCM_ARG1, __FUNCTION__);
|
||||
info.max_decimal_places = scm_num2int (SCM_CAR (info_scm), SCM_ARG1,
|
||||
__FUNCTION__);
|
||||
|
||||
info_scm = SCM_CDR (info_scm);
|
||||
info.min_decimal_places = scm_num2int (SCM_CAR (info_scm), SCM_ARG1, __FUNCTION__);
|
||||
info.min_decimal_places = scm_num2int (SCM_CAR (info_scm), SCM_ARG1,
|
||||
__FUNCTION__);
|
||||
|
||||
info_scm = SCM_CDR (info_scm);
|
||||
info.use_separators = SCM_NFALSEP (SCM_CAR (info_scm));
|
||||
@ -117,7 +119,7 @@ gnc_printinfo_p(SCM info_scm)
|
||||
* attempt to optimize the speed of price quote retrieval, this
|
||||
* routine only converts the fields that price-quotes.scm uses. Since
|
||||
* it converts these fields all at once, it should prevent multiple
|
||||
* transitions back and forth from Scheme to C (via g-wrap) to extract
|
||||
* transitions back and forth from Scheme to C to extract
|
||||
* the data from a pointers to a gnc-commodity (the older method).
|
||||
* This is *not* a reversible conversion as it drops data.
|
||||
*
|
||||
@ -139,9 +141,9 @@ gnc_quoteinfo2scm(gnc_commodity *comm)
|
||||
source = gnc_commodity_get_quote_source (comm);
|
||||
name = gnc_quote_source_get_internal_name (source);
|
||||
tz = gnc_commodity_get_quote_tz (comm);
|
||||
comm_scm = gw_wcp_assimilate_ptr (comm, scm_c_eval_string("<gnc:commodity*>"));
|
||||
def_comm_scm = gw_wcp_assimilate_ptr (gnc_default_currency (),
|
||||
scm_c_eval_string("<gnc:commodity*>"));
|
||||
comm_scm = SWIG_NewPointerObj(comm, SWIG_TypeQuery("_p_gnc_commodity"), 0);
|
||||
def_comm_scm = SWIG_NewPointerObj(gnc_default_currency (),
|
||||
SWIG_TypeQuery("_p_gnc_commodity"), 0);
|
||||
|
||||
if (tz)
|
||||
info_scm = scm_cons (scm_makfrom0str (tz), info_scm);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/********************************************************************\
|
||||
* gnc-helpers.h -- gnucash g-wrap helper functions *
|
||||
* gnc-helpers.h -- gnucash app-util helper functions *
|
||||
* Copyright (C) 2000 Linas Vepstas *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <libguile.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
@ -57,6 +57,9 @@ app_utils_shutdown(void)
|
||||
gnc_hook_run(HOOK_SAVE_OPTIONS, NULL);
|
||||
}
|
||||
|
||||
|
||||
extern SCM scm_init_sw_app_utils_module(void);
|
||||
|
||||
int
|
||||
libgncmod_app_utils_LTX_gnc_module_init(int refcount)
|
||||
{
|
||||
@ -70,9 +73,10 @@ libgncmod_app_utils_LTX_gnc_module_init(int refcount)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* publish g-wrapped bindings */
|
||||
scm_init_sw_app_utils_module();
|
||||
/* publish swig bindings */
|
||||
/* load the scheme code */
|
||||
lmod("(g-wrapped gw-app-utils)");
|
||||
lmod("(sw_app_utils)");
|
||||
lmod("(gnucash app-utils)");
|
||||
|
||||
if (refcount == 0) {
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <string.h>
|
||||
#include <g-wrap-wct.h>
|
||||
#include "swig-runtime.h"
|
||||
#include <libguile.h>
|
||||
|
||||
#include "qof.h"
|
||||
@ -367,7 +367,7 @@ gnc_scm_lookup(const char *module, const char *symbol)
|
||||
SCM
|
||||
gnc_copy_split(Split *split, gboolean use_cut_semantics)
|
||||
{
|
||||
static SCM split_type = SCM_UNDEFINED;
|
||||
static swig_type_info *split_type = NULL;
|
||||
SCM func;
|
||||
SCM arg;
|
||||
|
||||
@ -378,13 +378,10 @@ gnc_copy_split(Split *split, gboolean use_cut_semantics)
|
||||
if (!SCM_PROCEDUREP(func))
|
||||
return SCM_UNDEFINED;
|
||||
|
||||
if(split_type == SCM_UNDEFINED) {
|
||||
split_type = scm_c_eval_string("<gnc:Split*>");
|
||||
/* don't really need this - types are bound globally anyway. */
|
||||
if(split_type != SCM_UNDEFINED) scm_gc_protect_object(split_type);
|
||||
}
|
||||
if (!split_type)
|
||||
split_type = SWIG_TypeQuery("_p_Split");
|
||||
|
||||
arg = gw_wcp_assimilate_ptr(split, split_type);
|
||||
arg = SWIG_NewPointerObj(split, split_type, 0);
|
||||
|
||||
return scm_call_2(func, arg, SCM_BOOL(use_cut_semantics));
|
||||
}
|
||||
@ -402,7 +399,7 @@ void
|
||||
gnc_copy_split_scm_onto_split(SCM split_scm, Split *split,
|
||||
QofBook * book)
|
||||
{
|
||||
static SCM split_type = SCM_UNDEFINED;
|
||||
static swig_type_info *split_type = NULL;
|
||||
SCM result;
|
||||
SCM func;
|
||||
SCM arg;
|
||||
@ -427,13 +424,10 @@ gnc_copy_split_scm_onto_split(SCM split_scm, Split *split,
|
||||
if (!SCM_PROCEDUREP(func))
|
||||
return;
|
||||
|
||||
if(split_type == SCM_UNDEFINED) {
|
||||
split_type = scm_c_eval_string("<gnc:Split*>");
|
||||
/* don't really need this - types are bound globally anyway. */
|
||||
if(split_type != SCM_UNDEFINED) scm_gc_protect_object(split_type);
|
||||
}
|
||||
if (!split_type)
|
||||
split_type = SWIG_TypeQuery("_p_Split");
|
||||
|
||||
arg = gw_wcp_assimilate_ptr(split, split_type);
|
||||
arg = SWIG_NewPointerObj(split, split_type, 0);
|
||||
|
||||
scm_call_3(func, split_scm, arg, gnc_book_to_scm (book));
|
||||
}
|
||||
@ -736,7 +730,7 @@ gnc_split_scm_get_value(SCM split_scm)
|
||||
SCM
|
||||
gnc_copy_trans(Transaction *trans, gboolean use_cut_semantics)
|
||||
{
|
||||
static SCM trans_type = SCM_UNDEFINED;
|
||||
static swig_type_info *trans_type = NULL;
|
||||
SCM func;
|
||||
SCM arg;
|
||||
|
||||
@ -747,13 +741,10 @@ gnc_copy_trans(Transaction *trans, gboolean use_cut_semantics)
|
||||
if (!SCM_PROCEDUREP(func))
|
||||
return SCM_UNDEFINED;
|
||||
|
||||
if(trans_type == SCM_UNDEFINED) {
|
||||
trans_type = scm_c_eval_string("<gnc:Transaction*>");
|
||||
/* don't really need this - types are bound globally anyway. */
|
||||
if(trans_type != SCM_UNDEFINED) scm_gc_protect_object(trans_type);
|
||||
}
|
||||
if (!trans_type)
|
||||
trans_type = SWIG_TypeQuery("_p_Transaction");
|
||||
|
||||
arg = gw_wcp_assimilate_ptr(trans, trans_type);
|
||||
arg = SWIG_NewPointerObj(trans, trans_type, 0);
|
||||
|
||||
return scm_call_2(func, arg, SCM_BOOL(use_cut_semantics));
|
||||
}
|
||||
@ -798,7 +789,7 @@ gnc_copy_trans_scm_onto_trans_swap_accounts(SCM trans_scm,
|
||||
gboolean do_commit,
|
||||
QofBook *book)
|
||||
{
|
||||
static SCM trans_type = SCM_UNDEFINED;
|
||||
static swig_type_info *trans_type = NULL;
|
||||
SCM result;
|
||||
SCM func;
|
||||
SCM arg;
|
||||
@ -823,13 +814,10 @@ gnc_copy_trans_scm_onto_trans_swap_accounts(SCM trans_scm,
|
||||
if (!SCM_PROCEDUREP(func))
|
||||
return;
|
||||
|
||||
if(trans_type == SCM_UNDEFINED) {
|
||||
trans_type = scm_c_eval_string("<gnc:Transaction*>");
|
||||
/* don't really need this - types are bound globally anyway. */
|
||||
if(trans_type != SCM_UNDEFINED) scm_gc_protect_object(trans_type);
|
||||
}
|
||||
if (!trans_type)
|
||||
trans_type = SWIG_TypeQuery("_p_Transaction");
|
||||
|
||||
arg = gw_wcp_assimilate_ptr(trans, trans_type);
|
||||
arg = SWIG_NewPointerObj(trans, trans_type, 0);
|
||||
|
||||
if ((guid_1 == NULL) || (guid_2 == NULL))
|
||||
{
|
||||
@ -1088,7 +1076,6 @@ gnc_trans_scm_get_num_splits(SCM trans_scm)
|
||||
char *
|
||||
gnc_get_debit_string(GNCAccountType account_type)
|
||||
{
|
||||
const char *type_string;
|
||||
const gchar *string;
|
||||
SCM result;
|
||||
SCM arg;
|
||||
@ -1101,9 +1088,7 @@ gnc_get_debit_string(GNCAccountType account_type)
|
||||
if ((account_type < ACCT_TYPE_NONE) || (account_type >= NUM_ACCOUNT_TYPES))
|
||||
account_type = ACCT_TYPE_NONE;
|
||||
|
||||
type_string = xaccAccountTypeEnumAsString(account_type);
|
||||
|
||||
arg = scm_str2symbol(type_string);
|
||||
arg = scm_long2num(account_type);
|
||||
|
||||
result = scm_call_1(getters.debit_string, arg);
|
||||
if (!SCM_STRINGP(result))
|
||||
@ -1126,7 +1111,6 @@ gnc_get_debit_string(GNCAccountType account_type)
|
||||
char *
|
||||
gnc_get_credit_string(GNCAccountType account_type)
|
||||
{
|
||||
const char *type_string;
|
||||
const gchar *string;
|
||||
SCM result;
|
||||
SCM arg;
|
||||
@ -1139,9 +1123,7 @@ gnc_get_credit_string(GNCAccountType account_type)
|
||||
if ((account_type < ACCT_TYPE_NONE) || (account_type >= NUM_ACCOUNT_TYPES))
|
||||
account_type = ACCT_TYPE_NONE;
|
||||
|
||||
type_string = xaccAccountTypeEnumAsString(account_type);
|
||||
|
||||
arg = scm_str2symbol(type_string);
|
||||
arg = scm_long2num(account_type);
|
||||
|
||||
result = scm_call_1(getters.credit_string, arg);
|
||||
if (!SCM_STRINGP(result))
|
||||
|
@ -1,394 +0,0 @@
|
||||
(define-module (g-wrapped gw-app-utils-spec))
|
||||
|
||||
(debug-set! maxdepth 100000)
|
||||
(debug-set! stack 200000)
|
||||
|
||||
(use-modules (g-wrap))
|
||||
(use-modules (g-wrap simple-type))
|
||||
|
||||
(use-modules (g-wrap gw-standard-spec))
|
||||
(use-modules (g-wrap gw-wct-spec))
|
||||
(use-modules (g-wrap gw-glib-spec))
|
||||
|
||||
(use-modules (g-wrapped gw-engine-spec))
|
||||
|
||||
(let ((ws (gw:new-wrapset "gw-app-utils")))
|
||||
|
||||
(gw:wrapset-depends-on ws "gw-standard")
|
||||
(gw:wrapset-depends-on ws "gw-wct")
|
||||
(gw:wrapset-depends-on ws "gw-glib")
|
||||
|
||||
(gw:wrapset-depends-on ws "gw-engine")
|
||||
|
||||
(gw:wrapset-set-guile-module! ws '(g-wrapped gw-app-utils))
|
||||
|
||||
(gw:wrapset-add-cs-declarations!
|
||||
ws
|
||||
(lambda (wrapset client-wrapset)
|
||||
(list
|
||||
"#include <config.h>\n"
|
||||
"#include <option-util.h>\n"
|
||||
"#include <gnc-euro.h>\n"
|
||||
"#include <gnc-exp-parser.h>\n"
|
||||
"#include <gnc-ui-util.h>\n"
|
||||
"#include <gnc-gettext-util.h>\n"
|
||||
"#include <gnc-helpers.h>\n"
|
||||
"#include <gnc-accounting-period.h>\n"
|
||||
"#include <gnc-session.h>\n"
|
||||
"#include <gnc-component-manager.h>\n")))
|
||||
|
||||
(gw:wrap-simple-type ws '<gnc:print-amount-info-scm> "GNCPrintAmountInfo"
|
||||
'("gnc_printinfo_p(" scm-var ")")
|
||||
'(c-var " = gnc_scm2printinfo(" scm-var ");\n")
|
||||
'(scm-var " = gnc_printinfo2scm(" c-var ");\n"))
|
||||
|
||||
(gw:wrap-simple-type ws '<gnc:quote-info-scm> "gnc_commodity *"
|
||||
'("FALSE")
|
||||
'(c-var " = NULL;\n")
|
||||
'(scm-var " = gnc_quoteinfo2scm(" c-var ");\n"))
|
||||
|
||||
(gw:wrap-as-wct ws
|
||||
'<gnc:OptionChangeCallback>
|
||||
"GNCOptionChangeCallback" "const GNCOptionChangeCallback")
|
||||
|
||||
(gw:wrap-as-wct ws '<gnc:OptionDB*> "GNCOptionDB*" "const GNCOptionDB*")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:get-current-group
|
||||
'<gnc:AccountGroup*>
|
||||
"gnc_get_current_group"
|
||||
'()
|
||||
"Get the current top-level group.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:get-current-book
|
||||
'<gnc:Book*>
|
||||
"gnc_get_current_book"
|
||||
'()
|
||||
"Get the current top-level book.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:get-current-session
|
||||
'<gnc:Session*>
|
||||
"gnc_get_current_session"
|
||||
'()
|
||||
"Get the current session.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:parse-amount
|
||||
'<gw:scm>
|
||||
"gnc_parse_amount_helper"
|
||||
'(((<gw:mchars> caller-owned const) str)
|
||||
(<gw:bool> monetary))
|
||||
"Parse the expression and return either a gnc numeric or #f.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:gettext-helper
|
||||
'(<gw:mchars> caller-owned const)
|
||||
"gnc_gettext_helper"
|
||||
'(((<gw:mchars> caller-owned const) str))
|
||||
"Returns the translated version of string")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:option-db-new
|
||||
'<gnc:OptionDB*>
|
||||
"gnc_option_db_new"
|
||||
'((<gw:scm> guile-options))
|
||||
"Create an option DB with the set of guile options")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:option-db-destroy
|
||||
'<gw:void>
|
||||
"gnc_option_db_destroy"
|
||||
'((<gnc:OptionDB*> option-db))
|
||||
"Destroy the OptionDB")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:option-db-set-option-selectable-by-name
|
||||
'<gw:void>
|
||||
"gnc_option_db_set_option_selectable_by_name"
|
||||
'((<gw:scm> guile-options)
|
||||
((<gw:mchars> caller-owned const) section)
|
||||
((<gw:mchars> caller-owned const) name)
|
||||
(<gw:bool> selectable))
|
||||
"Set the appropriate option widget to be selectable or not selectable, depending on if <gw:bool> selectable is true or false respectively.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:default-currency
|
||||
'(<gnc:commodity*> const)
|
||||
"gnc_default_currency"
|
||||
'()
|
||||
"Return the new-account default currency set by the user.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:default-report-currency
|
||||
'(<gnc:commodity*> const)
|
||||
"gnc_default_report_currency"
|
||||
'()
|
||||
"Return the default report currency set by the user.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:amount->string
|
||||
'(<gw:mchars> callee-owned const)
|
||||
"xaccPrintAmount"
|
||||
'((<gnc:numeric> amount)
|
||||
(<gnc:print-amount-info-scm> info))
|
||||
"Print amount using current locale. The info argument
|
||||
determines formatting details.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:option-invoke-callback
|
||||
'<gw:void>
|
||||
"gncp_option_invoke_callback"
|
||||
'((<gnc:OptionChangeCallback> callback) (<gw:void*> data))
|
||||
"Invoke the c option callback on the given data.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:option-db-register-option
|
||||
'<gw:void>
|
||||
"gncp_option_db_register_option"
|
||||
'((<gw:int> db_handle) (<gw:scm> option))
|
||||
"Register the option with the option database db_handle.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:locale-decimal-places
|
||||
'<gw:int>
|
||||
"gnc_locale_decimal_places"
|
||||
'()
|
||||
"Return the number of decimal places for this locale.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:locale-default-currency
|
||||
'(<gnc:commodity*> const)
|
||||
"gnc_locale_default_currency"
|
||||
'()
|
||||
"Return the default currency for the current locale.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:locale-default-iso-currency-code
|
||||
'(<gw:mchars> callee-owned const)
|
||||
"gnc_locale_default_iso_currency_code"
|
||||
'()
|
||||
"Return the default iso currency code for the current locale.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:register-gui-component
|
||||
'<gw:int>
|
||||
"gnc_register_gui_component_scm"
|
||||
'(((<gw:mchars> caller-owned const) component-class)
|
||||
(<gw:scm> refresh-handler)
|
||||
(<gw:scm> close-handler))
|
||||
"Register a gui component with the component manager.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:gui-component-watch-entity
|
||||
'<gw:void>
|
||||
"gnc_gui_component_watch_entity_direct"
|
||||
'((<gw:int> component-id)
|
||||
(<gnc:guid-scm> entity)
|
||||
(<gnc:event-type> event-type-mask))
|
||||
"Watch the events for a particular entity.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:gui-component-watch-entity-type
|
||||
'<gw:void>
|
||||
"gnc_gui_component_watch_entity_type"
|
||||
'((<gw:int> component-id)
|
||||
((<gw:mchars> caller-owned const) id-type)
|
||||
(<gnc:event-type> event-type-mask))
|
||||
"Watch the events for a particular entity type.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:unregister-gui-component
|
||||
'<gw:void>
|
||||
"gnc_unregister_gui_component"
|
||||
'((<gw:int> component-id))
|
||||
"Unregister a gui component by id.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:gui-refresh-all
|
||||
'<gw:void>
|
||||
"gnc_gui_refresh_all"
|
||||
'()
|
||||
"Refresh all gui components.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:close-gui-component
|
||||
'<gw:void>
|
||||
"gnc_close_gui_component"
|
||||
'((<gw:int> component-id))
|
||||
"Close a gui component by id.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:account-get-full-name
|
||||
'(<gw:mchars> caller-owned)
|
||||
"gnc_account_get_full_name"
|
||||
'((<gnc:Account*> account))
|
||||
"Return the fully-qualified name of the account.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:default-print-info
|
||||
'<gnc:print-amount-info-scm>
|
||||
"gnc_default_print_info"
|
||||
'((<gw:bool> use_symbol))
|
||||
"Return the default print info object.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:commodity-print-info
|
||||
'<gnc:print-amount-info-scm>
|
||||
"gnc_commodity_print_info"
|
||||
'((<gnc:commodity*> commodity) (<gw:bool> use_symbol))
|
||||
"Return the default print info for commodity.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:account-print-info
|
||||
'<gnc:print-amount-info-scm>
|
||||
"gnc_account_print_info"
|
||||
'((<gnc:Account*> account) (<gw:bool> use_symbol))
|
||||
"Return a print info for printing account balances.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:split-amount-print-info
|
||||
'<gnc:print-amount-info-scm>
|
||||
"gnc_split_amount_print_info"
|
||||
'((<gnc:Split*> split) (<gw:bool> use_symbol))
|
||||
"Return a print info for printing split amounts.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:split-value-print-info
|
||||
'<gnc:print-amount-info-scm>
|
||||
"gnc_split_value_print_info"
|
||||
'((<gnc:Split*> split) (<gw:bool> use_symbol))
|
||||
"Return a print info for print split value quantities.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:share-print-info-places
|
||||
'<gnc:print-amount-info-scm>
|
||||
"gnc_share_print_info_places"
|
||||
'((<gw:int> decplaces))
|
||||
"Return a print info for printing share quantities to 'n' places.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:default-share-print-info
|
||||
'<gnc:print-amount-info-scm>
|
||||
"gnc_default_share_print_info"
|
||||
'()
|
||||
"Return a print info for printing generic share quantities.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:default-price-print-info
|
||||
'<gnc:print-amount-info-scm>
|
||||
"gnc_default_price_print_info"
|
||||
'()
|
||||
"Return a print info for printing generic price quantities.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:account-reverse-balance?
|
||||
'<gw:bool>
|
||||
"gnc_reverse_balance"
|
||||
'((<gnc:Account*> account))
|
||||
"Given an account, find out whether the balance should be reversed for display")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:is-euro-currency
|
||||
'<gw:bool>
|
||||
"gnc_is_euro_currency"
|
||||
'((<gnc:commodity*> currency))
|
||||
"Check if a given currency is a EURO currency")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:is-euro-currency-code
|
||||
'<gw:bool>
|
||||
"gnc_is_euro_currency_code"
|
||||
'(((<gw:mchars> caller-owned const) str))
|
||||
"Check if a given currency is a EURO currency")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:convert-to-euro
|
||||
'<gnc:numeric>
|
||||
"gnc_convert_to_euro"
|
||||
'((<gnc:commodity*> currency) (<gnc:numeric> value))
|
||||
"Convert the value from the given currency to EURO")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:convert-from-euro
|
||||
'<gnc:numeric>
|
||||
"gnc_convert_from_euro"
|
||||
'((<gnc:commodity*> currency) (<gnc:numeric> value))
|
||||
"Convert the value from EURO to the given currency")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:euro-currency-get-rate
|
||||
'<gnc:numeric>
|
||||
"gnc_euro_currency_get_rate"
|
||||
'((<gnc:commodity*> currency))
|
||||
"Returns the exchange rate from the given currency to EURO")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:get-euro
|
||||
'<gnc:commodity*>
|
||||
"gnc_get_euro"
|
||||
'()
|
||||
"Returns the commodity EURO")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:commodity-table-get-quotable-commodities-info
|
||||
'(gw:glist-of <gnc:quote-info-scm> caller-owned)
|
||||
"gnc_commodity_table_get_quotable_commodities"
|
||||
'((<gnc:commodity-table*> table))
|
||||
"Return a list of all the quotable commodities in a given namespace in the table.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:accounting-period-start
|
||||
'<gw:int>
|
||||
"gnc_accounting_period_fiscal_start"
|
||||
'()
|
||||
"Returns the beginning of the preferred accounting period")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:accounting-period-end
|
||||
'<gw:int>
|
||||
"gnc_accounting_period_fiscal_end"
|
||||
'()
|
||||
"Returns the end of the preferred accounting period"))
|
@ -17,6 +17,6 @@
|
||||
|
||||
(define (gnc:hook-run-danglers hook . args)
|
||||
(if (null? args)
|
||||
(set! args #f)
|
||||
(set! args '())
|
||||
(set! args (car args)))
|
||||
(gnc:hook-run-danglers-real hook args))
|
||||
(gnc-hook-run hook args))
|
||||
|
@ -1,61 +0,0 @@
|
||||
;; Code for the kvp/option registry
|
||||
;;
|
||||
;; Copyright (C) 2002, Derek Atkins <derek@ihtfp.com>
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or
|
||||
;; modify it under the terms of the GNU General Public License as
|
||||
;; published by the Free Software Foundation; either version 2 of
|
||||
;; the License, or (at your option) any later version.
|
||||
;;
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program; if not, contact:
|
||||
;;
|
||||
;; Free Software Foundation Voice: +1-617-542-5942
|
||||
;; 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
||||
;; Boston, MA 02110-1301, USA gnu@gnu.org
|
||||
|
||||
|
||||
(use-modules (ice-9 slib))
|
||||
(require 'hash)
|
||||
|
||||
(define gnc:*kvp-option-path* '("options"))
|
||||
|
||||
(define gnc:*kvp-option-registry* (make-hash-table 23))
|
||||
|
||||
(define (get-ref id-type)
|
||||
(let ((gen-list (hash-ref gnc:*kvp-option-registry* id-type)))
|
||||
(if gen-list gen-list '())))
|
||||
|
||||
|
||||
;;
|
||||
;; the generator should be a procedure that takes one argument,
|
||||
;; an options object. The procedure should fill in the options with
|
||||
;; its defined kvp options.
|
||||
;;
|
||||
(define (gnc:register-kvp-option-generator id-type generator)
|
||||
(let ((gen-list (get-ref id-type)))
|
||||
(hash-set! gnc:*kvp-option-registry*
|
||||
id-type (append gen-list (list generator)))))
|
||||
|
||||
(define (gnc:unregister-kvp-option-generator id-type generator)
|
||||
(let ((gen-list (get-ref id-type)))
|
||||
(hash-set! gnc:*kvp-option-registry*
|
||||
id-type (delq! generator gen-list))))
|
||||
|
||||
;;
|
||||
;; create a new options object for the requested type
|
||||
;;
|
||||
(define (gnc:make-kvp-options id-type)
|
||||
(let ((gen-list (get-ref id-type))
|
||||
(options (gnc:new-options)))
|
||||
(map
|
||||
(lambda (generator)
|
||||
(generator options))
|
||||
gen-list)
|
||||
|
||||
options))
|
@ -34,7 +34,7 @@
|
||||
#include "qof.h"
|
||||
#include "guile-mappings.h"
|
||||
|
||||
#include <g-wrap-wct.h>
|
||||
#include "swig-runtime.h"
|
||||
|
||||
/* TODO:
|
||||
|
||||
@ -267,23 +267,12 @@ gnc_option_db_find (SCM guile_options)
|
||||
|
||||
/* Create an option DB for a particular data type */
|
||||
GNCOptionDB *
|
||||
gnc_option_db_new_for_type(SCM id_type)
|
||||
gnc_option_db_new_for_type(QofIdType id_type)
|
||||
{
|
||||
static SCM make_option_proc = SCM_UNDEFINED;
|
||||
SCM options;
|
||||
|
||||
if (!id_type) return NULL;
|
||||
|
||||
if (make_option_proc == SCM_UNDEFINED) {
|
||||
make_option_proc = scm_c_eval_string("gnc:make-kvp-options");
|
||||
if (!SCM_PROCEDUREP (make_option_proc)) {
|
||||
PERR ("not a procedure\n");
|
||||
make_option_proc = SCM_UNDEFINED;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
options = scm_call_1 (make_option_proc, id_type);
|
||||
options = gnc_make_kvp_options(id_type);
|
||||
return gnc_option_db_new (options);
|
||||
}
|
||||
|
||||
@ -312,8 +301,7 @@ gnc_option_db_load_from_kvp(GNCOptionDB* odb, kvp_frame *slots)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
scm_slots = gw_wcp_assimilate_ptr (slots, scm_c_eval_string("<gnc:kvp-frame*>"));
|
||||
scm_slots = SWIG_NewPointerObj(slots, SWIG_TypeQuery("_p_KvpFrame"), 0);
|
||||
|
||||
scm_call_3 (kvp_to_scm, odb->guile_options, scm_slots, kvp_option_path);
|
||||
}
|
||||
@ -344,7 +332,7 @@ gnc_option_db_save_to_kvp(GNCOptionDB* odb, kvp_frame *slots)
|
||||
}
|
||||
}
|
||||
|
||||
scm_slots = gw_wcp_assimilate_ptr (slots, scm_c_eval_string("<gnc:kvp-frame*>"));
|
||||
scm_slots = SWIG_NewPointerObj(slots, SWIG_TypeQuery("p_KvpFrame"), 0);
|
||||
|
||||
scm_call_3 (scm_to_kvp, odb->guile_options, scm_slots, kvp_option_path);
|
||||
}
|
||||
@ -443,9 +431,6 @@ gnc_option_db_register_change_callback(GNCOptionDB *odb,
|
||||
const char *section,
|
||||
const char *name)
|
||||
{
|
||||
static SCM void_type = SCM_UNDEFINED;
|
||||
static SCM callback_type = SCM_UNDEFINED;
|
||||
|
||||
SCM register_proc;
|
||||
SCM arg;
|
||||
SCM args;
|
||||
@ -461,18 +446,6 @@ gnc_option_db_register_change_callback(GNCOptionDB *odb,
|
||||
return SCM_UNDEFINED;
|
||||
}
|
||||
|
||||
if(void_type == SCM_UNDEFINED) {
|
||||
void_type = scm_c_eval_string("<gw:void*>");
|
||||
/* don't really need this - types are bound globally anyway. */
|
||||
if(void_type != SCM_UNDEFINED) scm_gc_protect_object(void_type);
|
||||
}
|
||||
if(callback_type == SCM_UNDEFINED) {
|
||||
callback_type = scm_c_eval_string("<gnc:OptionChangeCallback>");
|
||||
/* don't really need this - types are bound globally anyway. */
|
||||
if(callback_type != SCM_UNDEFINED)
|
||||
scm_gc_protect_object(callback_type);
|
||||
}
|
||||
|
||||
/* Now build the args list for apply */
|
||||
args = SCM_EOL;
|
||||
|
||||
@ -480,11 +453,12 @@ gnc_option_db_register_change_callback(GNCOptionDB *odb,
|
||||
args = scm_cons(odb->guile_options, args);
|
||||
|
||||
/* next the data */
|
||||
arg = gw_wcp_assimilate_ptr(data, void_type);
|
||||
arg = SWIG_NewPointerObj(data, SWIG_TypeQuery("_p_void"), 0);
|
||||
args = scm_cons(arg, args);
|
||||
|
||||
/* next the callback */
|
||||
arg = gw_wcp_assimilate_ptr(callback, callback_type);
|
||||
arg = SWIG_NewPointerObj(
|
||||
callback, SWIG_TypeQuery("GNCOptionChangeCallback"), 0);
|
||||
args = scm_cons(arg, args);
|
||||
|
||||
/* next the name */
|
||||
@ -1040,7 +1014,6 @@ gnc_option_get_account_type_list(GNCOption *option)
|
||||
{
|
||||
SCM pair;
|
||||
SCM lst;
|
||||
SCM conv_func;
|
||||
GList *type_list = NULL;
|
||||
|
||||
initialize_getters();
|
||||
@ -1048,12 +1021,6 @@ gnc_option_get_account_type_list(GNCOption *option)
|
||||
pair = scm_call_1(getters.option_data, option->guile_option);
|
||||
lst = SCM_CDR(pair);
|
||||
|
||||
conv_func = scm_c_eval_string ("gw:enum-<gnc:AccountType>-val->int");
|
||||
if (!SCM_PROCEDUREP (conv_func)) {
|
||||
PERR ("Cannot obtain conv_func");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (!SCM_NULLP (lst)) {
|
||||
GNCAccountType type;
|
||||
SCM item;
|
||||
@ -1062,8 +1029,6 @@ gnc_option_get_account_type_list(GNCOption *option)
|
||||
item = SCM_CAR (lst);
|
||||
lst = SCM_CDR (lst);
|
||||
|
||||
item = scm_call_1(conv_func, item);
|
||||
|
||||
if (SCM_FALSEP (scm_integer_p (item))) {
|
||||
PERR ("Invalid type");
|
||||
} else {
|
||||
@ -1451,7 +1416,7 @@ gnc_option_db_clean(GNCOptionDB *odb)
|
||||
* Returns: nothing *
|
||||
\********************************************************************/
|
||||
void
|
||||
gncp_option_db_register_option(GNCOptionDBHandle handle, SCM guile_option)
|
||||
gnc_option_db_register_option(GNCOptionDBHandle handle, SCM guile_option)
|
||||
{
|
||||
GNCOptionDB *odb;
|
||||
GNCOption *option;
|
||||
@ -2816,3 +2781,51 @@ SCM gnc_dateformat_option_set_value(QofDateFormat format, GNCDateMonthFormat mon
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/* For now, this is global, just like when it was in guile.
|
||||
But, it should be make per-book. */
|
||||
static GHashTable *kvp_registry = NULL;
|
||||
|
||||
static void
|
||||
init_table(void)
|
||||
{
|
||||
if (!kvp_registry)
|
||||
kvp_registry = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
}
|
||||
|
||||
/*
|
||||
* the generator should be a procedure that takes one argument,
|
||||
* an options object. The procedure should fill in the options with
|
||||
* its defined kvp options.
|
||||
*/
|
||||
void
|
||||
gnc_register_kvp_option_generator(QofIdType id_type, SCM generator)
|
||||
{
|
||||
GList *list;
|
||||
init_table();
|
||||
list = g_hash_table_lookup(kvp_registry, id_type);
|
||||
list = g_list_prepend(list, generator);
|
||||
g_hash_table_insert(kvp_registry, (gpointer) id_type, list);
|
||||
scm_gc_protect_object(generator);
|
||||
}
|
||||
|
||||
|
||||
/* create a new options object for the requested type */
|
||||
SCM
|
||||
gnc_make_kvp_options(QofIdType id_type)
|
||||
{
|
||||
GList *list, *p;
|
||||
SCM gnc_new_options = SCM_UNDEFINED;
|
||||
SCM options = SCM_UNDEFINED;
|
||||
|
||||
init_table();
|
||||
list = g_hash_table_lookup(kvp_registry, id_type);
|
||||
gnc_new_options = scm_c_eval_string("gnc:new-options");
|
||||
options = scm_call_0(gnc_new_options);
|
||||
|
||||
for (p = list; p; p = p->next) {
|
||||
SCM generator = p->data;
|
||||
scm_call_1(generator, options);
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
@ -65,14 +65,14 @@ void gnc_option_db_destroy(GNCOptionDB *odb);
|
||||
/* Create an option DB for a particular type, and save/load from a kvp.
|
||||
* This assumes the gnc:*kvp-option-path* location for the options
|
||||
* in the kvp.
|
||||
*
|
||||
* Note: the id_type MUST be a reference to the actual SCM
|
||||
* gnc:id-type. Just wrapping the type in scheme is *NOT* sufficient.
|
||||
*/
|
||||
GNCOptionDB * gnc_option_db_new_for_type(SCM id_type);
|
||||
GNCOptionDB * gnc_option_db_new_for_type(QofIdType id_type);
|
||||
void gnc_option_db_load_from_kvp(GNCOptionDB* odb, kvp_frame *slots);
|
||||
void gnc_option_db_save_to_kvp(GNCOptionDB* odb, kvp_frame *slots);
|
||||
|
||||
void gnc_register_kvp_option_generator(QofIdType id_type, SCM generator);
|
||||
SCM gnc_make_kvp_options(QofIdType id_type);
|
||||
|
||||
void gnc_option_db_set_ui_callbacks (GNCOptionDB *odb,
|
||||
GNCOptionGetUIValue get_ui_value,
|
||||
GNCOptionSetUIValue set_ui_value,
|
||||
@ -260,10 +260,10 @@ SCM gnc_dateformat_option_set_value(QofDateFormat format, GNCDateMonthFormat mon
|
||||
gboolean years, const char *custom);
|
||||
|
||||
|
||||
/* private */
|
||||
void gncp_option_db_register_option(GNCOptionDBHandle handle,
|
||||
SCM guile_option);
|
||||
void gnc_option_db_register_option(GNCOptionDBHandle handle,
|
||||
SCM guile_option);
|
||||
|
||||
/* private */
|
||||
void gncp_option_invoke_callback(GNCOptionChangeCallback callback,
|
||||
gpointer data);
|
||||
|
||||
|
@ -196,9 +196,9 @@
|
||||
(lambda (x) (set! value x))
|
||||
(lambda () default-value)
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p) (gnc:kvp-frame-set-slot-path f value p))
|
||||
(lambda (f p) (kvp-frame-set-slot-path-gslist f value p))
|
||||
(lambda (f p)
|
||||
(let ((v (gnc:kvp-frame-get-slot-path f p)))
|
||||
(let ((v (kvp-frame-get-slot-path-gslist f p)))
|
||||
(if (and v (string? v))
|
||||
(set! value v))))
|
||||
(lambda (x)
|
||||
@ -220,9 +220,9 @@
|
||||
(lambda (x) (set! value x))
|
||||
(lambda () default-value)
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p) (gnc:kvp-frame-set-slot-path f value p))
|
||||
(lambda (f p) (kvp-frame-set-slot-path-gslist f value p))
|
||||
(lambda (f p)
|
||||
(let ((v (gnc:kvp-frame-get-slot-path f p)))
|
||||
(let ((v (kvp-frame-get-slot-path-gslist f p)))
|
||||
(if (and v (string? v))
|
||||
(set! value v))))
|
||||
(lambda (x)
|
||||
@ -254,9 +254,9 @@
|
||||
(lambda (x) (set! value x))
|
||||
(lambda () default-value)
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p) (gnc:kvp-frame-set-slot-path f value p))
|
||||
(lambda (f p) (kvp-frame-set-slot-path-gslist f value p))
|
||||
(lambda (f p)
|
||||
(let ((v (gnc:kvp-frame-get-slot-path f p)))
|
||||
(let ((v (kvp-frame-get-slot-path-gslist f p)))
|
||||
(if (and v (string? v))
|
||||
(set! value v))))
|
||||
(lambda (x)
|
||||
@ -276,12 +276,12 @@
|
||||
(define (currency->scm currency)
|
||||
(if (string? currency)
|
||||
currency
|
||||
(gnc:commodity-get-mnemonic currency)))
|
||||
(gnc-commodity-get-mnemonic currency)))
|
||||
|
||||
(define (scm->currency currency)
|
||||
(if (string? currency)
|
||||
(gnc:commodity-table-lookup
|
||||
(gnc:book-get-commodity-table (gnc:get-current-book))
|
||||
(gnc-commodity-table-lookup
|
||||
(gnc-commodity-table-get-table (gnc-get-current-book))
|
||||
GNC_COMMODITY_NS_CURRENCY currency)
|
||||
currency))
|
||||
|
||||
@ -293,9 +293,9 @@
|
||||
(lambda (x) (set! value (currency->scm x)))
|
||||
(lambda () (scm->currency default-value))
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p) (gnc:kvp-frame-set-slot-path f value p))
|
||||
(lambda (f p) (kvp-frame-set-slot-path-gslist f value p))
|
||||
(lambda (f p)
|
||||
(let ((v (gnc:kvp-frame-get-slot-path f p)))
|
||||
(let ((v (kvp-frame-get-slot-path-gslist f p)))
|
||||
(if (and v (string? v))
|
||||
(set! value v))))
|
||||
(lambda (x) (list #t x))
|
||||
@ -312,14 +312,14 @@
|
||||
(define (budget->guid budget)
|
||||
(if (string? budget)
|
||||
budget
|
||||
(gnc:budget-get-guid budget)))
|
||||
(gncBudgetGetGUID budget)))
|
||||
|
||||
(define (guid->budget budget)
|
||||
(if (string? budget)
|
||||
(gnc:budget-lookup budget (gnc:get-current-book))
|
||||
(gnc-budget-lookup budget (gnc-get-current-book))
|
||||
budget))
|
||||
|
||||
(let* ((default-value (gnc:budget-get-default (gnc:get-current-book)))
|
||||
(let* ((default-value (gnc-budget-get-default (gnc-get-current-book)))
|
||||
(value (budget->guid default-value))
|
||||
(option-set #f)
|
||||
(value->string (lambda ()
|
||||
@ -340,11 +340,11 @@
|
||||
(set! option-set #t)) ;; setter
|
||||
(lambda ()
|
||||
(guid->budget
|
||||
(gnc:budget-get-default (gnc:get-current-book)))) ;; default-getter
|
||||
(gnc-budget-get-default (gnc-get-current-book)))) ;; default-getter
|
||||
(gnc:restore-form-generator value->string) ;; ??
|
||||
(lambda (f p) (gnc:kvp-frame-set-slot-path f value p))
|
||||
(lambda (f p) (kvp-frame-set-slot-path-gslist f value p))
|
||||
(lambda (f p)
|
||||
(let ((v (gnc:kvp-frame-get-slot-path f p)))
|
||||
(let ((v (kvp-frame-get-slot-path-gslist f p)))
|
||||
(if (and v (string? v))
|
||||
(set! value v))))
|
||||
(lambda (x) (list #t x)) ;; value-validator
|
||||
@ -365,12 +365,12 @@
|
||||
GNC_COMMODITY_NS_CURRENCY
|
||||
commodity)
|
||||
(list 'commodity-scm
|
||||
(gnc:commodity-get-namespace commodity)
|
||||
(gnc:commodity-get-mnemonic commodity))))
|
||||
(gnc-commodity-get-namespace commodity)
|
||||
(gnc-commodity-get-mnemonic commodity))))
|
||||
|
||||
(define (scm->commodity scm)
|
||||
(gnc:commodity-table-lookup
|
||||
(gnc:book-get-commodity-table (gnc:get-current-book))
|
||||
(gnc-commodity-table-lookup
|
||||
(gnc-commodity-table-get-table (gnc-get-current-book))
|
||||
(cadr scm) (caddr scm)))
|
||||
|
||||
(let* ((value (commodity->scm default-value))
|
||||
@ -385,11 +385,11 @@
|
||||
(lambda () default-value)
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p)
|
||||
(gnc:kvp-frame-set-slot-path f (cadr value) (append p '("ns")))
|
||||
(gnc:kvp-frame-set-slot-path f (caddr value) (append p '("monic"))))
|
||||
(kvp-frame-set-slot-path-gslist f (cadr value) (append p '("ns")))
|
||||
(kvp-frame-set-slot-path-gslist f (caddr value) (append p '("monic"))))
|
||||
(lambda (f p)
|
||||
(let ((ns (gnc:kvp-frame-get-slot-path f (append p '("ns"))))
|
||||
(monic (gnc:kvp-frame-get-slot-path f (append p '("monic")))))
|
||||
(let ((ns (kvp-frame-get-slot-path-gslist f (append p '("ns"))))
|
||||
(monic (kvp-frame-get-slot-path-gslist f (append p '("monic")))))
|
||||
(if (and ns monic (string? ns) (string? monic))
|
||||
(set! value (list 'commodity-scm ns monic)))))
|
||||
(lambda (x) (list #t x))
|
||||
@ -443,9 +443,9 @@
|
||||
(setter-function-called-cb x)))
|
||||
(lambda () default-value)
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p) (gnc:kvp-frame-set-slot-path f value p))
|
||||
(lambda (f p) (kvp-frame-set-slot-path-gslist f value p))
|
||||
(lambda (f p)
|
||||
(let ((v (gnc:kvp-frame-get-slot-path f p)))
|
||||
(let ((v (kvp-frame-get-slot-path-gslist f p)))
|
||||
(if (and v (boolean? v) (not (equal? v default-value)))
|
||||
(set! value v))))
|
||||
(lambda (x)
|
||||
@ -517,16 +517,16 @@
|
||||
default-getter
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p)
|
||||
(gnc:kvp-frame-set-slot-path f (symbol->string (car value))
|
||||
(kvp-frame-set-slot-path-gslist f (symbol->string (car value))
|
||||
(append p '("type")))
|
||||
(gnc:kvp-frame-set-slot-path f
|
||||
(kvp-frame-set-slot-path-gslist f
|
||||
(if (symbol? (cdr value))
|
||||
(symbol->string (cdr value))
|
||||
(cdr value))
|
||||
(append p '("value"))))
|
||||
(lambda (f p)
|
||||
(let ((t (gnc:kvp-frame-get-slot-path f (append p '("type"))))
|
||||
(v (gnc:kvp-frame-get-slot-path f (append p '("value")))))
|
||||
(let ((t (kvp-frame-get-slot-path-gslist f (append p '("type"))))
|
||||
(v (kvp-frame-get-slot-path-gslist f (append p '("value")))))
|
||||
(if (and t v (string? t))
|
||||
(set! value (cons (string->symbol t)
|
||||
(if (string? v) (string->symbol v) v))))))
|
||||
@ -613,11 +613,11 @@
|
||||
(define (convert-to-guid item)
|
||||
(if (string? item)
|
||||
item
|
||||
(gnc:account-get-guid item)))
|
||||
(gncAccountGetGUID item)))
|
||||
|
||||
(define (convert-to-account item)
|
||||
(if (string? item)
|
||||
(gnc:account-lookup item (gnc:get-current-book))
|
||||
(xaccAccountLookup item (gnc-get-current-book))
|
||||
item))
|
||||
|
||||
(let* ((option (map convert-to-guid (default-getter)))
|
||||
@ -640,8 +640,8 @@
|
||||
(if (not account-list) (set! account-list (default-getter)))
|
||||
(set! account-list
|
||||
(filter (lambda (x) (if (string? x)
|
||||
(gnc:account-lookup
|
||||
x (gnc:get-current-book))
|
||||
(xaccAccountLookup
|
||||
x (gnc-get-current-book))
|
||||
x)) account-list))
|
||||
(let* ((result (validator account-list))
|
||||
(valid (car result))
|
||||
@ -657,20 +657,20 @@
|
||||
(define (save-acc list count)
|
||||
(if (not (null? list))
|
||||
(let ((key (string-append "acc" (gnc:value->string count))))
|
||||
(gnc:kvp-frame-set-slot-path f (car list) (append p (list key)))
|
||||
(kvp-frame-set-slot-path-gslist f (car list) (append p (list key)))
|
||||
(save-acc (cdr list) (+ 1 count)))))
|
||||
|
||||
(if option-set
|
||||
(begin
|
||||
(gnc:kvp-frame-set-slot-path f (length option)
|
||||
(kvp-frame-set-slot-path-gslist f (length option)
|
||||
(append p '("len")))
|
||||
(save-acc option 0))))
|
||||
(lambda (f p)
|
||||
(let ((len (gnc:kvp-frame-get-slot-path f (append p '("len")))))
|
||||
(let ((len (kvp-frame-get-slot-path-gslist f (append p '("len")))))
|
||||
(define (load-acc count)
|
||||
(if (< count len)
|
||||
(let* ((key (string-append "acc" (gnc:value->string count)))
|
||||
(guid (gnc:kvp-frame-get-slot-path
|
||||
(guid (kvp-frame-get-slot-path-gslist
|
||||
f (append p (list key)))))
|
||||
(cons guid (load-acc (+ count 1))))
|
||||
'()))
|
||||
@ -715,26 +715,27 @@
|
||||
(define (convert-to-guid item)
|
||||
(if (string? item)
|
||||
item
|
||||
(gnc:account-get-guid item)))
|
||||
(gncAccountGetGUID item)))
|
||||
|
||||
(define (convert-to-account item)
|
||||
(if (string? item)
|
||||
(gnc:account-lookup item (gnc:get-current-book))
|
||||
(xaccAccountLookup item (gnc-get-current-book))
|
||||
item))
|
||||
|
||||
(define (find-first-account)
|
||||
(define (find-first account-list)
|
||||
(if (null? account-list)
|
||||
#f
|
||||
'()
|
||||
(let* ((this-account (car account-list))
|
||||
(account-type (gw:enum-<gnc:AccountType>-val->sym
|
||||
(gnc:account-get-type this-account) #f)))
|
||||
(if (if (null? acct-type-list) #t (member account-type acct-type-list))
|
||||
(account-type (xaccAccountGetType this-account)))
|
||||
(if (if (null? acct-type-list)
|
||||
#t
|
||||
(member account-type acct-type-list))
|
||||
this-account
|
||||
(find-first (cdr account-list))))))
|
||||
|
||||
(let* ((current-group (gnc:get-current-group))
|
||||
(account-list (gnc:group-get-subaccounts current-group)))
|
||||
(let* ((current-group (gnc-get-current-group))
|
||||
(account-list (xaccGroupGetSubAccountsSorted current-group)))
|
||||
(find-first account-list)))
|
||||
|
||||
(define (get-default)
|
||||
@ -771,9 +772,9 @@
|
||||
(gnc:error "Illegal account value set"))))
|
||||
(lambda () (convert-to-account (get-default)))
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p) (gnc:kvp-frame-set-slot-path f value p))
|
||||
(lambda (f p) (kvp-frame-set-slot-path-gslist f value p))
|
||||
(lambda (f p)
|
||||
(let ((v (gnc:kvp-frame-get-slot-path f p)))
|
||||
(let ((v (kvp-frame-get-slot-path-gslist f p)))
|
||||
(if (and v (string? v))
|
||||
(set! value v))))
|
||||
validator
|
||||
@ -850,9 +851,9 @@
|
||||
(gnc:error "Illegal Multichoice option set")))
|
||||
(lambda () default-value)
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p) (gnc:kvp-frame-set-slot-path f (symbol->string value) p))
|
||||
(lambda (f p) (kvp-frame-set-slot-path-gslist f (symbol->string value) p))
|
||||
(lambda (f p)
|
||||
(let ((v (gnc:kvp-frame-get-slot-path f p)))
|
||||
(let ((v (kvp-frame-get-slot-path-gslist f p)))
|
||||
(if (and v (string? v))
|
||||
(set! value (string->symbol v)))))
|
||||
(lambda (x)
|
||||
@ -936,9 +937,9 @@
|
||||
(gnc:error "Illegal Radiobutton option set")))
|
||||
(lambda () default-value)
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p) (gnc:kvp-frame-set-slot-path f (symbol->string value) p))
|
||||
(lambda (f p) (kvp-frame-set-slot-path-gslist f (symbol->string value) p))
|
||||
(lambda (f p)
|
||||
(let ((v (gnc:kvp-frame-get-slot-path f p)))
|
||||
(let ((v (kvp-frame-get-slot-path-gslist f p)))
|
||||
(if (and v (string? v))
|
||||
(set! value (string->symbol v)))))
|
||||
(lambda (x)
|
||||
@ -1002,16 +1003,16 @@
|
||||
(define (save-item list count)
|
||||
(if (not (null? list))
|
||||
(let ((key (string-append "item" (gnc:value->string count))))
|
||||
(gnc:kvp-frame-set-slot-path f (car list) (append p (list key)))
|
||||
(kvp-frame-set-slot-path-gslist f (car list) (append p (list key)))
|
||||
(save-item (cdr list) (+ 1 count)))))
|
||||
(gnc:kvp-frame-set-slot-path f (length value) (append p '("len")))
|
||||
(kvp-frame-set-slot-path-gslist f (length value) (append p '("len")))
|
||||
(save-item value 0))
|
||||
(lambda (f p)
|
||||
(let ((len (gnc:kvp-frame-get-slot-path f (append p '("len")))))
|
||||
(let ((len (kvp-frame-get-slot-path-gslist f (append p '("len")))))
|
||||
(define (load-item count)
|
||||
(if (< count len)
|
||||
(let* ((key (string-append "item" (gnc:value->string count)))
|
||||
(val (gnc:kvp-frame-get-slot-path
|
||||
(val (kvp-frame-get-slot-path-gslist
|
||||
f (append p (list key)))))
|
||||
(cons val (load-item (+ count 1))))
|
||||
'()))
|
||||
@ -1050,9 +1051,9 @@
|
||||
(lambda (x) (set! value x))
|
||||
(lambda () default-value)
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p) (gnc:kvp-frame-set-slot-path f (symbol->string value) p))
|
||||
(lambda (f p) (kvp-frame-set-slot-path-gslist f (symbol->string value) p))
|
||||
(lambda (f p)
|
||||
(let ((v (gnc:kvp-frame-get-slot-path f p)))
|
||||
(let ((v (kvp-frame-get-slot-path-gslist f p)))
|
||||
(if (and v (number? v))
|
||||
(set! value v))))
|
||||
(lambda (x)
|
||||
@ -1089,16 +1090,16 @@
|
||||
default-value)
|
||||
(let* ((value (if (list? default-value)
|
||||
default-value
|
||||
(gnc:query->scm default-value)))
|
||||
(gnc-query2scm default-value)))
|
||||
(value->string (lambda ()
|
||||
(string-append "'" (gnc:value->string value)))))
|
||||
(gnc:make-option
|
||||
section name "" 'query #f
|
||||
(lambda () value)
|
||||
(lambda (x) (set! value (if (list? x) x (gnc:query->scm x))))
|
||||
(lambda (x) (set! value (if (list? x) x (gnc-query2scm x))))
|
||||
(lambda () (if (list? default-value)
|
||||
default-value
|
||||
(gnc:query->scm default-value)))
|
||||
(gnc-query2scm default-value)))
|
||||
(gnc:restore-form-generator value->string)
|
||||
#f
|
||||
#f
|
||||
@ -1210,18 +1211,18 @@
|
||||
(lambda () (def-value))
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p)
|
||||
(gnc:kvp-frame-set-slot-path
|
||||
(kvp-frame-set-slot-path-gslist
|
||||
f (symbol->string (car value)) (append p '("fmt")))
|
||||
(gnc:kvp-frame-set-slot-path
|
||||
(kvp-frame-set-slot-path-gslist
|
||||
f (symbol->string (cadr value)) (append p '("month")))
|
||||
(gnc:kvp-frame-set-slot-path
|
||||
(kvp-frame-set-slot-path-gslist
|
||||
f (if (caddr value) 1 0) (append p '("years")))
|
||||
(gnc:kvp-frame-set-slot-path f (cadddr value) (append p '("custom"))))
|
||||
(kvp-frame-set-slot-path-gslist f (cadddr value) (append p '("custom"))))
|
||||
(lambda (f p)
|
||||
(let ((fmt (gnc:kvp-frame-get-slot-path f (append p '("fmt"))))
|
||||
(month (gnc:kvp-frame-get-slot-path f (append p '("month"))))
|
||||
(years (gnc:kvp-frame-get-slot-path f (append p '("years"))))
|
||||
(custom (gnc:kvp-frame-get-slot-path f (append p '("custom")))))
|
||||
(let ((fmt (kvp-frame-get-slot-path-gslist f (append p '("fmt"))))
|
||||
(month (kvp-frame-get-slot-path-gslist f (append p '("month"))))
|
||||
(years (kvp-frame-get-slot-path-gslist f (append p '("years"))))
|
||||
(custom (kvp-frame-get-slot-path-gslist f (append p '("custom")))))
|
||||
(if (and
|
||||
fmt (string? fmt)
|
||||
month (string? month)
|
||||
@ -1447,7 +1448,7 @@
|
||||
((options 'register-callback) section name callback))
|
||||
|
||||
(define (gnc:options-register-c-callback section name c-callback data options)
|
||||
(let ((callback (lambda () (gnc:option-invoke-callback c-callback data))))
|
||||
(let ((callback (lambda () (gncp-option-invoke-callback c-callback data))))
|
||||
((options 'register-callback) section name callback)))
|
||||
|
||||
(define (gnc:options-unregister-callback-id id options)
|
||||
@ -1467,7 +1468,7 @@
|
||||
|
||||
(define (gnc:options-scm->kvp options kvp-frame key-path clear-kvp?)
|
||||
(if clear-kvp?
|
||||
(gnc:kvp-frame-delete-at-path kvp-frame key-path))
|
||||
(gnc-kvp-frame-delete-at-path kvp-frame key-path))
|
||||
((options 'scm->kvp) kvp-frame key-path))
|
||||
|
||||
(define (gnc:options-kvp->scm options kvp-frame key-path)
|
||||
@ -1507,7 +1508,7 @@
|
||||
(define (gnc:send-options db_handle options)
|
||||
(gnc:options-for-each
|
||||
(lambda (option)
|
||||
(gnc:option-db-register-option db_handle option))
|
||||
(gnc-option-db-register-option db_handle option))
|
||||
options))
|
||||
|
||||
(define (gnc:save-options options options-string file header truncate?)
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
(require 'sort)
|
||||
(require 'hash-table)
|
||||
(use-modules (g-wrapped gw-core-utils))
|
||||
|
||||
;; (define gnc:*double-entry-restriction*
|
||||
;; (gnc:make-config-var
|
||||
@ -64,36 +63,36 @@
|
||||
;;;;;; Create config vars
|
||||
|
||||
(define gnc:*debit-strings*
|
||||
(list (cons 'ACCT_TYPE_NONE (N_ "Funds In"))
|
||||
(cons 'ACCT_TYPE_BANK (N_ "Deposit"))
|
||||
(cons 'ACCT_TYPE_CASH (N_ "Receive"))
|
||||
(cons 'ACCT_TYPE_CREDIT (N_ "Payment"))
|
||||
(cons 'ACCT_TYPE_ASSET (N_ "Increase"))
|
||||
(cons 'ACCT_TYPE_LIABILITY (N_ "Decrease"))
|
||||
(cons 'ACCT_TYPE_STOCK (N_ "Buy"))
|
||||
(cons 'ACCT_TYPE_MUTUAL (N_ "Buy"))
|
||||
(cons 'ACCT_TYPE_CURRENCY (N_ "Buy"))
|
||||
(cons 'ACCT_TYPE_INCOME (N_ "Charge"))
|
||||
(cons 'ACCT_TYPE_EXPENSE (N_ "Expense"))
|
||||
(cons 'ACCT_TYPE_PAYABLE (N_ "Payment"))
|
||||
(cons 'ACCT_TYPE_RECEIVABLE (N_ "Invoice"))
|
||||
(cons 'ACCT_TYPE_EQUITY (N_ "Decrease"))))
|
||||
(list (cons ACCT-TYPE-NONE (N_ "Funds In"))
|
||||
(cons ACCT-TYPE-BANK (N_ "Deposit"))
|
||||
(cons ACCT-TYPE-CASH (N_ "Receive"))
|
||||
(cons ACCT-TYPE-CREDIT (N_ "Payment"))
|
||||
(cons ACCT-TYPE-ASSET (N_ "Increase"))
|
||||
(cons ACCT-TYPE-LIABILITY (N_ "Decrease"))
|
||||
(cons ACCT-TYPE-STOCK (N_ "Buy"))
|
||||
(cons ACCT-TYPE-MUTUAL (N_ "Buy"))
|
||||
(cons ACCT-TYPE-CURRENCY (N_ "Buy"))
|
||||
(cons ACCT-TYPE-INCOME (N_ "Charge"))
|
||||
(cons ACCT-TYPE-EXPENSE (N_ "Expense"))
|
||||
(cons ACCT-TYPE-PAYABLE (N_ "Payment"))
|
||||
(cons ACCT-TYPE-RECEIVABLE (N_ "Invoice"))
|
||||
(cons ACCT-TYPE-EQUITY (N_ "Decrease"))))
|
||||
|
||||
(define gnc:*credit-strings*
|
||||
(list (cons 'ACCT_TYPE_NONE (N_ "Funds Out"))
|
||||
(cons 'ACCT_TYPE_BANK (N_ "Withdrawal"))
|
||||
(cons 'ACCT_TYPE_CASH (N_ "Spend"))
|
||||
(cons 'ACCT_TYPE_CREDIT (N_ "Charge"))
|
||||
(cons 'ACCT_TYPE_ASSET (N_ "Decrease"))
|
||||
(cons 'ACCT_TYPE_LIABILITY (N_ "Increase"))
|
||||
(cons 'ACCT_TYPE_STOCK (N_ "Sell"))
|
||||
(cons 'ACCT_TYPE_MUTUAL (N_ "Sell"))
|
||||
(cons 'ACCT_TYPE_CURRENCY (N_ "Sell"))
|
||||
(cons 'ACCT_TYPE_INCOME (N_ "Income"))
|
||||
(cons 'ACCT_TYPE_EXPENSE (N_ "Rebate"))
|
||||
(cons 'ACCT_TYPE_PAYABLE (N_ "Bill"))
|
||||
(cons 'ACCT_TYPE_RECEIVABLE (N_ "Payment"))
|
||||
(cons 'ACCT_TYPE_EQUITY (N_ "Increase"))))
|
||||
(list (cons ACCT-TYPE-NONE (N_ "Funds Out"))
|
||||
(cons ACCT-TYPE-BANK (N_ "Withdrawal"))
|
||||
(cons ACCT-TYPE-CASH (N_ "Spend"))
|
||||
(cons ACCT-TYPE-CREDIT (N_ "Charge"))
|
||||
(cons ACCT-TYPE-ASSET (N_ "Decrease"))
|
||||
(cons ACCT-TYPE-LIABILITY (N_ "Increase"))
|
||||
(cons ACCT-TYPE-STOCK (N_ "Sell"))
|
||||
(cons ACCT-TYPE-MUTUAL (N_ "Sell"))
|
||||
(cons ACCT-TYPE-CURRENCY (N_ "Sell"))
|
||||
(cons ACCT-TYPE-INCOME (N_ "Income"))
|
||||
(cons ACCT-TYPE-EXPENSE (N_ "Rebate"))
|
||||
(cons ACCT-TYPE-PAYABLE (N_ "Bill"))
|
||||
(cons ACCT-TYPE-RECEIVABLE (N_ "Payment"))
|
||||
(cons ACCT-TYPE-EQUITY (N_ "Increase"))))
|
||||
|
||||
(define (gnc:get-debit-string type)
|
||||
(_ (assoc-ref gnc:*debit-strings* type)))
|
||||
|
@ -1,7 +1,6 @@
|
||||
TESTS = \
|
||||
test-link-module \
|
||||
test-load-module \
|
||||
test-component-manager \
|
||||
test-exp-parser \
|
||||
test-scm-query-string \
|
||||
test-print-parse-amount
|
||||
@ -22,15 +21,14 @@ GNC_TEST_DEPS := @GNC_TEST_SRFI_LOAD_CMD@ \
|
||||
--gnc-module-dir ${top_builddir}/src/app-utils \
|
||||
--gnc-module-dir ${top_srcdir}/src/engine \
|
||||
--gnc-module-dir ${top_srcdir}/src/app-utils \
|
||||
--guile-load-dir ${G_WRAP_MODULE_DIR} \
|
||||
--guile-load-dir ${top_srcdir}/src/scm \
|
||||
--guile-load-dir ${top_builddir}/src/scm \
|
||||
--guile-load-dir ${top_builddir}/src/gnome-utils \
|
||||
--guile-load-dir ${top_builddir}/src/core-utils \
|
||||
--guile-load-dir ${top_builddir}/src/gnome \
|
||||
--library-dir ${top_builddir}/src/gnome-utils \
|
||||
--library-dir ${top_builddir}/src/gnome \
|
||||
--library-dir ${top_builddir}/lib/libqof/qof \
|
||||
--library-dir ${G_WRAP_LIB_DIR}
|
||||
--library-dir ${top_builddir}/src/gnome
|
||||
|
||||
TESTS_ENVIRONMENT := \
|
||||
$(shell ${top_srcdir}/src/gnc-test-env --no-exports ${GNC_TEST_DEPS})
|
||||
@ -39,7 +37,6 @@ LDADD = \
|
||||
${top_builddir}/src/engine/libgncmod-engine.la \
|
||||
${top_builddir}/src/gnc-module/libgncmodule.la \
|
||||
${top_builddir}/src/app-utils/libgncmod-app-utils.la \
|
||||
${top_builddir}/src/engine/libgw-engine.la \
|
||||
${top_builddir}/src/test-core/libgncmod-test.la \
|
||||
${top_builddir}/src/engine/test-core/libgncmod-test-engine.la \
|
||||
${top_builddir}/src/core-utils/libcore-utils.la \
|
||||
@ -55,8 +52,7 @@ noinst_PROGRAMS = \
|
||||
test-print-queries
|
||||
|
||||
EXTRA_DIST = \
|
||||
test-load-module \
|
||||
test-component-manager
|
||||
test-load-module
|
||||
|
||||
AM_CFLAGS = \
|
||||
-I${top_srcdir}/src \
|
||||
|
@ -1,49 +0,0 @@
|
||||
#! /bin/bash
|
||||
exec guile -s "$0"
|
||||
!#
|
||||
|
||||
(use-modules (gnucash gnc-module))
|
||||
(gnc:module-system-init)
|
||||
|
||||
(or (gnc:module-load "gnucash/app-utils" 0)
|
||||
(error "can't load module"))
|
||||
|
||||
(let ((id #f)
|
||||
(refresh-ran #f)
|
||||
(close-ran #f))
|
||||
|
||||
(define (refresh-handler)
|
||||
(set! refresh-ran #t))
|
||||
|
||||
(define (close-handler)
|
||||
(set! close-ran #t)
|
||||
(gnc:unregister-gui-component id))
|
||||
|
||||
(set! id (gnc:register-gui-component "test-class"
|
||||
refresh-handler
|
||||
close-handler))
|
||||
(or (not (equal? id -1))
|
||||
(error "can't register"))
|
||||
|
||||
(gnc:gui-refresh-all)
|
||||
|
||||
(or refresh-ran (error "refresh didn't run"))
|
||||
|
||||
(gnc:close-gui-component id)
|
||||
|
||||
(or close-ran (error "close didn't run"))
|
||||
|
||||
(set! refresh-ran #f)
|
||||
(set! close-ran #f)
|
||||
|
||||
(gnc:gui-refresh-all)
|
||||
(gnc:close-gui-component id)
|
||||
|
||||
(or (not (or refresh-ran close-ran))
|
||||
(error "component not removed")))
|
||||
|
||||
(exit 0)
|
||||
|
||||
;; Local Variables:
|
||||
;; mode: scheme
|
||||
;; End:
|
@ -8,7 +8,7 @@ exec guile -s "$0"
|
||||
(if (gnc:module-load "gnucash/app-utils" 0)
|
||||
(begin
|
||||
(if (and (procedure? gnc:error->string)
|
||||
(procedure? gnc:guid-new)
|
||||
(procedure? gnc-default-currency)
|
||||
(macro? N_)
|
||||
(string=? (N_ "foobar") "foobar"))
|
||||
(exit 0)
|
||||
|
@ -62,7 +62,7 @@ test_string_converters_SOURCES = \
|
||||
${top_srcdir}/src/backend/file/sixtp-stack.c \
|
||||
${top_srcdir}/src/backend/file/sixtp-to-dom-parser.c \
|
||||
test-string-converters.c
|
||||
|
||||
|
||||
test_xml_account_SOURCES = \
|
||||
${top_srcdir}/src/backend/file/sixtp-dom-parsers.c \
|
||||
${top_srcdir}/src/backend/file/sixtp-dom-generators.c \
|
||||
@ -181,11 +181,9 @@ GNC_TEST_DEPS := \
|
||||
--gnc-module-dir ${top_builddir}/src/gnc-module \
|
||||
--gnc-module-dir ${top_builddir}/src/engine \
|
||||
--gnc-module-dir ${top_srcdir}/src/gnc-module \
|
||||
--gnc-module-dir ${top_srcdir}/src/engine \
|
||||
--guile-load-dir ${G_WRAP_MODULE_DIR} \
|
||||
--library-dir ${top_builddir}/src/backend/file \
|
||||
--library-dir ${top_builddir}/lib/libqof/qof \
|
||||
--library-dir ${G_WRAP_LIB_DIR}
|
||||
--gnc-module-dir ${top_srcdir}/src/engine
|
||||
|
||||
TESTS_ENVIRONMENT := \
|
||||
GNC_ACCOUNT_PATH=${top_srcdir}/accounts/C \
|
||||
@ -219,8 +217,6 @@ noinst_HEADERS = test-file-stuff.h
|
||||
LDADD = ${top_builddir}/src/test-core/libgncmod-test.la \
|
||||
${top_builddir}/src/gnc-module/libgncmodule.la \
|
||||
${top_builddir}/src/engine/libgncmod-engine.la \
|
||||
${top_builddir}/src/engine/libgw-engine.la \
|
||||
${top_builddir}/src/engine/libgw-kvp.la \
|
||||
${top_builddir}/src/engine/test-core/libgncmod-test-engine.la \
|
||||
${top_builddir}/src/core-utils/libcore-utils.la \
|
||||
./libgnc-test-file-stuff.la \
|
||||
|
@ -8,9 +8,7 @@ GNC_TEST_DEPS := \
|
||||
--gnc-module-dir ${top_builddir}/src/engine \
|
||||
--guile-load-dir ${top_srcdir}/src/engine \
|
||||
--gnc-module-dir ${top_builddir}/src/backend/file \
|
||||
--gnc-module-dir ${top_builddir}/src/backend/postgres \
|
||||
--guile-load-dir ${G_WRAP_MODULE_DIR} \
|
||||
--library-dir ${G_WRAP_LIB_DIR}
|
||||
--gnc-module-dir ${top_builddir}/src/backend/postgres
|
||||
|
||||
TESTS_ENVIRONMENT := \
|
||||
TEST_DB_SOCKET_DIR=`pwd`/gnc_test_db_sock \
|
||||
@ -26,8 +24,6 @@ LDADD = ${top_builddir}/src/test-core/libgncmod-test.la \
|
||||
${top_builddir}/src/gnc-module/libgncmodule.la \
|
||||
${top_builddir}/src/engine/libgncmod-engine.la \
|
||||
${top_builddir}/src/engine/libgncmod-engine.la \
|
||||
${top_builddir}/src/engine/libgw-engine.la \
|
||||
${top_builddir}/src/engine/libgw-kvp.la \
|
||||
${top_builddir}/src/engine/test-core/libgncmod-test-engine.la \
|
||||
-lltdl \
|
||||
-lpq
|
||||
|
@ -31,8 +31,6 @@ gnucash: gnucash.in ${top_builddir}/config.status Makefile
|
||||
rm -f $@.tmp
|
||||
sed < $< > $@.tmp \
|
||||
-e 's#@-BIN_DIR-@#${bindir}#g' \
|
||||
-e 's#@-G_WRAP_MODULE_DIR-@#${G_WRAP_MODULE_DIR}#g' \
|
||||
-e 's#@-G_WRAP_LIB_DIR-@#${G_WRAP_LIB_DIR}#g' \
|
||||
-e 's#@-GNC_GUILE_MODULE_DIR-@#${GNC_SHAREDIR}/guile-modules#g' \
|
||||
-e 's#@-GNC_SCM_INSTALL_DIR-@#${GNC_SCM_INSTALL_DIR}#g' \
|
||||
-e 's#@-GNC_LIB_INSTALLDIR-@#${libdir}#' \
|
||||
@ -46,8 +44,6 @@ gnucash-valgrind: gnucash-valgrind.in ${top_builddir}/config.status Makefile
|
||||
rm -f $@.tmp
|
||||
sed < $< > $@.tmp \
|
||||
-e 's#@-BIN_DIR-@#${bindir}#g' \
|
||||
-e 's#@-G_WRAP_MODULE_DIR-@#${G_WRAP_MODULE_DIR}#g' \
|
||||
-e 's#@-G_WRAP_LIB_DIR-@#${G_WRAP_LIB_DIR}#g' \
|
||||
-e 's#@-GNC_GUILE_MODULE_DIR-@#${GNC_SHAREDIR}/guile-modules#g' \
|
||||
-e 's#@-GNC_SCM_INSTALL_DIR-@#${GNC_SCM_INSTALL_DIR}#g' \
|
||||
-e 's#@-GNC_LIB_INSTALLDIR-@#${libdir}#' \
|
||||
|
@ -50,6 +50,9 @@
|
||||
#include "gnc-plugin-file-history.h"
|
||||
#include "gnc-gconf-utils.h"
|
||||
#include "dialog-new-user.h"
|
||||
#include "gnc-session.h"
|
||||
#include "engine-helpers.h"
|
||||
#include "swig-runtime.h"
|
||||
|
||||
#ifdef HAVE_GETTEXT
|
||||
# include <libintl.h>
|
||||
@ -103,28 +106,6 @@ envt_override()
|
||||
help_path = path;
|
||||
}
|
||||
|
||||
static int error_in_scm_eval = FALSE;
|
||||
|
||||
static void
|
||||
error_handler(const char *msg)
|
||||
{
|
||||
g_warning(msg);
|
||||
error_in_scm_eval = TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
try_load(gchar *fn)
|
||||
{
|
||||
g_message("looking for %s", fn);
|
||||
if (g_file_test(fn, G_FILE_TEST_EXISTS)) {
|
||||
g_message("trying to load %s", fn);
|
||||
error_in_scm_eval = FALSE;
|
||||
gfec_eval_file(fn, error_handler);
|
||||
return !error_in_scm_eval;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
try_load_config_array(const gchar *fns[])
|
||||
{
|
||||
@ -133,7 +114,7 @@ try_load_config_array(const gchar *fns[])
|
||||
|
||||
for (i = 0; fns[i]; i++) {
|
||||
filename = gnc_build_dotgnucash_path(fns[i]);
|
||||
if (try_load(filename)) {
|
||||
if (gfec_try_load(filename)) {
|
||||
g_free(filename);
|
||||
return TRUE;
|
||||
}
|
||||
@ -160,7 +141,7 @@ load_system_config(void)
|
||||
update_message("loading system configuration");
|
||||
/* FIXME: use runtime paths from gnc-path.c here */
|
||||
system_config = g_build_filename(config_path, "config", NULL);
|
||||
is_system_config_loaded = try_load(system_config);
|
||||
is_system_config_loaded = gfec_try_load(system_config);
|
||||
g_free(system_config);
|
||||
}
|
||||
|
||||
@ -394,8 +375,9 @@ load_gnucash_modules()
|
||||
static void
|
||||
inner_main_add_price_quotes(void *closure, int argc, char **argv)
|
||||
{
|
||||
SCM mod, add_quotes, scm_filename, scm_result;
|
||||
|
||||
SCM mod, add_quotes, scm_book, scm_result = SCM_BOOL_F;
|
||||
QofSession *session;
|
||||
|
||||
mod = scm_c_resolve_module("gnucash price-quotes");
|
||||
scm_set_current_module(mod);
|
||||
|
||||
@ -404,22 +386,42 @@ inner_main_add_price_quotes(void *closure, int argc, char **argv)
|
||||
qof_event_suspend();
|
||||
scm_c_eval_string("(gnc:price-quotes-install-sources)");
|
||||
|
||||
if (gnc_quote_source_fq_installed()) {
|
||||
add_quotes = scm_c_eval_string("gnc:add-quotes-to-book-at-url");
|
||||
scm_filename = scm_makfrom0str (add_quotes_file);
|
||||
scm_result = scm_call_1(add_quotes, scm_filename);
|
||||
if (!gnc_quote_source_fq_installed()) {
|
||||
g_print(_("No quotes retrieved. Finance::Quote isn't "
|
||||
"installed properly.\n"));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!SCM_NFALSEP(scm_result)) {
|
||||
add_quotes = scm_c_eval_string("gnc:book-add-quotes");
|
||||
session = gnc_get_current_session();
|
||||
if (!session) goto fail;
|
||||
|
||||
qof_session_begin(session, add_quotes_file, FALSE, FALSE);
|
||||
if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR) goto fail;
|
||||
|
||||
qof_session_load(session, NULL);
|
||||
if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR) goto fail;
|
||||
|
||||
scm_book = gnc_book_to_scm(qof_session_get_book(session));
|
||||
scm_result = scm_call_2(add_quotes, SCM_BOOL_F, scm_book);
|
||||
|
||||
qof_session_save(session, NULL);
|
||||
if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR) goto fail;
|
||||
|
||||
qof_session_destroy(session);
|
||||
if (!SCM_NFALSEP(scm_result)) {
|
||||
g_error("Failed to add quotes to %s.", add_quotes_file);
|
||||
gnc_shutdown(1);
|
||||
}
|
||||
} else {
|
||||
g_print(_("No quotes retrieved. Finance::Quote isn't installed properly.\n"));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
qof_event_resume();
|
||||
gnc_shutdown(0);
|
||||
return;
|
||||
fail:
|
||||
if (session && qof_session_get_error(session) != ERR_BACKEND_NO_ERR)
|
||||
g_error("Session Error: %s", qof_session_get_error_message(session));
|
||||
qof_event_resume();
|
||||
gnc_shutdown(1);
|
||||
}
|
||||
|
||||
static char *
|
||||
|
@ -8,7 +8,6 @@ export GUILE_WARN_DEPRECATED
|
||||
|
||||
GNC_MODULE_PATH="@-GNC_PKGLIB_INSTALLDIR-@:${GNC_MODULE_PATH}"
|
||||
|
||||
EXTRA_PATH="@-G_WRAP_MODULE_DIR-@"
|
||||
EXTRA_PATH="${EXTRA_PATH}:@-GNC_GUILE_MODULE_DIR-@"
|
||||
EXTRA_PATH="${EXTRA_PATH}:@-GNC_SCM_INSTALL_DIR-@"
|
||||
GUILE_LOAD_PATH="${EXTRA_PATH}:${GUILE_LOAD_PATH}"
|
||||
@ -16,7 +15,6 @@ GUILE_LOAD_PATH="${EXTRA_PATH}:${GUILE_LOAD_PATH}"
|
||||
EXTRA_LIBS="${GNC_MODULE_PATH}"
|
||||
EXTRA_LIBS="${EXTRA_LIBS}:@-GNC_LIB_INSTALLDIR-@"
|
||||
EXTRA_LIBS="${EXTRA_LIBS}:@-GNC_MODULE_DIR-@"
|
||||
EXTRA_LIBS="${EXTRA_LIBS}:@-G_WRAP_LIB_DIR-@"
|
||||
|
||||
LD_LIBRARY_PATH="${EXTRA_LIBS}:${LD_LIBRARY_PATH}"
|
||||
LTDL_LIBRARY_PATH="${EXTRA_LIBS}:${LTDL_LIBRARY_PATH}"
|
||||
|
@ -8,7 +8,6 @@ export GUILE_WARN_DEPRECATED
|
||||
|
||||
GNC_MODULE_PATH="@-GNC_PKGLIB_INSTALLDIR-@@-PATH_SEPARATOR-@${GNC_MODULE_PATH}"
|
||||
|
||||
EXTRA_PATH="@-G_WRAP_MODULE_DIR-@"
|
||||
EXTRA_PATH="${EXTRA_PATH}@-PATH_SEPARATOR-@@-GNC_GUILE_MODULE_DIR-@"
|
||||
EXTRA_PATH="${EXTRA_PATH}@-PATH_SEPARATOR-@@-GNC_SCM_INSTALL_DIR-@"
|
||||
GUILE_LOAD_PATH="${EXTRA_PATH}@-PATH_SEPARATOR-@${GUILE_LOAD_PATH}"
|
||||
@ -16,7 +15,6 @@ GUILE_LOAD_PATH="${EXTRA_PATH}@-PATH_SEPARATOR-@${GUILE_LOAD_PATH}"
|
||||
EXTRA_LIBS="${GNC_MODULE_PATH}"
|
||||
EXTRA_LIBS="${EXTRA_LIBS}@-PATH_SEPARATOR-@@-GNC_LIB_INSTALLDIR-@"
|
||||
EXTRA_LIBS="${EXTRA_LIBS}@-PATH_SEPARATOR-@@-GNC_MODULE_DIR-@"
|
||||
EXTRA_LIBS="${EXTRA_LIBS}@-PATH_SEPARATOR-@@-G_WRAP_LIB_DIR-@"
|
||||
|
||||
LD_LIBRARY_PATH="${EXTRA_LIBS}@-PATH_SEPARATOR-@${LD_LIBRARY_PATH}"
|
||||
LTDL_LIBRARY_PATH="${EXTRA_LIBS}@-PATH_SEPARATOR-@${LTDL_LIBRARY_PATH}"
|
||||
|
@ -31,8 +31,6 @@ CLEANFILES = guile
|
||||
gnucash-env: gnucash-env.in ${top_builddir}/config.status Makefile
|
||||
rm -f $@.tmp
|
||||
sed < $< > $@.tmp \
|
||||
-e 's#@-G_WRAP_MODULE_DIR-@#${G_WRAP_MODULE_DIR}#g' \
|
||||
-e 's#@-G_WRAP_LIB_DIR-@#${G_WRAP_LIB_DIR}#g' \
|
||||
-e 's#@-GNC_GUILE_MODULE_DIR-@#${GNC_SHAREDIR}/guile-modules#g' \
|
||||
-e 's#@-GNC_SCM_INSTALL_DIR-@#${GNC_SCM_INSTALL_DIR}#g' \
|
||||
-e 's#@-GNC_LIB_INSTALLDIR-@#${libdir}#' \
|
||||
@ -47,8 +45,6 @@ gnucash-build-env: gnucash-build-env.in ${top_builddir}/config.status Makefile
|
||||
rm -f $@.tmp
|
||||
sed < $< > $@.tmp \
|
||||
-e 's#@-GNC_TEST_SRFI_LOAD_CMD-@#@GNC_TEST_SRFI_LOAD_CMD@#g' \
|
||||
-e 's#@-G_WRAP_MODULE_DIR-@#${G_WRAP_MODULE_DIR}#g' \
|
||||
-e 's#@-G_WRAP_LIB_DIR-@#${G_WRAP_LIB_DIR}#g' \
|
||||
-e 's#@-GNC_BUILDDIR-@#${PWD}/${top_builddir}#g' \
|
||||
-e 's#@-GNC_SRCDIR-@#${PWD}/${top_srcdir}#g'
|
||||
mv $@.tmp $@
|
||||
|
@ -10,8 +10,6 @@
|
||||
|
||||
top_srcdir="@-GNC_SRCDIR-@"
|
||||
top_builddir="@-GNC_BUILDDIR-@"
|
||||
G_WRAP_MODULE_DIR="@-G_WRAP_MODULE_DIR-@"
|
||||
G_WRAP_LIB_DIR="@-G_WRAP_LIB_DIR-@"
|
||||
|
||||
if test "${GNC_CONFIG_PATH}"x = x
|
||||
then
|
||||
@ -33,8 +31,6 @@ fi
|
||||
|
||||
eval `@-GNC_SRCDIR-@/src/gnc-test-env @-GNC_TEST_SRFI_LOAD_CMD-@ \
|
||||
--library-dir ${top_builddir}/src/gnome \
|
||||
--library-dir ${G_WRAP_LIB_DIR} \
|
||||
--guile-load-dir ${G_WRAP_MODULE_DIR} \
|
||||
--guile-load-dir ${top_builddir}/src/scm \
|
||||
--guile-load-dir ${top_builddir}/lib/guile-www \
|
||||
--guile-load-dir ${top_builddir}/src/gnome \
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
GNC_MODULE_PATH="@-GNC_PKGLIB_INSTALLDIR-@:${GNC_MODULE_PATH}"
|
||||
|
||||
EXTRA_PATH="@-G_WRAP_MODULE_DIR-@"
|
||||
EXTRA_PATH="${EXTRA_PATH}:@-GNC_GUILE_MODULE_DIR-@"
|
||||
EXTRA_PATH="${EXTRA_PATH}:@-GNC_SCM_INSTALL_DIR-@"
|
||||
|
||||
@ -15,7 +14,6 @@ GUILE_LOAD_PATH="${EXTRA_PATH}:${GUILE_LOAD_PATH}"
|
||||
EXTRA_LIBS="${GNC_MODULE_PATH}"
|
||||
EXTRA_LIBS="${EXTRA_LIBS}:@-GNC_LIB_INSTALLDIR-@"
|
||||
EXTRA_LIBS="${EXTRA_LIBS}:@-GNC_MODULE_DIR-@"
|
||||
EXTRA_LIBS="${EXTRA_LIBS}:@-G_WRAP_LIB_DIR-@"
|
||||
|
||||
LD_LIBRARY_PATH="${EXTRA_LIBS}:${LD_LIBRARY_PATH}"
|
||||
LTDL_LIBRARY_PATH="${EXTRA_LIBS}:${LTDL_LIBRARY_PATH}"
|
||||
|
@ -1,18 +1,19 @@
|
||||
SUBDIRS = . test file
|
||||
PWD := $(shell pwd)
|
||||
|
||||
pkglib_LTLIBRARIES = libgncmod-business-core.la libgw-business-core.la
|
||||
pkglib_LTLIBRARIES = libgncmod-business-core.la
|
||||
|
||||
AM_CFLAGS = \
|
||||
-I${top_srcdir}/src \
|
||||
-I${top_srcdir}/src/engine \
|
||||
-I${top_srcdir}/src/gnc-module \
|
||||
${G_WRAP_COMPILE_ARGS} \
|
||||
${GUILE_INCS} \
|
||||
${QOF_CFLAGS} \
|
||||
${GLIB_CFLAGS}
|
||||
|
||||
libgncmod_business_core_la_SOURCES = \
|
||||
swig-business-core.c \
|
||||
gncBusGuile.c \
|
||||
businessmod-core.c \
|
||||
gncAddress.c \
|
||||
gncBillTerm.c \
|
||||
@ -57,7 +58,6 @@ noinst_HEADERS = \
|
||||
libgncmod_business_core_la_LIBADD = \
|
||||
${top_builddir}/src/gnc-module/libgncmodule.la \
|
||||
${top_builddir}/src/engine/libgncmod-engine.la \
|
||||
${G_WRAP_LINK_ARGS} \
|
||||
${QOF_LIBS} \
|
||||
${GUILE_LIBS} \
|
||||
${GLIB_LIBS} \
|
||||
@ -65,43 +65,25 @@ libgncmod_business_core_la_LIBADD = \
|
||||
|
||||
# business-core-helpers.c
|
||||
|
||||
libgw_business_core_la_SOURCES = \
|
||||
gncBusGuile.c
|
||||
|
||||
nodist_libgw_business_core_la_SOURCES = \
|
||||
gw-business-core.c
|
||||
|
||||
libgw_business_core_la_LDFLAGS = ${G_WRAP_LINK_ARGS}
|
||||
libgw_business_core_la_LIBADD = \
|
||||
libgncmod-business-core.la \
|
||||
${top_builddir}/src/engine/libgw-engine.la \
|
||||
${top_builddir}/src/engine/libgncmod-engine.la \
|
||||
${QOF_LIBS} \
|
||||
${GLIB_LIBS}
|
||||
if BUILDING_FROM_SVN
|
||||
swig-business-core.c: business-core.i ${noinst_HEADERS}
|
||||
$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
|
||||
-I${top_srcdir}/src/engine -o $@ $<
|
||||
endif
|
||||
|
||||
gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash
|
||||
gncmod_DATA = business-core.scm
|
||||
|
||||
gwmoddir = ${GNC_GWRAP_LIBDIR}
|
||||
gwmod_DATA = \
|
||||
gw-business-core-spec.scm
|
||||
nodist_gwmod_DATA = \
|
||||
gw-business-core.scm
|
||||
|
||||
EXTRA_DIST = \
|
||||
${gncmod_DATA} \
|
||||
${gwmod_DATA}
|
||||
EXTRA_DIST = business-core.i ${gncmod_DATA}
|
||||
|
||||
if GNUCASH_SEPARATE_BUILDDIR
|
||||
#For compiling
|
||||
SCM_FILE_LINKS = gw-business-core-spec.scm
|
||||
#For executing test cases
|
||||
SCM_FILE_LINKS += ${gncmod_DATA}
|
||||
SCM_FILE_LINKS = ${gncmod_DATA}
|
||||
endif
|
||||
|
||||
.scm-links:
|
||||
$(RM) -rf gnucash g-wrapped
|
||||
mkdir -p gnucash g-wrapped
|
||||
$(RM) -rf gnucash
|
||||
mkdir -p gnucash
|
||||
if GNUCASH_SEPARATE_BUILDDIR
|
||||
for X in ${SCM_FILE_LINKS} ; do \
|
||||
$(LN_S) -f ${srcdir}/$$X . ; \
|
||||
@ -110,25 +92,6 @@ endif
|
||||
( cd gnucash; for A in $(gncmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
|
||||
touch .scm-links
|
||||
|
||||
clean-local:
|
||||
$(RM) -rf gnucash g-wrapped
|
||||
|
||||
.INTERMEDIATE: gwrap-files
|
||||
|
||||
gw-business-core.scm gw-business-core.c gw-business-core.h: \
|
||||
gwrap-files
|
||||
|
||||
gwrap-files: \
|
||||
.scm-links gw-business-core-spec.scm ${top_builddir}/config.status
|
||||
FLAVOR=gnome $(GUILE) -c \
|
||||
"(set! %load-path (cons \"${G_WRAP_MODULE_DIR}\" %load-path)) \
|
||||
(set! %load-path (cons \"${PWD}\" %load-path)) \
|
||||
(set! %load-path (cons \"../../engine\" %load-path)) \
|
||||
(primitive-load \"./gw-business-core-spec.scm\") \
|
||||
(gw:generate-wrapset \"gw-business-core\")"
|
||||
touch $@
|
||||
( cd g-wrapped; $(LN_S) -f ../gw-*.scm . )
|
||||
|
||||
BUILT_SOURCES = gw-business-core.scm gw-business-core.c gw-business-core.h
|
||||
CLEANFILES = $(BUILT_SOURCES) gw-business-core.html \
|
||||
.scm-links ${SCM_FILE_LINKS}
|
||||
noinst_DATA = .scm-links
|
||||
CLEANFILES = gnucash .scm-links ${SCM_FILE_LINKS}
|
||||
MAINTAINERCLEANFILES = swig-business-core.c
|
||||
|
157
src/business/business-core/business-core.i
Normal file
157
src/business/business-core/business-core.i
Normal file
@ -0,0 +1,157 @@
|
||||
%module sw_business_core
|
||||
%{
|
||||
/* Includes the header in the wrapper code */
|
||||
#include <config.h>
|
||||
#include <gncAddress.h>
|
||||
#include <gncBillTerm.h>
|
||||
#include <gncCustomer.h>
|
||||
#include <gncEmployee.h>
|
||||
#include <gncEntry.h>
|
||||
#include <gncInvoice.h>
|
||||
#include <gncJob.h>
|
||||
#include <gncOrder.h>
|
||||
#include <gncOwner.h>
|
||||
#include <gncTaxTable.h>
|
||||
#include <gncVendor.h>
|
||||
#include <gncBusGuile.h>
|
||||
#include "engine-helpers.h"
|
||||
#include "gncBusGuile.h"
|
||||
|
||||
SCM scm_init_sw_business_core_module (void);
|
||||
%}
|
||||
|
||||
// Temporary SWIG<->G-wrap converters for engine types
|
||||
%typemap(in) gboolean "$1 = SCM_NFALSEP($input) ? TRUE : FALSE;"
|
||||
%typemap(out) gboolean "$result = $1 ? SCM_BOOL_T : SCM_BOOL_F;"
|
||||
|
||||
%typemap(in) Timespec "$1 = gnc_timepair2timespec($input);"
|
||||
%typemap(out) Timespec "$result = gnc_timespec2timepair($1);"
|
||||
|
||||
%typemap(in) GUID "$1 = gnc_scm2guid($input);"
|
||||
%typemap(out) GUID "$result = gnc_guid2scm($1);"
|
||||
|
||||
%typemap(in) gnc_numeric "$1 = gnc_scm_to_numeric($input);"
|
||||
%typemap(out) gnc_numeric "$result = gnc_numeric_to_scm($1);"
|
||||
|
||||
// End of temporary typemaps.
|
||||
|
||||
|
||||
%rename(gncOwnerReturnGUID) gncOwnerRetGUID;
|
||||
|
||||
%inline %{
|
||||
static GUID gncTaxTableReturnGUID(GncTaxTable *x)
|
||||
{ return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
|
||||
|
||||
static GUID gncInvoiceReturnGUID(GncInvoice *x)
|
||||
{ return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
|
||||
|
||||
static GUID gncJobReturnGUID(GncJob *x)
|
||||
{ return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
|
||||
|
||||
static GUID gncVendorReturnGUID(GncVendor *x)
|
||||
{ return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
|
||||
|
||||
static GUID gncCustomerReturnGUID(GncCustomer *x)
|
||||
{ return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
|
||||
|
||||
static GUID gncEmployeeReturnGUID(GncEmployee *x)
|
||||
{ return (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null())); }
|
||||
|
||||
static GncTaxTable * gncTaxTableLookupFlip(GUID g, QofBook *b)
|
||||
{ return gncTaxTableLookup(b, &g); }
|
||||
|
||||
static GncInvoice * gncInvoiceLookupFlip(GUID g, QofBook *b)
|
||||
{ return gncInvoiceLookup(b, &g); }
|
||||
|
||||
static GncJob * gncJobLookupFlip(GUID g, QofBook *b)
|
||||
{ return gncJobLookup(b, &g); }
|
||||
|
||||
static GncVendor * gncVendorLookupFlip(GUID g, QofBook *b)
|
||||
{ return gncVendorLookup(b, &g); }
|
||||
|
||||
static GncCustomer * gncCustomerLookupFlip(GUID g, QofBook *b)
|
||||
{ return gncCustomerLookup(b, &g); }
|
||||
|
||||
static GncEmployee * gncEmployeeLookupFlip(GUID g, QofBook *b)
|
||||
{ return gncEmployeeLookup(b, &g); }
|
||||
|
||||
%}
|
||||
|
||||
%typemap(out) EntryList * {
|
||||
SCM list = SCM_EOL;
|
||||
GList *node;
|
||||
|
||||
for (node = $1; node; node = node->next)
|
||||
list = scm_cons(SWIG_NewPointerObj(node->data,
|
||||
SWIGTYPE_p__gncEntry, 0), list);
|
||||
|
||||
$result = scm_reverse(list);
|
||||
}
|
||||
|
||||
%typemap(out) AccountValueList * {
|
||||
SCM list = SCM_EOL;
|
||||
GList *node;
|
||||
|
||||
for (node = $1; node; node = node->next)
|
||||
list = scm_cons(SWIG_NewPointerObj(node->data,
|
||||
SWIGTYPE_p__gncAccountValue, 0), list);
|
||||
|
||||
$result = scm_reverse(list);
|
||||
}
|
||||
|
||||
%typemap(in) GncAccountValue * "$1 = gnc_scm_to_account_value_ptr($input);"
|
||||
%typemap(out) GncAccountValue * "$result = gnc_account_value_ptr_to_scm($1);"
|
||||
|
||||
|
||||
/* Parse the header file to generate wrappers */
|
||||
%include <gncAddress.h>
|
||||
%include <gncBillTerm.h>
|
||||
%include <gncCustomer.h>
|
||||
%include <gncEmployee.h>
|
||||
%include <gncEntry.h>
|
||||
%include <gncInvoice.h>
|
||||
%include <gncJob.h>
|
||||
%include <gncOrder.h>
|
||||
%include <gncOwner.h>
|
||||
%include <gncTaxTable.h>
|
||||
%include <gncVendor.h>
|
||||
%include <gncBusGuile.h>
|
||||
|
||||
#define URL_TYPE_CUSTOMER GNC_ID_CUSTOMER
|
||||
#define URL_TYPE_VENDOR GNC_ID_VENDOR
|
||||
#define URL_TYPE_EMPLOYEE GNC_ID_EMPLOYEE
|
||||
#define URL_TYPE_INVOICE GNC_ID_INVOICE
|
||||
// not exactly clean
|
||||
#define URL_TYPE_OWNERREPORT "owner-report"
|
||||
|
||||
%init {
|
||||
{
|
||||
char tmp[100];
|
||||
|
||||
#define SET_ENUM(e) snprintf(tmp, 100, "(set! %s (%s))", (e), (e)); \
|
||||
scm_c_eval_string(tmp);
|
||||
|
||||
SET_ENUM("GNC-OWNER-CUSTOMER");
|
||||
SET_ENUM("GNC-OWNER-VENDOR");
|
||||
SET_ENUM("GNC-OWNER-EMPLOYEE");
|
||||
SET_ENUM("GNC-OWNER-JOB");
|
||||
SET_ENUM("GNC-AMT-TYPE-VALUE");
|
||||
SET_ENUM("GNC-AMT-TYPE-PERCENT");
|
||||
|
||||
SET_ENUM("URL-TYPE-CUSTOMER");
|
||||
SET_ENUM("URL-TYPE-VENDOR");
|
||||
SET_ENUM("URL-TYPE-EMPLOYEE");
|
||||
SET_ENUM("URL-TYPE-INVOICE");
|
||||
SET_ENUM("URL-TYPE-OWNERREPORT");
|
||||
|
||||
SET_ENUM("INVOICE-FROM-TXN");
|
||||
SET_ENUM("INVOICE-FROM-LOT");
|
||||
SET_ENUM("INVOICE-OWNER");
|
||||
SET_ENUM("OWNER-PARENTG");
|
||||
SET_ENUM("OWNER-FROM-LOT");
|
||||
|
||||
|
||||
#undefine SET_ENUM
|
||||
}
|
||||
|
||||
}
|
@ -1,25 +1,24 @@
|
||||
(define-module (gnucash business-core))
|
||||
(use-modules (g-wrapped gw-business-core))
|
||||
(use-modules (sw_business_core))
|
||||
(use-modules (gnucash gnc-module))
|
||||
(gnc:module-load "gnucash/engine" 0)
|
||||
|
||||
(define (gnc:owner-get-address owner)
|
||||
(let ((type (gw:enum-<gnc:GncOwnerType>-val->sym
|
||||
(gnc:owner-get-type owner) #f)))
|
||||
(case type
|
||||
((gnc-owner-customer)
|
||||
(let ((c (gnc:owner-get-customer owner)))
|
||||
(gnc:customer-get-addr c)))
|
||||
((gnc-owner-vendor)
|
||||
(let ((v (gnc:owner-get-vendor owner)))
|
||||
(gnc:vendor-get-addr v)))
|
||||
((gnc-owner-employee)
|
||||
(let ((e (gnc:owner-get-employee owner)))
|
||||
(gnc:employee-get-addr e)))
|
||||
((gnc-owner-job)
|
||||
(let ((type (gncOwnerGetType owner)))
|
||||
(cond
|
||||
((eqv? type GNC-OWNER-CUSTOMER)
|
||||
(let ((c (gncOwnerGetCustomer owner)))
|
||||
(gncCustomerGetAddr c)))
|
||||
((eqv? type GNC-OWNER-VENDOR)
|
||||
(let ((v (gncOwnerGetVendor owner)))
|
||||
(gncVendorGetAddr v)))
|
||||
((eqv? type GNC-OWNER-EMPLOYEE)
|
||||
(let ((e (gncOwnerGetEmployee owner)))
|
||||
(gncEmployeeGetAddr e)))
|
||||
((eqv? type GNC-OWNER-JOB)
|
||||
(gnc:owner-get-address (gnc:job-get-owner
|
||||
(gnc:owner-get-job owner))))
|
||||
(else ""))))
|
||||
(gncOwnerGetJob owner))))
|
||||
(else '()))))
|
||||
|
||||
;
|
||||
; The -dep functions return combined strings of the appropriate
|
||||
@ -36,13 +35,12 @@
|
||||
(define (just-name name)
|
||||
(if name name ""))
|
||||
|
||||
(let ((type (gw:enum-<gnc:GncOwnerType>-val->sym
|
||||
(gnc:owner-get-type owner) #f)))
|
||||
(case type
|
||||
((gnc-owner-job)
|
||||
(let ((type (gncOwnerGetType owner)))
|
||||
(cond
|
||||
((eqv? type GNC-OWNER-JOB)
|
||||
(gnc:owner-get-name-dep (gnc:job-get-owner
|
||||
(gnc:owner-get-job owner))))
|
||||
(else (just-name (gnc:owner-get-name owner))))))
|
||||
(gncOwnerGetJob owner))))
|
||||
(else (just-name (gncOwnerGetName owner))))))
|
||||
|
||||
(define (gnc:owner-get-address-dep owner)
|
||||
(define (add-if-exists lst new)
|
||||
@ -56,10 +54,10 @@
|
||||
(else (string-append (build-string (cdr lst)) "\n" (car lst)))))
|
||||
(let ((lst '())
|
||||
(addr (gnc:owner-get-address owner)))
|
||||
(set! lst (add-if-exists lst (gnc:address-get-addr1 addr)))
|
||||
(set! lst (add-if-exists lst (gnc:address-get-addr2 addr)))
|
||||
(set! lst (add-if-exists lst (gnc:address-get-addr3 addr)))
|
||||
(set! lst (add-if-exists lst (gnc:address-get-addr4 addr)))
|
||||
(set! lst (add-if-exists lst (gncAddressGetAddr1 addr)))
|
||||
(set! lst (add-if-exists lst (gncAddressGetAddr2 addr)))
|
||||
(set! lst (add-if-exists lst (gncAddressGetAddr3 addr)))
|
||||
(set! lst (add-if-exists lst (gncAddressGetAddr4 addr)))
|
||||
(build-string lst)))
|
||||
|
||||
(define (gnc:owner-get-name-and-address-dep owner)
|
||||
@ -70,45 +68,44 @@
|
||||
addr)))
|
||||
|
||||
(define (gnc:owner-get-owner-id owner)
|
||||
(let ((type (gw:enum-<gnc:GncOwnerType>-val->sym
|
||||
(gnc:owner-get-type owner) #f)))
|
||||
(case type
|
||||
((gnc-owner-customer)
|
||||
(let ((c (gnc:owner-get-customer owner)))
|
||||
(gnc:customer-get-id c)))
|
||||
((gnc-owner-vendor)
|
||||
(let ((v (gnc:owner-get-vendor owner)))
|
||||
(gnc:vendor-get-id v)))
|
||||
((gnc-owner-employee)
|
||||
(let ((e (gnc:owner-get-employee owner)))
|
||||
(gnc:employee-get-id e)))
|
||||
((gnc-owner-job)
|
||||
(gnc:owner-get-owner-id (gnc:job-get-owner (gnc:owner-get-job owner))))
|
||||
(let ((type (gncOwnerGetType owner)))
|
||||
(cond
|
||||
((eqv? type GNC-OWNER-CUSTOMER)
|
||||
(let ((c (gncOwnerGetCustomer owner)))
|
||||
(gncCustomerGetID c)))
|
||||
((eqv? type GNC-OWNER-VENDOR)
|
||||
(let ((v (gncOwnerGetVendor owner)))
|
||||
(gncVendorGetID v)))
|
||||
((eqv? type GNC-OWNER-EMPLOYEE)
|
||||
(let ((e (gncOwnerGetEmployee owner)))
|
||||
(gncEmployeeGetID e)))
|
||||
((eqv? type GNC-OWNER-JOB)
|
||||
(gnc:owner-get-owner-id (gncJobGetOwner (gncOwnerGetJob owner))))
|
||||
(else ""))))
|
||||
|
||||
(define (gnc:entry-type-percent-p type-val)
|
||||
(let ((type (gw:enum-<gnc:GncAmountType>-val->sym type-val #f)))
|
||||
(equal? type 'gnc-amount-type-percent)))
|
||||
(let ((type type-val))
|
||||
(equal? type GNC-AMT-TYPE-PERCENT)))
|
||||
|
||||
(define (gnc:owner-from-split split result-owner)
|
||||
(let* ((trans (gnc:split-get-parent split))
|
||||
(invoice (gnc:invoice-get-invoice-from-txn trans))
|
||||
(temp-owner (gnc:owner-create))
|
||||
(let* ((trans (xaccSplitGetParent split))
|
||||
(invoice (gncInvoiceGetInvoiceFromTxn trans))
|
||||
(temp-owner (gncOwnerCreate))
|
||||
(owner #f))
|
||||
|
||||
(if invoice
|
||||
(set! owner (gnc:invoice-get-owner invoice))
|
||||
(let ((split-list (gnc:transaction-get-splits trans)))
|
||||
(set! owner (gncInvoiceGetOwner invoice))
|
||||
(let ((split-list (xaccTransGetSplits trans)))
|
||||
(define (check-splits splits)
|
||||
(if (and splits (not (null? splits)))
|
||||
(let* ((split (car splits))
|
||||
(lot (gnc:split-get-lot split)))
|
||||
(lot (xaccSplitGetLot split)))
|
||||
(if lot
|
||||
(let* ((invoice (gnc:invoice-get-invoice-from-lot lot))
|
||||
(let* ((invoice (gncInvoiceGetInvoiceFromLot lot))
|
||||
(owner? (gnc:owner-get-owner-from-lot
|
||||
lot temp-owner)))
|
||||
(if invoice
|
||||
(set! owner (gnc:invoice-get-owner invoice))
|
||||
(set! owner (gncInvoiceGetOwner invoice))
|
||||
(if owner?
|
||||
(set! owner temp-owner)
|
||||
(check-splits (cdr splits)))))
|
||||
@ -117,12 +114,12 @@
|
||||
|
||||
(if owner
|
||||
(begin
|
||||
(gnc:owner-copy-into-owner (gnc:owner-get-end-owner owner) result-owner)
|
||||
(gnc:owner-destroy temp-owner)
|
||||
(gncOwnerCopy (gncOwnerGetEndOwner owner) result-owner)
|
||||
(gncOwnerDestroy temp-owner)
|
||||
result-owner)
|
||||
(begin
|
||||
(gnc:owner-destroy temp-owner)
|
||||
#f))))
|
||||
(gncOwnerDestroy temp-owner)
|
||||
#f)))) ;; FIXME!
|
||||
|
||||
|
||||
(export gnc:owner-get-address)
|
||||
|
@ -30,7 +30,6 @@
|
||||
|
||||
#include "gnc-module.h"
|
||||
#include "gnc-module-api.h"
|
||||
#include "gw-business-core.h"
|
||||
|
||||
#include "gncAddressP.h"
|
||||
#include "gncBillTermP.h"
|
||||
@ -44,6 +43,8 @@
|
||||
#include "gncTaxTableP.h"
|
||||
#include "gncVendorP.h"
|
||||
|
||||
extern SCM scm_init_sw_business_core_module (void);
|
||||
|
||||
/* version of the gnc module system interface we require */
|
||||
int libgncmod_business_core_LTX_gnc_module_system_interface = 0;
|
||||
|
||||
@ -94,7 +95,8 @@ libgncmod_business_core_LTX_gnc_module_init(int refcount)
|
||||
gncVendorRegister ();
|
||||
}
|
||||
|
||||
scm_c_eval_string("(use-modules (g-wrapped gw-business-core))");
|
||||
scm_init_sw_business_core_module();
|
||||
scm_c_eval_string("(use-modules (sw_business_core))");
|
||||
scm_c_eval_string("(use-modules (gnucash business-core))");
|
||||
|
||||
return TRUE;
|
||||
|
@ -59,17 +59,19 @@ typedef struct _gncBillTerm GncBillTerm;
|
||||
* ??? huh?
|
||||
* NOTE: This enum /depends/ on starting at value 1
|
||||
*/
|
||||
#ifndef SWIG
|
||||
#define ENUM_TERMS_TYPE(_) \
|
||||
_(GNC_TERM_TYPE_DAYS,=1) \
|
||||
_(GNC_TERM_TYPE_PROXIMO,)
|
||||
|
||||
DEFINE_ENUM(GncBillTermType, ENUM_TERMS_TYPE)
|
||||
|
||||
/*typedef enum {
|
||||
#else
|
||||
typedef enum {
|
||||
GNC_TERM_TYPE_DAYS = 1,
|
||||
GNC_TERM_TYPE_PROXIMO,
|
||||
} GncBillTermType;
|
||||
*/
|
||||
#endif
|
||||
|
||||
/** @name Create/Destroy Functions
|
||||
@{ */
|
||||
GncBillTerm * gncBillTermCreate (QofBook *book);
|
||||
@ -108,7 +110,6 @@ void gncBillTermSetCutoff (GncBillTerm *term, gint cutoff);
|
||||
|
||||
GncBillTerm *gncBillTermLookupByName (QofBook *book, const char *name);
|
||||
GList * gncBillTermGetTerms (QofBook *book);
|
||||
KvpFrame* gncBillTermGetSlots (GncBillTerm *term);
|
||||
|
||||
const char *gncBillTermGetName (GncBillTerm *term);
|
||||
const char *gncBillTermGetDescription (GncBillTerm *term);
|
||||
|
@ -25,28 +25,26 @@
|
||||
|
||||
#include "gncBusGuile.h"
|
||||
#include "engine-helpers.h"
|
||||
#include <g-wrap-wct.h>
|
||||
#include "swig-runtime.h"
|
||||
#define FUNC_NAME __FUNCTION__
|
||||
|
||||
static SCM
|
||||
static swig_type_info *
|
||||
get_acct_type ()
|
||||
{
|
||||
static SCM account_type = SCM_UNDEFINED;
|
||||
static swig_type_info * account_type = NULL;
|
||||
|
||||
if(account_type == SCM_UNDEFINED) {
|
||||
account_type = scm_c_eval_string("<gnc:Account*>");
|
||||
/* don't really need this - types are bound globally anyway. */
|
||||
if(account_type != SCM_UNDEFINED) scm_gc_protect_object(account_type);
|
||||
}
|
||||
if (!account_type)
|
||||
account_type = SWIG_TypeQuery("_p_Account");
|
||||
|
||||
return account_type;
|
||||
}
|
||||
|
||||
int gnc_account_value_pointer_p (SCM arg)
|
||||
{
|
||||
SCM account_type = get_acct_type();
|
||||
swig_type_info * account_type = get_acct_type();
|
||||
|
||||
return (SCM_CONSP (arg) &&
|
||||
gw_wcp_is_of_type_p(account_type, SCM_CAR (arg)) &&
|
||||
SWIG_IsPointerOfType(SCM_CAR (arg), account_type) &&
|
||||
gnc_numeric_p (SCM_CDR (arg)));
|
||||
}
|
||||
|
||||
@ -55,15 +53,15 @@ GncAccountValue * gnc_scm_to_account_value_ptr (SCM valuearg)
|
||||
GncAccountValue *res;
|
||||
Account *acc = NULL;
|
||||
gnc_numeric value;
|
||||
SCM account_type = get_acct_type();
|
||||
swig_type_info * account_type = get_acct_type();
|
||||
SCM val;
|
||||
|
||||
/* Get the account */
|
||||
val = SCM_CAR (valuearg);
|
||||
if (!gw_wcp_is_of_type_p (account_type, val))
|
||||
if (!SWIG_IsPointerOfType (val, account_type))
|
||||
return NULL;
|
||||
|
||||
acc = gw_wcp_get_ptr (val);
|
||||
acc = SWIG_MustGetPtr(val, account_type, 1, 0);
|
||||
|
||||
/* Get the value */
|
||||
val = SCM_CDR (valuearg);
|
||||
@ -78,7 +76,7 @@ GncAccountValue * gnc_scm_to_account_value_ptr (SCM valuearg)
|
||||
|
||||
SCM gnc_account_value_ptr_to_scm (GncAccountValue *av)
|
||||
{
|
||||
SCM account_type = get_acct_type();
|
||||
swig_type_info * account_type = get_acct_type();
|
||||
gnc_commodity * com;
|
||||
gnc_numeric val;
|
||||
|
||||
@ -88,6 +86,6 @@ SCM gnc_account_value_ptr_to_scm (GncAccountValue *av)
|
||||
val = gnc_numeric_convert (av->value, gnc_commodity_get_fraction (com),
|
||||
GNC_RND_ROUND);
|
||||
|
||||
return scm_cons (gw_wcp_assimilate_ptr (av->account, account_type),
|
||||
return scm_cons (SWIG_NewPointerObj(av->account, account_type, 0),
|
||||
gnc_numeric_to_scm (val));
|
||||
}
|
||||
|
@ -120,7 +120,6 @@ gnc_commodity * gncCustomerGetCurrency (GncCustomer *customer);
|
||||
gboolean gncCustomerGetTaxTableOverride (GncCustomer *customer);
|
||||
GncTaxTable* gncCustomerGetTaxTable (GncCustomer *customer);
|
||||
|
||||
KvpFrame *gncCustomerGetSlots (GncCustomer *customer);
|
||||
GList * gncCustomerGetJoblist (GncCustomer *customer, gboolean show_all);
|
||||
/** @} */
|
||||
|
||||
|
@ -1141,7 +1141,7 @@ gnc_numeric gncEntryReturnTaxValue (GncEntry *entry, gboolean is_inv)
|
||||
return (is_inv ? entry->i_tax_value_rounded : entry->b_tax_value_rounded);
|
||||
}
|
||||
|
||||
GList * gncEntryReturnTaxValues (GncEntry *entry, gboolean is_inv)
|
||||
AccountValueList * gncEntryReturnTaxValues (GncEntry *entry, gboolean is_inv)
|
||||
{
|
||||
if (!entry) return NULL;
|
||||
gncEntryRecomputeValues (entry);
|
||||
|
@ -169,7 +169,8 @@ void gncEntryCopy (const GncEntry *src, GncEntry *dest);
|
||||
gnc_numeric gncEntryReturnValue (GncEntry *entry, gboolean is_inv);
|
||||
gnc_numeric gncEntryReturnDiscountValue (GncEntry *entry, gboolean is_inv);
|
||||
gnc_numeric gncEntryReturnTaxValue (GncEntry *entry, gboolean is_inv);
|
||||
GList * gncEntryReturnTaxValues (GncEntry *entry, gboolean is_inv);
|
||||
typedef GList AccountValueList;
|
||||
AccountValueList * gncEntryReturnTaxValues (GncEntry *entry, gboolean is_inv);
|
||||
|
||||
/** Compute the Entry value, tax-value, and discount_value, based on
|
||||
* the quantity, price, discount, tax-table, and types. The value is
|
||||
|
@ -94,6 +94,11 @@ mark_invoice (GncInvoice *invoice)
|
||||
qof_event_gen (&invoice->inst.entity, QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
|
||||
QofBook * gncInvoiceGetBook(GncInvoice *x)
|
||||
{
|
||||
return qof_instance_get_book(QOF_INSTANCE(x));
|
||||
}
|
||||
|
||||
/* ================================================================== */
|
||||
/* Create/Destroy Functions */
|
||||
|
||||
@ -639,7 +644,7 @@ gnc_numeric gncInvoiceGetToChargeAmount (GncInvoice *invoice)
|
||||
return invoice->to_charge_amount;
|
||||
}
|
||||
|
||||
GList * gncInvoiceGetEntries (GncInvoice *invoice)
|
||||
EntryList * gncInvoiceGetEntries (GncInvoice *invoice)
|
||||
{
|
||||
if (!invoice) return NULL;
|
||||
return invoice->entries;
|
||||
|
@ -43,6 +43,7 @@ typedef struct _gncInvoice GncInvoice;
|
||||
#include "gncEntry.h"
|
||||
#include "gncOwner.h"
|
||||
#include "gnc-lot.h"
|
||||
#include "qofbook.h"
|
||||
|
||||
#define GNC_ID_INVOICE "gncInvoice"
|
||||
#define GNC_IS_INVOICE(obj) (QOF_CHECK_TYPE((obj), GNC_ID_INVOICE))
|
||||
@ -108,7 +109,8 @@ gnc_numeric gncInvoiceGetTotalOf (GncInvoice *invoice, GncEntryPaymentType type)
|
||||
gnc_numeric gncInvoiceGetTotalSubtotal (GncInvoice *invoice);
|
||||
gnc_numeric gncInvoiceGetTotalTax (GncInvoice *invoice);
|
||||
|
||||
GList * gncInvoiceGetEntries (GncInvoice *invoice);
|
||||
typedef GList EntryList;
|
||||
EntryList * gncInvoiceGetEntries (GncInvoice *invoice);
|
||||
|
||||
/** Post this invoice to an account. Returns the new Transaction
|
||||
* that is tied to this invoice. The transaction is set with
|
||||
@ -164,7 +166,6 @@ GncInvoice * gncInvoiceGetInvoiceFromLot (GNCLot *lot);
|
||||
#define gncInvoiceLookup(book,guid) \
|
||||
QOF_BOOK_LOOKUP_ENTITY((book),(guid),GNC_ID_INVOICE, GncInvoice)
|
||||
|
||||
gboolean gncInvoiceIsDirty (GncInvoice *invoice);
|
||||
void gncInvoiceBeginEdit (GncInvoice *invoice);
|
||||
void gncInvoiceCommitEdit (GncInvoice *invoice);
|
||||
int gncInvoiceCompare (GncInvoice *a, GncInvoice *b);
|
||||
@ -192,8 +193,9 @@ gboolean gncInvoiceIsPaid (GncInvoice *invoice);
|
||||
#define INVOICE_FROM_LOT "invoice-from-lot"
|
||||
#define INVOICE_FROM_TXN "invoice-from-txn"
|
||||
|
||||
QofBook *gncInvoiceGetBook(GncInvoice *x);
|
||||
|
||||
/** deprecated functions */
|
||||
#define gncInvoiceGetBook(x) qof_instance_get_book(QOF_INSTANCE(x))
|
||||
#define gncInvoiceGetGUID(x) qof_instance_get_guid(QOF_INSTANCE(x))
|
||||
#define gncInvoiceRetGUID(x) (x ? *(qof_instance_get_guid(QOF_INSTANCE(x))) : *(guid_null()))
|
||||
#define gncInvoiceLookupDirect(G,B) gncInvoiceLookup((B),&(G))
|
||||
|
@ -70,7 +70,6 @@ GncOwner * gncJobGetOwner (GncJob *job);
|
||||
|
||||
/** @} */
|
||||
gboolean gncJobGetActive (GncJob *job);
|
||||
gboolean gncJobIsDirty (GncJob *job);
|
||||
|
||||
/** Return a pointer to the instance gncJob that is identified
|
||||
* by the guid, and is residing in the book. Returns NULL if the
|
||||
|
@ -76,7 +76,6 @@ gboolean gncOrderGetActive (GncOrder *order);
|
||||
/* Get the list Entries */
|
||||
GList * gncOrderGetEntries (GncOrder *order);
|
||||
|
||||
gboolean gncOrderIsDirty (GncOrder *order);
|
||||
void gncOrderBeginEdit (GncOrder *order);
|
||||
void gncOrderCommitEdit (GncOrder *order);
|
||||
int gncOrderCompare (GncOrder *a, GncOrder *b);
|
||||
|
@ -33,7 +33,7 @@
|
||||
#ifndef GNC_OWNER_H_
|
||||
#define GNC_OWNER_H_
|
||||
|
||||
typedef struct gnc_owner_s GncOwner;
|
||||
typedef struct _gncOwner GncOwner;
|
||||
|
||||
#define GNC_ID_OWNER "gncOwner"
|
||||
|
||||
@ -67,17 +67,13 @@ QofEntity* qofOwnerGetOwner (GncOwner *owner);
|
||||
/** set the owner from the entity. */
|
||||
void qofOwnerSetEntity (GncOwner *owner, QofEntity *ent);
|
||||
|
||||
/** \brief Set the parent owner. */
|
||||
void qofOwnerSetEndOwner (GncOwner *owner, GncOwner *parent);
|
||||
GncOwner* qofOwnerCreate (QofBook *book);
|
||||
|
||||
gboolean
|
||||
gncOwnerRegister(void);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** \struct GncOwner */
|
||||
struct gnc_owner_s {
|
||||
struct _gncOwner {
|
||||
GncOwnerType type; /**< Customer, Job, Vendor, Employee or Undefined. */
|
||||
union {
|
||||
gpointer undefined;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -13,9 +13,7 @@ LDADD = \
|
||||
${top_builddir}/src/gnc-module/libgncmodule.la \
|
||||
${top_builddir}/src/test-core/libgncmod-test.la \
|
||||
${top_builddir}/src/engine/libgncmod-engine.la \
|
||||
${top_builddir}/src/engine/libgw-engine.la \
|
||||
../libgncmod-business-core.la \
|
||||
../libgw-business-core.la \
|
||||
${GLIB_LIBS} \
|
||||
${QOF_LIBS} \
|
||||
-lltdl
|
||||
@ -35,10 +33,8 @@ GNC_TEST_DEPS := \
|
||||
--gnc-module-dir ${top_builddir}/src/engine \
|
||||
--gnc-module-dir ${top_builddir}/src/business/business-core \
|
||||
--gnc-module-dir ${top_srcdir}/src/gnc-module \
|
||||
--gnc-module-dir ${top_srcdir}/src/engine \
|
||||
--library-dir ${top_builddir}/lib/libqof/qof \
|
||||
--library-dir ${G_WRAP_LIB_DIR} \
|
||||
--guile-load-dir ${G_WRAP_MODULE_DIR}
|
||||
--gnc-module-dir ${top_srcdir}/src/engine
|
||||
|
||||
TESTS_ENVIRONMENT := \
|
||||
$(shell ${top_srcdir}/src/gnc-test-env --no-exports ${GNC_TEST_DEPS})
|
||||
|
@ -1,7 +1,7 @@
|
||||
SUBDIRS = . glade schemas ui
|
||||
PWD := $(shell pwd)
|
||||
|
||||
pkglib_LTLIBRARIES = libgncmod-business-gnome.la libgw-business-gnome.la
|
||||
pkglib_LTLIBRARIES = libgncmod-business-gnome.la
|
||||
|
||||
AM_CFLAGS = \
|
||||
-I${top_srcdir}/src \
|
||||
@ -22,7 +22,6 @@ AM_CFLAGS = \
|
||||
${GTKHTML_CFLAGS} \
|
||||
${GDK_PIXBUF_CFLAGS} \
|
||||
${GLIB_CFLAGS} \
|
||||
${G_WRAP_COMPILE_ARGS} \
|
||||
${GUILE_INCS} \
|
||||
${QOF_CFLAGS} \
|
||||
-I${top_srcdir}/src/register/register-core \
|
||||
@ -81,21 +80,11 @@ libgncmod_business_gnome_la_LIBADD = \
|
||||
${top_builddir}/src/gnc-module/libgncmodule.la \
|
||||
${GLADE_LIBS} \
|
||||
${GNOME_LIBS} \
|
||||
${G_WRAP_LINK_ARGS} \
|
||||
${GUILE_LIBS} \
|
||||
${GLIB_LIBS} \
|
||||
${QOF_LIBS} \
|
||||
${EFENCE_LIBS}
|
||||
|
||||
|
||||
nodist_libgw_business_gnome_la_SOURCES = gw-business-gnome.c
|
||||
|
||||
libgw_business_gnome_la_LDFLAGS = ${G_WRAP_LINK_ARGS}
|
||||
libgw_business_gnome_la_LIBADD = \
|
||||
libgncmod-business-gnome.la \
|
||||
${G_WRAP_LINK_ARGS} \
|
||||
${GUILE_LIBS}
|
||||
|
||||
# For Business Reports
|
||||
gncscmmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash/report/
|
||||
gncscmmod_DATA =
|
||||
@ -103,28 +92,19 @@ gncscmmod_DATA =
|
||||
gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash
|
||||
gncmod_DATA = business-gnome.scm
|
||||
|
||||
gwmoddir = ${GNC_GWRAP_LIBDIR}
|
||||
gwmod_DATA = \
|
||||
gw-business-gnome-spec.scm
|
||||
nodist_gwmod_DATA = \
|
||||
gw-business-gnome.scm
|
||||
|
||||
EXTRA_DIST = \
|
||||
${gncmod_DATA} \
|
||||
${gwmod_DATA} \
|
||||
${gncscmmod_DATA}
|
||||
|
||||
if GNUCASH_SEPARATE_BUILDDIR
|
||||
#Only needed when srcdir and builddir are different
|
||||
#for compiling
|
||||
SCM_FILE_LINKS = gw-business-gnome-spec.scm
|
||||
#for running
|
||||
SCM_FILE_LINKS += ${gncmod_DATA}
|
||||
SCM_FILE_LINKS = ${gncmod_DATA}
|
||||
endif
|
||||
|
||||
.scm-links:
|
||||
$(RM) -rf gnucash g-wrapped
|
||||
mkdir -p gnucash g-wrapped
|
||||
$(RM) -rf gnucash
|
||||
mkdir -p gnucash
|
||||
if GNUCASH_SEPARATE_BUILDDIR
|
||||
for X in ${SCM_FILE_LINKS} ; do \
|
||||
$(LN_S) -f ${srcdir}/$$X . ; \
|
||||
@ -133,29 +113,5 @@ endif
|
||||
( cd gnucash; for A in $(gncmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
|
||||
touch .scm-links
|
||||
|
||||
clean-local:
|
||||
$(RM) -rf gnucash g-wrapped
|
||||
|
||||
.INTERMEDIATE: gwrap-files
|
||||
|
||||
gw-business-gnome.scm gw-business-gnome.c gw-business-gnome.h: \
|
||||
gwrap-files
|
||||
|
||||
gwrap-files: \
|
||||
.scm-links gw-business-gnome-spec.scm ${top_builddir}/config.status
|
||||
FLAVOR=gnome $(GUILE) -c \
|
||||
"(set! %load-path (cons \"${G_WRAP_MODULE_DIR}\" %load-path)) \
|
||||
(set! %load-path (cons \"${PWD}\" %load-path)) \
|
||||
(set! %load-path (cons \"../business-core\" %load-path)) \
|
||||
(set! %load-path (cons \"${srcdir}/../business-core\" %load-path)) \
|
||||
(set! %load-path (cons \"../../engine\" %load-path)) \
|
||||
(set! %load-path (cons \"../../app-utils\" %load-path)) \
|
||||
(set! %load-path (cons \"../../gnome-utils\" %load-path)) \
|
||||
(primitive-load \"./gw-business-gnome-spec.scm\") \
|
||||
(gw:generate-wrapset \"gw-business-gnome\")"
|
||||
touch $@
|
||||
( cd g-wrapped; $(LN_S) -f ../gw-*.scm . )
|
||||
|
||||
BUILT_SOURCES = gw-business-gnome.scm gw-business-gnome.c gw-business-gnome.h
|
||||
CLEANFILES = $(BUILT_SOURCES) .scm-links \
|
||||
${SCM_FILE_LINKS} gw-business-gnome.html
|
||||
noinst_DATA = .scm-links
|
||||
CLEANFILES = $(BUILT_SOURCES) gnucash .scm-links ${SCM_FILE_LINKS}
|
||||
|
@ -1,5 +1,4 @@
|
||||
(define-module (gnucash business-gnome))
|
||||
(use-modules (g-wrapped gw-business-gnome))
|
||||
(use-modules (gnucash gnc-module))
|
||||
|
||||
(gnc:module-load "gnucash/gnome-utils" 0)
|
||||
@ -22,8 +21,8 @@
|
||||
(set-current-module m)))
|
||||
|
||||
(define (business-report-function)
|
||||
(gnc:add-extension
|
||||
(gnc-add-scm-extension
|
||||
(gnc:make-menu gnc:menuname-business-reports
|
||||
(list gnc:menuname-reports))))
|
||||
|
||||
(gnc:hook-add-dangler gnc:*report-hook* business-report-function)
|
||||
(gnc-hook-add-scm-dangler HOOK-REPORT business-report-function)
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <g-wrap-wct.h>
|
||||
#include "swig-runtime.h"
|
||||
#include <libguile.h>
|
||||
|
||||
#include "gnc-ui-util.h"
|
||||
@ -39,6 +39,8 @@
|
||||
#include "business-gnome-utils.h"
|
||||
#include "dialog-invoice.h"
|
||||
|
||||
#define FUNC_NAME __FUNCTION__
|
||||
|
||||
static GtkWidget *
|
||||
create_owner_widget (GNCOption *option, GncOwnerType type, GtkWidget *hbox)
|
||||
{
|
||||
@ -94,12 +96,9 @@ static GncOwnerType
|
||||
get_owner_type_from_option (GNCOption *option)
|
||||
{
|
||||
SCM odata = gnc_option_get_option_data (option);
|
||||
SCM conv_func;
|
||||
|
||||
conv_func = scm_c_eval_string ("gw:enum-<gnc:GncOwnerType>-val->int");
|
||||
odata = scm_call_1 (conv_func, odata);
|
||||
|
||||
return scm_num2long (odata, SCM_ARG1, __FUNCTION__);
|
||||
/* The option data is enum-typed. It's just the enum value. */
|
||||
return (GncOwnerType) scm_num2int(odata, SCM_ARG1, __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
@ -135,11 +134,11 @@ owner_set_value (GNCOption *option, gboolean use_default,
|
||||
GncOwner owner_def;
|
||||
GncOwner *owner;
|
||||
|
||||
if (!gw_wcp_p (value))
|
||||
if (!SWIG_IsPointer (value))
|
||||
scm_misc_error("business_options:owner_set_value",
|
||||
"Item is not a gw:wcp.", value);
|
||||
"SCM is not a wrapped pointer.", value);
|
||||
|
||||
owner = gw_wcp_get_ptr (value);
|
||||
owner = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncOwner"), 1, 0);
|
||||
|
||||
/* XXX: should we verify that the owner type is correct? */
|
||||
if (!owner) {
|
||||
@ -164,7 +163,7 @@ owner_get_value (GNCOption *option, GtkWidget *widget)
|
||||
owner.type = type;
|
||||
gnc_owner_get_owner (widget, &owner);
|
||||
|
||||
return gw_wcp_assimilate_ptr (&owner, scm_c_eval_string("<gnc:GncOwner*>"));
|
||||
return SWIG_NewPointerObj(&owner, SWIG_TypeQuery("_p__gncOwner"), 0);
|
||||
}
|
||||
|
||||
|
||||
@ -203,11 +202,11 @@ customer_set_value (GNCOption *option, gboolean use_default,
|
||||
GncOwner owner;
|
||||
GncCustomer *customer;
|
||||
|
||||
if (!gw_wcp_p (value))
|
||||
if (!SWIG_IsPointer (value))
|
||||
scm_misc_error("business_options:customer_set_value",
|
||||
"Item is not a gw:wcp.", value);
|
||||
"SCM is not a wrapped pointer.", value);
|
||||
|
||||
customer = gw_wcp_get_ptr (value);
|
||||
customer = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncCustomer"), 1, 0);
|
||||
gncOwnerInitCustomer (&owner, customer);
|
||||
|
||||
widget = gnc_option_get_widget (option);
|
||||
@ -222,9 +221,8 @@ customer_get_value (GNCOption *option, GtkWidget *widget)
|
||||
GncOwner owner;
|
||||
|
||||
gnc_owner_get_owner (widget, &owner);
|
||||
|
||||
return gw_wcp_assimilate_ptr (owner.owner.undefined,
|
||||
scm_c_eval_string("<gnc:GncCustomer*>"));
|
||||
return SWIG_NewPointerObj(owner.owner.undefined,
|
||||
SWIG_TypeQuery("_p__gncCustomer"), 0);
|
||||
}
|
||||
|
||||
|
||||
@ -263,11 +261,11 @@ vendor_set_value (GNCOption *option, gboolean use_default,
|
||||
GncOwner owner;
|
||||
GncVendor *vendor;
|
||||
|
||||
if (!gw_wcp_p (value))
|
||||
if (!SWIG_IsPointer (value))
|
||||
scm_misc_error("business_options:vendor_set_value",
|
||||
"Item is not a gw:wcp.", value);
|
||||
"SCM is not a wrapped pointer.", value);
|
||||
|
||||
vendor = gw_wcp_get_ptr (value);
|
||||
vendor = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncVendor"), 1, 0);
|
||||
gncOwnerInitVendor (&owner, vendor);
|
||||
|
||||
widget = gnc_option_get_widget (option);
|
||||
@ -282,9 +280,8 @@ vendor_get_value (GNCOption *option, GtkWidget *widget)
|
||||
GncOwner owner;
|
||||
|
||||
gnc_owner_get_owner (widget, &owner);
|
||||
|
||||
return gw_wcp_assimilate_ptr (owner.owner.undefined,
|
||||
scm_c_eval_string("<gnc:GncVendor*>"));
|
||||
return SWIG_NewPointerObj(owner.owner.undefined,
|
||||
SWIG_TypeQuery("_p__gncVendor"), 0);
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
@ -322,11 +319,11 @@ employee_set_value (GNCOption *option, gboolean use_default,
|
||||
GncOwner owner;
|
||||
GncEmployee *employee;
|
||||
|
||||
if (!gw_wcp_p (value))
|
||||
if (!SWIG_IsPointer (value))
|
||||
scm_misc_error("business_options:employee_set_value",
|
||||
"Item is not a gw:wcp.", value);
|
||||
"SCM is not a wrapped pointer.", value);
|
||||
|
||||
employee = gw_wcp_get_ptr (value);
|
||||
employee = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncEmployee"), 1, 0);
|
||||
gncOwnerInitEmployee (&owner, employee);
|
||||
|
||||
widget = gnc_option_get_widget (option);
|
||||
@ -342,8 +339,8 @@ employee_get_value (GNCOption *option, GtkWidget *widget)
|
||||
|
||||
gnc_owner_get_owner (widget, &owner);
|
||||
|
||||
return gw_wcp_assimilate_ptr (owner.owner.undefined,
|
||||
scm_c_eval_string("<gnc:GncEmployee*>"));
|
||||
return SWIG_NewPointerObj(owner.owner.undefined,
|
||||
SWIG_TypeQuery("_p__gncEmployee"), 0);
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
@ -396,11 +393,11 @@ invoice_set_value (GNCOption *option, gboolean use_default,
|
||||
{
|
||||
GncInvoice *invoice;
|
||||
|
||||
if (!gw_wcp_p (value))
|
||||
if (!SWIG_IsPointer (value))
|
||||
scm_misc_error("business_options:invoice_set_value",
|
||||
"Item is not a gw:wcp.", value);
|
||||
"SCM is not a wrapped pointer.", value);
|
||||
|
||||
invoice = gw_wcp_get_ptr (value);
|
||||
invoice = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncInvoice"), 1, 0);
|
||||
|
||||
widget = gnc_option_get_widget (option);
|
||||
gnc_general_search_set_selected (GNC_GENERAL_SEARCH (widget), invoice);
|
||||
@ -414,7 +411,7 @@ invoice_get_value (GNCOption *option, GtkWidget *widget)
|
||||
GncInvoice *invoice;
|
||||
|
||||
invoice = gnc_general_search_get_selected (GNC_GENERAL_SEARCH (widget));
|
||||
return gw_wcp_assimilate_ptr (invoice, scm_c_eval_string("<gnc:GncInvoice*>"));
|
||||
return SWIG_NewPointerObj(invoice, SWIG_TypeQuery("_p__gncInvoice"), 0);
|
||||
}
|
||||
|
||||
|
||||
@ -471,11 +468,11 @@ taxtable_set_value (GNCOption *option, gboolean use_default,
|
||||
{
|
||||
GncTaxTable *taxtable;
|
||||
|
||||
if (!gw_wcp_p (value))
|
||||
if (!SWIG_IsPointer (value))
|
||||
scm_misc_error("business_options:taxtable_set_value",
|
||||
"Item is not a gw:wcp.", value);
|
||||
"SCM is not a wrapped pointer.", value);
|
||||
|
||||
taxtable = gw_wcp_get_ptr (value);
|
||||
taxtable = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncTaxTable"), 1, 0);
|
||||
|
||||
widget = gnc_option_get_widget (option);
|
||||
gnc_ui_optionmenu_set_value (widget, taxtable);
|
||||
@ -489,7 +486,7 @@ taxtable_get_value (GNCOption *option, GtkWidget *widget)
|
||||
GncTaxTable *taxtable;
|
||||
|
||||
taxtable = gnc_ui_optionmenu_get_value (widget);
|
||||
return gw_wcp_assimilate_ptr (taxtable, scm_c_eval_string("<gnc:GncTaxTable*>"));
|
||||
return SWIG_NewPointerObj(taxtable, SWIG_TypeQuery("_p__gncTaxTable"), 0);
|
||||
}
|
||||
|
||||
|
||||
@ -510,6 +507,7 @@ gnc_business_options_gnome_initialize (void)
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
SWIG_GetModule(NULL); /* Work-around for SWIG bug. */
|
||||
for (i = 0; options[i].option_name; i++)
|
||||
gnc_options_ui_register_option (&(options[i]));
|
||||
}
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "gnc-hooks.h"
|
||||
#include "gnc-module.h"
|
||||
#include "gnc-module-api.h"
|
||||
#include "gw-business-gnome.h"
|
||||
|
||||
#include "search-core-type.h"
|
||||
#include "search-owner.h"
|
||||
@ -101,10 +100,28 @@ libgncmod_business_gnome_LTX_gnc_module_init(int refcount)
|
||||
// return FALSE;
|
||||
// }
|
||||
|
||||
scm_c_eval_string("(use-modules (g-wrapped gw-business-gnome))");
|
||||
scm_c_eval_string("(use-modules (gnucash business-gnome))");
|
||||
scm_c_eval_string("(use-modules (gnucash report business-reports))");
|
||||
|
||||
// temp code until gnc:url-type is wrapped
|
||||
/*
|
||||
{
|
||||
SCM wct_gnc_url_type = scm_c_eval_string("<gnc:url-type>");
|
||||
SCM tmp;
|
||||
|
||||
tmp = gw_wcp_assimilate_ptr(GNC_CUSTOMER_MODULE_NAME, wct_gnc_url_type);
|
||||
scm_c_define("gnc:url-type-customer", tmp);
|
||||
tmp = gw_wcp_assimilate_ptr(GNC_VENDOR_MODULE_NAME, wct_gnc_url_type);
|
||||
scm_c_define("gnc:url-type-vendor", tmp);
|
||||
tmp = gw_wcp_assimilate_ptr(GNC_EMPLOYEE_MODULE_NAME, wct_gnc_url_type);
|
||||
scm_c_define("gnc:url-type-employee", tmp);
|
||||
tmp = gw_wcp_assimilate_ptr(GNC_INVOICE_MODULE_NAME, wct_gnc_url_type);
|
||||
scm_c_define("gnc:url-type-invoice", tmp);
|
||||
tmp = gw_wcp_assimilate_ptr(URL_TYPE_OWNERREPORT, wct_gnc_url_type);
|
||||
scm_c_define("gnc:url-type-ownerreport", tmp);
|
||||
}
|
||||
*/
|
||||
|
||||
if (refcount == 0) {
|
||||
/* Register the Owner search type */
|
||||
gnc_search_core_register_type (GNC_OWNER_MODULE_NAME,
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
#include <gnome.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <g-wrap-wct.h>
|
||||
#include <libguile.h>
|
||||
#include "swig-runtime.h"
|
||||
|
||||
#include "gncObject.h"
|
||||
#include "QueryCore.h"
|
||||
@ -569,7 +569,7 @@ gnc_invoice_window_printCB (GtkWidget *widget, gpointer data)
|
||||
func = scm_c_eval_string ("gnc:invoice-report-create");
|
||||
g_return_if_fail (SCM_PROCEDUREP (func));
|
||||
|
||||
arg = gw_wcp_assimilate_ptr (invoice, scm_c_eval_string("<gnc:GncInvoice*>"));
|
||||
arg = SWIG_NewPointerObj(invoice, SWIG_TypeQuery("_p__gncInvoice"), 0);
|
||||
args = scm_cons (arg, args);
|
||||
|
||||
/* scm_gc_protect_object(func); */
|
||||
@ -734,7 +734,6 @@ void gnc_invoice_window_new_invoice_cb (GtkWidget *widget, gpointer data)
|
||||
void gnc_business_call_owner_report (GncOwner *owner, Account *acc)
|
||||
{
|
||||
int id;
|
||||
SCM qtype;
|
||||
SCM args;
|
||||
SCM func;
|
||||
SCM arg;
|
||||
@ -747,20 +746,17 @@ void gnc_business_call_owner_report (GncOwner *owner, Account *acc)
|
||||
g_return_if_fail (SCM_PROCEDUREP (func));
|
||||
|
||||
if (acc) {
|
||||
qtype = scm_c_eval_string("<gnc:Account*>");
|
||||
g_return_if_fail (qtype != SCM_UNDEFINED);
|
||||
swig_type_info * qtype = SWIG_TypeQuery("_p_Account");
|
||||
g_return_if_fail (qtype);
|
||||
|
||||
arg = gw_wcp_assimilate_ptr (acc, qtype);
|
||||
arg = SWIG_NewPointerObj(acc, qtype, 0);
|
||||
g_return_if_fail (arg != SCM_UNDEFINED);
|
||||
args = scm_cons (arg, args);
|
||||
} else {
|
||||
args = scm_cons (SCM_BOOL_F, args);
|
||||
}
|
||||
|
||||
qtype = scm_c_eval_string("<gnc:GncOwner*>");
|
||||
g_return_if_fail (qtype != SCM_UNDEFINED);
|
||||
|
||||
arg = gw_wcp_assimilate_ptr (owner, qtype);
|
||||
arg = SWIG_NewPointerObj(owner, SWIG_TypeQuery("_p__gncOwner"), 0);
|
||||
g_return_if_fail (arg != SCM_UNDEFINED);
|
||||
args = scm_cons (arg, args);
|
||||
|
||||
|
@ -1,267 +0,0 @@
|
||||
;;; -*-scheme-*-
|
||||
|
||||
;(debug-enable 'backtrace)
|
||||
;(debug-enable 'debug)
|
||||
;(read-enable 'positions)
|
||||
|
||||
(debug-set! maxdepth 100000)
|
||||
(debug-set! stack 200000)
|
||||
|
||||
(define-module (g-wrapped gw-business-gnome-spec)
|
||||
:use-module (g-wrap))
|
||||
|
||||
(use-modules (g-wrap))
|
||||
|
||||
(use-modules (g-wrap gw-standard-spec))
|
||||
(use-modules (g-wrap gw-wct-spec))
|
||||
|
||||
(use-modules (g-wrapped gw-business-core-spec))
|
||||
(use-modules (g-wrapped gw-gnome-utils-spec))
|
||||
|
||||
(let ((ws (gw:new-wrapset "gw-business-gnome")))
|
||||
|
||||
(gw:wrapset-depends-on ws "gw-standard")
|
||||
|
||||
(gw:wrapset-depends-on ws "gw-business-core")
|
||||
(gw:wrapset-depends-on ws "gw-engine")
|
||||
(gw:wrapset-depends-on ws "gw-gnome-utils")
|
||||
|
||||
(gw:wrapset-set-guile-module! ws '(g-wrapped gw-business-gnome))
|
||||
|
||||
(gw:wrapset-add-cs-declarations!
|
||||
ws
|
||||
(lambda (wrapset client-wrapset)
|
||||
(list
|
||||
"#include <config.h>\n"
|
||||
"#include <gtk/gtk.h>\n"
|
||||
"#include <business-urls.h>\n"
|
||||
"#include <dialog-billterms.h>\n"
|
||||
"#include <dialog-customer.h>\n"
|
||||
"#include <dialog-employee.h>\n"
|
||||
"#include <dialog-invoice.h>\n"
|
||||
"#include <dialog-job.h>\n"
|
||||
"#include <dialog-order.h>\n"
|
||||
"#include <dialog-payment.h>\n"
|
||||
"#include <dialog-vendor.h>\n"
|
||||
)))
|
||||
|
||||
(gw:wrapset-add-cs-initializers!
|
||||
ws
|
||||
(lambda (wrapset client-wrapset status-var)
|
||||
(if client-wrapset
|
||||
'()
|
||||
(gw:inline-scheme '(use-modules (gnucash business-gnome))))))
|
||||
|
||||
;;
|
||||
;; Business URL Types
|
||||
;;
|
||||
(gw:wrap-value ws 'gnc:url-type-customer '<gnc:url-type>
|
||||
"GNC_CUSTOMER_MODULE_NAME")
|
||||
(gw:wrap-value ws 'gnc:url-type-vendor '<gnc:url-type>
|
||||
"GNC_VENDOR_MODULE_NAME")
|
||||
(gw:wrap-value ws 'gnc:url-type-employee '<gnc:url-type>
|
||||
"GNC_EMPLOYEE_MODULE_NAME")
|
||||
(gw:wrap-value ws 'gnc:url-type-invoice '<gnc:url-type>
|
||||
"GNC_INVOICE_MODULE_NAME")
|
||||
(gw:wrap-value ws 'gnc:url-type-ownerreport '<gnc:url-type>
|
||||
"URL_TYPE_OWNERREPORT")
|
||||
|
||||
|
||||
;;
|
||||
;; dialog-billterms.h
|
||||
;;
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:billterms-new
|
||||
'<gw:void>
|
||||
"gnc_ui_billterms_window_new"
|
||||
'((<gnc:Book*> book))
|
||||
"Dialog: view and edit the available Billing Terms.")
|
||||
|
||||
;;
|
||||
;; dialog-customer.h
|
||||
;;
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:customer-new
|
||||
'<gw:void>
|
||||
"gnc_ui_customer_new"
|
||||
'((<gnc:Book*> book))
|
||||
"Dialog: create a new GncCustomer.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:customer-edit
|
||||
'<gw:void>
|
||||
"gnc_ui_customer_edit"
|
||||
'((<gnc:GncCustomer*> customer))
|
||||
"Dialog: Edit a GncCustomer.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:customer-search
|
||||
'<gw:void>
|
||||
"gnc_customer_search"
|
||||
'((<gnc:GncCustomer*> start_selection) (<gnc:Book*> book) )
|
||||
"Dialog: Find a GncCustomer. Start_selection may be NULL.")
|
||||
|
||||
;;
|
||||
;; dialog-employee.h
|
||||
;;
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:employee-new
|
||||
'<gw:void>
|
||||
"gnc_ui_employee_new"
|
||||
'((<gnc:Book*> book))
|
||||
"Dialog: create a new GncEmployee.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:employee-edit
|
||||
'<gw:void>
|
||||
"gnc_ui_employee_edit"
|
||||
'((<gnc:GncEmployee*> employee))
|
||||
"Dialog: Edit a GncEmployee.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:employee-search
|
||||
'<gw:void>
|
||||
"gnc_employee_search"
|
||||
'((<gnc:GncEmployee*> start_selection) (<gnc:Book*> book))
|
||||
"Dialog: Find a GncEmployee. Start_selection may be NULL.")
|
||||
|
||||
;;
|
||||
;; dialog-invoice.h
|
||||
;;
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:invoice-new
|
||||
'<gw:void>
|
||||
"gnc_ui_invoice_new"
|
||||
'((<gnc:GncOwner*> owner) (<gnc:Book*> book))
|
||||
"Dialog: create a new GncInvoice.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:invoice-edit
|
||||
'<gw:void>
|
||||
"gnc_ui_invoice_edit"
|
||||
'((<gnc:GncInvoice*> invoice))
|
||||
"Dialog: Edit a GncInvoice.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:invoice-search
|
||||
'<gw:void>
|
||||
"gnc_invoice_search"
|
||||
'((<gnc:GncInvoice*> start_selection) (<gnc:GncOwner*> owner)
|
||||
(<gnc:Book*> book))
|
||||
"Dialog: Select a GncInvoice. Either start_selection or "
|
||||
"owner may be NULL.")
|
||||
|
||||
;;
|
||||
;; dialog-job.h
|
||||
;;
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:job-new
|
||||
'<gw:void>
|
||||
"gnc_ui_job_new"
|
||||
'((<gnc:GncOwner*> default_owner) (<gnc:Book*> book))
|
||||
"Dialog: create a new GncJob. Owner may be NULL.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:job-edit
|
||||
'<gw:void>
|
||||
"gnc_ui_job_edit"
|
||||
'((<gnc:GncJob*> job))
|
||||
"Dialog: Edit a GncJob.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:job-search
|
||||
'<gw:void>
|
||||
"gnc_job_search"
|
||||
'((<gnc:GncJob*> job) (<gnc:GncOwner*> owner) (<gnc:Book*> book))
|
||||
"Dialog: Search for a job. Job and Owner may be NULL.")
|
||||
|
||||
;;
|
||||
;; dialog-order.h
|
||||
;;
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:order-new
|
||||
'<gw:void>
|
||||
"gnc_ui_order_new"
|
||||
'((<gnc:GncOwner*> owner) (<gnc:Book*> book))
|
||||
"Dialog: create a new GncOrder.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:order-edit
|
||||
'<gw:void>
|
||||
"gnc_ui_order_edit"
|
||||
'((<gnc:GncOrder*> order))
|
||||
"Dialog: Edit a GncOrder.")
|
||||
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:order-search
|
||||
'<gw:void>
|
||||
"gnc_order_search"
|
||||
'((<gnc:GncOrder*> start_selection) (<gnc:GncOwner*> order_owner)
|
||||
(<gnc:Book*> book) )
|
||||
"Dialog: Select a GncOrder. Either start_selection or "
|
||||
"order_owner may be NULL.")
|
||||
|
||||
;;
|
||||
;; dialog-payment.h
|
||||
;;
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:payment-new
|
||||
'<gw:void>
|
||||
"gnc_ui_payment_new"
|
||||
'((<gnc:GncOwner*> owner) (<gnc:Book*> book))
|
||||
"Dialog: Enter a payment. The owner may be NULL.")
|
||||
|
||||
;;
|
||||
;; dialog-vendor.h
|
||||
;;
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:vendor-new
|
||||
'<gw:void>
|
||||
"gnc_ui_vendor_new"
|
||||
'((<gnc:Book*> book))
|
||||
"Dialog: create a new GncVendor.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:vendor-edit
|
||||
'<gw:void>
|
||||
"gnc_ui_vendor_edit"
|
||||
'((<gnc:GncVendor*> vendor))
|
||||
"Dialog: Edit a GncVendor.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:vendor-search
|
||||
'<gw:void>
|
||||
"gnc_vendor_search"
|
||||
'((<gnc:GncVendor*> start_selection) (<gnc:Book*> book))
|
||||
"Dialog: Select a GncVendor. Start_selection may be NULL.")
|
||||
|
||||
)
|
@ -276,8 +276,6 @@ void gnc_entry_ledger_load_xfer_cells (GncEntryLedger *ledger)
|
||||
*/
|
||||
void gnc_entry_ledger_load (GncEntryLedger *ledger, GList *entry_list)
|
||||
{
|
||||
static SCM id_book = SCM_UNDEFINED;
|
||||
|
||||
GncEntry *blank_entry, *find_entry;
|
||||
CursorBuffer *cursor_buffer;
|
||||
Table *table;
|
||||
@ -359,11 +357,8 @@ void gnc_entry_ledger_load (GncEntryLedger *ledger, GList *entry_list)
|
||||
break;
|
||||
}
|
||||
|
||||
if (id_book == SCM_UNDEFINED)
|
||||
id_book = scm_c_eval_string ("gnc:id-book");
|
||||
|
||||
/* Compute the proper taxtable */
|
||||
odb = gnc_option_db_new_for_type (id_book);
|
||||
odb = gnc_option_db_new_for_type (GNC_ID_BOOK);
|
||||
gnc_option_db_load_from_kvp (odb, gnc_book_get_slots (ledger->book));
|
||||
|
||||
switch (gncOwnerGetType (owner)) {
|
||||
|
@ -67,13 +67,13 @@
|
||||
|
||||
(define num-buckets 4)
|
||||
(define (new-bucket-vector)
|
||||
(make-vector num-buckets (gnc:numeric-zero)))
|
||||
(make-vector num-buckets (gnc-numeric-zero)))
|
||||
|
||||
(define make-company-private
|
||||
(record-constructor company-info '(currency bucket-vector overpayment owner-obj)))
|
||||
|
||||
(define (make-company currency owner-obj)
|
||||
(make-company-private currency (new-bucket-vector) (gnc:numeric-zero) owner-obj))
|
||||
(make-company-private currency (new-bucket-vector) (gnc-numeric-zero) owner-obj))
|
||||
|
||||
(define company-get-currency
|
||||
(record-accessor company-info 'currency))
|
||||
@ -116,11 +116,11 @@
|
||||
(find-bucket (+ current-bucket 1) bucket-intervals date)))))
|
||||
|
||||
(define (calculate-adjusted-values amount overpayment)
|
||||
(if (>= (gnc:numeric-compare amount overpayment) 0)
|
||||
(cons (gnc:numeric-sub-fixed amount overpayment)
|
||||
(gnc:numeric-zero))
|
||||
(cons (gnc:numeric-zero)
|
||||
(gnc:numeric-sub-fixed overpayment amount))))
|
||||
(if (>= (gnc-numeric-compare amount overpayment) 0)
|
||||
(cons (gnc-numeric-sub-fixed amount overpayment)
|
||||
(gnc-numeric-zero))
|
||||
(cons (gnc-numeric-zero)
|
||||
(gnc-numeric-sub-fixed overpayment amount))))
|
||||
|
||||
(let* ((current-overpayment (company-get-overpayment company))
|
||||
(adjusted-values (calculate-adjusted-values amount current-overpayment))
|
||||
@ -129,7 +129,7 @@
|
||||
(bucket-index (find-bucket 0 bucket-intervals date))
|
||||
(buckets (company-get-buckets company))
|
||||
(new-bucket-value
|
||||
(gnc:numeric-add-fixed adjusted-amount (vector-ref buckets bucket-index))))
|
||||
(gnc-numeric-add-fixed adjusted-amount (vector-ref buckets bucket-index))))
|
||||
(vector-set! buckets bucket-index new-bucket-value)
|
||||
(company-set-buckets company buckets)
|
||||
(company-set-overpayment company adjusted-overpayment)))
|
||||
@ -144,15 +144,15 @@
|
||||
(if (>= current-bucket-index (vector-length buckets))
|
||||
amount
|
||||
(let ((current-bucket-amt (vector-ref buckets current-bucket-index)))
|
||||
(if (>= (gnc:numeric-compare current-bucket-amt amount) 0)
|
||||
(if (>= (gnc-numeric-compare current-bucket-amt amount) 0)
|
||||
(begin
|
||||
(vector-set! buckets current-bucket-index (gnc:numeric-sub-fixed
|
||||
(vector-set! buckets current-bucket-index (gnc-numeric-sub-fixed
|
||||
current-bucket-amt amount))
|
||||
(gnc:numeric-zero))
|
||||
(gnc-numeric-zero))
|
||||
(begin
|
||||
(vector-set! buckets current-bucket-index (gnc:numeric-zero))
|
||||
(vector-set! buckets current-bucket-index (gnc-numeric-zero))
|
||||
(process-payment-driver
|
||||
(gnc:numeric-sub-fixed amount current-bucket-amt)
|
||||
(gnc-numeric-sub-fixed amount current-bucket-amt)
|
||||
buckets
|
||||
(+ current-bucket-index 1)))))))
|
||||
|
||||
@ -161,8 +161,8 @@
|
||||
(gnc:debug "processing payment of " amount)
|
||||
(gnc:debug "overpayment was " overpayment)
|
||||
|
||||
(if (gnc:numeric-positive-p overpayment)
|
||||
(company-set-overpayment company (gnc:numeric-add-fixed overpayment amount))
|
||||
(if (gnc-numeric-positive-p overpayment)
|
||||
(company-set-overpayment company (gnc-numeric-add-fixed overpayment amount))
|
||||
|
||||
(let ((result (process-payment-driver amount (company-get-buckets company) 0)))
|
||||
(gnc:debug "payment-driver processed. new overpayment: " result)
|
||||
@ -179,36 +179,36 @@
|
||||
reverse? show-zeros)
|
||||
|
||||
(define (do-update value)
|
||||
(let* ((transaction (gnc:split-get-parent split))
|
||||
(temp-owner (gnc:owner-create))
|
||||
(let* ((transaction (xaccSplitGetParent split))
|
||||
(temp-owner (gncOwnerCreate))
|
||||
(owner (gnc:owner-from-split split temp-owner)))
|
||||
|
||||
(if
|
||||
owner
|
||||
(let* ((guid (gnc:owner-get-guid owner))
|
||||
(this-currency (gnc:transaction-get-currency transaction))
|
||||
(this-date (gnc:transaction-get-date-posted transaction))
|
||||
(let* ((guid (gncOwnerReturnGUID owner))
|
||||
(this-currency (xaccTransGetCurrency transaction))
|
||||
(this-date (gnc-transaction-get-date-posted transaction))
|
||||
(company-info (hash-ref hash guid)))
|
||||
|
||||
(gnc:debug "update-company-hash called")
|
||||
(gnc:debug "owner: " owner ", guid: " guid)
|
||||
(gnc:debug "split-value: " value)
|
||||
(if reverse? (set! value (gnc:numeric-neg value)))
|
||||
(if reverse? (set! value (gnc-numeric-neg value)))
|
||||
(if company-info
|
||||
;; if it's an existing company, destroy the temp owner and
|
||||
;; then make sure the currencies match
|
||||
(begin
|
||||
(gnc:owner-destroy temp-owner)
|
||||
(if (not (gnc:commodity-equiv?
|
||||
(gncOwnerDestroy temp-owner)
|
||||
(if (not (gnc-commodity-equiv
|
||||
this-currency
|
||||
(company-get-currency company-info)))
|
||||
(cons #f (sprintf
|
||||
(_ "Transactions relating to '%s' contain \
|
||||
more than one currency. This report is not designed to cope with this possibility.") (gnc:owner-get-name owner)))
|
||||
more than one currency. This report is not designed to cope with this possibility.") (gncOwnerGetName owner)))
|
||||
(begin
|
||||
(gnc:debug "it's an old company")
|
||||
(if (gnc:numeric-negative-p value)
|
||||
(process-invoice company-info (gnc:numeric-neg value) bucket-intervals this-date)
|
||||
(if (gnc-numeric-negative-p value)
|
||||
(process-invoice company-info (gnc-numeric-neg value) bucket-intervals this-date)
|
||||
(process-payment company-info value))
|
||||
(hash-set! hash guid company-info)
|
||||
(cons #t guid))))
|
||||
@ -217,19 +217,19 @@ more than one currency. This report is not designed to cope with this possibili
|
||||
(begin
|
||||
(gnc:debug "value" value)
|
||||
(let ((new-company (make-company this-currency owner)))
|
||||
(if (gnc:numeric-negative-p value)
|
||||
(process-invoice new-company (gnc:numeric-neg value) bucket-intervals this-date)
|
||||
(if (gnc-numeric-negative-p value)
|
||||
(process-invoice new-company (gnc-numeric-neg value) bucket-intervals this-date)
|
||||
(process-payment new-company value))
|
||||
(hash-set! hash guid new-company))
|
||||
(cons #t guid))))
|
||||
; else (no owner)
|
||||
(gnc:owner-destroy temp-owner))))
|
||||
(gncOwnerDestroy temp-owner))))
|
||||
|
||||
;; figure out if this split is part of a closed lot
|
||||
;; also save the split value...
|
||||
(let* ((lot (gnc:split-get-lot split))
|
||||
(value (gnc:split-get-value split))
|
||||
(is-paid? (if (null? lot) #f (gnc:lot-closed? lot))))
|
||||
(let* ((lot (xaccSplitGetLot split))
|
||||
(value (xaccSplitGetValue split))
|
||||
(is-paid? (if (null? lot) #f (gnc-lot-is-closed lot))))
|
||||
|
||||
;; if it's closed, then ignore it because it doesn't matter.
|
||||
;; XXX: we _could_ just set the value to 0 in order to list
|
||||
@ -240,11 +240,11 @@ more than one currency. This report is not designed to cope with this possibili
|
||||
|
||||
;; get the total debt from the buckets
|
||||
(define (buckets-get-total buckets)
|
||||
(let ((running-total (gnc:numeric-zero))
|
||||
(let ((running-total (gnc-numeric-zero))
|
||||
(buckets-list (vector->list buckets)))
|
||||
(for-each (lambda (bucket)
|
||||
(set! running-total
|
||||
(gnc:numeric-add-fixed bucket running-total)))
|
||||
(gnc-numeric-add-fixed bucket running-total)))
|
||||
buckets-list)
|
||||
running-total))
|
||||
|
||||
@ -258,7 +258,7 @@ more than one currency. This report is not designed to cope with this possibili
|
||||
(bucket-b (company-get-buckets company-b))
|
||||
(total-a (buckets-get-total bucket-a))
|
||||
(total-b (buckets-get-total bucket-b))
|
||||
(difference-sign (gnc:numeric-compare (gnc:numeric-sub-fixed total-a total-b) (gnc:numeric-zero))))
|
||||
(difference-sign (gnc-numeric-compare (gnc-numeric-sub-fixed total-a total-b) (gnc-numeric-zero))))
|
||||
;; if same totals, compare by name
|
||||
(if (= difference-sign 0)
|
||||
(gnc:safe-strcmp (car litem-a) (car litem-b))
|
||||
@ -270,11 +270,11 @@ more than one currency. This report is not designed to cope with this possibili
|
||||
(define (driver buckets-a buckets-b)
|
||||
(if (null? buckets-a)
|
||||
0
|
||||
(let ((diff (gnc:numeric-compare
|
||||
(gnc:numeric-sub-fixed
|
||||
(let ((diff (gnc-numeric-compare
|
||||
(gnc-numeric-sub-fixed
|
||||
(car buckets-a)
|
||||
(car buckets-b))
|
||||
(gnc:numeric-zero))))
|
||||
(gnc-numeric-zero))))
|
||||
(if (= diff 0)
|
||||
(driver (cdr buckets-a) (cdr buckets-b))
|
||||
diff))))
|
||||
@ -304,14 +304,14 @@ more than one currency. This report is not designed to cope with this possibili
|
||||
(set! begindate (decdate begindate NinetyDayDelta)) ;XXX - 360 days!?!
|
||||
(gnc:debug "begindate" begindate)
|
||||
(gnc:debug "date" date)
|
||||
(gnc:query-set-book query (gnc:get-current-book))
|
||||
(gnc:query-set-match-non-voids-only! query (gnc:get-current-book))
|
||||
(gnc:query-add-single-account-match query account 'query-and)
|
||||
(gnc:query-add-date-match-timepair query #t begindate #t date 'query-and)
|
||||
(gnc:query-set-sort-order query
|
||||
(list gnc:split-trans gnc:trans-date-posted)
|
||||
(qof-query-set-book query (gnc-get-current-book))
|
||||
(gnc:query-set-match-non-voids-only! query (gnc-get-current-book))
|
||||
(xaccQueryAddSingleAccountMatch query account QOF-QUERY-AND)
|
||||
(xaccQueryAddDateMatchTS query #t begindate #t date QOF-QUERY-AND)
|
||||
(qof-query-set-sort-order query
|
||||
(list SPLIT-TRANS TRANS-DATE-POSTED)
|
||||
'() '())
|
||||
(gnc:query-set-sort-increasing query #t #t #t)))
|
||||
(qof-query-set-sort-increasing query #t #t #t)))
|
||||
|
||||
|
||||
(define (aging-options-generator options)
|
||||
@ -386,7 +386,7 @@ totals to report currency")
|
||||
|
||||
(define (get-name a)
|
||||
(let* ((owner (company-get-owner-obj (cdr a))))
|
||||
(gnc:owner-get-name owner)))
|
||||
(gncOwnerGetName owner)))
|
||||
|
||||
;; Predicates for sorting the companys once the data has been collected
|
||||
|
||||
@ -472,12 +472,12 @@ totals to report currency")
|
||||
|
||||
;; convert the buckets in the header data structure
|
||||
(define (convert-to-monetary-list bucket-list currency overpayment)
|
||||
(let* ((running-total (gnc:numeric-neg overpayment))
|
||||
(let* ((running-total (gnc-numeric-neg overpayment))
|
||||
(monetised-buckets
|
||||
(map (lambda (bucket-list-entry)
|
||||
(begin
|
||||
(set! running-total
|
||||
(gnc:numeric-add-fixed running-total bucket-list-entry))
|
||||
(gnc-numeric-add-fixed running-total bucket-list-entry))
|
||||
(gnc:make-gnc-monetary currency bucket-list-entry)))
|
||||
(vector->list bucket-list))))
|
||||
(append (reverse monetised-buckets)
|
||||
@ -533,7 +533,7 @@ totals to report currency")
|
||||
(exchange-fn (gnc:case-exchange-fn price-source report-currency report-date))
|
||||
(total-collector-list (make-collector-list))
|
||||
(table (gnc:make-html-table))
|
||||
(query (gnc:malloc-query))
|
||||
(query (qof-query-create-for-splits))
|
||||
(company-list '())
|
||||
(work-done 0)
|
||||
(work-to-do 0)
|
||||
@ -546,7 +546,7 @@ totals to report currency")
|
||||
(if account
|
||||
(begin
|
||||
(gnc:html-document-set-title!
|
||||
document (string-append report-title ": " (gnc:account-get-name account)))
|
||||
document (string-append report-title ": " (xaccAccountGetName account)))
|
||||
(gnc:html-document-set-headline! document
|
||||
(gnc:html-markup
|
||||
"!"
|
||||
@ -554,7 +554,7 @@ totals to report currency")
|
||||
": "
|
||||
(gnc:html-markup-anchor
|
||||
(gnc:account-anchor-text account)
|
||||
(gnc:account-get-name account))))))
|
||||
(xaccAccountGetName account))))))
|
||||
|
||||
(gnc:html-table-set-col-headers! table heading-list)
|
||||
|
||||
@ -562,7 +562,7 @@ totals to report currency")
|
||||
(begin
|
||||
(setup-query query account report-date)
|
||||
;; get the appropriate splits
|
||||
(let ((splits (gnc:query-get-splits query)))
|
||||
(let ((splits (qof-query-run query)))
|
||||
; (gnc:debug "splits" splits)
|
||||
|
||||
;; build the table
|
||||
@ -602,7 +602,7 @@ totals to report currency")
|
||||
(cdr company-list-entry))))
|
||||
(owner (company-get-owner-obj
|
||||
(cdr company-list-entry)))
|
||||
(company-name (gnc:owner-get-name owner)))
|
||||
(company-name (gncOwnerGetName owner)))
|
||||
|
||||
(add-to-column-totals total-collector-list
|
||||
monetary-list)
|
||||
@ -627,7 +627,7 @@ totals to report currency")
|
||||
(gnc:owner-anchor-text owner)
|
||||
company-name))
|
||||
monetary-list))
|
||||
(gnc:owner-destroy owner)))
|
||||
(gncOwnerDestroy owner)))
|
||||
company-list)
|
||||
|
||||
;; add the totals
|
||||
@ -644,7 +644,7 @@ totals to report currency")
|
||||
document
|
||||
(gnc:make-html-text
|
||||
(_ "No valid account selected. Click on the Options button and select the account to use."))))
|
||||
(gnc:free-query query)
|
||||
(qof-query-destroy query)
|
||||
(gnc:report-finished)
|
||||
document))
|
||||
|
||||
|
@ -28,74 +28,72 @@
|
||||
(gnc:module-load "gnucash/report/standard-reports" 0)
|
||||
(gnc:module-load "gnucash/business-utils" 0)
|
||||
|
||||
;; this defines gnc:url-type-ownerreport and pulls in gnome-utils
|
||||
;; to define gnc:html-build-url
|
||||
;; this defines URL-TYPE-OWNERREPORT and pulls in gnome-utils
|
||||
;; to define gnc-build-url
|
||||
(gnc:module-load "gnucash/business-gnome" 0)
|
||||
|
||||
(define gnc:menuname-business-reports (N_ "_Business"))
|
||||
|
||||
(define (guid-ref idstr type guid)
|
||||
(gnc:html-build-url type (string-append idstr guid) #f))
|
||||
(gnc-build-url type (string-append idstr guid) ""))
|
||||
|
||||
(define (gnc:customer-anchor-text customer)
|
||||
(guid-ref "customer=" gnc:url-type-customer (gnc:customer-get-guid customer)))
|
||||
(guid-ref "customer=" URL-TYPE-CUSTOMER (gncCustomerReturnGUID customer)))
|
||||
|
||||
(define (gnc:job-anchor-text job)
|
||||
(guid-ref "job=" gnc:url-type-job (gnc:job-get-guid job)))
|
||||
(guid-ref "job=" URL-TYPE-JOB (gncJobReturnGUID job)))
|
||||
|
||||
(define (gnc:vendor-anchor-text vendor)
|
||||
(guid-ref "vendor=" gnc:url-type-vendor (gnc:vendor-get-guid vendor)))
|
||||
(guid-ref "vendor=" URL-TYPE-VENDOR (gncVendorReturnGUID vendor)))
|
||||
|
||||
(define (gnc:employee-anchor-text employee)
|
||||
(guid-ref "employee=" gnc:url-type-employee (gnc:employee-get-guid employee)))
|
||||
(guid-ref "employee=" URL-TYPE-EMPLOYEE (gncEmployeeReturnGUID employee)))
|
||||
|
||||
(define (gnc:invoice-anchor-text invoice)
|
||||
(guid-ref "invoice=" gnc:url-type-invoice (gnc:invoice-get-guid invoice)))
|
||||
(guid-ref "invoice=" URL-TYPE-INVOICE (gncInvoiceReturnGUID invoice)))
|
||||
|
||||
(define (gnc:owner-anchor-text owner)
|
||||
(let ((type (gw:enum-<gnc:GncOwnerType>-val->sym
|
||||
(gnc:owner-get-type (gnc:owner-get-end-owner owner)) #f)))
|
||||
(case type
|
||||
((gnc-owner-customer)
|
||||
(gnc:customer-anchor-text (gnc:owner-get-customer owner)))
|
||||
(let ((type (gncOwnerGetType (gncOwnerGetEndOwner owner))))
|
||||
(cond
|
||||
((eqv? type GNC-OWNER-CUSTOMER)
|
||||
(gnc:customer-anchor-text (gncOwnerGetCustomer owner)))
|
||||
|
||||
((gnc-owner-vendor)
|
||||
(gnc:vendor-anchor-text (gnc:owner-get-vendor owner)))
|
||||
((eqv? type GNC-OWNER-VENDOR)
|
||||
(gnc:vendor-anchor-text (gncOwnerGetVendor owner)))
|
||||
|
||||
((gnc-owner-employee)
|
||||
(gnc:employee-anchor-text (gnc:owner-get-employee owner)))
|
||||
((eqv? type GNC-OWNER-EMPLOYEE)
|
||||
(gnc:employee-anchor-text (gncOwnerGetEmployee owner)))
|
||||
|
||||
((gnc-owner-job)
|
||||
(gnc:job-anchor-text (gnc:owner-get-job owner)))
|
||||
((eqv? type GNC-OWNER-JOB)
|
||||
(gnc:job-anchor-text (gncOwnerGetJob owner)))
|
||||
|
||||
(else
|
||||
""))))
|
||||
|
||||
(define (gnc:owner-report-text owner acc)
|
||||
(let* ((end-owner (gnc:owner-get-end-owner owner))
|
||||
(type (gw:enum-<gnc:GncOwnerType>-val->sym
|
||||
(gnc:owner-get-type end-owner) #f))
|
||||
(let* ((end-owner (gncOwnerGetEndOwner owner))
|
||||
(type (gncOwnerGetType end-owner))
|
||||
(ref #f))
|
||||
|
||||
(case type
|
||||
((gnc-owner-customer)
|
||||
(cond
|
||||
((eqv? type GNC-OWNER-CUSTOMER)
|
||||
(set! ref "owner=c:"))
|
||||
|
||||
((gnc-owner-vendor)
|
||||
((eqv? type GNC-OWNER-VENDOR)
|
||||
(set! ref "owner=v:"))
|
||||
|
||||
((gnc-owner-employee)
|
||||
((eqv? type GNC-OWNER-EMPLOYEE)
|
||||
(set! ref "owner=e:"))
|
||||
|
||||
(else (set! ref "unknown-type=")))
|
||||
|
||||
(if ref
|
||||
(begin
|
||||
(set! ref (string-append ref (gnc:owner-get-guid end-owner)))
|
||||
(set! ref (string-append ref (gncOwnerReturnGUID end-owner)))
|
||||
(if acc
|
||||
(set! ref (string-append ref "&acct="
|
||||
(gnc:account-get-guid acc))))
|
||||
(gnc:html-build-url gnc:url-type-ownerreport ref #f))
|
||||
(gncAccountGetGUID acc))))
|
||||
(gnc-build-url URL-TYPE-OWNERREPORT ref ""))
|
||||
ref)))
|
||||
|
||||
(export gnc:menuname-business-reports)
|
||||
|
@ -142,7 +142,7 @@
|
||||
(val (cdr item))
|
||||
(ref (hash-ref hash acct)))
|
||||
|
||||
(hash-set! hash acct (if ref (gnc:numeric-add-fixed ref val) val))))
|
||||
(hash-set! hash acct (if ref (gnc-numeric-add-fixed ref val) val))))
|
||||
values))
|
||||
|
||||
|
||||
@ -167,54 +167,54 @@
|
||||
(let* ((row-contents '())
|
||||
(entry-value (gnc:make-gnc-monetary
|
||||
currency
|
||||
(gnc:entry-get-value entry invoice?)))
|
||||
(gncEntryReturnValue entry invoice?)))
|
||||
(entry-tax-value (gnc:make-gnc-monetary
|
||||
currency
|
||||
(gnc:entry-get-tax-value entry invoice?))))
|
||||
(gncEntryReturnTaxValue entry invoice?))))
|
||||
|
||||
(if (date-col column-vector)
|
||||
(addto! row-contents
|
||||
(gnc:print-date (gnc:entry-get-date entry))))
|
||||
(gnc-print-date (gncEntryGetDate entry))))
|
||||
|
||||
(if (description-col column-vector)
|
||||
(addto! row-contents
|
||||
(gnc:entry-get-description entry)))
|
||||
(gncEntryGetDescription entry)))
|
||||
|
||||
(if (action-col column-vector)
|
||||
(addto! row-contents
|
||||
(gnc:entry-get-action entry)))
|
||||
(gncEntryGetAction entry)))
|
||||
|
||||
(if (quantity-col column-vector)
|
||||
(addto! row-contents
|
||||
(gnc:make-html-table-cell/markup
|
||||
"number-cell"
|
||||
(gnc:entry-get-quantity entry))))
|
||||
(gncEntryGetQuantity entry))))
|
||||
|
||||
(if (price-col column-vector)
|
||||
(addto! row-contents
|
||||
(gnc:make-html-table-cell/markup
|
||||
"number-cell"
|
||||
(gnc:make-gnc-monetary
|
||||
currency (if invoice? (gnc:entry-get-inv-price entry)
|
||||
(gnc:entry-get-bill-price entry))))))
|
||||
currency (if invoice? (gncEntryGetInvPrice entry)
|
||||
(gncEntryGetBillPrice entry))))))
|
||||
|
||||
(if (discount-col column-vector)
|
||||
(addto! row-contents
|
||||
(if invoice?
|
||||
(gnc:make-html-table-cell/markup
|
||||
"number-cell"
|
||||
(monetary-or-percent (gnc:entry-get-inv-discount entry)
|
||||
(monetary-or-percent (gncEntryGetInvDiscount entry)
|
||||
currency
|
||||
(gnc:entry-get-inv-discount-type entry)))
|
||||
(gncEntryGetInvDiscountType entry)))
|
||||
"")))
|
||||
|
||||
(if (tax-col column-vector)
|
||||
(addto! row-contents
|
||||
(if (if invoice?
|
||||
(and (gnc:entry-get-inv-taxable entry)
|
||||
(gnc:entry-get-inv-tax-table entry))
|
||||
(and (gnc:entry-get-bill-taxable entry)
|
||||
(gnc:entry-get-bill-tax-table entry)))
|
||||
(and (gncEntryGetInvTaxable entry)
|
||||
(gncEntryGetInvTaxTable entry))
|
||||
(and (gncEntryGetBillTaxable entry)
|
||||
(gncEntryGetBillTaxTable entry)))
|
||||
;; This "T" is supposed to be an abbrev. for Tax?
|
||||
(_ "T") "")))
|
||||
|
||||
@ -244,7 +244,7 @@
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-invoice-option invoice-page invoice-name "x" ""
|
||||
(lambda () #f) #f))
|
||||
(lambda () '()) #f))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
@ -376,9 +376,9 @@
|
||||
|
||||
(let ((show-payments (opt-val "Display" "Payments"))
|
||||
(display-all-taxes (opt-val "Display" "Individual Taxes"))
|
||||
(lot (gnc:invoice-get-posted-lot invoice))
|
||||
(txn (gnc:invoice-get-posted-txn invoice))
|
||||
(currency (gnc:invoice-get-currency invoice)))
|
||||
(lot (gncInvoiceGetPostedLot invoice))
|
||||
(txn (gncInvoiceGetPostedTxn invoice))
|
||||
(currency (gncInvoiceGetCurrency invoice)))
|
||||
|
||||
(define (colspan monetary used-columns)
|
||||
(cond
|
||||
@ -391,7 +391,7 @@
|
||||
monetary
|
||||
(let ((amt (gnc:gnc-monetary-amount monetary)))
|
||||
(if amt
|
||||
(if (gnc:numeric-negative-p amt)
|
||||
(if (gnc-numeric-negative-p amt)
|
||||
(gnc:monetary-neg monetary)
|
||||
monetary)
|
||||
monetary))))
|
||||
@ -415,10 +415,10 @@
|
||||
currency-totals)))
|
||||
|
||||
(define (add-payment-row table used-columns split total-collector)
|
||||
(let* ((t (gnc:split-get-parent split))
|
||||
(currency (gnc:transaction-get-currency t))
|
||||
(let* ((t (xaccSplitGetParent split))
|
||||
(currency (xaccTransGetCurrency t))
|
||||
;; XXX Need to know when to reverse the value
|
||||
(amt (gnc:make-gnc-monetary currency (gnc:split-get-value split)))
|
||||
(amt (gnc:make-gnc-monetary currency (xaccSplitGetValue split)))
|
||||
(payment-style "grand-total")
|
||||
(row '()))
|
||||
|
||||
@ -428,7 +428,7 @@
|
||||
|
||||
(if (date-col used-columns)
|
||||
(addto! row
|
||||
(gnc:print-date (gnc:transaction-get-date-posted t))))
|
||||
(gnc-print-date (gnc-transaction-get-date-posted t))))
|
||||
|
||||
(if (description-col used-columns)
|
||||
(addto! row (_ "Payment, thank you")))
|
||||
@ -462,8 +462,8 @@
|
||||
(hash-for-each
|
||||
(lambda (acct value)
|
||||
(let ((collector (gnc:make-commodity-collector))
|
||||
(commodity (gnc:account-get-commodity acct))
|
||||
(name (gnc:account-get-name acct)))
|
||||
(commodity (xaccAccountGetCommodity acct))
|
||||
(name (xaccAccountGetName acct)))
|
||||
(collector 'add commodity value)
|
||||
(add-subtotal-row table used-columns collector
|
||||
"grand-total" name)))
|
||||
@ -475,14 +475,14 @@
|
||||
|
||||
(if (and show-payments lot)
|
||||
(let ((splits (sort-list!
|
||||
(gnc:lot-get-splits lot)
|
||||
(gnc-lot-get-split-list lot)
|
||||
(lambda (s1 s2)
|
||||
(let ((t1 (gnc:split-get-parent s1))
|
||||
(t2 (gnc:split-get-parent s2)))
|
||||
(< (gnc:transaction-order t1 t2) 0))))))
|
||||
(let ((t1 (xaccSplitGetParent s1))
|
||||
(t2 (xaccSplitGetParent s2)))
|
||||
(< (xaccTransOrder t1 t2) 0))))))
|
||||
(for-each
|
||||
(lambda (split)
|
||||
(if (not (equal? (gnc:split-get-parent split) txn))
|
||||
(if (not (equal? (xaccSplitGetParent split) txn))
|
||||
(add-payment-row table used-columns
|
||||
split total-collector)))
|
||||
splits)))
|
||||
@ -506,7 +506,7 @@
|
||||
invoice?)))
|
||||
|
||||
(if display-all-taxes
|
||||
(let ((tax-list (gnc:entry-get-tax-values current invoice?)))
|
||||
(let ((tax-list (gncEntryReturnTaxValues current invoice?)))
|
||||
(update-account-hash acct-hash tax-list))
|
||||
(tax-collector 'add
|
||||
(gnc:gnc-monetary-commodity (cdr entry-values))
|
||||
@ -539,7 +539,7 @@
|
||||
(let* ((table (gnc:make-html-table))
|
||||
(used-columns (build-column-used options))
|
||||
(width (num-columns-required used-columns))
|
||||
(entries (gnc:invoice-get-entries invoice))
|
||||
(entries (gncInvoiceGetEntries invoice))
|
||||
(totals (gnc:make-commodity-collector)))
|
||||
|
||||
(gnc:html-table-set-col-headers!
|
||||
@ -591,7 +591,7 @@
|
||||
(list "<br>"))
|
||||
(for-each
|
||||
(lambda (order)
|
||||
(let* ((reference (gnc:order-get-reference order)))
|
||||
(let* ((reference (gncOrderGetReference order)))
|
||||
(if (and reference (> (string-length reference) 0))
|
||||
(gnc:html-table-append-row!
|
||||
table
|
||||
@ -609,7 +609,7 @@
|
||||
table
|
||||
(list
|
||||
(string-append label ": ")
|
||||
(string-expand (gnc:print-date date) #\space " "))))
|
||||
(string-expand (gnc-print-date date) #\space " "))))
|
||||
|
||||
(define (make-date-table)
|
||||
(let ((table (gnc:make-html-table)))
|
||||
@ -624,11 +624,11 @@
|
||||
|
||||
(define (make-myname-table book)
|
||||
(let* ((table (gnc:make-html-table))
|
||||
(slots (gnc:book-get-slots book))
|
||||
(name (gnc:kvp-frame-get-slot-path
|
||||
(slots (gnc-book-get-slots book))
|
||||
(name (kvp-frame-get-slot-path-gslist
|
||||
slots (append gnc:*kvp-option-path*
|
||||
(list gnc:*business-label* gnc:*company-name*))))
|
||||
(addy (gnc:kvp-frame-get-slot-path
|
||||
(addy (kvp-frame-get-slot-path-gslist
|
||||
slots (append gnc:*kvp-option-path*
|
||||
(list gnc:*business-label* gnc:*company-addy*)))))
|
||||
|
||||
@ -674,7 +674,7 @@
|
||||
(table '())
|
||||
(orders '())
|
||||
(invoice (opt-val invoice-page invoice-name))
|
||||
(owner #f)
|
||||
(owner '())
|
||||
(references? (opt-val "Display" "References"))
|
||||
(title (_ "Invoice"))
|
||||
(invoice? #f))
|
||||
@ -685,19 +685,18 @@
|
||||
|
||||
(if invoice
|
||||
(begin
|
||||
(set! owner (gnc:invoice-get-owner invoice))
|
||||
(let ((type (gw:enum-<gnc:GncOwnerType>-val->sym
|
||||
(gnc:owner-get-type
|
||||
(gnc:owner-get-end-owner owner)) #f)))
|
||||
(case type
|
||||
((gnc-owner-customer)
|
||||
(set! owner (gncInvoiceGetOwner invoice))
|
||||
(let ((type (gncOwnerGetType
|
||||
(gncOwnerGetEndOwner owner))))
|
||||
(cond
|
||||
((eqv? type GNC-OWNER-CUSTOMER)
|
||||
(set! invoice? #t))
|
||||
((gnc-owner-vendor)
|
||||
((eqv? type GNC-OWNER-VENDOR)
|
||||
(set! title (_ "Bill")))
|
||||
((gnc-owner-employee)
|
||||
((eqv? type GNC-OWNER-EMPLOYEE)
|
||||
(set! title (_ "Expense Voucher")))))
|
||||
(set! title (sprintf #f (_"%s #%d") title
|
||||
(gnc:invoice-get-id invoice)))))
|
||||
(gncInvoiceGetID invoice)))))
|
||||
|
||||
; (gnc:html-document-set-title! document title)
|
||||
|
||||
@ -715,14 +714,14 @@
|
||||
(add-html! document "<td align='left'>")
|
||||
(add-html! document "<b><u>")
|
||||
(add-html! document (sprintf #f (_ "Invoice #%d")
|
||||
(gnc:invoice-get-id invoice)))
|
||||
(gncInvoiceGetID invoice)))
|
||||
(add-html! document "</u></b></td>")
|
||||
(add-html! document "<td align='right'>")
|
||||
|
||||
(if (opt-val "Display" "My Company ID")
|
||||
(let* ((book (gnc:invoice-get-book invoice))
|
||||
(slots (gnc:book-get-slots book))
|
||||
(taxid (gnc:kvp-frame-get-slot-path
|
||||
(let* ((book (gncInvoiceGetBook invoice))
|
||||
(slots (gnc-book-get-slots book))
|
||||
(taxid (kvp-frame-get-slot-path-gslist
|
||||
slots (append gnc:*kvp-option-path*
|
||||
(list gnc:*business-label* gnc:*company-id*)))))
|
||||
(if (and taxid (> (string-length taxid) 0))
|
||||
@ -738,7 +737,7 @@
|
||||
(make-break! document)
|
||||
|
||||
; add the client and company name table
|
||||
(let ((book (gnc:invoice-get-book invoice)))
|
||||
(let ((book (gncInvoiceGetBook invoice)))
|
||||
(set! table (make-entry-table invoice
|
||||
(gnc:report-options report-obj)
|
||||
add-order invoice?))
|
||||
@ -760,9 +759,8 @@
|
||||
)
|
||||
|
||||
; add the date
|
||||
(let ((date-table #f)
|
||||
(post-date (gnc:invoice-get-date-posted invoice))
|
||||
(due-date (gnc:invoice-get-date-due invoice)))
|
||||
(let ((post-date (gncInvoiceGetDatePosted invoice))
|
||||
(due-date (gncInvoiceGetDateDue invoice)))
|
||||
(if (not (equal? post-date (cons 0 0)))
|
||||
(begin
|
||||
(add-html! document "<table border=0><tr>")
|
||||
@ -770,7 +768,7 @@
|
||||
(add-html! document "Date: ")
|
||||
(add-html! document "</td>")
|
||||
(add-html! document "<td>")
|
||||
(add-html! document (gnc:print-date post-date))
|
||||
(add-html! document (gnc-print-date post-date))
|
||||
(add-html! document "</td>")
|
||||
(if (opt-val "Display" "Due Date")
|
||||
(begin
|
||||
@ -778,7 +776,7 @@
|
||||
(add-html! document "Due: ")
|
||||
(add-html! document "</td>")
|
||||
(add-html! document "<td>")
|
||||
(add-html! document (gnc:print-date due-date))
|
||||
(add-html! document (gnc-print-date due-date))
|
||||
(add-html! document "</td>")))
|
||||
(add-html! document "</tr></table>"))
|
||||
(add-html! document
|
||||
@ -791,7 +789,7 @@
|
||||
(make-break! document)
|
||||
|
||||
(if (opt-val "Display" "Billing ID")
|
||||
(let ((billing-id (gnc:invoice-get-billing-id invoice)))
|
||||
(let ((billing-id (gncInvoiceGetBillingID invoice)))
|
||||
(if (and billing-id (> (string-length billing-id) 0))
|
||||
(begin
|
||||
(gnc:html-document-add-object!
|
||||
@ -803,8 +801,8 @@
|
||||
(make-break! document)))))
|
||||
|
||||
(if (opt-val "Display" "Billing Terms")
|
||||
(let* ((term (gnc:invoice-get-terms invoice))
|
||||
(terms (gnc:bill-term-get-description term)))
|
||||
(let* ((term (gncInvoiceGetTerms invoice))
|
||||
(terms (gncBillTermGetDescription term)))
|
||||
(if (and terms (> (string-length terms) 0))
|
||||
(gnc:html-document-add-object!
|
||||
document
|
||||
@ -829,7 +827,7 @@
|
||||
|
||||
(if (opt-val "Display" "Invoice Notes")
|
||||
(begin
|
||||
(let ((notes (gnc:invoice-get-notes invoice)))
|
||||
(let ((notes (gncInvoiceGetNotes invoice)))
|
||||
(gnc:html-document-add-object!
|
||||
document
|
||||
(gnc:make-html-text
|
||||
|
@ -160,7 +160,7 @@
|
||||
(val (cdr item))
|
||||
(ref (hash-ref hash acct)))
|
||||
|
||||
(hash-set! hash acct (if ref (gnc:numeric-add-fixed ref val) val))))
|
||||
(hash-set! hash acct (if ref (gnc-numeric-add-fixed ref val) val))))
|
||||
values))
|
||||
|
||||
(define (monetary-or-percent numeric currency entry-type)
|
||||
@ -173,54 +173,54 @@
|
||||
(let* ((row-contents '())
|
||||
(entry-value (gnc:make-gnc-monetary
|
||||
currency
|
||||
(gnc:entry-get-value entry invoice?)))
|
||||
(gncEntryReturnValue entry invoice?)))
|
||||
(entry-tax-value (gnc:make-gnc-monetary
|
||||
currency
|
||||
(gnc:entry-get-tax-value entry invoice?))))
|
||||
(gncEntryReturnTaxValue entry invoice?))))
|
||||
|
||||
(if (date-col column-vector)
|
||||
(addto! row-contents
|
||||
(gnc:print-date (gnc:entry-get-date entry))))
|
||||
(gnc-print-date (gncEntryGetDate entry))))
|
||||
|
||||
(if (description-col column-vector)
|
||||
(addto! row-contents
|
||||
(gnc:entry-get-description entry)))
|
||||
(gncEntryGetDescription entry)))
|
||||
|
||||
(if (action-col column-vector)
|
||||
(addto! row-contents
|
||||
(gnc:entry-get-action entry)))
|
||||
(gncEntryGetAction entry)))
|
||||
|
||||
(if (quantity-col column-vector)
|
||||
(addto! row-contents
|
||||
(gnc:make-html-table-cell/markup
|
||||
"number-cell"
|
||||
(gnc:entry-get-quantity entry))))
|
||||
(gncEntryGetQuantity entry))))
|
||||
|
||||
(if (price-col column-vector)
|
||||
(addto! row-contents
|
||||
(gnc:make-html-table-cell/markup
|
||||
"number-cell"
|
||||
(gnc:make-gnc-monetary
|
||||
currency (if invoice? (gnc:entry-get-inv-price entry)
|
||||
(gnc:entry-get-bill-price entry))))))
|
||||
currency (if invoice? (gncEntryGetInvPrice entry)
|
||||
(gncEntryGetBillPrice entry))))))
|
||||
|
||||
(if (discount-col column-vector)
|
||||
(addto! row-contents
|
||||
(if invoice?
|
||||
(gnc:make-html-table-cell/markup
|
||||
"number-cell"
|
||||
(monetary-or-percent (gnc:entry-get-inv-discount entry)
|
||||
(monetary-or-percent (gncEntryGetInvDiscount entry)
|
||||
currency
|
||||
(gnc:entry-get-inv-discount-type entry)))
|
||||
(gncEntryGetInvDiscountType entry)))
|
||||
"")))
|
||||
|
||||
(if (tax-col column-vector)
|
||||
(addto! row-contents
|
||||
(if (if invoice?
|
||||
(and (gnc:entry-get-inv-taxable entry)
|
||||
(gnc:entry-get-inv-tax-table entry))
|
||||
(and (gnc:entry-get-bill-taxable entry)
|
||||
(gnc:entry-get-bill-tax-table entry)))
|
||||
(and (gncEntryGetInvTaxable entry)
|
||||
(gncEntryGetInvTaxTable entry))
|
||||
(and (gncEntryGetBillTaxable entry)
|
||||
(gncEntryGetBillTaxTable entry)))
|
||||
(_ "T") "")))
|
||||
|
||||
(if (taxvalue-col column-vector)
|
||||
@ -251,7 +251,7 @@
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-invoice-option invoice-page invoice-name "x" ""
|
||||
(lambda () #f) #f))
|
||||
(lambda () '()) #f))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
@ -349,7 +349,7 @@
|
||||
(gnc:make-complex-boolean-option
|
||||
(N_ "Display") (N_ "Payable to")
|
||||
"ua1" (N_ "Display the Payable to: information") #t #f
|
||||
(lambda (x) (gnc:option-db-set-option-selectable-by-name
|
||||
(lambda (x) (gnc-option-db-set-option-selectable-by-name
|
||||
gnc:*report-options* "Display" "Payable to string" x))))
|
||||
|
||||
(gnc:register-inv-option
|
||||
@ -362,7 +362,7 @@
|
||||
(gnc:make-complex-boolean-option
|
||||
(N_ "Display") (N_ "Company contact")
|
||||
"ub1" (N_ "Display the Company contact information") #t #f
|
||||
(lambda (x) (gnc:option-db-set-option-selectable-by-name
|
||||
(lambda (x) (gnc-option-db-set-option-selectable-by-name
|
||||
gnc:*report-options* "Display" "Company contact string" x))))
|
||||
|
||||
(gnc:register-inv-option
|
||||
@ -389,9 +389,9 @@
|
||||
|
||||
(let ((show-payments (opt-val "Display" "Payments"))
|
||||
(display-all-taxes (opt-val "Display" "Individual Taxes"))
|
||||
(lot (gnc:invoice-get-posted-lot invoice))
|
||||
(txn (gnc:invoice-get-posted-txn invoice))
|
||||
(currency (gnc:invoice-get-currency invoice))
|
||||
(lot (gncInvoiceGetPostedLot invoice))
|
||||
(txn (gncInvoiceGetPostedTxn invoice))
|
||||
(currency (gncInvoiceGetCurrency invoice))
|
||||
(entries-added 0))
|
||||
|
||||
(define (colspan monetary used-columns)
|
||||
@ -405,7 +405,7 @@
|
||||
monetary
|
||||
(let ((amt (gnc:gnc-monetary-amount monetary)))
|
||||
(if amt
|
||||
(if (gnc:numeric-negative-p amt)
|
||||
(if (gnc-numeric-negative-p amt)
|
||||
(gnc:monetary-neg monetary)
|
||||
monetary)
|
||||
monetary))))
|
||||
@ -432,10 +432,10 @@
|
||||
currency-totals)))
|
||||
|
||||
(define (add-payment-row table used-columns split total-collector)
|
||||
(let* ((t (gnc:split-get-parent split))
|
||||
(currency (gnc:transaction-get-currency t))
|
||||
(let* ((t (xaccSplitGetParent split))
|
||||
(currency (xaccTransGetCurrency t))
|
||||
;; XXX Need to know when to reverse the value
|
||||
(amt (gnc:make-gnc-monetary currency (gnc:split-get-value split)))
|
||||
(amt (gnc:make-gnc-monetary currency (xaccSplitGetValue split)))
|
||||
(payment-style "grand-total")
|
||||
(row '()))
|
||||
|
||||
@ -445,7 +445,7 @@
|
||||
|
||||
(if (date-col used-columns)
|
||||
(addto! row
|
||||
(gnc:print-date (gnc:transaction-get-date-posted t))))
|
||||
(gnc-print-date (gnc-transaction-get-date-posted t))))
|
||||
|
||||
(if (description-col used-columns)
|
||||
(addto! row (_ "Payment, thank you")))
|
||||
@ -488,8 +488,8 @@
|
||||
(hash-for-each
|
||||
(lambda (acct value)
|
||||
(let ((collector (gnc:make-commodity-collector))
|
||||
(commodity (gnc:account-get-commodity acct))
|
||||
(name (gnc:account-get-name acct)))
|
||||
(commodity (xaccAccountGetCommodity acct))
|
||||
(name (xaccAccountGetName acct)))
|
||||
(collector 'add commodity value)
|
||||
(add-subtotal-row table used-columns collector
|
||||
"grand-total" (string-expand
|
||||
@ -502,14 +502,14 @@
|
||||
|
||||
(if (and show-payments lot)
|
||||
(let ((splits (sort-list!
|
||||
(gnc:lot-get-splits lot)
|
||||
(gnc-lot-get-split-list lot)
|
||||
(lambda (s1 s2)
|
||||
(let ((t1 (gnc:split-get-parent s1))
|
||||
(t2 (gnc:split-get-parent s2)))
|
||||
(< (gnc:transaction-order t1 t2) 0))))))
|
||||
(let ((t1 (xaccSplitGetParent s1))
|
||||
(t2 (xaccSplitGetParent s2)))
|
||||
(< (xaccTransOrder t1 t2) 0))))))
|
||||
(for-each
|
||||
(lambda (split)
|
||||
(if (not (equal? (gnc:split-get-parent split) txn))
|
||||
(if (not (equal? (xaccSplitGetParent split) txn))
|
||||
(add-payment-row table used-columns
|
||||
split total-collector)))
|
||||
splits)))
|
||||
@ -534,7 +534,7 @@
|
||||
invoice?)))
|
||||
|
||||
(if display-all-taxes
|
||||
(let ((tax-list (gnc:entry-get-tax-values current invoice?)))
|
||||
(let ((tax-list (gncEntryReturnTaxValues current invoice?)))
|
||||
(update-account-hash acct-hash tax-list))
|
||||
(tax-collector 'add
|
||||
(gnc:gnc-monetary-commodity (cdr entry-values))
|
||||
@ -569,7 +569,7 @@
|
||||
(let* ((table (gnc:make-html-table))
|
||||
(used-columns (build-column-used options))
|
||||
(width (num-columns-required used-columns))
|
||||
(entries (gnc:invoice-get-entries invoice))
|
||||
(entries (gncInvoiceGetEntries invoice))
|
||||
(totals (gnc:make-commodity-collector)))
|
||||
|
||||
(gnc:html-table-set-col-headers!
|
||||
@ -628,7 +628,7 @@
|
||||
(list "<br>"))
|
||||
(for-each
|
||||
(lambda (order)
|
||||
(let* ((reference (gnc:order-get-reference order)))
|
||||
(let* ((reference (gncOrderGetReference order)))
|
||||
(if (and reference (> (string-length reference) 0))
|
||||
(gnc:html-table-append-row!
|
||||
table
|
||||
@ -649,7 +649,7 @@
|
||||
;; for the invoice date/due date fields
|
||||
;; I could have taken the format from the report options, but... ;)
|
||||
(string-expand (strftime "%B %e, %Y" (localtime (car date))) #\space " ")
|
||||
;;(string-expand (gnc:print-date date) #\space " ")
|
||||
;;(string-expand (gnc-print-date date) #\space " ")
|
||||
)))
|
||||
|
||||
(define (make-date-table)
|
||||
@ -665,26 +665,26 @@
|
||||
|
||||
(define (make-myname-table book date-format)
|
||||
(let* ((table (gnc:make-html-table))
|
||||
(slots (gnc:book-get-slots book))
|
||||
(name (gnc:kvp-frame-get-slot-path
|
||||
(slots (gnc-book-get-slots book))
|
||||
(name (kvp-frame-get-slot-path-gslist
|
||||
slots (append gnc:*kvp-option-path*
|
||||
(list gnc:*business-label* gnc:*company-name*))))
|
||||
;; (contact (gnc:kvp-frame-get-slot-path
|
||||
;; (contact (kvp-frame-get-slot-path-gslist
|
||||
;; slots (append gnc:*kvp-option-path*
|
||||
;; (list gnc:*business-label* gnc:*company-contact*))))
|
||||
(addy (gnc:kvp-frame-get-slot-path
|
||||
(addy (kvp-frame-get-slot-path-gslist
|
||||
slots (append gnc:*kvp-option-path*
|
||||
(list gnc:*business-label* gnc:*company-addy*))))
|
||||
(id (gnc:kvp-frame-get-slot-path
|
||||
(id (kvp-frame-get-slot-path-gslist
|
||||
slots (append gnc:*kvp-option-path*
|
||||
(list gnc:*business-label* gnc:*company-id*))))
|
||||
(phone (gnc:kvp-frame-get-slot-path
|
||||
(phone (kvp-frame-get-slot-path-gslist
|
||||
slots (append gnc:*kvp-option-path*
|
||||
(list gnc:*business-label* gnc:*company-phone*))))
|
||||
(fax (gnc:kvp-frame-get-slot-path
|
||||
(fax (kvp-frame-get-slot-path-gslist
|
||||
slots (append gnc:*kvp-option-path*
|
||||
(list gnc:*business-label* gnc:*company-fax*))))
|
||||
(url (gnc:kvp-frame-get-slot-path
|
||||
(url (kvp-frame-get-slot-path-gslist
|
||||
slots (append gnc:*kvp-option-path*
|
||||
(list gnc:*business-label* gnc:*company-url*))))
|
||||
(invoice-cell (gnc:make-html-table-cell))
|
||||
@ -757,7 +757,7 @@
|
||||
(table '())
|
||||
(orders '())
|
||||
(invoice (opt-val invoice-page invoice-name))
|
||||
(owner #f)
|
||||
(owner '())
|
||||
(references? (opt-val "Display" "References"))
|
||||
(title (_ "Invoice"))
|
||||
(invoice? #f))
|
||||
@ -768,26 +768,25 @@
|
||||
|
||||
(if invoice
|
||||
(begin
|
||||
(set! owner (gnc:invoice-get-owner invoice))
|
||||
(let ((type (gw:enum-<gnc:GncOwnerType>-val->sym
|
||||
(gnc:owner-get-type
|
||||
(gnc:owner-get-end-owner owner)) #f)))
|
||||
(case type
|
||||
((gnc-owner-customer)
|
||||
(set! owner (gncInvoiceGetOwner invoice))
|
||||
(let ((type (gncOwnerGetType
|
||||
(gncOwnerGetEndOwner owner))))
|
||||
(cond
|
||||
((eqv? type GNC-OWNER-CUSTOMER)
|
||||
(set! invoice? #t))
|
||||
((gnc-owner-vendor)
|
||||
((eqv? type GNC-OWNER-VENDOR)
|
||||
(set! title (_ "Bill")))
|
||||
((gnc-owner-employee)
|
||||
((eqv? type GNC-OWNER-EMPLOYEE)
|
||||
(set! title (_ "Expense Voucher")))))
|
||||
(set! title (sprintf #f (_"%s #%d") title
|
||||
(gnc:invoice-get-id invoice)))))
|
||||
(gncInvoiceGetID invoice)))))
|
||||
;; oli-custom - title redundant, "Invoice" moved to myname-table,
|
||||
;; invoice number moved below
|
||||
;;(gnc:html-document-set-title! document title)
|
||||
|
||||
(if invoice
|
||||
(let* ((book (gnc:invoice-get-book invoice))
|
||||
(slots (gnc:book-get-slots book))
|
||||
(let* ((book (gncInvoiceGetBook invoice))
|
||||
(slots (gnc-book-get-slots book))
|
||||
(date-object #f)
|
||||
(helper-table (gnc:make-html-table)))
|
||||
(set! table (make-entry-table invoice
|
||||
@ -835,8 +834,8 @@
|
||||
'attribute (list "width" "100%"))
|
||||
|
||||
(set! date-object (let ((date-table #f)
|
||||
(post-date (gnc:invoice-get-date-posted invoice))
|
||||
(due-date (gnc:invoice-get-date-due invoice)))
|
||||
(post-date (gncInvoiceGetDatePosted invoice))
|
||||
(due-date (gncInvoiceGetDateDue invoice)))
|
||||
|
||||
(if (not (equal? post-date (cons 0 0)))
|
||||
(begin
|
||||
@ -844,7 +843,7 @@
|
||||
;; oli-custom - moved invoice number here
|
||||
(gnc:html-table-append-row!
|
||||
date-table (list (sprintf #f (_ "Invoice # %d")
|
||||
(gnc:invoice-get-id invoice))))
|
||||
(gncInvoiceGetID invoice))))
|
||||
(make-date-row! date-table (_ "Invoice Date") post-date)
|
||||
(make-date-row! date-table (_ "Due Date") due-date)
|
||||
date-table)
|
||||
@ -876,7 +875,7 @@
|
||||
(make-break! document)
|
||||
|
||||
(if (opt-val "Display" "Billing ID")
|
||||
(let ((billing-id (gnc:invoice-get-billing-id invoice)))
|
||||
(let ((billing-id (gncInvoiceGetBillingID invoice)))
|
||||
(if (and billing-id (> (string-length billing-id) 0))
|
||||
(begin
|
||||
(gnc:html-document-add-object!
|
||||
@ -888,8 +887,8 @@
|
||||
(make-break! document)))))
|
||||
|
||||
(if (opt-val "Display" "Billing Terms")
|
||||
(let* ((term (gnc:invoice-get-terms invoice))
|
||||
(terms (gnc:bill-term-get-description term)))
|
||||
(let* ((term (gncInvoiceGetTerms invoice))
|
||||
(terms (gncBillTermGetDescription term)))
|
||||
(if (and terms (> (string-length terms) 0))
|
||||
(gnc:html-document-add-object!
|
||||
document
|
||||
@ -906,7 +905,7 @@
|
||||
(make-break! document)
|
||||
|
||||
(if (opt-val "Display" "Invoice Notes")
|
||||
(let ((notes (gnc:invoice-get-notes invoice)))
|
||||
(let ((notes (gncInvoiceGetNotes invoice)))
|
||||
(gnc:html-document-add-object!
|
||||
document
|
||||
(gnc:make-html-text
|
||||
@ -915,7 +914,7 @@
|
||||
(make-break! document)
|
||||
|
||||
(if (opt-val "Display" "Payable to")
|
||||
(let* ((name (gnc:kvp-frame-get-slot-path
|
||||
(let* ((name (kvp-frame-get-slot-path-gslist
|
||||
slots (append gnc:*kvp-option-path*
|
||||
(list gnc:*business-label*
|
||||
gnc:*company-name*))))
|
||||
@ -930,7 +929,7 @@
|
||||
(make-break! document)
|
||||
|
||||
(if (opt-val "Display" "Company contact")
|
||||
(let* ((contact (gnc:kvp-frame-get-slot-path
|
||||
(let* ((contact (kvp-frame-get-slot-path-gslist
|
||||
slots (append gnc:*kvp-option-path*
|
||||
(list gnc:*business-label*
|
||||
gnc:*company-contact*))))
|
||||
|
@ -136,7 +136,7 @@
|
||||
(val (cdr item))
|
||||
(ref (hash-ref hash acct)))
|
||||
|
||||
(hash-set! hash acct (if ref (gnc:numeric-add-fixed ref val) val))))
|
||||
(hash-set! hash acct (if ref (gnc-numeric-add-fixed ref val) val))))
|
||||
values))
|
||||
|
||||
|
||||
@ -161,54 +161,54 @@
|
||||
(let* ((row-contents '())
|
||||
(entry-value (gnc:make-gnc-monetary
|
||||
currency
|
||||
(gnc:entry-get-value entry invoice?)))
|
||||
(gncEntryReturnValue entry invoice?)))
|
||||
(entry-tax-value (gnc:make-gnc-monetary
|
||||
currency
|
||||
(gnc:entry-get-tax-value entry invoice?))))
|
||||
(gncEntryReturnTaxValue entry invoice?))))
|
||||
|
||||
(if (date-col column-vector)
|
||||
(addto! row-contents
|
||||
(gnc:print-date (gnc:entry-get-date entry))))
|
||||
(gnc-print-date (gncEntryGetDate entry))))
|
||||
|
||||
(if (description-col column-vector)
|
||||
(addto! row-contents
|
||||
(gnc:entry-get-description entry)))
|
||||
(gncEntryGetDescription entry)))
|
||||
|
||||
(if (action-col column-vector)
|
||||
(addto! row-contents
|
||||
(gnc:entry-get-action entry)))
|
||||
(gncEntryGetAction entry)))
|
||||
|
||||
(if (quantity-col column-vector)
|
||||
(addto! row-contents
|
||||
(gnc:make-html-table-cell/markup
|
||||
"number-cell"
|
||||
(gnc:entry-get-quantity entry))))
|
||||
(gncEntryGetQuantity entry))))
|
||||
|
||||
(if (price-col column-vector)
|
||||
(addto! row-contents
|
||||
(gnc:make-html-table-cell/markup
|
||||
"number-cell"
|
||||
(gnc:make-gnc-monetary
|
||||
currency (if invoice? (gnc:entry-get-inv-price entry)
|
||||
(gnc:entry-get-bill-price entry))))))
|
||||
currency (if invoice? (gncEntryGetInvPrice entry)
|
||||
(gncEntryGetBillPrice entry))))))
|
||||
|
||||
(if (discount-col column-vector)
|
||||
(addto! row-contents
|
||||
(if invoice?
|
||||
(gnc:make-html-table-cell/markup
|
||||
"number-cell"
|
||||
(monetary-or-percent (gnc:entry-get-inv-discount entry)
|
||||
(monetary-or-percent (gncEntryGetInvDiscount entry)
|
||||
currency
|
||||
(gnc:entry-get-inv-discount-type entry)))
|
||||
(gncEntryGetInvDiscountType entry)))
|
||||
"")))
|
||||
|
||||
(if (tax-col column-vector)
|
||||
(addto! row-contents
|
||||
(if (if invoice?
|
||||
(and (gnc:entry-get-inv-taxable entry)
|
||||
(gnc:entry-get-inv-tax-table entry))
|
||||
(and (gnc:entry-get-bill-taxable entry)
|
||||
(gnc:entry-get-bill-tax-table entry)))
|
||||
(and (gncEntryGetInvTaxable entry)
|
||||
(gncEntryGetInvTaxTable entry))
|
||||
(and (gncEntryGetBillTaxable entry)
|
||||
(gncEntryGetBillTaxTable entry)))
|
||||
(_ "T") "")))
|
||||
|
||||
(if (taxvalue-col column-vector)
|
||||
@ -237,7 +237,7 @@
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-invoice-option invoice-page invoice-name "x" ""
|
||||
(lambda () #f) #f))
|
||||
(lambda () '()) #f))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-simple-boolean-option
|
||||
@ -342,9 +342,9 @@
|
||||
|
||||
(let ((show-payments (opt-val "Display" "Payments"))
|
||||
(display-all-taxes (opt-val "Display" "Individual Taxes"))
|
||||
(lot (gnc:invoice-get-posted-lot invoice))
|
||||
(txn (gnc:invoice-get-posted-txn invoice))
|
||||
(currency (gnc:invoice-get-currency invoice)))
|
||||
(lot (gncInvoiceGetPostedLot invoice))
|
||||
(txn (gncInvoiceGetPostedTxn invoice))
|
||||
(currency (gncInvoiceGetCurrency invoice)))
|
||||
|
||||
(define (colspan monetary used-columns)
|
||||
(cond
|
||||
@ -357,7 +357,7 @@
|
||||
monetary
|
||||
(let ((amt (gnc:gnc-monetary-amount monetary)))
|
||||
(if amt
|
||||
(if (gnc:numeric-negative-p amt)
|
||||
(if (gnc-numeric-negative-p amt)
|
||||
(gnc:monetary-neg monetary)
|
||||
monetary)
|
||||
monetary))))
|
||||
@ -381,10 +381,10 @@
|
||||
currency-totals)))
|
||||
|
||||
(define (add-payment-row table used-columns split total-collector)
|
||||
(let* ((t (gnc:split-get-parent split))
|
||||
(currency (gnc:transaction-get-currency t))
|
||||
(let* ((t (xaccSplitGetParent split))
|
||||
(currency (xaccTransGetCurrency t))
|
||||
;; XXX Need to know when to reverse the value
|
||||
(amt (gnc:make-gnc-monetary currency (gnc:split-get-value split)))
|
||||
(amt (gnc:make-gnc-monetary currency (xaccSplitGetValue split)))
|
||||
(payment-style "grand-total")
|
||||
(row '()))
|
||||
|
||||
@ -394,7 +394,7 @@
|
||||
|
||||
(if (date-col used-columns)
|
||||
(addto! row
|
||||
(gnc:print-date (gnc:transaction-get-date-posted t))))
|
||||
(gnc-print-date (gnc-transaction-get-date-posted t))))
|
||||
|
||||
(if (description-col used-columns)
|
||||
(addto! row (_ "Payment, thank you")))
|
||||
@ -426,8 +426,8 @@
|
||||
(hash-for-each
|
||||
(lambda (acct value)
|
||||
(let ((collector (gnc:make-commodity-collector))
|
||||
(commodity (gnc:account-get-commodity acct))
|
||||
(name (gnc:account-get-name acct)))
|
||||
(commodity (xaccAccountGetCommodity acct))
|
||||
(name (xaccAccountGetName acct)))
|
||||
(collector 'add commodity value)
|
||||
(add-subtotal-row table used-columns collector
|
||||
"grand-total" name)))
|
||||
@ -439,14 +439,14 @@
|
||||
|
||||
(if (and show-payments lot)
|
||||
(let ((splits (sort-list!
|
||||
(gnc:lot-get-splits lot)
|
||||
(gnc-lot-get-split-list lot)
|
||||
(lambda (s1 s2)
|
||||
(let ((t1 (gnc:split-get-parent s1))
|
||||
(t2 (gnc:split-get-parent s2)))
|
||||
(< (gnc:transaction-order t1 t2) 0))))))
|
||||
(let ((t1 (xaccSplitGetParent s1))
|
||||
(t2 (xaccSplitGetParent s2)))
|
||||
(< (xaccTransOrder t1 t2) 0))))))
|
||||
(for-each
|
||||
(lambda (split)
|
||||
(if (not (equal? (gnc:split-get-parent split) txn))
|
||||
(if (not (equal? (xaccSplitGetParent split) txn))
|
||||
(add-payment-row table used-columns
|
||||
split total-collector)))
|
||||
splits)))
|
||||
@ -470,7 +470,7 @@
|
||||
invoice?)))
|
||||
|
||||
(if display-all-taxes
|
||||
(let ((tax-list (gnc:entry-get-tax-values current invoice?)))
|
||||
(let ((tax-list (gncEntryReturnTaxValues current invoice?)))
|
||||
(update-account-hash acct-hash tax-list))
|
||||
(tax-collector 'add
|
||||
(gnc:gnc-monetary-commodity (cdr entry-values))
|
||||
@ -503,7 +503,7 @@
|
||||
(let* ((table (gnc:make-html-table))
|
||||
(used-columns (build-column-used options))
|
||||
(width (num-columns-required used-columns))
|
||||
(entries (gnc:invoice-get-entries invoice))
|
||||
(entries (gncInvoiceGetEntries invoice))
|
||||
(totals (gnc:make-commodity-collector)))
|
||||
|
||||
(gnc:html-table-set-col-headers!
|
||||
@ -555,7 +555,7 @@
|
||||
(list "<br>"))
|
||||
(for-each
|
||||
(lambda (order)
|
||||
(let* ((reference (gnc:order-get-reference order)))
|
||||
(let* ((reference (gncOrderGetReference order)))
|
||||
(if (and reference (> (string-length reference) 0))
|
||||
(gnc:html-table-append-row!
|
||||
table
|
||||
@ -572,7 +572,7 @@
|
||||
table
|
||||
(list
|
||||
(string-append label ": ")
|
||||
(string-expand (gnc:print-date date) #\space " "))))
|
||||
(string-expand (gnc-print-date date) #\space " "))))
|
||||
|
||||
(define (make-date-table)
|
||||
(let ((table (gnc:make-html-table)))
|
||||
@ -587,11 +587,11 @@
|
||||
|
||||
(define (make-myname-table book date-format)
|
||||
(let* ((table (gnc:make-html-table))
|
||||
(slots (gnc:book-get-slots book))
|
||||
(name (gnc:kvp-frame-get-slot-path
|
||||
(slots (gnc-book-get-slots book))
|
||||
(name (kvp-frame-get-slot-path-gslist
|
||||
slots (append gnc:*kvp-option-path*
|
||||
(list gnc:*business-label* gnc:*company-name*))))
|
||||
(addy (gnc:kvp-frame-get-slot-path
|
||||
(addy (kvp-frame-get-slot-path-gslist
|
||||
slots (append gnc:*kvp-option-path*
|
||||
(list gnc:*business-label* gnc:*company-addy*)))))
|
||||
|
||||
@ -627,7 +627,7 @@
|
||||
(table '())
|
||||
(orders '())
|
||||
(invoice (opt-val invoice-page invoice-name))
|
||||
(owner #f)
|
||||
(owner '())
|
||||
(references? (opt-val "Display" "References"))
|
||||
(title (_ "Invoice"))
|
||||
(invoice? #f))
|
||||
@ -638,24 +638,23 @@
|
||||
|
||||
(if invoice
|
||||
(begin
|
||||
(set! owner (gnc:invoice-get-owner invoice))
|
||||
(let ((type (gw:enum-<gnc:GncOwnerType>-val->sym
|
||||
(gnc:owner-get-type
|
||||
(gnc:owner-get-end-owner owner)) #f)))
|
||||
(case type
|
||||
((gnc-owner-customer)
|
||||
(set! owner (gncInvoiceGetOwner invoice))
|
||||
(let ((type (gncOwnerGetType
|
||||
(gncOwnerGetEndOwner owner))))
|
||||
(cond
|
||||
((eqv? type GNC-OWNER-CUSTOMER)
|
||||
(set! invoice? #t))
|
||||
((gnc-owner-vendor)
|
||||
((eqv? type GNC-OWNER-VENDOR)
|
||||
(set! title (_ "Bill")))
|
||||
((gnc-owner-employee)
|
||||
((eqv? type GNC-OWNER-EMPLOYEE)
|
||||
(set! title (_ "Expense Voucher")))))
|
||||
(set! title (sprintf #f (_"%s #%d") title
|
||||
(gnc:invoice-get-id invoice)))))
|
||||
(gncInvoiceGetID invoice)))))
|
||||
|
||||
(gnc:html-document-set-title! document title)
|
||||
|
||||
(if invoice
|
||||
(let ((book (gnc:invoice-get-book invoice)))
|
||||
(let ((book (gncInvoiceGetBook invoice)))
|
||||
(set! table (make-entry-table invoice
|
||||
(gnc:report-options report-obj)
|
||||
add-order invoice?))
|
||||
@ -671,8 +670,8 @@
|
||||
(make-myname-table book (opt-val "Display" "Today Date Format")))
|
||||
|
||||
(let ((date-table #f)
|
||||
(post-date (gnc:invoice-get-date-posted invoice))
|
||||
(due-date (gnc:invoice-get-date-due invoice)))
|
||||
(post-date (gncInvoiceGetDatePosted invoice))
|
||||
(due-date (gncInvoiceGetDateDue invoice)))
|
||||
|
||||
(if (not (equal? post-date (cons 0 0)))
|
||||
(begin
|
||||
@ -696,7 +695,7 @@
|
||||
(make-break! document)
|
||||
|
||||
(if (opt-val "Display" "Billing ID")
|
||||
(let ((billing-id (gnc:invoice-get-billing-id invoice)))
|
||||
(let ((billing-id (gncInvoiceGetBillingID invoice)))
|
||||
(if (and billing-id (> (string-length billing-id) 0))
|
||||
(begin
|
||||
(gnc:html-document-add-object!
|
||||
@ -708,8 +707,8 @@
|
||||
(make-break! document)))))
|
||||
|
||||
(if (opt-val "Display" "Billing Terms")
|
||||
(let* ((term (gnc:invoice-get-terms invoice))
|
||||
(terms (gnc:bill-term-get-description term)))
|
||||
(let* ((term (gncInvoiceGetTerms invoice))
|
||||
(terms (gncBillTermGetDescription term)))
|
||||
(if (and terms (> (string-length terms) 0))
|
||||
(gnc:html-document-add-object!
|
||||
document
|
||||
@ -726,7 +725,7 @@
|
||||
(make-break! document)
|
||||
|
||||
(if (opt-val "Display" "Invoice Notes")
|
||||
(let ((notes (gnc:invoice-get-notes invoice)))
|
||||
(let ((notes (gncInvoiceGetNotes invoice)))
|
||||
(gnc:html-document-add-object!
|
||||
document
|
||||
(gnc:make-html-text
|
||||
|
@ -115,7 +115,7 @@
|
||||
|
||||
(define num-buckets 4)
|
||||
(define (new-bucket-vector)
|
||||
(make-vector num-buckets (gnc:numeric-zero)))
|
||||
(make-vector num-buckets (gnc-numeric-zero)))
|
||||
|
||||
(define (make-interval-list to-date)
|
||||
(let ((begindate to-date))
|
||||
@ -126,10 +126,10 @@
|
||||
|
||||
|
||||
(define (make-aging-table options query bucket-intervals reverse?)
|
||||
(let ((lots (gnc:query-get-lots query 'query-txn-match-any))
|
||||
(let ((lots (xaccQueryGetLots query QUERY-TXN-MATCH-ANY))
|
||||
(buckets (new-bucket-vector))
|
||||
(payments (gnc:numeric-zero))
|
||||
(currency (gnc:default-currency)) ;XXX
|
||||
(payments (gnc-numeric-zero))
|
||||
(currency (gnc-default-currency)) ;XXX
|
||||
(table (gnc:make-html-table)))
|
||||
|
||||
(define (in-interval this-date current-bucket)
|
||||
@ -145,24 +145,24 @@
|
||||
|
||||
(define (apply-invoice date value)
|
||||
(let* ((bucket-index (find-bucket 0 bucket-intervals date))
|
||||
(new-value (gnc:numeric-add-fixed
|
||||
(new-value (gnc-numeric-add-fixed
|
||||
value
|
||||
(vector-ref buckets bucket-index))))
|
||||
(vector-set! buckets bucket-index new-value)))
|
||||
|
||||
(define (apply-payment value)
|
||||
(set! payments (gnc:numeric-add-fixed value payments)))
|
||||
(set! payments (gnc-numeric-add-fixed value payments)))
|
||||
|
||||
(for-each
|
||||
(lambda (lot)
|
||||
(let* ((bal (gnc:lot-get-balance lot))
|
||||
(invoice (gnc:invoice-get-invoice-from-lot lot))
|
||||
(post-date (gnc:invoice-get-date-posted invoice)))
|
||||
(let* ((bal (gnc-lot-get-balance lot))
|
||||
(invoice (gncInvoiceGetInvoiceFromLot lot))
|
||||
(post-date (gncInvoiceGetDatePosted invoice)))
|
||||
|
||||
(if (not (gnc:numeric-zero-p bal))
|
||||
(if (not (gnc-numeric-zero-p bal))
|
||||
(begin
|
||||
(if reverse?
|
||||
(set! bal (gnc:numeric-neg bal)))
|
||||
(set! bal (gnc-numeric-neg bal)))
|
||||
(if invoice
|
||||
(begin
|
||||
(apply-invoice post-date bal))
|
||||
@ -192,13 +192,13 @@
|
||||
;;
|
||||
(define (add-txn-row table txn acc column-vector odd-row? printed?
|
||||
inv-str reverse? start-date total)
|
||||
(let* ((type (gnc:transaction-get-txn-type txn))
|
||||
(date (gnc:transaction-get-date-posted txn))
|
||||
(let* ((type (xaccTransGetTxnType txn))
|
||||
(date (gnc-transaction-get-date-posted txn))
|
||||
(due-date #f)
|
||||
(value (gnc:transaction-get-account-value txn acc))
|
||||
(split (gnc:transaction-get-split txn 0))
|
||||
(invoice (gnc:invoice-get-invoice-from-txn txn))
|
||||
(currency (gnc:transaction-get-currency txn))
|
||||
(value (xaccTransGetAccountValue txn acc))
|
||||
(split (xaccTransGetSplit txn 0))
|
||||
(invoice (gncInvoiceGetInvoiceFromTxn txn))
|
||||
(currency (xaccTransGetCurrency txn))
|
||||
(type-str
|
||||
(cond
|
||||
((equal? type gnc:transaction-type-invoice)
|
||||
@ -215,12 +215,12 @@
|
||||
(define (make-row date due-date num type-str memo value)
|
||||
(let ((row-contents '()))
|
||||
(if (date-col column-vector)
|
||||
(addto! row-contents (gnc:print-date date)))
|
||||
(addto! row-contents (gnc-print-date date)))
|
||||
(if (date-due-col column-vector)
|
||||
(addto! row-contents
|
||||
(if (and due-date
|
||||
(not (equal? due-date (cons 0 0))))
|
||||
(gnc:print-date due-date)
|
||||
(gnc-print-date due-date)
|
||||
"")))
|
||||
(if (num-col column-vector)
|
||||
(addto! row-contents num))
|
||||
@ -236,7 +236,7 @@
|
||||
row-contents))
|
||||
|
||||
(if reverse?
|
||||
(set! value (gnc:numeric-neg value)))
|
||||
(set! value (gnc-numeric-neg value)))
|
||||
|
||||
(if (gnc:timepair-later start-date date)
|
||||
(begin
|
||||
@ -245,7 +245,7 @@
|
||||
(if (not printed?)
|
||||
(begin
|
||||
(set! printed? #t)
|
||||
(if (not (gnc:numeric-zero-p total))
|
||||
(if (not (gnc-numeric-zero-p total))
|
||||
(let ((row (make-row start-date #f "" (_ "Balance") "" total))
|
||||
(row-style (if odd-row? "normal-row" "alternate-row")))
|
||||
(gnc:html-table-append-row/markup! table row-style
|
||||
@ -256,10 +256,10 @@
|
||||
|
||||
; Now print out the invoice row
|
||||
(if invoice
|
||||
(set! due-date (gnc:invoice-get-date-due invoice)))
|
||||
(set! due-date (gncInvoiceGetDateDue invoice)))
|
||||
|
||||
(let ((row (make-row date due-date (gnc:transaction-get-num txn)
|
||||
type-str (gnc:split-get-memo split) value))
|
||||
(let ((row (make-row date due-date (xaccTransGetNum txn)
|
||||
type-str (xaccSplitGetMemo split) value))
|
||||
(row-style (if odd-row? "normal-row" "alternate-row")))
|
||||
|
||||
(gnc:html-table-append-row/markup! table row-style
|
||||
@ -273,10 +273,10 @@
|
||||
|
||||
|
||||
(define (make-txn-table options query acc start-date end-date)
|
||||
(let ((txns (gnc:query-get-transactions query 'query-txn-match-any))
|
||||
(let ((txns (xaccQueryGetTransactions query QUERY-TXN-MATCH-ANY))
|
||||
(used-columns (build-column-used options))
|
||||
(total (gnc:numeric-zero))
|
||||
(currency (gnc:default-currency)) ;XXX
|
||||
(total (gnc-numeric-zero))
|
||||
(currency (gnc-default-currency)) ;XXX
|
||||
(table (gnc:make-html-table))
|
||||
(inv-str (gnc:option-value (gnc:lookup-option options "__reg"
|
||||
"inv-str")))
|
||||
@ -288,13 +288,13 @@
|
||||
(make-heading-list used-columns))
|
||||
|
||||
; Order the transactions properly
|
||||
(set! txns (sort txns (lambda (a b) (> 0 (gnc:transaction-order a b)))))
|
||||
(set! txns (sort txns (lambda (a b) (> 0 (xaccTransOrder a b)))))
|
||||
|
||||
(let ((printed? #f)
|
||||
(odd-row? #t))
|
||||
(for-each
|
||||
(lambda (txn)
|
||||
(let ((type (gnc:transaction-get-txn-type txn)))
|
||||
(let ((type (xaccTransGetTxnType txn)))
|
||||
(if
|
||||
(or (equal? type gnc:transaction-type-invoice)
|
||||
(equal? type gnc:transaction-type-payment))
|
||||
@ -302,7 +302,7 @@
|
||||
inv-str reverse? start-date total)))
|
||||
|
||||
(set! printed? (car result))
|
||||
(set! total (gnc:numeric-add-fixed total (cadr result)))
|
||||
(set! total (gnc-numeric-add-fixed total (cadr result)))
|
||||
(set! odd-row? (caddr result))
|
||||
))))
|
||||
txns))
|
||||
@ -312,7 +312,7 @@
|
||||
"grand-total"
|
||||
(append (cons (gnc:make-html-table-cell/markup
|
||||
"total-label-cell"
|
||||
(if (gnc:numeric-negative-p total)
|
||||
(if (gnc-numeric-negative-p total)
|
||||
(_ "Total Credit")
|
||||
(_ "Total Due")))
|
||||
'())
|
||||
@ -348,7 +348,7 @@
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-owner-option owner-page owner-string "v"
|
||||
(N_ "The company for this report")
|
||||
(lambda () #f) #f owner-type))
|
||||
(lambda () '()) #f owner-type))
|
||||
|
||||
(gnc:register-inv-option
|
||||
(gnc:make-internal-option "__reg" "owner-type" owner-type))
|
||||
@ -403,13 +403,16 @@
|
||||
gnc:*report-options*)
|
||||
|
||||
(define (customer-options-generator)
|
||||
(options-generator '(receivable) 'gnc-owner-customer (_ "Invoice") #f))
|
||||
(options-generator (list ACCT-TYPE-RECEIVABLE) GNC-OWNER-CUSTOMER
|
||||
(_ "Invoice") #f))
|
||||
|
||||
(define (vendor-options-generator)
|
||||
(options-generator '(payable) 'gnc-owner-vendor (_ "Bill") #t))
|
||||
(options-generator (list ACCT-TYPE-PAYABLE) GNC-OWNER-VENDOR
|
||||
(_ "Bill") #t))
|
||||
|
||||
(define (employee-options-generator)
|
||||
(options-generator '(payable) 'gnc-owner-employee (_ "Expense Report") #t))
|
||||
(options-generator (list ACCT-TYPE-PAYABLE) GNC-OWNER-EMPLOYEE
|
||||
(_ "Expense Report") #t))
|
||||
|
||||
(define (string-expand string character replace-string)
|
||||
(define (car-line chars)
|
||||
@ -430,26 +433,26 @@
|
||||
(line-helper (string->list string)))
|
||||
|
||||
(define (setup-query q owner account end-date)
|
||||
(let* ((guid (gnc:owner-get-guid (gnc:owner-get-end-owner owner))))
|
||||
(let* ((guid (gncOwnerReturnGUID (gncOwnerGetEndOwner owner))))
|
||||
|
||||
(gnc:query-add-guid-match
|
||||
(qof-query-add-guid-match
|
||||
q
|
||||
(list gnc:split-trans gnc:invoice-from-txn gnc:invoice-owner
|
||||
gnc:owner-parentg)
|
||||
guid 'query-or)
|
||||
(gnc:query-add-guid-match
|
||||
(list SPLIT-TRANS INVOICE-FROM-TXN INVOICE-OWNER
|
||||
OWNER-PARENTG)
|
||||
guid QOF-QUERY-OR)
|
||||
(qof-query-add-guid-match
|
||||
q
|
||||
(list gnc:split-lot gnc:owner-from-lot gnc:owner-parentg)
|
||||
guid 'query-or)
|
||||
(gnc:query-add-guid-match
|
||||
(list SPLIT-LOT OWNER-FROM-LOT OWNER-PARENTG)
|
||||
guid QOF-QUERY-OR)
|
||||
(qof-query-add-guid-match
|
||||
q
|
||||
(list gnc:split-lot gnc:invoice-from-lot gnc:invoice-owner
|
||||
gnc:owner-parentg)
|
||||
guid 'query-or)
|
||||
(list SPLIT-LOT INVOICE-FROM-LOT INVOICE-OWNER
|
||||
OWNER-PARENTG)
|
||||
guid QOF-QUERY-OR)
|
||||
|
||||
(gnc:query-add-single-account-match q account 'query-and)
|
||||
(gnc:query-add-date-match-timepair q #f end-date #t end-date 'query-and)
|
||||
(gnc:query-set-book q (gnc:get-current-book))
|
||||
(xaccQueryAddSingleAccountMatch q account QOF-QUERY-AND)
|
||||
(xaccQueryAddDateMatchTS q #f end-date #t end-date QOF-QUERY-AND)
|
||||
(qof-query-set-book q (gnc-get-current-book))
|
||||
q))
|
||||
|
||||
(define (make-owner-table owner)
|
||||
@ -476,7 +479,7 @@
|
||||
table
|
||||
(list
|
||||
(string-append label ": ")
|
||||
(string-expand (gnc:print-date date) #\space " "))))
|
||||
(string-expand (gnc-print-date date) #\space " "))))
|
||||
|
||||
(define (make-date-table)
|
||||
(let ((table (gnc:make-html-table)))
|
||||
@ -491,11 +494,11 @@
|
||||
|
||||
(define (make-myname-table book date-format)
|
||||
(let* ((table (gnc:make-html-table))
|
||||
(slots (gnc:book-get-slots book))
|
||||
(name (gnc:kvp-frame-get-slot-path
|
||||
(slots (gnc-book-get-slots book))
|
||||
(name (kvp-frame-get-slot-path-gslist
|
||||
slots (append gnc:*kvp-option-path*
|
||||
(list gnc:*business-label* gnc:*company-name*))))
|
||||
(addy (gnc:kvp-frame-get-slot-path
|
||||
(addy (kvp-frame-get-slot-path-gslist
|
||||
slots (append gnc:*kvp-option-path*
|
||||
(list gnc:*business-label* gnc:*company-addy*)))))
|
||||
|
||||
@ -531,7 +534,7 @@
|
||||
(let* ((document (gnc:make-html-document))
|
||||
(table '())
|
||||
(orders '())
|
||||
(query (gnc:malloc-query))
|
||||
(query (qof-query-create-for-splits))
|
||||
(account (opt-val owner-page acct-string))
|
||||
(owner (opt-val owner-page owner-string))
|
||||
(start-date (gnc:timepair-start-day-time
|
||||
@ -540,28 +543,28 @@
|
||||
(end-date (gnc:timepair-end-day-time
|
||||
(gnc:date-option-absolute-time
|
||||
(opt-val gnc:pagename-general (N_ "To")))))
|
||||
(book (gnc:get-current-book)) ;XXX Grab this from elsewhere
|
||||
(owner-type (opt-val "__reg" "owner-type"))
|
||||
(book (gnc-get-current-book)) ;XXX Grab this from elsewhere
|
||||
(type (opt-val "__reg" "owner-type"))
|
||||
(type-str ""))
|
||||
|
||||
(case owner-type
|
||||
((gnc-owner-customer)
|
||||
(cond
|
||||
((eqv? type GNC-OWNER-CUSTOMER)
|
||||
(set! type-str (N_ "Customer")))
|
||||
((gnc-owner-vendor)
|
||||
((eqv? type GNC-OWNER-VENDOR)
|
||||
(set! type-str (N_ "Vendor")))
|
||||
((gnc-owner-employee)
|
||||
((eqv? type GNC-OWNER-EMPLOYEE)
|
||||
(set! type-str (N_ "Employee"))))
|
||||
|
||||
(gnc:html-document-set-title!
|
||||
document (string-append (_ type-str) " " (_ "Report")))
|
||||
|
||||
(if (gnc:owner-is-valid? owner)
|
||||
(if (gncOwnerIsValid owner)
|
||||
(begin
|
||||
(setup-query query owner account end-date)
|
||||
|
||||
(gnc:html-document-set-title!
|
||||
document
|
||||
(string-append (_ type-str ) " " (_ "Report:") " " (gnc:owner-get-name owner)))
|
||||
(string-append (_ type-str ) " " (_ "Report:") " " (gncOwnerGetName owner)))
|
||||
|
||||
(gnc:html-document-set-headline!
|
||||
document (gnc:html-markup
|
||||
@ -570,7 +573,7 @@
|
||||
" " (_ "Report:") " "
|
||||
(gnc:html-markup-anchor
|
||||
(gnc:owner-anchor-text owner)
|
||||
(gnc:owner-get-name owner))))
|
||||
(gncOwnerGetName owner))))
|
||||
|
||||
(if account
|
||||
(begin
|
||||
@ -603,9 +606,9 @@
|
||||
(string-append
|
||||
(_ "Date Range")
|
||||
": "
|
||||
(gnc:print-date start-date)
|
||||
(gnc-print-date start-date)
|
||||
" - "
|
||||
(gnc:print-date end-date))))
|
||||
(gnc-print-date end-date))))
|
||||
|
||||
(make-break! document)
|
||||
|
||||
@ -619,45 +622,43 @@
|
||||
(_ "No valid %s selected. Click on the Options button to select a company.")
|
||||
(_ type-str))))) ;; FIXME because of translations: Please change this string into full sentences instead of sprintf, because in non-english languages the "no valid" has different forms depending on the grammatical gender of the "%s".
|
||||
|
||||
(gnc:free-query query)
|
||||
(qof-query-destroy query)
|
||||
document))
|
||||
|
||||
(define (find-first-account type)
|
||||
(define (find-first group num index)
|
||||
(if (>= index num)
|
||||
#f
|
||||
(let* ((this-account (gnc:group-get-account group index))
|
||||
(account-type (gw:enum-<gnc:AccountType>-val->sym
|
||||
(gnc:account-get-type this-account) #f)))
|
||||
'()
|
||||
(let* ((this-account (xaccGroupGetAccount group index))
|
||||
(account-type (xaccAccountGetType this-account)))
|
||||
(if (eq? account-type type)
|
||||
this-account
|
||||
(find-first group num (+ index 1))))))
|
||||
|
||||
(let* ((current-group (gnc:get-current-group))
|
||||
(num-accounts (gnc:group-get-num-accounts
|
||||
(let* ((current-group (gnc-get-current-group))
|
||||
(num-accounts (xaccGroupGetNumAccounts
|
||||
current-group)))
|
||||
(if (> num-accounts 0)
|
||||
(find-first current-group num-accounts 0)
|
||||
#f)))
|
||||
'())))
|
||||
|
||||
(define (find-first-account-for-owner owner)
|
||||
(let ((type (gw:enum-<gnc:GncOwnerType>-val->sym
|
||||
(gnc:owner-get-type (gnc:owner-get-end-owner owner)) #f)))
|
||||
(case type
|
||||
((gnc-owner-customer)
|
||||
(find-first-account 'receivable))
|
||||
(let ((type (gncOwnerGetType (gncOwnerGetEndOwner owner))))
|
||||
(cond
|
||||
((eqv? type GNC-OWNER-CUSTOMER)
|
||||
(find-first-account ACCT-TYPE-RECEIVABLE))
|
||||
|
||||
((gnc-owner-vendor)
|
||||
(find-first-account 'payable))
|
||||
((eqv? type GNC-OWNER-VENDOR)
|
||||
(find-first-account ACCT-TYPE-PAYABLE))
|
||||
|
||||
((gnc-owner-employee)
|
||||
(find-first-account 'payable))
|
||||
((eqv? type GNC-OWNER-EMPLOYEE)
|
||||
(find-first-account ACCT-TYPE-PAYABLE))
|
||||
|
||||
((gnc-owner-job)
|
||||
(find-first-account-for-owner (gnc:owner-get-end-owner owner)))
|
||||
((eqv? type GNC-OWNER-JOB)
|
||||
(find-first-account-for-owner (gncOwnerGetEndOwner owner)))
|
||||
|
||||
(else
|
||||
#f))))
|
||||
'()))))
|
||||
|
||||
(gnc:define-report
|
||||
'version 1
|
||||
@ -693,16 +694,15 @@
|
||||
(gnc:make-report report-name options)))
|
||||
|
||||
(define (owner-report-create owner account)
|
||||
(let ((type (gw:enum-<gnc:GncOwnerType>-val->sym
|
||||
(gnc:owner-get-type (gnc:owner-get-end-owner owner)) #f)))
|
||||
(case type
|
||||
((gnc-owner-customer)
|
||||
(let ((type (gncOwnerGetType (gncOwnerGetEndOwner owner))))
|
||||
(cond
|
||||
((eqv? type GNC-OWNER-CUSTOMER)
|
||||
(owner-report-create-internal (N_ "Customer Report") owner account))
|
||||
|
||||
((gnc-owner-vendor)
|
||||
((eqv? type GNC-OWNER-VENDOR)
|
||||
(owner-report-create-internal (N_ "Vendor Report") owner account))
|
||||
|
||||
((gnc-owner-employee)
|
||||
((eqv? type GNC-OWNER-EMPLOYEE)
|
||||
(owner-report-create-internal (N_ "Employee Report") owner account))
|
||||
|
||||
(else #f))))
|
||||
@ -718,20 +718,20 @@
|
||||
account split query journal? double? title
|
||||
debit-string credit-string)
|
||||
|
||||
(let* ((temp-owner (gnc:owner-create))
|
||||
(let* ((temp-owner (gncOwnerCreate))
|
||||
(owner (gnc:owner-from-split split temp-owner))
|
||||
(res #f))
|
||||
|
||||
(if owner
|
||||
(set! res (gnc:owner-report-create owner account)))
|
||||
|
||||
(gnc:owner-destroy temp-owner)
|
||||
(gncOwnerDestroy temp-owner)
|
||||
res))
|
||||
|
||||
(gnc:register-report-hook 'receivable #t
|
||||
(gnc:register-report-hook ACCT-TYPE-RECEIVABLE #t
|
||||
gnc:owner-report-create-internal)
|
||||
|
||||
(gnc:register-report-hook 'payable #t
|
||||
(gnc:register-report-hook ACCT-TYPE-PAYABLE #t
|
||||
gnc:owner-report-create-internal)
|
||||
|
||||
(export gnc:owner-report-create)
|
||||
|
@ -49,7 +49,7 @@
|
||||
(gnc:make-account-sel-limited-option
|
||||
acc-page this-acc
|
||||
(N_ "The payable account you wish to examine") "zz"
|
||||
#f #f '(payable)))
|
||||
#f #f (list ACCT-TYPE-PAYABLE)))
|
||||
|
||||
(aging-options-generator options)))
|
||||
|
||||
@ -83,5 +83,5 @@
|
||||
debit-string credit-string)
|
||||
(payables-report-create-internal account))
|
||||
|
||||
(gnc:register-report-hook 'payable #f
|
||||
(gnc:register-report-hook ACCT-TYPE-PAYABLE #f
|
||||
gnc:payables-report-create-internal)
|
||||
|
@ -49,7 +49,7 @@
|
||||
(gnc:make-account-sel-limited-option
|
||||
acc-page this-acc
|
||||
(N_ "The receivables account you wish to examine") "w"
|
||||
#f #f '(receivable)))
|
||||
#f #f (list ACCT-TYPE-RECEIVABLE)))
|
||||
|
||||
(aging-options-generator options)))
|
||||
|
||||
@ -84,5 +84,5 @@
|
||||
debit-string credit-string)
|
||||
(receivables-report-create-internal account))
|
||||
|
||||
(gnc:register-report-hook 'receivable #f
|
||||
(gnc:register-report-hook ACCT-TYPE-RECEIVABLE #f
|
||||
gnc:receivables-report-create-internal)
|
||||
|
@ -6,7 +6,6 @@ AM_CFLAGS = \
|
||||
-I${top_srcdir}/src/gnc-module \
|
||||
-I${top_srcdir}/src/app-utils \
|
||||
-I${top_srcdir}/src/business/business-core \
|
||||
${G_WRAP_COMPILE_ARGS} \
|
||||
${GUILE_INCS} \
|
||||
${GLIB_CFLAGS} \
|
||||
${QOF_CFLAGS} \
|
||||
@ -22,7 +21,6 @@ noinst_HEADERS = \
|
||||
libgncmod_business_utils_la_LIBADD = \
|
||||
${top_builddir}/src/gnc-module/libgncmodule.la \
|
||||
${top_builddir}/src/app-utils/libgncmod-app-utils.la \
|
||||
${G_WRAP_LINK_ARGS} \
|
||||
${GUILE_LIBS} \
|
||||
${GLIB_LIBS} \
|
||||
${QOF_LIBS} \
|
||||
|
@ -25,11 +25,11 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "business-options.h"
|
||||
#include "swig-runtime.h"
|
||||
|
||||
#include <g-wrap-wct.h>
|
||||
#define FUNC_NAME __FUNCTION__
|
||||
|
||||
|
||||
#define LOOKUP_OPTION(fcn) { \
|
||||
#define LOOKUP_OPTION(fcn) \
|
||||
GNCOption *option; \
|
||||
SCM getter; \
|
||||
SCM value; \
|
||||
@ -46,13 +46,9 @@
|
||||
value = scm_call_0 (getter); \
|
||||
if (value == SCM_BOOL_F) \
|
||||
return NULL; \
|
||||
\
|
||||
if (!gw_wcp_p(value)) \
|
||||
scm_misc_error(fcn, "Item is not a gw:wcp.", value); \
|
||||
\
|
||||
return gw_wcp_get_ptr(value); \
|
||||
}
|
||||
|
||||
SWIG_GetModule(NULL); /* Work-around for SWIG bug. */ \
|
||||
if (!SWIG_IsPointer(value)) \
|
||||
scm_misc_error(fcn, "SCM is not a wrapped pointer.", value)
|
||||
|
||||
GncTaxTable*
|
||||
gnc_option_db_lookup_taxtable_option(GNCOptionDB *odb,
|
||||
@ -61,6 +57,7 @@ gnc_option_db_lookup_taxtable_option(GNCOptionDB *odb,
|
||||
GncTaxTable * default_value)
|
||||
{
|
||||
LOOKUP_OPTION("gnc_option_db_lookup_taxtable_option");
|
||||
return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncTaxTable"), 1, 0);
|
||||
}
|
||||
|
||||
GncInvoice*
|
||||
@ -70,6 +67,7 @@ gnc_option_db_lookup_invoice_option(GNCOptionDB *odb,
|
||||
GncInvoice * default_value)
|
||||
{
|
||||
LOOKUP_OPTION("gnc_option_db_lookup_invoice_option");
|
||||
return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncInvoice"), 1, 0);
|
||||
}
|
||||
|
||||
GncCustomer*
|
||||
@ -79,6 +77,7 @@ gnc_option_db_lookup_customer_option(GNCOptionDB *odb,
|
||||
GncCustomer * default_value)
|
||||
{
|
||||
LOOKUP_OPTION("gnc_option_db_lookup_customer_option");
|
||||
return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncCustomer"), 1, 0);
|
||||
}
|
||||
|
||||
GncVendor*
|
||||
@ -88,4 +87,5 @@ gnc_option_db_lookup_vendor_option(GNCOptionDB *odb,
|
||||
GncVendor * default_value)
|
||||
{
|
||||
LOOKUP_OPTION("gnc_option_db_lookup_vendor_option");
|
||||
return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncVendor"), 1, 0);
|
||||
}
|
||||
|
@ -24,6 +24,8 @@
|
||||
;; invoice pointers may be used to set the value of the option. The
|
||||
;; option always returns a single invoice pointer.
|
||||
|
||||
(use-modules (gnucash main))
|
||||
|
||||
(define (gnc:make-invoice-option
|
||||
section
|
||||
name
|
||||
@ -35,11 +37,11 @@
|
||||
(define (convert-to-guid item)
|
||||
(if (string? item)
|
||||
item
|
||||
(gnc:invoice-get-guid item)))
|
||||
(gncInvoiceReturnGUID item)))
|
||||
|
||||
(define (convert-to-invoice item)
|
||||
(if (string? item)
|
||||
(gnc:invoice-lookup item (gnc:get-current-book))
|
||||
(gncInvoiceLookupFlip item (gnc-get-current-book))
|
||||
item))
|
||||
|
||||
(let* ((option (convert-to-guid (default-getter)))
|
||||
@ -71,9 +73,9 @@
|
||||
(gnc:error "Illegal invoice value set"))))
|
||||
(lambda () (convert-to-invoice (default-getter)))
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p) (gnc:kvp-frame-set-slot-path f option p))
|
||||
(lambda (f p) (kvp-frame-set-slot-path-gslist f option p))
|
||||
(lambda (f p)
|
||||
(let ((v (gnc:kvp-frame-get-slot-path f p)))
|
||||
(let ((v (kvp-frame-get-slot-path-gslist f p)))
|
||||
(if (and v (string? v))
|
||||
(begin
|
||||
(set! option v)
|
||||
@ -96,11 +98,11 @@
|
||||
(define (convert-to-guid item)
|
||||
(if (string? item)
|
||||
item
|
||||
(gnc:customer-get-guid item)))
|
||||
(gncCustomerReturnGUID item)))
|
||||
|
||||
(define (convert-to-customer item)
|
||||
(if (string? item)
|
||||
(gnc:customer-lookup item (gnc:get-current-book))
|
||||
(gncCustomerLookupFlip item (gnc-get-current-book))
|
||||
item))
|
||||
|
||||
(let* ((option (convert-to-guid (default-getter)))
|
||||
@ -132,9 +134,9 @@
|
||||
(gnc:error "Illegal customer value set"))))
|
||||
(lambda () (convert-to-customer (default-getter)))
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p) (gnc:kvp-frame-set-slot-path f option p))
|
||||
(lambda (f p) (kvp-frame-set-slot-path-gslist f option p))
|
||||
(lambda (f p)
|
||||
(let ((v (gnc:kvp-frame-get-slot-path f p)))
|
||||
(let ((v (kvp-frame-get-slot-path-gslist f p)))
|
||||
(if (and v (string? v))
|
||||
(begin
|
||||
(set! option v)
|
||||
@ -157,11 +159,11 @@
|
||||
(define (convert-to-guid item)
|
||||
(if (string? item)
|
||||
item
|
||||
(gnc:vendor-get-guid item)))
|
||||
(gncVendorReturnGUID item)))
|
||||
|
||||
(define (convert-to-vendor item)
|
||||
(if (string? item)
|
||||
(gnc:vendor-lookup item (gnc:get-current-book))
|
||||
(gncVendorLookupFlip item (gnc-get-current-book))
|
||||
item))
|
||||
|
||||
(let* ((option (convert-to-guid (default-getter)))
|
||||
@ -193,9 +195,9 @@
|
||||
(gnc:error "Illegal vendor value set"))))
|
||||
(lambda () (convert-to-vendor (default-getter)))
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p) (gnc:kvp-frame-set-slot-path f option p))
|
||||
(lambda (f p) (kvp-frame-set-slot-path-gslist f option p))
|
||||
(lambda (f p)
|
||||
(let ((v (gnc:kvp-frame-get-slot-path f p)))
|
||||
(let ((v (kvp-frame-get-slot-path-gslist f p)))
|
||||
(if (and v (string? v))
|
||||
(begin
|
||||
(set! option v)
|
||||
@ -218,11 +220,11 @@
|
||||
(define (convert-to-guid item)
|
||||
(if (string? item)
|
||||
item
|
||||
(gnc:employee-get-guid item)))
|
||||
(gncEmployeeReturnGUID item)))
|
||||
|
||||
(define (convert-to-employee item)
|
||||
(if (string? item)
|
||||
(gnc:employee-lookup item (gnc:get-current-book))
|
||||
(gncEmployeeLookupFlip item (gnc-get-current-book))
|
||||
item))
|
||||
|
||||
(let* ((option (convert-to-guid (default-getter)))
|
||||
@ -254,9 +256,9 @@
|
||||
(gnc:error "Illegal employee value set"))))
|
||||
(lambda () (convert-to-employee (default-getter)))
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p) (gnc:kvp-frame-set-slot-path f option p))
|
||||
(lambda (f p) (kvp-frame-set-slot-path-gslist f option p))
|
||||
(lambda (f p)
|
||||
(let ((v (gnc:kvp-frame-get-slot-path f p)))
|
||||
(let ((v (kvp-frame-get-slot-path-gslist f p)))
|
||||
(if (and v (string? v))
|
||||
(begin
|
||||
(set! option v)
|
||||
@ -277,44 +279,43 @@
|
||||
value-validator
|
||||
owner-type)
|
||||
|
||||
(let ((option-value (gnc:owner-create)))
|
||||
(let ((option-value (gncOwnerCreate)))
|
||||
|
||||
(define (convert-to-pair item)
|
||||
(if (pair? item)
|
||||
item
|
||||
(cons (gw:enum-<gnc:GncOwnerType>-val->sym
|
||||
(gnc:owner-get-type item) #f)
|
||||
(gnc:owner-get-guid item))))
|
||||
(cons (gncOwnerGetType item)
|
||||
(gncOwnerReturnGUID item))))
|
||||
|
||||
(define (convert-to-owner pair)
|
||||
(if (pair? pair)
|
||||
(let ((type (gw:enum-<gnc:GncOwnerType>-val->sym (car pair) #f)))
|
||||
(case type
|
||||
((gnc-owner-customer)
|
||||
(gnc:owner-init-customer
|
||||
(let ((type (car pair)))
|
||||
(cond
|
||||
((eqv? type GNC-OWNER-CUSTOMER)
|
||||
(gncOwnerInitCustomer
|
||||
option-value
|
||||
(gnc:customer-lookup (cdr pair) (gnc:get-current-book)))
|
||||
(gncCustomerLookupFlip (cdr pair) (gnc-get-current-book)))
|
||||
option-value)
|
||||
|
||||
((gnc-owner-vendor)
|
||||
(gnc:owner-init-vendor
|
||||
((eqv? type GNC-OWNER-VENDOR)
|
||||
(gncOwnerInitVendor
|
||||
option-value
|
||||
(gnc:vendor-lookup (cdr pair) (gnc:get-current-book)))
|
||||
(gncVendorLookupFlip (cdr pair) (gnc-get-current-book)))
|
||||
option-value)
|
||||
|
||||
((gnc-owner-employee)
|
||||
(gnc:owner-init-employee
|
||||
((eqv? type GNC-OWNER-EMPLOYEE)
|
||||
(gncOwnerInitEmployee
|
||||
option-value
|
||||
(gnc:employee-lookup (cdr pair) (gnc:get-current-book)))
|
||||
(gncEmployeeLookupFlip (cdr pair) (gnc-get-current-book)))
|
||||
option-value)
|
||||
|
||||
((gnc-owner-job)
|
||||
(gnc:owner-init-job
|
||||
((eqv? type GNC-OWNER-JOB)
|
||||
(gncOwnerInitJob
|
||||
option-value
|
||||
(gnc:job-lookup (cdr pair) (gnc:get-current-book)))
|
||||
(gncJobLookupFlip (cdr pair) (gnc-get-current-book)))
|
||||
option-value)
|
||||
|
||||
(else #f)))
|
||||
(else '())))
|
||||
pair))
|
||||
|
||||
(let* ((option (convert-to-pair (default-getter)))
|
||||
@ -330,10 +331,9 @@
|
||||
(validator
|
||||
(if (not value-validator)
|
||||
(lambda (owner)
|
||||
(let ((type (gw:enum-<gnc:GncOwnerType>-val->sym
|
||||
(if (pair? owner)
|
||||
(car owner)
|
||||
(gnc:owner-get-type owner)) #f)))
|
||||
(let ((type (if (pair? owner)
|
||||
(car owner)
|
||||
(gncOwnerGetType owner))))
|
||||
(if (equal? type owner-type)
|
||||
(list #t owner)
|
||||
(list #f "Owner-Type Mismatch"))))
|
||||
@ -356,13 +356,13 @@
|
||||
(lambda () (convert-to-owner (default-getter)))
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p)
|
||||
(gnc:kvp-frame-set-slot-path f (symbol->string (car option))
|
||||
(kvp-frame-set-slot-path-gslist f (symbol->string (car option))
|
||||
(append p '("type")))
|
||||
(gnc:kvp-frame-set-slot-path f (cdr option)
|
||||
(kvp-frame-set-slot-path-gslist f (cdr option)
|
||||
(append p '("value"))))
|
||||
(lambda (f p)
|
||||
(let ((t (gnc:kvp-frame-get-slot-path f (append p '("type"))))
|
||||
(v (gnc:kvp-frame-get-slot-path f (append p '("value")))))
|
||||
(let ((t (kvp-frame-get-slot-path-gslist f (append p '("type"))))
|
||||
(v (kvp-frame-get-slot-path-gslist f (append p '("value")))))
|
||||
(if (and t v (string? t) (string? v))
|
||||
(begin
|
||||
(set! option (cons (string->symbol t) v))
|
||||
@ -386,11 +386,11 @@
|
||||
(define (convert-to-guid item)
|
||||
(if (string? item)
|
||||
item
|
||||
(gnc:taxtable-get-guid item)))
|
||||
(gncTaxTableReturnGUID item)))
|
||||
|
||||
(define (convert-to-taxtable item)
|
||||
(if (string? item)
|
||||
(gnc:taxtable-lookup item (gnc:get-current-book))
|
||||
(gncTaxTableLookupFlip item (gnc-get-current-book))
|
||||
item))
|
||||
|
||||
(let* ((option (convert-to-guid (default-getter)))
|
||||
@ -422,9 +422,9 @@
|
||||
(gnc:error "Illegal taxtable value set"))))
|
||||
(lambda () (convert-to-taxtable (default-getter)))
|
||||
(gnc:restore-form-generator value->string)
|
||||
(lambda (f p) (gnc:kvp-frame-set-slot-path f option p))
|
||||
(lambda (f p) (kvp-frame-set-slot-path-gslist f option p))
|
||||
(lambda (f p)
|
||||
(let ((v (gnc:kvp-frame-get-slot-path f p)))
|
||||
(let ((v (kvp-frame-get-slot-path-gslist f p)))
|
||||
(if (and v (string? v))
|
||||
(begin
|
||||
(set! option v)
|
||||
|
@ -68,13 +68,13 @@
|
||||
(gnc:make-taxtable-option
|
||||
gnc:*business-label* (N_ "Default Customer TaxTable")
|
||||
"e" (N_ "The default tax table to apply to customers.")
|
||||
(lambda () #f) #f))
|
||||
(lambda () '()) #f))
|
||||
|
||||
(reg-option
|
||||
(gnc:make-taxtable-option
|
||||
gnc:*business-label* (N_ "Default Vendor TaxTable")
|
||||
"f" (N_ "The default tax table to apply to vendors.")
|
||||
(lambda () #f) #f))
|
||||
(lambda () '()) #f))
|
||||
|
||||
(reg-option
|
||||
(gnc:make-dateformat-option
|
||||
@ -83,4 +83,4 @@
|
||||
#f))
|
||||
)
|
||||
|
||||
(gnc:register-kvp-option-generator gnc:id-book book-options-generator)
|
||||
(gnc-register-kvp-option-generator QOF-ID-BOOK-SCM book-options-generator)
|
||||
|
@ -1,6 +1,6 @@
|
||||
PWD := $(shell pwd)
|
||||
|
||||
pkglib_LTLIBRARIES = libgncmod-dialog-tax-table.la libgw-dialog-tax-table.la
|
||||
pkglib_LTLIBRARIES = libgncmod-dialog-tax-table.la
|
||||
|
||||
AM_CFLAGS = \
|
||||
-I${top_srcdir}/src \
|
||||
@ -17,10 +17,10 @@ AM_CFLAGS = \
|
||||
${GDK_PIXBUF_CFLAGS} \
|
||||
${GLIB_CFLAGS} \
|
||||
${QOF_CFLAGS} \
|
||||
${G_WRAP_COMPILE_ARGS} \
|
||||
${GUILE_INCS}
|
||||
|
||||
libgncmod_dialog_tax_table_la_SOURCES = \
|
||||
swig-dialog-tax-table.c \
|
||||
gncmod-dialog-tax-table.c \
|
||||
dialog-tax-table.c
|
||||
|
||||
@ -36,22 +36,14 @@ libgncmod_dialog_tax_table_la_LIBADD = \
|
||||
${GLADE_LIBS} \
|
||||
${GUILE_LIBS} \
|
||||
${GNOME_LIBS} \
|
||||
${G_WRAP_LINK_ARGS} \
|
||||
${GLIB_LIBS} \
|
||||
${QOF_LIBS} \
|
||||
${EFENCE_LIBS}
|
||||
|
||||
nodist_libgw_dialog_tax_table_la_SOURCES = gw-dialog-tax-table.c
|
||||
|
||||
libgw_dialog_tax_table_la_LIBADD = \
|
||||
libgncmod-dialog-tax-table.la \
|
||||
${G_WRAP_LINK_ARGS}
|
||||
|
||||
gwmoddir = ${GNC_GWRAP_LIBDIR}
|
||||
gwmod_DATA = \
|
||||
gw-dialog-tax-table-spec.scm
|
||||
nodist_gwmod_DATA = \
|
||||
gw-dialog-tax-table.scm
|
||||
if BUILDING_FROM_SVN
|
||||
swig-dialog-tax-table.c: dialog-tax-table.i ${noinst_HEADERS}
|
||||
$(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $<
|
||||
endif
|
||||
|
||||
gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash
|
||||
gncmod_DATA = dialog-tax-table.scm
|
||||
@ -60,21 +52,19 @@ gladedir = $(GNC_GLADE_DIR)
|
||||
glade_DATA = tax-tables.glade
|
||||
|
||||
EXTRA_DIST = \
|
||||
dialog-tax-table.i \
|
||||
${glade_DATA} \
|
||||
${gwmod_DATA} \
|
||||
${gncmod_DATA}
|
||||
|
||||
if GNUCASH_SEPARATE_BUILDDIR
|
||||
#Only needed when srcdir and builddir are different
|
||||
# for compline
|
||||
SCM_FILE_LINKS = gw-dialog-tax-table-spec.scm
|
||||
# for running
|
||||
SCM_FILE_LINKS += ${gncmod_DATA}
|
||||
SCM_FILE_LINKS = ${gncmod_DATA}
|
||||
endif
|
||||
|
||||
.scm-links:
|
||||
$(RM) -rf gnucash g-wrapped
|
||||
mkdir -p gnucash g-wrapped
|
||||
$(RM) -rf gnucash
|
||||
mkdir -p gnucash
|
||||
if GNUCASH_SEPARATE_BUILDDIR
|
||||
for X in ${SCM_FILE_LINKS} ; do \
|
||||
$(LN_S) -f ${srcdir}/$$X . ; \
|
||||
@ -83,29 +73,6 @@ endif
|
||||
( cd gnucash; for A in $(gncmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
|
||||
touch .scm-links
|
||||
|
||||
clean-local:
|
||||
$(RM) -rf gnucash g-wrapped
|
||||
|
||||
.INTERMEDIATE: gwrap-files
|
||||
|
||||
gw-dialog-tax-table.scm gw-dialog-tax-table.c gw-dialog-tax-table.h: \
|
||||
gwrap-files
|
||||
|
||||
gwrap-files: \
|
||||
.scm-links gw-dialog-tax-table-spec.scm ${top_builddir}/config.status
|
||||
FLAVOR=gnome $(GUILE) -c \
|
||||
"(set! %load-path (cons \"${G_WRAP_MODULE_DIR}\" %load-path)) \
|
||||
(set! %load-path (cons \"${PWD}\" %load-path)) \
|
||||
(set! %load-path (cons \"../business-core\" %load-path)) \
|
||||
(set! %load-path (cons \"../../engine\" %load-path)) \
|
||||
(set! %load-path (cons \"../../app-utils\" %load-path)) \
|
||||
(set! %load-path (cons \"../../gnome-utils\" %load-path)) \
|
||||
(primitive-load \"./gw-dialog-tax-table-spec.scm\") \
|
||||
(gw:generate-wrapset \"gw-dialog-tax-table\")"
|
||||
touch $@
|
||||
( cd g-wrapped; $(LN_S) -f ../gw-*.scm . )
|
||||
|
||||
BUILT_SOURCES = gw-dialog-tax-table.scm gw-dialog-tax-table.c \
|
||||
gw-dialog-tax-table.h
|
||||
CLEANFILES = $(BUILT_SOURCES) .scm-links \
|
||||
${SCM_FILE_LINKS} gw-dialog-tax-table.html
|
||||
noinst_DATA = .scm-links
|
||||
CLEANFILES = gnucash .scm-links ${SCM_FILE_LINKS}
|
||||
MAINTAINERCLEANFILES = swig-dialog-tax-table.c
|
||||
|
10
src/business/dialog-tax-table/dialog-tax-table.i
Normal file
10
src/business/dialog-tax-table/dialog-tax-table.i
Normal file
@ -0,0 +1,10 @@
|
||||
%module sw_dialog_tax_table
|
||||
%{
|
||||
/* Includes the header in the wrapper code */
|
||||
#include <config.h>
|
||||
#include <dialog-tax-table.h>
|
||||
|
||||
SCM scm_init_sw_dialog_tax_table_module (void);
|
||||
%}
|
||||
|
||||
TaxTableWindow * gnc_ui_tax_table_window_new (GNCBook *book);
|
@ -1,2 +1 @@
|
||||
(define-module (gnucash dialog-tax-table))
|
||||
(use-modules (g-wrapped gw-dialog-tax-table))
|
||||
|
@ -29,8 +29,8 @@
|
||||
|
||||
#include "gnc-module.h"
|
||||
#include "gnc-module-api.h"
|
||||
#include "gw-dialog-tax-table.h"
|
||||
|
||||
extern SCM scm_init_sw_dialog_tax_table_module(void);
|
||||
/* version of the gnc module system interface we require */
|
||||
int libgncmod_dialog_tax_table_LTX_gnc_module_system_interface = 0;
|
||||
|
||||
@ -73,8 +73,8 @@ libgncmod_dialog_tax_table_LTX_gnc_module_init(int refcount)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
scm_c_eval_string("(use-modules (g-wrapped gw-dialog-tax-table))");
|
||||
// scm_c_eval_string("(use-modules (gnucash dialog-tax-table))");
|
||||
scm_init_sw_dialog_tax_table_module();
|
||||
scm_c_eval_string("(use-modules (sw_dialog_tax_table))");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1,57 +0,0 @@
|
||||
;;; -*-scheme-*-
|
||||
|
||||
;(debug-enable 'backtrace)
|
||||
;(debug-enable 'debug)
|
||||
;(read-enable 'positions)
|
||||
|
||||
(debug-set! maxdepth 100000)
|
||||
(debug-set! stack 200000)
|
||||
|
||||
(define-module (g-wrapped gw-dialog-tax-table-spec)
|
||||
:use-module (g-wrap))
|
||||
|
||||
(use-modules (g-wrap))
|
||||
|
||||
(use-modules (g-wrap gw-standard-spec))
|
||||
(use-modules (g-wrap gw-wct-spec))
|
||||
|
||||
(use-modules (g-wrapped gw-business-core-spec))
|
||||
(use-modules (g-wrapped gw-gnome-utils-spec))
|
||||
|
||||
(let ((ws (gw:new-wrapset "gw-dialog-tax-table")))
|
||||
|
||||
(gw:wrapset-depends-on ws "gw-standard")
|
||||
|
||||
(gw:wrapset-depends-on ws "gw-business-core")
|
||||
(gw:wrapset-depends-on ws "gw-engine")
|
||||
(gw:wrapset-depends-on ws "gw-gnome-utils")
|
||||
|
||||
(gw:wrapset-set-guile-module! ws '(g-wrapped gw-dialog-tax-table))
|
||||
|
||||
(gw:wrapset-add-cs-declarations!
|
||||
ws
|
||||
(lambda (wrapset client-wrapset)
|
||||
(list
|
||||
"#include <config.h>\n"
|
||||
"#include <dialog-tax-table.h>\n"
|
||||
)))
|
||||
|
||||
(gw:wrapset-add-cs-initializers!
|
||||
ws
|
||||
(lambda (wrapset client-wrapset status-var)
|
||||
(if client-wrapset
|
||||
'()
|
||||
(gw:inline-scheme '(use-modules (gnucash dialog-tax-table))))))
|
||||
|
||||
;;
|
||||
;; dialog-tax-table.h
|
||||
;;
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:tax-table-new
|
||||
'<gw:void>
|
||||
"gnc_ui_tax_table_window_new"
|
||||
'((<gnc:Book*> book))
|
||||
"Dialog: Edit the Tax Tables.")
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
lib_LTLIBRARIES = libcore-utils.la libgw-core-utils.la
|
||||
lib_LTLIBRARIES = libcore-utils.la
|
||||
|
||||
libcore_utils_la_SOURCES = \
|
||||
gnc-main.c \
|
||||
@ -7,6 +7,7 @@ libcore_utils_la_SOURCES = \
|
||||
gnc-gkeyfile-utils.c \
|
||||
gnc-glib-utils.c \
|
||||
gnc-gobject-utils.c \
|
||||
swig-core-utils.c \
|
||||
gnc-gtk-utils.c
|
||||
|
||||
libcore_utils_la_LIBADD = \
|
||||
@ -14,15 +15,6 @@ libcore_utils_la_LIBADD = \
|
||||
${GCONF_LIBS} \
|
||||
${GTK_LIBS}
|
||||
|
||||
nodist_libgw_core_utils_la_SOURCES = \
|
||||
gw-core-utils.c
|
||||
|
||||
libgw_core_utils_la_LDFLAGS = ${G_WRAP_LINK_ARGS}
|
||||
libgw_core_utils_la_LIBADD = \
|
||||
libcore-utils.la \
|
||||
${GLIB_LIBS} \
|
||||
${GUILE_LIBS}
|
||||
|
||||
noinst_HEADERS = \
|
||||
gnc-main.h \
|
||||
gnc-gconf-utils.h \
|
||||
@ -32,51 +24,38 @@ noinst_HEADERS = \
|
||||
gnc-gobject-utils.h \
|
||||
gnc-gtk-utils.h
|
||||
|
||||
EXTRA_DIST = ${gwmod_DATA}
|
||||
if BUILDING_FROM_SVN
|
||||
swig-core-utils.c: core-utils.i
|
||||
$(SWIG) -guile $(SWIG_ARGS) -Linkage module -o $@ $<
|
||||
endif
|
||||
|
||||
AM_CFLAGS = \
|
||||
${G_WRAP_COMPILE_ARGS} \
|
||||
${GUILE_INCS} \
|
||||
${GLIB_CFLAGS} \
|
||||
${GCONF_CFLAGS} \
|
||||
${GTK_CFLAGS}
|
||||
|
||||
gwmoddir = ${GNC_GWRAP_LIBDIR}
|
||||
gwmod_DATA = gw-core-utils-spec.scm
|
||||
nodist_gwmod_DATA = gw-core-utils.scm
|
||||
gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash
|
||||
gncmod_DATA = core-utils.scm
|
||||
|
||||
if GNUCASH_SEPARATE_BUILDDIR
|
||||
#Only needed when srcdir and builddir are different
|
||||
SCM_FILE_LINKS = gw-core-utils-spec.scm
|
||||
#for running
|
||||
SCM_FILE_LINKS = ${gncmod_DATA}
|
||||
endif
|
||||
|
||||
.scm-links:
|
||||
$(RM) -rf gnucash g-wrapped
|
||||
mkdir -p gnucash g-wrapped
|
||||
$(RM) -rf gnucash
|
||||
mkdir -p gnucash
|
||||
if GNUCASH_SEPARATE_BUILDDIR
|
||||
for X in ${SCM_FILE_LINKS} ; do \
|
||||
$(LN_S) -f ${srcdir}/$$X . ; \
|
||||
done
|
||||
endif
|
||||
( cd gnucash; for A in $(gncmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
|
||||
touch .scm-links
|
||||
|
||||
clean-local:
|
||||
$(RM) -rf gnucash g-wrapped
|
||||
|
||||
.INTERMEDIATE: gwrap-files
|
||||
|
||||
gw-core-utils.scm gw-core-utils.h gw-core-utils.c gw-core-utils.html: \
|
||||
gwrap-files
|
||||
|
||||
gwrap-files: \
|
||||
gw-core-utils-spec.scm .scm-links ${top_builddir}/config.status
|
||||
FLAVOR=gnome $(GUILE) -c \
|
||||
"(set! %load-path (cons \"${G_WRAP_MODULE_DIR}\" %load-path)) \
|
||||
(primitive-load \"./gw-core-utils-spec.scm\") \
|
||||
(gw:generate-wrapset \"gw-core-utils\")"
|
||||
touch $@
|
||||
( cd g-wrapped; $(LN_S) -f ../gw-*.scm . )
|
||||
|
||||
BUILT_SOURCES = gw-core-utils.scm gw-core-utils.h gw-core-utils.c
|
||||
CLEANFILES = $(BUILT_SOURCES) .scm-links \
|
||||
${SCM_FILE_LINKS} gw-core-utils.html
|
||||
noinst_DATA = .scm-links
|
||||
EXTRA_DIST = $(gncmod_DATA) core-utils.i
|
||||
CLEANFILES = gnucash .scm-links
|
||||
MAINTAINERCLEANFILES = swig-core-utils.c
|
||||
|
27
src/core-utils/core-utils.i
Normal file
27
src/core-utils/core-utils.i
Normal file
@ -0,0 +1,27 @@
|
||||
%module sw_core_utils
|
||||
%{
|
||||
//#include <gnc-gconf-utils.h>
|
||||
#include <gnc-glib-utils.h>
|
||||
#include <gnc-main.h>
|
||||
#include <glib.h>
|
||||
|
||||
SCM scm_init_sw_core_utils_module (void);
|
||||
%}
|
||||
|
||||
typedef char gchar;
|
||||
%typemap(newfree) gchar * "g_free($1);"
|
||||
%typemap(in) gboolean " $1 = SCM_NFALSEP($input) ? TRUE : FALSE; "
|
||||
%typemap(out) gboolean " $result = $1 ? SCM_BOOL_T : SCM_BOOL_F; "
|
||||
|
||||
|
||||
|
||||
%newobject g_find_program_in_path;
|
||||
gchar * g_find_program_in_path(const gchar *);
|
||||
|
||||
gboolean gnc_is_debugging(void);
|
||||
|
||||
/* Special treatment because the string changes in place. */
|
||||
%typemap(in) gchar * " $1 = SCM_STRING_CHARS($input); "
|
||||
%typemap(freearg) gchar * ""
|
||||
void gnc_utf8_strip_invalid (gchar *str);
|
||||
|
14
src/core-utils/core-utils.scm
Normal file
14
src/core-utils/core-utils.scm
Normal file
@ -0,0 +1,14 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; core-utils.scm
|
||||
;;; Guile module for core-utils
|
||||
;;;
|
||||
;;; Copyright 2006 Chris Shoemaker <c.shoemaker@cox.net>
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define-module (gnucash core-utils))
|
||||
(load-extension "libcore-utils" "scm_init_sw_core_utils_module")
|
||||
(use-modules (sw_core_utils))
|
||||
|
||||
(export gnc-is-debugging)
|
||||
(export g-find-program-in-path)
|
||||
(export gnc-utf8-strip-invalid)
|
@ -24,11 +24,11 @@
|
||||
#include "config.h"
|
||||
#include "gnc-main.h"
|
||||
|
||||
static char *namespace_regexp = NULL;
|
||||
static int is_debugging;
|
||||
static gchar *namespace_regexp = NULL;
|
||||
static gboolean is_debugging;
|
||||
|
||||
void
|
||||
gnc_main_set_namespace_regexp(const char *str)
|
||||
gnc_main_set_namespace_regexp(const gchar *str)
|
||||
{
|
||||
if (namespace_regexp)
|
||||
g_free(namespace_regexp);
|
||||
@ -37,20 +37,20 @@ gnc_main_set_namespace_regexp(const char *str)
|
||||
namespace_regexp = g_strdup(str);
|
||||
}
|
||||
|
||||
const char *
|
||||
const gchar *
|
||||
gnc_main_get_namespace_regexp(void)
|
||||
{
|
||||
return namespace_regexp;
|
||||
}
|
||||
|
||||
int
|
||||
gboolean
|
||||
gnc_is_debugging(void)
|
||||
{
|
||||
return is_debugging;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_set_debugging(int d)
|
||||
gnc_set_debugging(gboolean d)
|
||||
{
|
||||
is_debugging = d;
|
||||
}
|
||||
|
@ -26,10 +26,10 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
void gnc_main_set_namespace_regexp(const char *str);
|
||||
const char *gnc_main_get_namespace_regexp(void);
|
||||
void gnc_main_set_namespace_regexp(const gchar *str);
|
||||
const gchar *gnc_main_get_namespace_regexp(void);
|
||||
|
||||
int gnc_is_debugging(void);
|
||||
void gnc_set_debugging(int d);
|
||||
gboolean gnc_is_debugging(void);
|
||||
void gnc_set_debugging(gboolean d);
|
||||
|
||||
#endif /* GNC_MAIN_H */
|
||||
|
@ -1,64 +0,0 @@
|
||||
;;; -*-scheme-*-
|
||||
|
||||
(debug-set! maxdepth 100000)
|
||||
(debug-set! stack 200000)
|
||||
|
||||
(define-module (g-wrapped gw-core-utils-spec))
|
||||
|
||||
(use-modules (g-wrap))
|
||||
(use-modules (g-wrap simple-type))
|
||||
|
||||
(use-modules (g-wrap gw-standard-spec))
|
||||
(use-modules (g-wrap gw-wct-spec))
|
||||
(use-modules (g-wrap gw-glib-spec))
|
||||
|
||||
(let ((ws (gw:new-wrapset "gw-core-utils")))
|
||||
|
||||
(gw:wrapset-depends-on ws "gw-standard")
|
||||
(gw:wrapset-depends-on ws "gw-wct")
|
||||
(gw:wrapset-depends-on ws "gw-glib")
|
||||
|
||||
(gw:wrapset-set-guile-module! ws '(g-wrapped gw-core-utils))
|
||||
|
||||
(gw:wrapset-add-cs-declarations!
|
||||
ws
|
||||
(lambda (wrapset client-wrapset)
|
||||
(list
|
||||
"#include <gnc-gconf-utils.h>\n"
|
||||
"#include <gnc-glib-utils.h>\n"
|
||||
"#include <gnc-main.h>\n")))
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:gconf-get-bool
|
||||
'<gw:bool>
|
||||
"gnc_gconf_get_bool_no_error"
|
||||
'(((<gw:mchars> caller-owned) section)
|
||||
((<gw:mchars> caller-owned) name))
|
||||
"Get a boolean value from gconf.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:debugging?
|
||||
'<gw:bool>
|
||||
"gnc_is_debugging"
|
||||
'()
|
||||
"Is debugging mode on?")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'g:find-program-in-path
|
||||
'(<gw:mchars> callee-owned const)
|
||||
"g_find_program_in_path"
|
||||
'(((<gw:mchars> caller-owned) program))
|
||||
"Get a boolean value from gconf.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:utf8-strip-invalid
|
||||
'<gw:void>
|
||||
"gnc_utf8_strip_invalid"
|
||||
'(((<gw:mchars> caller-owned) program))
|
||||
"Strip string of non-utf8 characters.")
|
||||
|
||||
)
|
@ -561,10 +561,6 @@ SplitList* xaccAccountGetSplitList (const Account *account);
|
||||
* in accfrom to accto. */
|
||||
void xaccAccountMoveAllSplits (Account *accfrom, Account *accto);
|
||||
|
||||
/** \warning Unimplemented */
|
||||
gpointer xaccAccountForEachSplit(Account *account, SplitCallback,
|
||||
gpointer data);
|
||||
|
||||
/** The xaccAccountForEachTransaction() routine will traverse all of
|
||||
the transactions in the given 'account' and call the callback
|
||||
function 'proc' on each transaction. Processing will continue
|
||||
|
@ -470,7 +470,7 @@ xaccGroupGetAccountList (const AccountGroup *grp)
|
||||
return grp->accounts;
|
||||
}
|
||||
|
||||
GList *
|
||||
AccountList *
|
||||
xaccGroupGetAccountListSorted (const AccountGroup *grp)
|
||||
{
|
||||
if (!grp) return NULL;
|
||||
|
@ -215,7 +215,7 @@ AccountList * xaccGroupGetAccountList (const AccountGroup *grp);
|
||||
* immediate children of the account group. The returned list
|
||||
* should be freed with g_list_free() when no longer needed.
|
||||
*/
|
||||
GList * xaccGroupGetAccountListSorted (const AccountGroup *grp);
|
||||
AccountList * xaccGroupGetAccountListSorted (const AccountGroup *grp);
|
||||
|
||||
/** The xaccGroupGetRoot() subroutine will find the topmost
|
||||
* (root) group to which this group belongs.
|
||||
|
@ -1,7 +1,7 @@
|
||||
SUBDIRS = . test-core test
|
||||
PWD := $(shell pwd)
|
||||
|
||||
pkglib_LTLIBRARIES = libgncmod-engine.la libgw-engine.la libgw-kvp.la
|
||||
pkglib_LTLIBRARIES = libgncmod-engine.la
|
||||
|
||||
AM_CFLAGS = \
|
||||
-I${top_srcdir}/lib/libc \
|
||||
@ -43,6 +43,10 @@ libgncmod_engine_la_SOURCES = \
|
||||
gnc-session.c \
|
||||
gnc-session-scm.c \
|
||||
gncmod-engine.c \
|
||||
swig-engine.c \
|
||||
kvp-scm.c \
|
||||
engine-helpers.c \
|
||||
glib-helpers.c \
|
||||
policy.c
|
||||
|
||||
EXTRA_libgncmod_engine_la_SOURCES = iso-4217-currencies.c
|
||||
@ -111,32 +115,13 @@ noinst_SCRIPTS = iso-currencies-to-c
|
||||
libgncmod_engine_la_LIBADD = \
|
||||
../gnc-module/libgncmodule.la \
|
||||
../core-utils/libcore-utils.la \
|
||||
${G_WRAP_LINK_ARGS} \
|
||||
${GUILE_LIBS} \
|
||||
${QOF_LIBS} \
|
||||
${REGEX_LIBS} \
|
||||
${GNUCASH_ENGINE_BASE_LIBS} \
|
||||
${BINRELOC_LIBS} \
|
||||
${top_builddir}/lib/libc/libc-missing.la
|
||||
|
||||
libgw_kvp_la_SOURCES = kvp-scm.c
|
||||
nodist_libgw_kvp_la_SOURCES = gw-kvp.c
|
||||
libgw_kvp_la_LDFLAGS = \
|
||||
${G_WRAP_LINK_ARGS} \
|
||||
${QOF_LIBS} \
|
||||
${GLIB_LIBS}
|
||||
libgw_kvp_la_LIBADD = \
|
||||
libgncmod-engine.la \
|
||||
libgw-engine.la
|
||||
|
||||
libgw_engine_la_SOURCES = engine-helpers.c glib-helpers.c
|
||||
nodist_libgw_engine_la_SOURCES = gw-engine.c
|
||||
libgw_engine_la_LDFLAGS = \
|
||||
${G_WRAP_LINK_ARGS} \
|
||||
${QOF_LIBS} \
|
||||
${GLIB_LIBS}
|
||||
libgw_engine_la_LIBADD = \
|
||||
libgncmod-engine.la
|
||||
|
||||
gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash
|
||||
gncmod_DATA = engine.scm
|
||||
|
||||
@ -147,14 +132,6 @@ gncscm_DATA = \
|
||||
engine-utilities.scm \
|
||||
gnc-numeric.scm
|
||||
|
||||
gwmoddir = ${GNC_GWRAP_LIBDIR}
|
||||
gwmod_DATA = \
|
||||
gw-engine-spec.scm \
|
||||
gw-kvp-spec.scm
|
||||
nodist_gwmod_DATA = \
|
||||
gw-engine.scm \
|
||||
gw-kvp.scm
|
||||
|
||||
EXTRA_DIST = \
|
||||
README.query-api \
|
||||
design.txt \
|
||||
@ -164,13 +141,13 @@ EXTRA_DIST = \
|
||||
gncla-dir.h.in \
|
||||
kvp_doc.txt \
|
||||
SX-book-p.h \
|
||||
engine.i \
|
||||
${gncmod_DATA} \
|
||||
${gncscm_DATA} \
|
||||
${gwmod_DATA}
|
||||
${gncscm_DATA}
|
||||
|
||||
if GNUCASH_SEPARATE_BUILDDIR
|
||||
#For compiling
|
||||
SCM_FILE_LINKS = gw-engine-spec.scm gw-kvp-spec.scm iso-4217-currencies.scm
|
||||
SCM_FILE_LINKS = iso-4217-currencies.scm
|
||||
#For executing test cases
|
||||
SCM_FILE_LINKS += \
|
||||
${gncmod_DATA} \
|
||||
@ -178,8 +155,8 @@ SCM_FILE_LINKS += \
|
||||
endif
|
||||
|
||||
.scm-links:
|
||||
$(RM) -rf gnucash g-wrapped
|
||||
mkdir -p gnucash g-wrapped
|
||||
$(RM) -rf gnucash
|
||||
mkdir -p gnucash
|
||||
if GNUCASH_SEPARATE_BUILDDIR
|
||||
for X in ${SCM_FILE_LINKS} ; do \
|
||||
$(LN_S) -f ${srcdir}/$$X . ; \
|
||||
@ -188,41 +165,18 @@ endif
|
||||
( cd gnucash; for A in $(gncmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
|
||||
touch .scm-links
|
||||
|
||||
clean-local:
|
||||
$(RM) -rf gnucash g-wrapped
|
||||
noinst_DATA = .scm-links
|
||||
|
||||
.INTERMEDIATE: gwrap-files1 gwrap-files2
|
||||
if BUILDING_FROM_SVN
|
||||
swig-engine.c: engine.i ${gncinclude_HEADERS} ${noinst_HEADERS}
|
||||
$(SWIG) -guile $(SWIG_ARGS) -Linkage module \
|
||||
-I${top_srcdir}/lib/libqof/qof -o $@ $<
|
||||
endif
|
||||
|
||||
iso-4217-currencies.c: iso-4217-currencies.scm iso-currencies-to-c
|
||||
-chmod u+x ${srcdir}/iso-currencies-to-c
|
||||
GUILE_LOAD_PATH=@GNC_SRFI_LOAD_PATH@:${GUILE_LOAD_PATH} srcdir=${srcdir} ${srcdir}/iso-currencies-to-c
|
||||
|
||||
gw-engine.scm gw-engine.c gw-engine.h: \
|
||||
gwrap-files1
|
||||
|
||||
gwrap-files1: \
|
||||
.scm-links gw-engine-spec.scm ${top_builddir}/config.status
|
||||
FLAVOR=gnome $(GUILE) -c \
|
||||
"(set! %load-path (cons \"${G_WRAP_MODULE_DIR}\" %load-path)) \
|
||||
(set! %load-path (cons \"${PWD}\" %load-path)) \
|
||||
(primitive-load \"./gw-engine-spec.scm\") \
|
||||
(gw:generate-wrapset \"gw-engine\")"
|
||||
touch $@
|
||||
( cd g-wrapped; $(LN_S) -f ../gw-engine*.scm . )
|
||||
|
||||
gw-kvp.scm gw-kvp.c gw-kvp.h: \
|
||||
gwrap-files2
|
||||
|
||||
gwrap-files2: \
|
||||
.scm-links gw-kvp-spec.scm ${top_builddir}/config.status gwrap-files1
|
||||
FLAVOR=gnome $(GUILE) -c \
|
||||
"(set! %load-path (cons \"${G_WRAP_MODULE_DIR}\" %load-path)) \
|
||||
(set! %load-path (cons \"${PWD}\" %load-path)) \
|
||||
(primitive-load \"./gw-kvp-spec.scm\") \
|
||||
(gw:generate-wrapset \"gw-kvp\")"
|
||||
touch $@
|
||||
( cd g-wrapped; $(LN_S) -f ../gw-kvp*.scm . )
|
||||
|
||||
gncla-dir.h: gncla-dir.h.in ${top_builddir}/config.status Makefile
|
||||
rm -f $@.tmp
|
||||
sed < $< > $@.tmp \
|
||||
@ -238,8 +192,8 @@ gncla-dir.h: gncla-dir.h.in ${top_builddir}/config.status Makefile
|
||||
mv $@.tmp $@
|
||||
|
||||
BUILT_SOURCES = iso-4217-currencies.c \
|
||||
gw-engine.scm gw-engine.c gw-engine.h \
|
||||
gw-kvp.scm gw-kvp.c gw-kvp.h gncla-dir.h
|
||||
gncla-dir.h
|
||||
|
||||
CLEANFILES = $(BUILT_SOURCES) .scm-links gncla-dir.h \
|
||||
${SCM_FILE_LINKS} gw-engine.html gw-kvp.html
|
||||
CLEANFILES = $(BUILT_SOURCES) gnucash .scm-links gncla-dir.h \
|
||||
${SCM_FILE_LINKS}
|
||||
MAINTAINERCLEANFILES = swig-engine.c
|
||||
|
@ -295,7 +295,8 @@ xaccQueryAddSingleAccountMatch(Query *q, Account *acc, QofQueryOp op)
|
||||
|
||||
void
|
||||
xaccQueryAddStringMatch (Query* q, const char *matchstring,
|
||||
int case_sens, int use_regexp, QofQueryOp op,
|
||||
gboolean case_sens, gboolean use_regexp,
|
||||
QofQueryOp op,
|
||||
const char * path, ...)
|
||||
{
|
||||
QofQueryPredData *pred_data;
|
||||
@ -353,8 +354,8 @@ xaccQueryAddNumericMatch (Query *q, gnc_numeric amount, QofNumericMatch sign,
|
||||
|
||||
void
|
||||
xaccQueryAddDateMatchTS (Query * q,
|
||||
int use_start, Timespec sts,
|
||||
int use_end, Timespec ets,
|
||||
gboolean use_start, Timespec sts,
|
||||
gboolean use_end, Timespec ets,
|
||||
QofQueryOp op)
|
||||
{
|
||||
Query *tmp_q = NULL;
|
||||
@ -425,8 +426,8 @@ xaccQueryGetDateMatchTS (Query * q,
|
||||
|
||||
void
|
||||
xaccQueryAddDateMatch(Query * q,
|
||||
int use_start, int sday, int smonth, int syear,
|
||||
int use_end, int eday, int emonth, int eyear,
|
||||
gboolean use_start, int sday, int smonth, int syear,
|
||||
gboolean use_end, int eday, int emonth, int eyear,
|
||||
QofQueryOp op)
|
||||
{
|
||||
/* gcc -O3 will auto-inline this function, avoiding a call overhead */
|
||||
@ -444,9 +445,9 @@ xaccQueryAddDateMatch(Query * q,
|
||||
|
||||
void
|
||||
xaccQueryAddDateMatchTT(Query * q,
|
||||
int use_start,
|
||||
gboolean use_start,
|
||||
time_t stt,
|
||||
int use_end,
|
||||
gboolean use_end,
|
||||
time_t ett,
|
||||
QofQueryOp op)
|
||||
{
|
||||
@ -532,22 +533,6 @@ xaccQueryAddGUIDMatch(Query * q, const GUID *guid,
|
||||
qof_query_add_guid_match (q, param_list, guid, op);
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddGUIDMatchGL (QofQuery *q, GList *param_list,
|
||||
GUID guid, QofQueryOp op)
|
||||
{
|
||||
GSList *params = NULL;
|
||||
GList *node;
|
||||
|
||||
for (node = param_list; node; node = node->next)
|
||||
params = g_slist_prepend (params, node->data);
|
||||
|
||||
params = g_slist_reverse (params);
|
||||
g_list_free (param_list);
|
||||
|
||||
qof_query_add_guid_match (q, params, &guid, op);
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddKVPMatch(QofQuery *q, GSList *path, const KvpValue *value,
|
||||
QofQueryCompare how, QofIdType id_type,
|
||||
@ -626,4 +611,68 @@ xaccQueryGetLatestDateFound(Query * q)
|
||||
return latest;
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddDescriptionMatch(Query *q, const char *m, gboolean c, gboolean r,
|
||||
QofQueryOp o)
|
||||
{
|
||||
xaccQueryAddStringMatch ((q), (m), (c), (r), (o), SPLIT_TRANS,
|
||||
TRANS_DESCRIPTION, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddNumberMatch(Query *q, const char *m, gboolean c, gboolean r,
|
||||
QofQueryOp o)
|
||||
{
|
||||
xaccQueryAddStringMatch ((q), (m), (c), (r), (o), SPLIT_TRANS,
|
||||
TRANS_NUM, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddActionMatch(Query *q, const char *m, gboolean c, gboolean r,
|
||||
QofQueryOp o)
|
||||
{
|
||||
xaccQueryAddStringMatch ((q), (m), (c), (r), (o), SPLIT_ACTION, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddMemoMatch(Query *q, const char *m, gboolean c, gboolean r,
|
||||
QofQueryOp o)
|
||||
{
|
||||
xaccQueryAddStringMatch ((q), (m), (c), (r), (o), SPLIT_MEMO, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddValueMatch(Query *q, gnc_numeric amt, QofNumericMatch sgn,
|
||||
QofQueryCompare how, QofQueryOp op)
|
||||
{
|
||||
xaccQueryAddNumericMatch ((q), (amt), (sgn), (how), (op),
|
||||
SPLIT_VALUE, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddSharePriceMatch(Query *q, gnc_numeric amt, QofQueryCompare how,
|
||||
QofQueryOp op)
|
||||
{
|
||||
xaccQueryAddNumericMatch ((q), (amt), QOF_NUMERIC_MATCH_ANY, (how), (op),
|
||||
SPLIT_SHARE_PRICE, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddSharesMatch(Query *q, gnc_numeric amt, QofQueryCompare how,
|
||||
QofQueryOp op)
|
||||
{
|
||||
xaccQueryAddNumericMatch ((q), (amt), QOF_NUMERIC_MATCH_ANY, (how), (op),
|
||||
SPLIT_AMOUNT, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddBalanceMatch(Query *q, QofQueryCompare bal, QofQueryOp op)
|
||||
{
|
||||
xaccQueryAddNumericMatch(
|
||||
(q), gnc_numeric_zero(), QOF_NUMERIC_MATCH_ANY,
|
||||
((bal) ? QOF_COMPARE_EQUAL : QOF_COMPARE_NEQ), (op),
|
||||
SPLIT_TRANS, TRANS_IMBALANCE, NULL);
|
||||
}
|
||||
|
||||
|
||||
/* ======================== END OF FILE ======================= */
|
||||
|
@ -124,43 +124,37 @@ void xaccQueryAddAccountGUIDMatch(Query *, AccountGUIDList *,
|
||||
void xaccQueryAddSingleAccountMatch(Query *, Account *, QofQueryOp);
|
||||
|
||||
void xaccQueryAddStringMatch (Query* q, const char *matchstring,
|
||||
int case_sens, int use_regexp, QofQueryOp op,
|
||||
gboolean case_sens, gboolean use_regexp,
|
||||
QofQueryOp op,
|
||||
const char * path, ...);
|
||||
|
||||
#define xaccQueryAddDescriptionMatch(q,m,c,r,o) \
|
||||
xaccQueryAddStringMatch ((q), (m), (c), (r), (o), SPLIT_TRANS, \
|
||||
TRANS_DESCRIPTION, NULL)
|
||||
#define xaccQueryAddNumberMatch(q,m,c,r,o) \
|
||||
xaccQueryAddStringMatch ((q), (m), (c), (r), (o), SPLIT_TRANS, \
|
||||
TRANS_NUM, NULL)
|
||||
#define xaccQueryAddActionMatch(q,m,c,r,o) \
|
||||
xaccQueryAddStringMatch ((q), (m), (c), (r), (o), SPLIT_ACTION, \
|
||||
NULL)
|
||||
#define xaccQueryAddMemoMatch(q,m,c,r,o) \
|
||||
xaccQueryAddStringMatch ((q), (m), (c), (r), (o), SPLIT_MEMO, \
|
||||
NULL)
|
||||
void
|
||||
xaccQueryAddDescriptionMatch(Query *q, const char *m, gboolean c, gboolean r,
|
||||
QofQueryOp o);
|
||||
void
|
||||
xaccQueryAddNumberMatch(Query *q, const char *m, gboolean c, gboolean r,
|
||||
QofQueryOp o);
|
||||
void
|
||||
xaccQueryAddActionMatch(Query *q, const char *m, gboolean c, gboolean r,
|
||||
QofQueryOp o);
|
||||
void
|
||||
xaccQueryAddMemoMatch(Query *q, const char *m, gboolean c, gboolean r,
|
||||
QofQueryOp o);
|
||||
void
|
||||
xaccQueryAddValueMatch(Query *q, gnc_numeric amt, QofNumericMatch sgn,
|
||||
QofQueryCompare how, QofQueryOp op);
|
||||
void
|
||||
xaccQueryAddSharePriceMatch(Query *q, gnc_numeric amt, QofQueryCompare how,
|
||||
QofQueryOp op);
|
||||
void
|
||||
xaccQueryAddSharesMatch(Query *q, gnc_numeric amt, QofQueryCompare how,
|
||||
QofQueryOp op);
|
||||
void
|
||||
xaccQueryAddBalanceMatch(Query *q, QofQueryCompare bal, QofQueryOp op);
|
||||
|
||||
void xaccQueryAddNumericMatch (Query *q, gnc_numeric amount,
|
||||
QofNumericMatch sign, QofQueryCompare how,
|
||||
QofQueryOp op, const char * path, ...);
|
||||
|
||||
#define xaccQueryAddValueMatch(q,amt,sgn,how,op) \
|
||||
xaccQueryAddNumericMatch ((q), (amt), (sgn), (how), (op), \
|
||||
SPLIT_VALUE, NULL)
|
||||
|
||||
#define xaccQueryAddSharePriceMatch(q,amt,how,op) \
|
||||
xaccQueryAddNumericMatch ((q), (amt), QOF_NUMERIC_MATCH_ANY, (how), (op), \
|
||||
SPLIT_SHARE_PRICE, NULL)
|
||||
|
||||
#define xaccQueryAddSharesMatch(q,amt,how,op) \
|
||||
xaccQueryAddNumericMatch ((q), (amt), QOF_NUMERIC_MATCH_ANY, (how), (op), \
|
||||
SPLIT_AMOUNT, NULL)
|
||||
|
||||
#define xaccQueryAddBalanceMatch(q,bal,op) \
|
||||
xaccQueryAddNumericMatch ((q), gnc_numeric_zero(), QOF_NUMERIC_MATCH_ANY, \
|
||||
((bal) ? QOF_COMPARE_EQUAL : QOF_COMPARE_NEQ), (op), \
|
||||
SPLIT_TRANS, TRANS_IMBALANCE, NULL)
|
||||
|
||||
/** The DateMatch queries match transactions whose posted date
|
||||
* is in a date range. If use_start is TRUE, then a matching
|
||||
* posted date will be greater than the start date. If
|
||||
@ -170,17 +164,17 @@ void xaccQueryAddNumericMatch (Query *q, gnc_numeric amount,
|
||||
* all transactions are matched.
|
||||
*/
|
||||
|
||||
void xaccQueryAddDateMatch(Query * q,
|
||||
int use_start, int sday, int smonth, int syear,
|
||||
int use_end, int eday, int emonth, int eyear,
|
||||
void xaccQueryAddDateMatch(Query * q, gboolean use_start,
|
||||
int sday, int smonth, int syear,
|
||||
gboolean use_end, int eday, int emonth, int eyear,
|
||||
QofQueryOp op);
|
||||
void xaccQueryAddDateMatchTS(Query * q,
|
||||
int use_start, Timespec sts,
|
||||
int use_end, Timespec ets,
|
||||
gboolean use_start, Timespec sts,
|
||||
gboolean use_end, Timespec ets,
|
||||
QofQueryOp op);
|
||||
void xaccQueryAddDateMatchTT(Query * q,
|
||||
int use_start, time_t stt,
|
||||
int use_end, time_t ett,
|
||||
gboolean use_start, time_t stt,
|
||||
gboolean use_end, time_t ett,
|
||||
QofQueryOp op);
|
||||
void xaccQueryGetDateMatchTS (Query * q,
|
||||
Timespec * sts,
|
||||
@ -202,8 +196,6 @@ typedef enum {
|
||||
void xaccQueryAddClearedMatch(Query * q, cleared_match_t how, QofQueryOp op);
|
||||
void xaccQueryAddGUIDMatch(Query * q, const GUID *guid,
|
||||
QofIdType id_type, QofQueryOp op);
|
||||
void xaccQueryAddGUIDMatchGL (QofQuery *q, GList *param_list,
|
||||
GUID guid, QofQueryOp op);
|
||||
|
||||
/** given kvp value is on right side of comparison */
|
||||
void xaccQueryAddKVPMatch(Query *q, GSList *path, const KvpValue *value,
|
||||
|
@ -226,10 +226,6 @@ guint gnc_book_count_transactions(QofBook *book);
|
||||
*/
|
||||
void xaccTransSortSplits (Transaction *trans);
|
||||
|
||||
/** Print the transaction out to the console. Used for debugging.
|
||||
*/
|
||||
void xaccTransDump (Transaction *trans, const char *tag);
|
||||
|
||||
/** Set the Transaction Type
|
||||
*
|
||||
* See #TXN_TYPE_NONE, #TXN_TYPE_INVOICE and #TXN_TYPE_PAYMENT */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/********************************************************************\
|
||||
* engine-helpers.c -- gnucash g-wrap helper functions *
|
||||
* engine-helpers.c -- gnucash engine helper functions *
|
||||
* Copyright (C) 2000 Linas Vepstas <linas@linas.org> *
|
||||
* Copyright (C) 2001 Linux Developers Group, Inc. *
|
||||
* *
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <g-wrap-wct.h>
|
||||
#include "swig-runtime.h"
|
||||
#include <libguile.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -43,6 +43,8 @@ cannot be considered "standard" or public parts of QOF. */
|
||||
#include "qofquery-p.h"
|
||||
#include "qofquerycore-p.h"
|
||||
|
||||
#define FUNC_NAME __FUNCTION__
|
||||
|
||||
static QofLogModule log_module = GNC_MOD_ENGINE;
|
||||
|
||||
Timespec
|
||||
@ -197,123 +199,47 @@ typedef enum {
|
||||
gnc_QUERY_v2
|
||||
} query_version_t;
|
||||
|
||||
static SCM
|
||||
gnc_gw_enum_val2scm (const char *typestr, int value)
|
||||
{
|
||||
char *func_name;
|
||||
SCM func;
|
||||
SCM scm;
|
||||
|
||||
func_name = g_strdup_printf ("gw:enum-%s-val->sym", typestr);
|
||||
|
||||
func = scm_c_eval_string (func_name);
|
||||
if (SCM_PROCEDUREP (func))
|
||||
scm = scm_call_2 (func, scm_int2num (value), SCM_BOOL_F);
|
||||
else
|
||||
scm = SCM_BOOL_F;
|
||||
|
||||
g_free (func_name);
|
||||
|
||||
return scm;
|
||||
}
|
||||
|
||||
static int
|
||||
gnc_gw_enum_scm2val (const char *typestr, SCM enum_scm)
|
||||
{
|
||||
char *func_name;
|
||||
SCM func;
|
||||
SCM scm;
|
||||
|
||||
func_name = g_strdup_printf ("gw:enum-%s-val->int", typestr);
|
||||
|
||||
func = scm_c_eval_string (func_name);
|
||||
if (SCM_PROCEDUREP (func))
|
||||
scm = scm_call_1 (func, enum_scm);
|
||||
else
|
||||
scm = scm_int2num (0);
|
||||
|
||||
g_free (func_name);
|
||||
|
||||
return scm_num2int (scm, SCM_ARG1, __FUNCTION__);
|
||||
}
|
||||
|
||||
/* QofCompareFunc */
|
||||
|
||||
static SCM
|
||||
gnc_query_compare2scm (QofQueryCompare how)
|
||||
{
|
||||
return gnc_gw_enum_val2scm ("<gnc:query-compare-how>", how);
|
||||
}
|
||||
|
||||
static QofQueryCompare
|
||||
gnc_query_scm2compare (SCM how_scm)
|
||||
{
|
||||
return gnc_gw_enum_scm2val ("<gnc:query-compare-how>", how_scm);
|
||||
return scm_num2int(how_scm, SCM_ARG1, __FUNCTION__);
|
||||
}
|
||||
|
||||
/* QofStringMatch */
|
||||
static SCM
|
||||
gnc_query_string2scm (QofStringMatch how)
|
||||
{
|
||||
return gnc_gw_enum_val2scm ("<gnc:string-match-how>", how);
|
||||
}
|
||||
|
||||
static QofStringMatch
|
||||
gnc_query_scm2string (SCM how_scm)
|
||||
{
|
||||
return gnc_gw_enum_scm2val ("<gnc:string-match-how>", how_scm);
|
||||
return scm_num2int(how_scm, SCM_ARG1, __FUNCTION__);
|
||||
}
|
||||
|
||||
/* QofDateMatch */
|
||||
static SCM
|
||||
gnc_query_date2scm (QofDateMatch how)
|
||||
{
|
||||
return gnc_gw_enum_val2scm ("<gnc:date-match-how>", how);
|
||||
}
|
||||
|
||||
static QofDateMatch
|
||||
gnc_query_scm2date (SCM how_scm)
|
||||
{
|
||||
return gnc_gw_enum_scm2val ("<gnc:date-match-how>", how_scm);
|
||||
return scm_num2int(how_scm, SCM_ARG1, __FUNCTION__);
|
||||
}
|
||||
|
||||
/* QofNumericMatch */
|
||||
static SCM
|
||||
gnc_query_numericop2scm (QofNumericMatch how)
|
||||
{
|
||||
return gnc_gw_enum_val2scm ("<gnc:numeric-match-how>", how);
|
||||
}
|
||||
|
||||
static QofNumericMatch
|
||||
gnc_query_scm2numericop (SCM how_scm)
|
||||
{
|
||||
return gnc_gw_enum_scm2val ("<gnc:numeric-match-how>", how_scm);
|
||||
return scm_num2int(how_scm, SCM_ARG1, __FUNCTION__);
|
||||
}
|
||||
|
||||
/* QofGuidMatch */
|
||||
static SCM
|
||||
gnc_query_guid2scm (QofGuidMatch how)
|
||||
{
|
||||
return gnc_gw_enum_val2scm ("<gnc:guid-match-how>", how);
|
||||
}
|
||||
|
||||
static QofGuidMatch
|
||||
gnc_query_scm2guid (SCM how_scm)
|
||||
{
|
||||
return gnc_gw_enum_scm2val ("<gnc:guid-match-how>", how_scm);
|
||||
return scm_num2int(how_scm, SCM_ARG1, __FUNCTION__);
|
||||
}
|
||||
|
||||
/* QofCharMatch */
|
||||
static SCM
|
||||
gnc_query_char2scm (QofCharMatch how)
|
||||
{
|
||||
return gnc_gw_enum_val2scm ("<gnc:char-match-how>", how);
|
||||
}
|
||||
|
||||
static QofCharMatch
|
||||
gnc_query_scm2char (SCM how_scm)
|
||||
{
|
||||
return gnc_gw_enum_scm2val ("<gnc:char-match-how>", how_scm);
|
||||
return scm_num2int(how_scm, SCM_ARG1, __FUNCTION__);
|
||||
}
|
||||
|
||||
static QofGuidMatch
|
||||
@ -379,7 +305,7 @@ gnc_scm2kvp_match_how (SCM how_scm)
|
||||
}
|
||||
|
||||
static int
|
||||
gnc_scm2bitfield (const char *typestr, SCM field_scm)
|
||||
gnc_scm2bitfield (SCM field_scm)
|
||||
{
|
||||
int field = 0;
|
||||
|
||||
@ -394,7 +320,7 @@ gnc_scm2bitfield (const char *typestr, SCM field_scm)
|
||||
scm = SCM_CAR (field_scm);
|
||||
field_scm = SCM_CDR (field_scm);
|
||||
|
||||
bit = gnc_gw_enum_scm2val (typestr, scm);
|
||||
bit = scm_num2int(scm, SCM_ARG2, __FUNCTION__);
|
||||
field |= bit;
|
||||
}
|
||||
|
||||
@ -404,7 +330,7 @@ gnc_scm2bitfield (const char *typestr, SCM field_scm)
|
||||
static cleared_match_t
|
||||
gnc_scm2cleared_match_how (SCM how_scm)
|
||||
{
|
||||
return gnc_scm2bitfield ("<gnc:cleared-match-how>", how_scm);
|
||||
return gnc_scm2bitfield (how_scm);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -551,7 +477,7 @@ gnc_query_path2scm (GSList *path)
|
||||
return scm_reverse (path_scm);
|
||||
}
|
||||
|
||||
static GSList *
|
||||
GSList *
|
||||
gnc_query_scm2path (SCM path_scm)
|
||||
{
|
||||
GSList *path = NULL;
|
||||
@ -588,16 +514,10 @@ gnc_query_path_free (GSList *path)
|
||||
g_slist_free (path);
|
||||
}
|
||||
|
||||
static SCM
|
||||
gnc_KvpValueTypeype2scm (KvpValueType how)
|
||||
{
|
||||
return gnc_gw_enum_val2scm ("<gnc:kvp-value-t>", how);
|
||||
}
|
||||
|
||||
static KvpValueType
|
||||
gnc_scm2KvpValueTypeype (SCM value_type_scm)
|
||||
{
|
||||
return gnc_gw_enum_scm2val ("<gnc:kvp-value-t>", value_type_scm);
|
||||
return scm_num2int(value_type_scm, SCM_ARG1, __FUNCTION__);
|
||||
}
|
||||
|
||||
static SCM gnc_kvp_frame2scm (KvpFrame *frame);
|
||||
@ -613,7 +533,7 @@ gnc_kvp_value2scm (KvpValue *value)
|
||||
|
||||
value_t = kvp_value_get_type (value);
|
||||
|
||||
value_scm = scm_cons (gnc_KvpValueTypeype2scm (value_t), value_scm);
|
||||
value_scm = scm_cons (scm_long2num (value_t), value_scm);
|
||||
|
||||
switch (value_t)
|
||||
{
|
||||
@ -862,31 +782,31 @@ gnc_queryterm2scm (QofQueryTerm *qt)
|
||||
|
||||
pd = qof_query_term_get_pred_data (qt);
|
||||
qt_scm = scm_cons (scm_str2symbol (pd->type_name), qt_scm);
|
||||
qt_scm = scm_cons (gnc_query_compare2scm (pd->how), qt_scm);
|
||||
qt_scm = scm_cons (scm_long2num (pd->how), qt_scm);
|
||||
|
||||
if (!safe_strcmp (pd->type_name, QOF_TYPE_STRING)) {
|
||||
query_string_t pdata = (query_string_t) pd;
|
||||
|
||||
qt_scm = scm_cons (gnc_query_string2scm (pdata->options), qt_scm);
|
||||
qt_scm = scm_cons (scm_long2num (pdata->options), qt_scm);
|
||||
qt_scm = scm_cons (SCM_BOOL (pdata->is_regex), qt_scm);
|
||||
qt_scm = scm_cons (scm_makfrom0str (pdata->matchstring), qt_scm);
|
||||
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_DATE)) {
|
||||
query_date_t pdata = (query_date_t) pd;
|
||||
|
||||
qt_scm = scm_cons (gnc_query_date2scm (pdata->options), qt_scm);
|
||||
qt_scm = scm_cons (scm_long2num (pdata->options), qt_scm);
|
||||
qt_scm = scm_cons (gnc_timespec2timepair (pdata->date), qt_scm);
|
||||
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_NUMERIC)) {
|
||||
query_numeric_t pdata = (query_numeric_t) pd;
|
||||
|
||||
qt_scm = scm_cons (gnc_query_numericop2scm (pdata->options), qt_scm);
|
||||
qt_scm = scm_cons (scm_long2num (pdata->options), qt_scm);
|
||||
qt_scm = scm_cons (gnc_query_numeric2scm (pdata->amount), qt_scm);
|
||||
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_GUID)) {
|
||||
query_guid_t pdata = (query_guid_t) pd;
|
||||
|
||||
qt_scm = scm_cons (gnc_query_guid2scm (pdata->options), qt_scm);
|
||||
qt_scm = scm_cons (scm_long2num (pdata->options), qt_scm);
|
||||
qt_scm = scm_cons (gnc_guid_glist2scm (pdata->guids), qt_scm);
|
||||
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_INT64)) {
|
||||
@ -907,7 +827,7 @@ gnc_queryterm2scm (QofQueryTerm *qt)
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_CHAR)) {
|
||||
query_char_t pdata = (query_char_t) pd;
|
||||
|
||||
qt_scm = scm_cons (gnc_query_char2scm (pdata->options), qt_scm);
|
||||
qt_scm = scm_cons (scm_long2num (pdata->options), qt_scm);
|
||||
qt_scm = scm_cons (scm_makfrom0str (pdata->char_list), qt_scm);
|
||||
|
||||
} else if (!safe_strcmp (pd->type_name, QOF_TYPE_KVP)) {
|
||||
@ -2066,46 +1986,6 @@ gnc_scm2query (SCM query_scm)
|
||||
return q;
|
||||
}
|
||||
|
||||
static int
|
||||
gnc_scm_traversal_adapter(Transaction *t, void *data)
|
||||
{
|
||||
static SCM trans_type = SCM_BOOL_F;
|
||||
SCM result;
|
||||
SCM scm_trans;
|
||||
SCM thunk = *((SCM *) data);
|
||||
|
||||
if(trans_type == SCM_BOOL_F) {
|
||||
trans_type = scm_c_eval_string("<gnc:Transaction*>");
|
||||
/* don't really need this - types are bound globally anyway. */
|
||||
if(trans_type != SCM_BOOL_F) scm_gc_protect_object(trans_type);
|
||||
}
|
||||
|
||||
scm_trans = gw_wcp_assimilate_ptr(t, trans_type);
|
||||
result = scm_call_1(thunk, scm_trans);
|
||||
|
||||
return (result != SCM_BOOL_F);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_scmGroupStagedTransactionTraversal(AccountGroup *grp,
|
||||
unsigned int new_marker,
|
||||
SCM thunk)
|
||||
{
|
||||
return xaccGroupStagedTransactionTraversal(grp, new_marker,
|
||||
gnc_scm_traversal_adapter,
|
||||
&thunk);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_scmAccountStagedTransactionTraversal(Account *a,
|
||||
unsigned int new_marker,
|
||||
SCM thunk)
|
||||
{
|
||||
return xaccAccountStagedTransactionTraversal(a, new_marker,
|
||||
gnc_scm_traversal_adapter,
|
||||
&thunk);
|
||||
}
|
||||
|
||||
SCM
|
||||
gnc_gint64_to_scm(const gint64 x)
|
||||
{
|
||||
@ -2265,89 +2145,60 @@ gnc_numeric_p(SCM arg)
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* gnc_scm_to_commodity
|
||||
********************************************************************/
|
||||
|
||||
static SCM
|
||||
gnc_generic_to_scm(const void *x, const gchar *type_str)
|
||||
{
|
||||
swig_type_info * stype = NULL;
|
||||
|
||||
if (!x) return SCM_BOOL_F;
|
||||
stype = SWIG_TypeQuery(type_str);
|
||||
|
||||
if (!stype) {
|
||||
PERR("Unknown SWIG Type: %s ", type_str);
|
||||
return SCM_BOOL_F;
|
||||
}
|
||||
|
||||
return SWIG_NewPointerObj(x, stype, 0);
|
||||
}
|
||||
|
||||
static void *
|
||||
gnc_scm_to_generic(SCM scm, const gchar *type_str)
|
||||
{
|
||||
swig_type_info * stype = NULL;
|
||||
|
||||
stype = SWIG_TypeQuery(type_str);
|
||||
if (!stype) {
|
||||
PERR("Unknown SWIG Type: %s ", type_str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!SWIG_IsPointerOfType(scm, stype))
|
||||
return NULL;
|
||||
|
||||
return SWIG_MustGetPtr(scm, stype, 1, 0);
|
||||
}
|
||||
|
||||
gnc_commodity *
|
||||
gnc_scm_to_commodity(SCM scm)
|
||||
{
|
||||
static SCM commodity_type = SCM_UNDEFINED;
|
||||
|
||||
if(commodity_type == SCM_UNDEFINED) {
|
||||
commodity_type = scm_c_eval_string("<gnc:commodity*>");
|
||||
/* don't really need this - types are bound globally anyway. */
|
||||
if(commodity_type != SCM_UNDEFINED) scm_gc_protect_object(commodity_type);
|
||||
}
|
||||
|
||||
if(!gw_wcp_is_of_type_p(commodity_type, scm)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return gw_wcp_get_ptr(scm);
|
||||
return gnc_scm_to_generic(scm, "_p_gnc_commodity");
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************
|
||||
* gnc_commodity_to_scm
|
||||
********************************************************************/
|
||||
SCM
|
||||
gnc_commodity_to_scm (const gnc_commodity *commodity)
|
||||
{
|
||||
static SCM commodity_type = SCM_UNDEFINED;
|
||||
|
||||
if(commodity == NULL) return SCM_BOOL_F;
|
||||
|
||||
if(commodity_type == SCM_UNDEFINED) {
|
||||
commodity_type = scm_c_eval_string("<gnc:commodity*>");
|
||||
/* don't really need this - types are bound globally anyway. */
|
||||
if(commodity_type != SCM_UNDEFINED) scm_gc_protect_object(commodity_type);
|
||||
}
|
||||
|
||||
return gw_wcp_assimilate_ptr((void *) commodity, commodity_type);
|
||||
return gnc_generic_to_scm(commodity, "_p_gnc_commodity");
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* gnc_book_to_scm
|
||||
********************************************************************/
|
||||
SCM
|
||||
gnc_book_to_scm (QofBook *book)
|
||||
{
|
||||
static SCM book_type = SCM_UNDEFINED;
|
||||
|
||||
if (!book)
|
||||
return SCM_BOOL_F;
|
||||
|
||||
if (book_type == SCM_UNDEFINED)
|
||||
{
|
||||
book_type = scm_c_eval_string ("<gnc:Book*>");
|
||||
|
||||
/* don't really need this - types are bound globally anyway. */
|
||||
if (book_type != SCM_UNDEFINED)
|
||||
scm_gc_protect_object (book_type);
|
||||
}
|
||||
|
||||
return gw_wcp_assimilate_ptr ((void *) book, book_type);
|
||||
return gnc_generic_to_scm(book, "_p_QofBook");
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* qof_session_to_scm
|
||||
********************************************************************/
|
||||
SCM
|
||||
qof_session_to_scm (QofSession *session)
|
||||
{
|
||||
static SCM session_type = SCM_UNDEFINED;
|
||||
|
||||
if (!session)
|
||||
return SCM_BOOL_F;
|
||||
|
||||
if (session_type == SCM_UNDEFINED)
|
||||
{
|
||||
session_type = scm_c_eval_string ("<gnc:Session*>");
|
||||
|
||||
/* don't really need this - types are bound globally anyway. */
|
||||
if (session_type != SCM_UNDEFINED)
|
||||
scm_gc_protect_object (session_type);
|
||||
}
|
||||
|
||||
return gw_wcp_assimilate_ptr ((void *) session, session_type);
|
||||
return gnc_generic_to_scm(session, "_p_QofSession");
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/********************************************************************\
|
||||
* engine-helpers.h -- gnucash g-wrap helper functions *
|
||||
* engine-helpers.h -- gnucash engine helper functions *
|
||||
* Copyright (C) 2000 Linas Vepstas <linas@linas.org> *
|
||||
* Copyright (C) 2001 Linux Developers Group, Inc. *
|
||||
* *
|
||||
@ -53,21 +53,15 @@ SCM gnc_guid2scm(GUID guid);
|
||||
GUID gnc_scm2guid(SCM guid_scm);
|
||||
int gnc_guid_p(SCM guid_scm);
|
||||
|
||||
/* for a list of strings */
|
||||
GSList * gnc_query_scm2path (SCM path_scm);
|
||||
|
||||
/* These two functions convert a query object into a scheme
|
||||
* representation of the query and vice-versa. They do not
|
||||
* simply convert a query pointer to a g-wrapped query pointer! */
|
||||
* simply convert a query pointer to a guile query pointer! */
|
||||
SCM gnc_query2scm (Query * q);
|
||||
Query * gnc_scm2query (SCM query_scm);
|
||||
|
||||
/* See Group.h for info about traversals. */
|
||||
|
||||
gboolean gnc_scmGroupStagedTransactionTraversal(AccountGroup *grp,
|
||||
unsigned int stage,
|
||||
SCM thunk);
|
||||
|
||||
gboolean gnc_scmAccountStagedTransactionTraversal(Account *a,
|
||||
unsigned int stage,
|
||||
SCM thunk);
|
||||
SCM gnc_gint64_to_scm(const gint64 x);
|
||||
gint64 gnc_scm_to_gint64(SCM num);
|
||||
int gnc_gh_gint64_p(SCM num);
|
||||
|
@ -95,15 +95,15 @@
|
||||
;; for editing.
|
||||
(define (gnc:split->split-scm split use-cut-semantics?)
|
||||
(gnc:make-split-scm
|
||||
(gnc:split-get-guid split)
|
||||
(gnc:account-get-guid (gnc:split-get-account split))
|
||||
(gnc:transaction-get-guid (gnc:split-get-parent split))
|
||||
(gnc:split-get-memo split)
|
||||
(gnc:split-get-action split)
|
||||
(gnc:split-get-reconcile-state split)
|
||||
(gnc:split-get-reconciled-date split)
|
||||
(gnc:split-get-amount split)
|
||||
(gnc:split-get-value split)))
|
||||
(gncSplitGetGUID split)
|
||||
(gncAccountGetGUID (xaccSplitGetAccount split))
|
||||
(gncTransGetGUID (xaccSplitGetParent split))
|
||||
(xaccSplitGetMemo split)
|
||||
(xaccSplitGetAction split)
|
||||
(xaccSplitGetReconcile split)
|
||||
(gnc-split-get-date-reconciled split)
|
||||
(xaccSplitGetAmount split)
|
||||
(xaccSplitGetValue split)))
|
||||
|
||||
;; Copy a scheme representation of a split onto a C split.
|
||||
;; If possible, insert the C split into the account of the
|
||||
@ -118,18 +118,18 @@
|
||||
(action (gnc:split-scm-get-action split-scm))
|
||||
(amount (gnc:split-scm-get-amount split-scm))
|
||||
(value (gnc:split-scm-get-value split-scm)))
|
||||
(if memo (gnc:split-set-memo split memo))
|
||||
(if action (gnc:split-set-action split action))
|
||||
(if amount (gnc:split-set-amount split amount))
|
||||
(if value (gnc:split-set-value split value)))
|
||||
(let ((account (gnc:account-lookup
|
||||
(if memo (xaccSplitSetMemo split memo))
|
||||
(if action (xaccSplitSetAction split action))
|
||||
(if amount (xaccSplitSetAmount split amount))
|
||||
(if value (xaccSplitSetValue split value)))
|
||||
(let ((account (xaccAccountLookup
|
||||
(gnc:split-scm-get-account-guid split-scm)
|
||||
book)))
|
||||
(if account
|
||||
(begin
|
||||
(gnc:account-begin-edit account)
|
||||
(gnc:account-insert-split account split)
|
||||
(gnc:account-commit-edit account)))))))
|
||||
(xaccAccountBeginEdit account)
|
||||
(xaccSplitSetAccount account split)
|
||||
(xaccAccountCommitEdit account)))))))
|
||||
|
||||
;; Defines a scheme representation of a transaction.
|
||||
(define gnc:transaction-structure
|
||||
@ -218,23 +218,23 @@
|
||||
;; a representation of it as a transaction-structure.
|
||||
(define (gnc:transaction->transaction-scm trans use-cut-semantics?)
|
||||
(define (trans-splits i)
|
||||
(let ((split (gnc:transaction-get-split trans i)))
|
||||
(let ((split (xaccTransGetSplit trans i)))
|
||||
(if (not split)
|
||||
'()
|
||||
(cons (gnc:split->split-scm split use-cut-semantics?)
|
||||
(trans-splits (+ i 1))))))
|
||||
(gnc:make-transaction-scm
|
||||
(gnc:transaction-get-guid trans)
|
||||
(gnc:transaction-get-currency trans)
|
||||
(gnc:transaction-get-date-entered trans)
|
||||
(gncTransGetGUID trans)
|
||||
(xaccTransGetCurrency trans)
|
||||
(gnc-transaction-get-date-entered trans)
|
||||
(if use-cut-semantics?
|
||||
(gnc:transaction-get-date-posted trans)
|
||||
(gnc-transaction-get-date-posted trans)
|
||||
#f)
|
||||
(if use-cut-semantics?
|
||||
(gnc:transaction-get-num trans)
|
||||
(xaccTransGetNum trans)
|
||||
#f)
|
||||
(gnc:transaction-get-description trans)
|
||||
(gnc:transaction-get-notes trans)
|
||||
(xaccTransGetDescription trans)
|
||||
(xaccTransGetNotes trans)
|
||||
(trans-splits 0)))
|
||||
|
||||
;; Copy a scheme representation of a transaction onto a C transaction.
|
||||
@ -246,8 +246,8 @@
|
||||
#f
|
||||
(begin
|
||||
;; open the transaction for editing
|
||||
(if (not (gnc:transaction-is-open trans))
|
||||
(gnc:transaction-begin-edit trans))
|
||||
(if (not (xaccTransIsOpen trans))
|
||||
(xaccTransBeginEdit trans))
|
||||
|
||||
;; copy in the transaction values
|
||||
(let ((currency (gnc:transaction-scm-get-currency trans-scm))
|
||||
@ -255,23 +255,23 @@
|
||||
(num (gnc:transaction-scm-get-num trans-scm))
|
||||
(notes (gnc:transaction-scm-get-notes trans-scm))
|
||||
(date-posted (gnc:transaction-scm-get-date-posted trans-scm)))
|
||||
(if currency (gnc:transaction-set-currency trans currency))
|
||||
(if description (gnc:transaction-set-description trans description))
|
||||
(if num (gnc:transaction-set-xnum trans num))
|
||||
(if notes (gnc:transaction-set-notes trans notes))
|
||||
(if date-posted (gnc:transaction-set-date-time-pair
|
||||
(if currency (xaccTransSetCurrency trans currency))
|
||||
(if description (xaccTransactionSetDescription trans description))
|
||||
(if num (xaccTransSetNum trans num))
|
||||
(if notes (xaccTransSetNotes trans notes))
|
||||
(if date-posted (gnc-transaction-set-date
|
||||
trans date-posted)))
|
||||
|
||||
;; strip off the old splits
|
||||
(for-each (lambda (split)
|
||||
(gnc:split-destroy split))
|
||||
(gnc:transaction-get-splits trans))
|
||||
(xaccSplitDestroy split))
|
||||
(xaccTransGetSplits trans))
|
||||
|
||||
;; and put on the new ones! Please note they go in the *same*
|
||||
;; order as in the original transaction. This is important.
|
||||
(for-each
|
||||
(lambda (split-scm)
|
||||
(let* ((new-split (gnc:split-create book))
|
||||
(let* ((new-split (xaccMallocSplit book))
|
||||
(old-guid (gnc:split-scm-get-account-guid split-scm))
|
||||
(new-guid (assoc-ref guid-mapping old-guid)))
|
||||
(if (not new-guid)
|
||||
@ -279,9 +279,9 @@
|
||||
(gnc:split-scm-set-account-guid split-scm new-guid)
|
||||
(gnc:split-scm-onto-split split-scm new-split book)
|
||||
(gnc:split-scm-set-account-guid split-scm old-guid)
|
||||
(gnc:transaction-append-split trans new-split)))
|
||||
(xaccTransAppendSplit trans new-split)))
|
||||
(gnc:transaction-scm-get-split-scms trans-scm))
|
||||
|
||||
;; close the transaction
|
||||
(if commit?
|
||||
(gnc:transaction-commit-edit trans)))))
|
||||
(xaccTransCommitEdit trans)))))
|
||||
|
@ -21,27 +21,10 @@
|
||||
|
||||
;; Copyright 2000 Rob Browning <rlb@cs.utexas.edu>
|
||||
|
||||
(define (gnc:url->loaded-session session url ignore-lock? create-if-needed?)
|
||||
;; Return a <gnc:Book*> representing the data stored at the given
|
||||
;; url or #f on failure -- this should later be changed to returning
|
||||
;; the symbol representing the book error... On success, the book
|
||||
;; will already be loaded.
|
||||
|
||||
(let* ((result (and session
|
||||
(gnc:session-begin session url
|
||||
ignore-lock?
|
||||
create-if-needed?)
|
||||
(eq? 'no-err (gw:enum-<gnc:BackendError>-val->sym
|
||||
(gnc:session-get-error session) #f))
|
||||
(gnc:session-load session)
|
||||
session)))
|
||||
(or result
|
||||
(begin (gnc:session-destroy session) #f))))
|
||||
|
||||
(define (gnc:group-map-all-accounts thunk group)
|
||||
(let ((accounts (or (gnc:group-get-subaccounts group) '())))
|
||||
(let ((accounts (or (xaccGroupGetSubAccountsSorted group) '())))
|
||||
(map thunk accounts)))
|
||||
|
||||
(define (gnc:group-map-accounts thunk group)
|
||||
(let ((accounts (or (gnc:group-get-account-list group) '())))
|
||||
(let ((accounts (or (xaccGroupGetAccountListSorted group) '())))
|
||||
(map thunk accounts)))
|
||||
|
366
src/engine/engine.i
Normal file
366
src/engine/engine.i
Normal file
@ -0,0 +1,366 @@
|
||||
%module sw_engine
|
||||
%{
|
||||
/* Includes the header in the wrapper code */
|
||||
#include <config.h>
|
||||
#include <glib.h>
|
||||
#include <qof.h>
|
||||
#include <Group.h>
|
||||
#include <Query.h>
|
||||
#include <gnc-budget.h>
|
||||
#include <gnc-commodity.h>
|
||||
#include <gnc-engine.h>
|
||||
#include <gnc-filepath-utils.h>
|
||||
#include <gnc-pricedb.h>
|
||||
#include <gnc-lot.h>
|
||||
#include <gnc-session-scm.h>
|
||||
#include <gnc-hooks-scm.h>
|
||||
#include <engine-helpers.h>
|
||||
#include <SX-book.h>
|
||||
#include <kvp-scm.h>
|
||||
#include "glib-helpers.h"
|
||||
|
||||
SCM scm_init_sw_engine_module (void);
|
||||
%}
|
||||
|
||||
/* Not sure why SWIG doesn't figure this out. */
|
||||
typedef unsigned int guint;
|
||||
typedef char gchar;
|
||||
typedef void * gpointer;
|
||||
typedef int gint;
|
||||
//%import "glib.h"
|
||||
|
||||
//typedef const gchar * QofIdType;
|
||||
//%import "qofid.h"
|
||||
|
||||
%typemap(in) gint64 " $1 = gnc_scm_to_gint64($input); "
|
||||
%typemap(out) gint64 " $result = gnc_gint64_to_scm($1); "
|
||||
|
||||
%typemap(in) gboolean " $1 = SCM_NFALSEP($input) ? TRUE : FALSE; "
|
||||
%typemap(out) gboolean " $result = $1 ? SCM_BOOL_T : SCM_BOOL_F; "
|
||||
|
||||
%typemap(in) Timespec " $1 = gnc_timepair2timespec($input); "
|
||||
%typemap(out) Timespec " $result = gnc_timespec2timepair($1); "
|
||||
|
||||
%typemap(in) GUID " $1 = gnc_scm2guid($input); "
|
||||
%typemap(out) GUID " $result = gnc_guid2scm($1); "
|
||||
%typemap(in) GUID * (GUID g) " g = gnc_scm2guid($input); $1 = &g; "
|
||||
%typemap(out) GUID * " $result = ($1) ? gnc_guid2scm(*($1)): SCM_UNDEFINED; "
|
||||
|
||||
|
||||
%typemap(in) gnc_numeric " $1 = gnc_scm_to_numeric($input); "
|
||||
%typemap(out) gnc_numeric " $result = gnc_numeric_to_scm($1); "
|
||||
|
||||
%define GLIST_HELPER_INOUT(ListType, ElemSwigType)
|
||||
%typemap(in) ListType * {
|
||||
SCM list = $input;
|
||||
GList *c_list = NULL;
|
||||
|
||||
while (!SCM_NULLP(list)) {
|
||||
Account *p;
|
||||
|
||||
SCM p_scm = SCM_CAR(list);
|
||||
if (SCM_FALSEP(p_scm) || SCM_NULLP(p_scm))
|
||||
p = NULL;
|
||||
else
|
||||
p = SWIG_MustGetPtr(p_scm, ElemSwigType, 1, 0);
|
||||
|
||||
c_list = g_list_prepend(c_list, p);
|
||||
list = SCM_CDR(list);
|
||||
}
|
||||
|
||||
$1 = g_list_reverse(c_list);
|
||||
}
|
||||
%typemap(out) ListType * {
|
||||
SCM list = SCM_EOL;
|
||||
GList *node;
|
||||
|
||||
for (node = $1; node; node = node->next)
|
||||
list = scm_cons(SWIG_NewPointerObj(node->data,
|
||||
ElemSwigType, 0), list);
|
||||
|
||||
$result = scm_reverse(list);
|
||||
}
|
||||
%enddef
|
||||
|
||||
GLIST_HELPER_INOUT(SplitList, SWIGTYPE_p_Split);
|
||||
GLIST_HELPER_INOUT(TransList, SWIGTYPE_p_Transaction);
|
||||
GLIST_HELPER_INOUT(LotList, SWIGTYPE_p_GNCLot);
|
||||
GLIST_HELPER_INOUT(AccountList, SWIGTYPE_p_Account);
|
||||
GLIST_HELPER_INOUT(PriceList, SWIGTYPE_p_GNCPrice);
|
||||
// TODO: free PriceList?
|
||||
GLIST_HELPER_INOUT(CommodityList, SWIGTYPE_p_gnc_commodity);
|
||||
|
||||
|
||||
%inline %{
|
||||
static const GUID * gncSplitGetGUID(Split *x)
|
||||
{ return qof_instance_get_guid(QOF_INSTANCE(x)); }
|
||||
static const GUID * gncTransGetGUID(Transaction *x)
|
||||
{ return qof_instance_get_guid(QOF_INSTANCE(x)); }
|
||||
static const GUID * gncAccountGetGUID(Account *x)
|
||||
{ return qof_instance_get_guid(QOF_INSTANCE(x)); }
|
||||
static const GUID * gncPriceGetGUID(GNCPrice *x)
|
||||
{ return qof_instance_get_guid(QOF_INSTANCE(x)); }
|
||||
static const GUID * gncBudgetGetGUID(GncBudget *x)
|
||||
{ return qof_instance_get_guid(QOF_INSTANCE(x)); }
|
||||
%}
|
||||
|
||||
%typemap(newfree) AccountList * "g_list_free($1);"
|
||||
%typemap(newfree) SplitList * "g_list_free($1);"
|
||||
%typemap(newfree) TransList * "g_list_free($1);"
|
||||
%typemap(newfree) PriceList * "g_list_free($1);"
|
||||
%typemap(newfree) LotList * "g_list_free($1);"
|
||||
%typemap(newfree) CommodityList * "g_list_free($1);"
|
||||
|
||||
%typemap(newfree) gchar * "g_free($1);"
|
||||
|
||||
/* NB: Should cover all the functions currently used, but not all that
|
||||
* are wrapped */
|
||||
|
||||
%newobject xaccGroupGetSubAccountsSorted;
|
||||
%newobject xaccGroupGetAccountListSorted;
|
||||
|
||||
%delobject gnc_price_list_destroy;
|
||||
%newobject gnc_pricedb_lookup_latest_any_currency;
|
||||
|
||||
%newobject gnc_pricedb_lookup_nearest_in_time_any_currency;
|
||||
%newobject gnc_pricedb_lookup_latest_before_any_currency;
|
||||
%newobject gnc_pricedb_get_prices;
|
||||
%newobject gnc_pricedb_lookup_at_time;
|
||||
%newobject gnc_pricedb_lookup_day;
|
||||
|
||||
%newobject xaccQueryGetSplitsUniqueTrans;
|
||||
%newobject xaccQueryGetTransactions;
|
||||
%newobject xaccQueryGetLots;
|
||||
|
||||
%newobject xaccSplitGetCorrAccountFullName;
|
||||
%newobject gnc_numeric_to_string;
|
||||
%newobject gnc_build_dotgnucash_path;
|
||||
%newobject gnc_build_book_path;
|
||||
|
||||
/* Parse the header file to generate wrappers */
|
||||
//#define QOF_ID_BOOK "Book"
|
||||
%inline {
|
||||
static QofIdType QOF_ID_BOOK_SCM (void) { return QOF_ID_BOOK; }
|
||||
}
|
||||
|
||||
%include <Split.h>
|
||||
%include <engine-helpers.h>
|
||||
%include <Account.h>
|
||||
%include <Transaction.h>
|
||||
%include <gnc-pricedb.h>
|
||||
|
||||
QofSession * qof_session_new (void);
|
||||
QofBook * qof_session_get_book (QofSession *session);
|
||||
|
||||
%include <Group.h>
|
||||
|
||||
// TODO: Maybe unroll
|
||||
void qof_book_kvp_changed (QofBook *book);
|
||||
|
||||
// TODO: Unroll/remove
|
||||
const char *qof_session_get_url (QofSession *session);
|
||||
|
||||
const char *gnc_print_date (Timespec ts);
|
||||
|
||||
%inline {
|
||||
static QofQuery * qof_query_create_for_splits(void) {
|
||||
return qof_query_create_for(GNC_ID_SPLIT);
|
||||
}
|
||||
}
|
||||
%typemap(in) GSList * "$1 = gnc_query_scm2path($input);"
|
||||
|
||||
void qof_query_add_guid_match (QofQuery *q, GSList *param_list,
|
||||
const GUID *guid, QofQueryOp op);
|
||||
void qof_query_set_sort_order (QofQuery *q, GSList *params1,
|
||||
GSList *params2, GSList *params3);
|
||||
|
||||
%clear GSList *;
|
||||
SplitList * qof_query_run (QofQuery *q);
|
||||
|
||||
%include <Query.h>
|
||||
%ignore qof_query_add_guid_match;
|
||||
%ignore qof_query_set_sort_order;
|
||||
%ignore qof_query_run;
|
||||
%include <qofquery.h>
|
||||
%include <qofquerycore.h>
|
||||
|
||||
gnc_numeric gnc_numeric_create(gint64 num, gint64 denom);
|
||||
gnc_numeric gnc_numeric_zero(void);
|
||||
gint64 gnc_numeric_num(gnc_numeric a);
|
||||
gint64 gnc_numeric_denom(gnc_numeric a);
|
||||
gboolean gnc_numeric_zero_p(gnc_numeric a);
|
||||
int gnc_numeric_compare(gnc_numeric a, gnc_numeric b);
|
||||
gboolean gnc_numeric_negative_p(gnc_numeric a);
|
||||
gboolean gnc_numeric_positive_p(gnc_numeric a);
|
||||
gboolean gnc_numeric_equal(gnc_numeric a, gnc_numeric b);
|
||||
gnc_numeric
|
||||
gnc_numeric_add(gnc_numeric a, gnc_numeric b, gint64 denom, gint how);
|
||||
gnc_numeric
|
||||
gnc_numeric_sub(gnc_numeric a, gnc_numeric b, gint64 denom, gint how);
|
||||
gnc_numeric
|
||||
gnc_numeric_mul(gnc_numeric a, gnc_numeric b, gint64 denom, gint how);
|
||||
gnc_numeric
|
||||
gnc_numeric_div(gnc_numeric a, gnc_numeric b, gint64 denom, gint how);
|
||||
gnc_numeric gnc_numeric_neg(gnc_numeric a);
|
||||
gnc_numeric gnc_numeric_abs(gnc_numeric a);
|
||||
gnc_numeric gnc_numeric_add_fixed(gnc_numeric a, gnc_numeric b);
|
||||
gnc_numeric gnc_numeric_sub_fixed(gnc_numeric a, gnc_numeric b);
|
||||
gnc_numeric gnc_numeric_convert(gnc_numeric in, gint64 denom, gint how);
|
||||
gnc_numeric double_to_gnc_numeric(double in, gint64 denom, gint how);
|
||||
double gnc_numeric_to_double(gnc_numeric in);
|
||||
gchar * gnc_numeric_to_string(gnc_numeric n);
|
||||
|
||||
Timespec timespecCanonicalDayTime(Timespec t);
|
||||
|
||||
gchar * gnc_build_dotgnucash_path (const gchar *filename);
|
||||
gchar * gnc_build_book_path (const gchar *filename);
|
||||
|
||||
%include <gnc-budget.h>
|
||||
|
||||
%typemap(in) GList * {
|
||||
SCM path_scm = $input;
|
||||
GList *path = NULL;
|
||||
|
||||
while (!SCM_NULLP (path_scm))
|
||||
{
|
||||
SCM key_scm = SCM_CAR (path_scm);
|
||||
char *key;
|
||||
|
||||
if (!SCM_STRINGP (key_scm))
|
||||
break;
|
||||
|
||||
key = g_strdup (SCM_STRING_CHARS (key_scm));
|
||||
|
||||
path = g_list_prepend (path, key);
|
||||
|
||||
path_scm = SCM_CDR (path_scm);
|
||||
}
|
||||
|
||||
$1 = g_list_reverse (path);
|
||||
}
|
||||
|
||||
void gnc_quote_source_set_fq_installed (GList *sources_list);
|
||||
%clear GList *;
|
||||
%ignore gnc_quote_source_set_fq_installed;
|
||||
%include <gnc-commodity.h>
|
||||
|
||||
%include <gnc-lot.h>
|
||||
%include <gnc-session-scm.h>
|
||||
void gnc_hook_add_scm_dangler (const gchar *name, SCM proc);
|
||||
void gnc_hook_run (const gchar *name, gpointer data);
|
||||
%include <gnc-hooks.h>
|
||||
|
||||
AccountGroup * gnc_book_get_template_group(QofBook *book);
|
||||
|
||||
// KVP stuff
|
||||
%typemap(in) KvpValue * " $1 = gnc_scm_to_kvp_value_ptr($input); "
|
||||
%typemap(out) KvpValue * " $result = gnc_kvp_value_ptr_to_scm($1); "
|
||||
%typemap(in) GSList *key_path " $1 = gnc_scm_to_gslist_string($input);"
|
||||
|
||||
void gnc_kvp_frame_delete_at_path(KvpFrame *frame, GSList *key_path);
|
||||
void kvp_frame_set_slot_path_gslist(
|
||||
KvpFrame *frame, const KvpValue *new_value, GSList *key_path);
|
||||
KvpValue * kvp_frame_get_slot_path_gslist (KvpFrame *frame, GSList *key_path);
|
||||
|
||||
%clear GSList *key_path;
|
||||
|
||||
%inline %{
|
||||
static KvpFrame * gnc_book_get_slots(QofBook *book) {
|
||||
return qof_instance_get_slots(QOF_INSTANCE(book));
|
||||
}
|
||||
%}
|
||||
|
||||
|
||||
%init {
|
||||
{
|
||||
char tmp[100];
|
||||
|
||||
#define SET_ENUM(e) snprintf(tmp, 100, "(set! %s (%s))", (e), (e)); \
|
||||
scm_c_eval_string(tmp);
|
||||
|
||||
SET_ENUM("TXN-TYPE-NONE");
|
||||
SET_ENUM("TXN-TYPE-INVOICE");
|
||||
SET_ENUM("TXN-TYPE-PAYMENT");
|
||||
|
||||
SET_ENUM("ACCT-TYPE-INVALID");
|
||||
SET_ENUM("ACCT-TYPE-NONE");
|
||||
SET_ENUM("ACCT-TYPE-BANK");
|
||||
SET_ENUM("ACCT-TYPE-CASH");
|
||||
SET_ENUM("ACCT-TYPE-CREDIT");
|
||||
SET_ENUM("ACCT-TYPE-ASSET");
|
||||
SET_ENUM("ACCT-TYPE-LIABILITY");
|
||||
SET_ENUM("ACCT-TYPE-STOCK");
|
||||
SET_ENUM("ACCT-TYPE-MUTUAL");
|
||||
SET_ENUM("ACCT-TYPE-CURRENCY");
|
||||
SET_ENUM("ACCT-TYPE-INCOME");
|
||||
SET_ENUM("ACCT-TYPE-EXPENSE");
|
||||
SET_ENUM("ACCT-TYPE-EQUITY");
|
||||
SET_ENUM("ACCT-TYPE-RECEIVABLE");
|
||||
SET_ENUM("ACCT-TYPE-PAYABLE");
|
||||
SET_ENUM("NUM-ACCOUNT-TYPES");
|
||||
SET_ENUM("ACCT-TYPE-CHECKING");
|
||||
SET_ENUM("ACCT-TYPE-SAVINGS");
|
||||
SET_ENUM("ACCT-TYPE-MONEYMRKT");
|
||||
SET_ENUM("ACCT-TYPE-CREDITLINE");
|
||||
|
||||
SET_ENUM("QOF-QUERY-AND");
|
||||
SET_ENUM("QOF-QUERY-OR");
|
||||
|
||||
SET_ENUM("QUERY-TXN-MATCH-ALL");
|
||||
SET_ENUM("QUERY-TXN-MATCH-ANY");
|
||||
|
||||
SET_ENUM("QOF-GUID-MATCH-ALL");
|
||||
SET_ENUM("QOF-GUID-MATCH-ANY");
|
||||
SET_ENUM("QOF-GUID-MATCH-NULL");
|
||||
SET_ENUM("QOF-GUID-MATCH-NONE");
|
||||
SET_ENUM("QOF-GUID-MATCH-LIST-ANY");
|
||||
|
||||
SET_ENUM("QOF-COMPARE-LT");
|
||||
SET_ENUM("QOF-COMPARE-LTE");
|
||||
SET_ENUM("QOF-COMPARE-EQUAL");
|
||||
SET_ENUM("QOF-COMPARE-GT");
|
||||
SET_ENUM("QOF-COMPARE-GTE");
|
||||
SET_ENUM("QOF-COMPARE-NEQ");
|
||||
|
||||
SET_ENUM("QOF-NUMERIC-MATCH-ANY");
|
||||
SET_ENUM("QOF-NUMERIC-MATCH-CREDIT");
|
||||
SET_ENUM("QOF-NUMERIC-MATCH-DEBIT");
|
||||
|
||||
SET_ENUM("CLEARED-NO");
|
||||
SET_ENUM("CLEARED-CLEARED");
|
||||
SET_ENUM("CLEARED-FROZEN");
|
||||
SET_ENUM("CLEARED-RECONCILED");
|
||||
SET_ENUM("CLEARED-VOIDED");
|
||||
|
||||
SET_ENUM("HOOK-REPORT");
|
||||
SET_ENUM("HOOK-SAVE-OPTIONS");
|
||||
|
||||
//SET_ENUM("GNC-ID-ACCOUNT");
|
||||
SET_ENUM("QOF-ID-BOOK-SCM");
|
||||
//SET_ENUM("GNC-ID-BUDGET");
|
||||
//SET_ENUM("GNC-ID-LOT");
|
||||
//SET_ENUM("GNC-ID-PRICE");
|
||||
//SET_ENUM("GNC-ID-SPLIT");
|
||||
//SET_ENUM("GNC-ID-SCHEDXACTION");
|
||||
//SET_ENUM("QOF-ID-SESSION");
|
||||
//SET_ENUM("GNC-ID-TRANS");
|
||||
|
||||
SET_ENUM("QUERY-DEFAULT-SORT");
|
||||
SET_ENUM("SPLIT-LOT");
|
||||
SET_ENUM("SPLIT-TRANS");
|
||||
SET_ENUM("SPLIT-ACCOUNT");
|
||||
SET_ENUM("SPLIT-VALUE");
|
||||
SET_ENUM("SPLIT-MEMO");
|
||||
SET_ENUM("SPLIT-DATE-RECONCILED");
|
||||
|
||||
SET_ENUM("TRANS-DATE-POSTED");
|
||||
SET_ENUM("TRANS-DESCRIPTION");
|
||||
SET_ENUM("TRANS-NUM");
|
||||
|
||||
SET_ENUM("ACCOUNT-CODE-"); /* sic */
|
||||
|
||||
#undefine SET_ENUM
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
(define-module (gnucash engine))
|
||||
|
||||
(use-modules (g-wrap gw-wct))
|
||||
|
||||
(use-modules (g-wrapped gw-engine))
|
||||
(use-modules (sw_engine))
|
||||
|
||||
(export GNC-RND-FLOOR)
|
||||
(export GNC-RND-CEIL)
|
||||
|
@ -1,6 +1,7 @@
|
||||
/********************************************************************\
|
||||
* gnc-helpers.c -- gnucash g-wrap helper functions *
|
||||
* gnc-helpers.c -- gnucash glib helper functions *
|
||||
* Copyright (C) 2000 Linas Vepstas *
|
||||
* Copyright (C) 2006 Chris Shoemaker <c.shoemaker@cox.net> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@ -27,39 +28,37 @@
|
||||
#include <glib.h>
|
||||
#include <libguile.h>
|
||||
#include "guile-mappings.h"
|
||||
|
||||
#include <g-wrap-wct.h>
|
||||
|
||||
#include "swig-runtime.h"
|
||||
#include "glib-helpers.h"
|
||||
|
||||
|
||||
/* These will eventually go into (g-wrapped glib). */
|
||||
|
||||
static SCM
|
||||
glist_to_scm_list_helper(GList *glist, SCM wct)
|
||||
glist_to_scm_list_helper(GList *glist, swig_type_info *wct)
|
||||
{
|
||||
SCM list = SCM_EOL;
|
||||
GList *node;
|
||||
|
||||
for (node = glist; node; node = node->next)
|
||||
list = scm_cons (gw_wcp_assimilate_ptr(node->data, wct), list);
|
||||
list = scm_cons(SWIG_NewPointerObj(node->data, wct, 0), list);
|
||||
|
||||
return scm_reverse (list);
|
||||
}
|
||||
|
||||
SCM
|
||||
gnc_glist_to_scm_list(GList *glist, SCM wct)
|
||||
gnc_glist_to_scm_list(GList *glist, gchar *wct)
|
||||
{
|
||||
SCM_ASSERT(gw_wct_p(wct), wct, SCM_ARG1, "gnc_glist_to_scm_list");
|
||||
return(glist_to_scm_list_helper(glist, wct));
|
||||
swig_type_info *stype = SWIG_TypeQuery(wct);
|
||||
g_return_val_if_fail(stype, SCM_UNDEFINED);
|
||||
return glist_to_scm_list_helper(glist, stype);
|
||||
}
|
||||
|
||||
GList*
|
||||
GList *
|
||||
gnc_scm_list_to_glist(SCM rest)
|
||||
{
|
||||
GList *result = NULL;
|
||||
SCM scm_item;
|
||||
|
||||
|
||||
SWIG_GetModule(NULL); /* Work-around for SWIG bug. */
|
||||
SCM_ASSERT(SCM_LISTP(rest), rest, SCM_ARG1, "gnc_scm_list_to_glist");
|
||||
|
||||
while(!SCM_NULLP(rest))
|
||||
@ -69,18 +68,17 @@ gnc_scm_list_to_glist(SCM rest)
|
||||
scm_item = SCM_CAR(rest);
|
||||
rest = SCM_CDR(rest);
|
||||
|
||||
/* fixes a bug in g-wrap */
|
||||
if (scm_item == SCM_BOOL_F)
|
||||
{
|
||||
result = g_list_prepend(result, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gw_wcp_p(scm_item))
|
||||
if (!SWIG_IsPointer(scm_item))
|
||||
scm_misc_error("gnc_scm_list_to_glist",
|
||||
"Item in list not a gw:wcp.", scm_item);
|
||||
"Item in list not a wcp.", scm_item);
|
||||
|
||||
item = gw_wcp_get_ptr(scm_item);
|
||||
item = (void *)SWIG_PointerAddress(scm_item);
|
||||
result = g_list_prepend(result, item);
|
||||
}
|
||||
}
|
||||
@ -88,38 +86,6 @@ gnc_scm_list_to_glist(SCM rest)
|
||||
return g_list_reverse(result);
|
||||
}
|
||||
|
||||
static SCM
|
||||
glist_map_helper(GList *glist, SCM wct, SCM thunk)
|
||||
{
|
||||
SCM list = SCM_EOL;
|
||||
GList *node;
|
||||
|
||||
for (node = glist; node; node = node->next)
|
||||
list = scm_cons (scm_call_1(thunk, gw_wcp_assimilate_ptr(node->data, wct)),
|
||||
list);
|
||||
|
||||
return scm_reverse (list);
|
||||
}
|
||||
|
||||
SCM
|
||||
gnc_glist_scm_map(SCM wct, SCM thunk, GList* glist)
|
||||
{
|
||||
SCM_ASSERT(gw_wct_p(wct), wct, SCM_ARG1, "gnc_glist_map");
|
||||
SCM_ASSERT(SCM_PROCEDUREP(thunk), thunk, SCM_ARG2, "gnc_glist_scm_map");
|
||||
return(glist_map_helper(glist, wct, thunk));
|
||||
}
|
||||
|
||||
void
|
||||
gnc_glist_scm_for_each(SCM wct, SCM thunk, GList *glist)
|
||||
{
|
||||
GList *lp;
|
||||
SCM_ASSERT(gw_wct_p(wct), wct, SCM_ARG1, "gnc_glist_map");
|
||||
SCM_ASSERT(SCM_PROCEDUREP(thunk), thunk, SCM_ARG2, "gnc_glist_scm_for_each");
|
||||
for(lp = glist; lp; lp = lp->next) {
|
||||
scm_call_1(thunk, gw_wcp_assimilate_ptr(lp->data, wct));
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* gnc_glist_string_to_scm
|
||||
* i.e. (glist-of (<gw:mchars> calee-owned) callee-owned)
|
||||
@ -143,9 +109,9 @@ gnc_glist_string_to_scm(GList *glist)
|
||||
|
||||
/********************************************************************
|
||||
* gnc_scm_to_glist_string
|
||||
* i.e. (glist-of (<gw:mchars> calee-owned) callee-owned)
|
||||
* i.e. (glist-of (<gw:mchars> callee-owned) callee-owned)
|
||||
* or equivalently
|
||||
* i.e. (glist-of (<gw:gchars> calee-owned) callee-owned)
|
||||
* i.e. (glist-of (<gw:gchars> callee-owned) callee-owned)
|
||||
********************************************************************/
|
||||
|
||||
GList *
|
||||
@ -164,6 +130,22 @@ gnc_scm_to_glist_string(SCM list)
|
||||
return g_list_reverse (glist);
|
||||
}
|
||||
|
||||
GSList *
|
||||
gnc_scm_to_gslist_string(SCM list)
|
||||
{
|
||||
GSList *gslist = NULL;
|
||||
|
||||
while (!SCM_NULLP (list))
|
||||
{
|
||||
const gchar * str = SCM_STRING_CHARS (SCM_CAR(list));
|
||||
if (str)
|
||||
gslist = g_slist_prepend (gslist, g_strdup (str));
|
||||
list = SCM_CDR (list);
|
||||
}
|
||||
|
||||
return g_slist_reverse (gslist);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* gnc_glist_string_p
|
||||
********************************************************************/
|
||||
|
@ -1,6 +1,7 @@
|
||||
/********************************************************************\
|
||||
* glib-helpers.h -- gnucash g-wrap helper functions *
|
||||
* glib-helpers.h -- gnucash glib helper functions *
|
||||
* Copyright (C) 2000 Linas Vepstas *
|
||||
* Copyright (C) 2006 Chris Shoemaker <c.shoemaker@cox.net> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@ -27,16 +28,15 @@
|
||||
#include <glib.h>
|
||||
#include <libguile.h>
|
||||
|
||||
SCM gnc_glist_to_scm_list(GList *glist, SCM wct);
|
||||
SCM gnc_glist_to_scm_list(GList *glist, gchar *wct);
|
||||
GList* gnc_scm_list_to_glist(SCM wcp_list);
|
||||
|
||||
SCM gnc_glist_scm_map(SCM wct, SCM thunk, GList *glist);
|
||||
void gnc_glist_scm_for_each(SCM wct, SCM thunk, GList *glist);
|
||||
|
||||
SCM gnc_glist_string_to_scm(GList * list);
|
||||
GList * gnc_scm_to_glist_string(SCM list);
|
||||
int gnc_glist_string_p(SCM list);
|
||||
|
||||
GSList * gnc_scm_to_gslist_string(SCM list);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user