2001-08-16 Bill Gribble <grib@billgribble.com>

* move report system into gnc-modules. This required a new
	module of application framework stuff, src/app-utils.

	* src/report/report-system/: the report-html-generation code
	and the various report utilities and infrastructure

	* src/report/standard-reports/: non-locale-specific financial
	reports

	* src/report/utility-reports: non-financial reports

	* src/report/locale-specific: reports that only apply to specific
	locales.

	* src/report/stylesheet: report style sheet definitions


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5144 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas
2001-08-17 00:44:01 +00:00
parent f28dcf0841
commit d9be6ea67b
126 changed files with 7649 additions and 1313 deletions

View File

@@ -1,3 +1,21 @@
2001-08-16 Bill Gribble <grib@billgribble.com>
* move report system into gnc-modules. This required a new
module of application framework stuff, src/app-utils.
* src/report/report-system/: the report-html-generation code
and the various report utilities and infrastructure
* src/report/standard-reports/: non-locale-specific financial
reports
* src/report/utility-reports: non-financial reports
* src/report/locale-specific: reports that only apply to specific
locales.
* src/report/stylesheet: report style sheet definitions
2001-08-16 Robert Graham Merkel <rgmerk@mira.net>
* src/engine/FreqSpec.c: Take out day and month name arrays - use
@@ -7,10 +25,11 @@
buttons to obsolete-sx dialog.
* src/gnome/dialog-sxsincelast.c: Remove string literals and magic
numbers. (freq_type_to_string) remove. (_create_transactions_on):
catch errors a bit better. (sx_obsolete_row_{un}sel): remove unnecessary
warnings. (sx_obsolete_{un}select_all_clicked): add callbacks for
"select all" and "unselect all" buttons.
numbers. (freq_type_to_string) remove.
(_create_transactions_on): catch errors a bit
better. (sx_obsolete_row_{un}sel): remove unnecessary warnings.
(sx_obsolete_{un}select_all_clicked): add callbacks for "select
all" and "unselect all" buttons.
2001-08-15 Christian Stimming <stimming@tuhh.de>

View File

@@ -620,11 +620,8 @@ AC_OUTPUT(
po/Makefile
rpm/Makefile
src/Makefile
src/calculation/Makefile
src/doc/Makefile
src/doc/design/Makefile
src/engine/Makefile
src/engine/test/Makefile
src/app-utils/Makefile
src/app-utils/test/Makefile
src/backend/Makefile
src/backend/file/Makefile
src/backend/file/test/Makefile
@@ -633,6 +630,11 @@ AC_OUTPUT(
src/backend/postgres/Makefile
src/backend/postgres/test/Makefile
src/backend/rpc/Makefile
src/calculation/Makefile
src/doc/Makefile
src/doc/design/Makefile
src/engine/Makefile
src/engine/test/Makefile
src/experimental/Makefile
src/experimental/cbb/Makefile
src/experimental/cbb/cbb-engine/Makefile
@@ -663,10 +665,21 @@ AC_OUTPUT(
src/register/ledger-core/Makefile
src/register/register-core/Makefile
src/register/register-gnome/Makefile
src/report/Makefile
src/report/report-system/test/Makefile
src/report/report-system/Makefile
src/report/standard-reports/test/Makefile
src/report/standard-reports/Makefile
src/report/locale-specific/Makefile
src/report/locale-specific/us/Makefile
src/report/locale-specific/us/test/Makefile
src/report/stylesheets/test/Makefile
src/report/stylesheets/Makefile
src/report/utility-reports/Makefile
src/report/utility-reports/test/Makefile
src/scm/Makefile
src/scm/gnumeric/Makefile
src/scm/printing/Makefile
src/scm/report/Makefile
src/test/Makefile
dnl # non-makefiles

View File

@@ -267,6 +267,7 @@ __DATA__
#*#
*.P
*.pp
*.a
*.bak
*.bin

View File

@@ -37,7 +37,7 @@
#include "gnc-event.h"
#include "gnc-ui.h"
#include "messages.h"
#include "guile/global-options.h"
#include "global-options.h"
/* FIXME: this is wrong. This file should not need this include. */
#include "gnc-book-p.h"
@@ -176,7 +176,7 @@ show_book_error (GNCBackendError io_error, const char *newfile)
case ERR_SQL_DB_TOO_OLD:
fmt = _("This database is from an older version of GnuCash.\n"
"Do you want to upgrade the database "
"Do you want to want to upgrade the database"
"to the current version?");
if (gnc_verify_dialog (fmt, TRUE)) { uh_oh = FALSE; }
break;

View File

@@ -4,8 +4,10 @@ SUBDIRS = \
gnc-module \
engine \
backend \
app-utils \
register \
import-export \
report \
calculation \
experimental \
guile \
@@ -27,7 +29,9 @@ bin_PROGRAMS = gnucash gnucash-make-guids
# that's fixed.
gnucash_LDADD = \
-Lengine -Lengine/.libs \
-Lgnc-module -Lgnc-module/.libs \
gnc-module/libgncmodule.la \
app-utils/libgncmod-app-utils.la \
engine/libgncmod-engine.la \
engine/libgw-engine.la \
engine/libgw-glib.la \
@@ -56,10 +60,8 @@ gnucash_LDADD = \
gnucash_SOURCES = \
EuroUtils.c \
FileDialog.c \
gnc-component-manager.c \
gnc-exp-parser.c \
gnc-main.c \
gnc-ui-util.c
gnc-exp-parser.c
gnucash_make_guids_LDADD = \
gnc-module/libgncmodule.la \
@@ -79,11 +81,8 @@ noinst_HEADERS = \
FileDialog.h \
RecnWindow.h \
file-history.h \
gnc-component-manager.h \
gnc-exp-parser.h \
gnc-ui.h \
gnc-ui-common.h \
gnc-ui-util.h \
messages.h
EXTRA_DIST = \
@@ -93,6 +92,7 @@ EXTRA_DIST = \
CFLAGS = @CFLAGS@ ${GNOME_INCLUDEDIR} ${GUILE_INCS}
INCLUDES = \
-I./app-utils \
-I./calculation \
-I./engine \
-I./guile \

View File

@@ -26,3 +26,12 @@ register/register-gnome Gnome-specific register code, formerly in
import-export/qif-import the old qif importer with Gnome druid
import-export/qif-io-core new qif import/export module. unfinished.
report/report-system the report infrastructure and HTML handling
report/standard-reports most of the reports that are in gnucash
report/utility-reports the multicolumn view, the iframe report, etc.
report/locale-specific-reports reports that should only be loaded in
certain locales. subdir per locale.
report/stylesheets predefined style sheet templates
app-utils utils for the gnucash app framework (component
mgr, cmd line processing, gettext stuff, etc)

67
src/app-utils/Makefile.am Normal file
View File

@@ -0,0 +1,67 @@
SUBDIRS = . test
pkglib_LTLIBRARIES = libgncmod-app-utils.la
CFLAGS = @CFLAGS@ ${GLIB_CFLAGS} ${G_WRAP_COMPILE_ARGS}
INCLUDES = -I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/engine ${GUILE_INCS} \
-I..
libgncmod_app_utils_la_SOURCES = \
gfec.c \
global-options.c \
gnc-component-manager.c \
gnc-gettext-util.c \
gnc-helpers.c \
gncmod-app-utils.c \
gnc-ui-util.c \
guile-util.c \
option-util.c
noinst_HEADERS = \
gnc-component-manager.h \
gnc-gettext-util.h \
gnc-helpers.h \
gnc-ui-util.h \
guile-util.h
libgncmod_app_utils_la_LDFLAGS = -module
libgncmod_app_utils_la_LIBADD = \
-L../engine -L../engine/.libs -lgncmod-engine \
-L../gnc-module -L../gnc-module/.libs -lgncmodule \
${GUILE_LIBS} ${GLIB_LIBS}
libgw_app_utils_la_SOURCES=gw-app-utils.c
libgw_app_utils_la_LDFLAGS=-module
gncmoddir=${GNC_SHAREDIR}/guile-modules/gnucash
gncmod_DATA=app-utils.scm
gncscmdir=${GNC_SHAREDIR}/scm
gncscm_DATA=c-interface.scm options.scm hooks.scm date-utilities.scm
gwmoddir=${GNC_SHAREDIR}/guile-modules/g-wrapped
gwmod_LTLIBRARIES=libgw-app-utils.la
gwmod_DATA=gw-app-utils-spec.scm
noinst_DATA=.scm-links
.scm-links:
rm -f gnucash g-wrapped
ln -sf . gnucash
ln -sf . g-wrapped
touch .scm-links
gw-app-utils.c gw-app-utils.h: .scm-links gw-app-utils-spec.scm
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_srcdir}/src/engine\" %load-path)) \
(primitive-load \"./gw-app-utils-spec.scm\") \
(gw:generate-module \"gw-app-utils\")"
BUILT_SOURCES += gw-app-utils.c gw-app-utils.h
CLEANFILES += gw-app-utils.c gw-app-utils.h gw-app-utils.html \
gnucash g-wrapped .scm-links

208
src/app-utils/app-utils.scm Normal file
View File

@@ -0,0 +1,208 @@
(define-module (gnucash app-utils))
(use-modules (g-wrapped gw-app-utils))
(use-modules (srfi srfi-1))
;; c-interface.scm
(export gnc:error->string)
(export gnc:gettext)
(export gnc:_)
(export _)
(export-syntax N_)
(export gnc:make-string-database)
(export gnc:make-option)
(export gnc:option-section)
(export gnc:option-name)
(export gnc:option-sort-tag)
(export gnc:option-type)
(export gnc:option-documentation)
(export gnc:option-getter)
(export gnc:option-setter)
(export gnc:option-default-getter)
(export gnc:option-generate-restore-form)
(export gnc:option-value-validator)
(export gnc:option-data)
(export gnc:option-data-fns)
(export gnc:option-set-changed-callback)
(export gnc:option-strings-getter)
(export gnc:option-widget-changed-proc)
(export gnc:option-value)
(export gnc:option-set-value)
(export gnc:option-index-get-name)
(export gnc:option-index-get-description)
(export gnc:option-index-get-value)
(export gnc:option-value-get-index)
(export gnc:option-number-of-indices)
(export gnc:option-default-value)
(export gnc:restore-form-generator)
(export gnc:value->string)
(export gnc:make-string-option)
(export gnc:make-text-option)
(export gnc:make-font-option)
(export gnc:make-currency-option)
(export gnc:make-commodity-option)
(export gnc:make-simple-boolean-option)
(export gnc:make-complex-boolean-option)
(export gnc:make-pixmap-option)
(export gnc:make-date-option)
(export gnc:get-rd-option-data-subtype)
(export gnc:get-rd-option-data-show-time)
(export gnc:get-rd-option-data-rd-list)
(export gnc:date-option-get-subtype)
(export gnc:date-option-show-time?)
(export gnc:date-option-value-type)
(export gnc:date-option-absolute-time)
(export gnc:date-option-relative-time)
(export gnc:make-account-list-option)
(export gnc:multichoice-list-lookup)
(export gnc:make-multichoice-option)
(export gnc:make-multichoice-callback-option)
(export gnc:make-list-option)
(export gnc:make-number-range-option)
(export gnc:make-internal-option)
(export gnc:make-query-option)
(export gnc:make-color-option)
(export gnc:color->html)
(export gnc:color-option->html)
(export gnc:color-option->hex-string)
(export gnc:new-options)
(export gnc:register-option)
(export gnc:options-register-callback)
(export gnc:options-register-c-callback)
(export gnc:options-unregister-callback-id)
(export gnc:options-for-each)
(export gnc:options-for-each-general)
(export gnc:lookup-option)
(export gnc:generate-restore-forms)
(export gnc:options-clear-changes)
(export gnc:options-touch)
(export gnc:options-run-callbacks)
(export gnc:options-set-default-section)
(export gnc:options-get-default-section)
(export gnc:options-copy-values)
(export gnc:send-options)
(export gnc:save-options)
;; date-utilities.scm
(export gnc:reldate-list)
(export gnc:timepair->secs)
(export gnc:secs->timepair)
(export gnc:timepair->date)
(export gnc:date->timepair)
(export gnc:date-get-year)
(export gnc:date-get-month-day)
(export gnc:date-get-month)
(export gnc:date-get-week-day)
(export gnc:date-get-year-day)
(export gnc:timepair-get-year)
(export gnc:timepair-get-month-day)
(export gnc:timepair-get-month)
(export gnc:timepair-get-week-day)
(export gnc:timepair-get-year-day)
(export gnc:date-get-month-string)
(export gnc:leap-year?)
(export gnc:days-in-year)
(export gnc:days-in-month)
(export gnc:date-to-year-fraction)
(export gnc:date-year-delta)
(export gnc:date-to-month-fraction)
(export gnc:date-to-week-fraction)
(export gnc:date-to-day-fraction)
(export moddatek)
(export decdate)
(export incdate)
(export gnc:timepair-later)
(export gnc:timepair-lt)
(export gnc:timepair-earlier)
(export gnc:timepair-gt)
(export gnc:timepair-le)
(export gnc:timepair-ge)
(export gnc:timepair-eq)
(export gnc:timepair-earlier-date)
(export gnc:timepair-later-date)
(export gnc:timepair-le-date)
(export gnc:timepair-ge-date)
(export gnc:timepair-eq-date)
(export gnc:make-date-interval-list)
(export gnc:make-date-list)
(export make-zdate)
(export SecDelta )
(export DayDelta)
(export WeekDelta )
(export TwoWeekDelta)
(export MonthDelta)
(export QuarterDelta)
(export HalfYearDelta)
(export YearDelta )
(export ThirtyDayDelta)
(export NinetyDayDelta)
(export gnc:timepair-delta)
(export gnc:time-elapsed)
(export gnc:timepair-to-datestring)
(export gnc:timepair-start-day-time)
(export gnc:timepair-end-day-time)
(export gnc:timepair-previous-day)
(export gnc:reldate-get-symbol)
(export gnc:reldate-get-string)
(export gnc:reldate-get-desc)
(export gnc:reldate-get-fn)
(export gnc:make-reldate-hash)
(export gnc:reldate-string-db)
(export gnc:relative-date-values)
(export gnc:relative-date-hash)
(export gnc:get-absolute-from-relative-date)
(export gnc:get-relative-date-strings)
(export gnc:get-relative-date-string)
(export gnc:get-relative-date-desc)
(export gnc:get-start-cal-year)
(export gnc:get-end-cal-year)
(export gnc:get-start-prev-year)
(export gnc:get-end-prev-year)
(export gnc:get-start-cur-fin-year)
(export gnc:get-start-prev-fin-year)
(export gnc:get-end-prev-fin-year)
(export gnc:get-end-cur-fin-year)
(export gnc:get-start-this-month)
(export gnc:get-end-this-month)
(export gnc:get-start-prev-month)
(export gnc:get-end-prev-month)
(export gnc:get-start-current-quarter)
(export gnc:get-end-current-quarter)
(export gnc:get-start-prev-quarter)
(export gnc:get-end-prev-quarter)
(export gnc:get-today)
(export gnc:get-one-month-ago)
(export gnc:get-three-months-ago)
(export gnc:get-six-months-ago)
(export gnc:get-one-year-ago)
(export gnc:reldate-initialize)
;; hooks
(export gnc:hook-export)
(export gnc:hook-danglers-get)
(export gnc:hook-danglers-set!)
(export gnc:hook-danglers->list)
(export gnc:hook-replace-danglers)
(export gnc:hook-run-danglers)
(export gnc:hook-lookup)
(export gnc:hook-add-dangler)
(export gnc:hook-remove-dangler)
(export gnc:hook-description-get)
(export gnc:hook-name-get)
(export gnc:*startup-hook*)
(export gnc:*shutdown-hook*)
(export gnc:*ui-startup-hook*)
(export gnc:*ui-shutdown-hook*)
(export gnc:*book-opened-hook*)
(export gnc:*book-closed-hook*)
(load-from-path "c-interface.scm")
(load-from-path "options.scm")
(load-from-path "hooks.scm")
(load-from-path "date-utilities.scm")

View File

@@ -15,10 +15,11 @@
;; 59 Temple Place - Suite 330 Fax: +1-617-542-2652
;; Boston, MA 02111-1307, USA gnu@gnu.org
(require 'hash-table)
(use-modules (ice-9 slib))
(use-modules (ice-9 syncase))
(require 'hash-table)
(define (gnc:error->string tag args)
(define (write-error port)
(if (and (list? args) (not (null? args)))
@@ -69,5 +70,5 @@
(if func
(apply func args)
(gnc:warn "string-database: bad message" message "\n"))))
dispatch)

View File

@@ -19,10 +19,6 @@
;; 59 Temple Place - Suite 330 Fax: +1-617-542-2652
;; Boston, MA 02111-1307, USA gnu@gnu.org
(use-modules (srfi srfi-19))
(gnc:support "date-utilities.scm")
(define gnc:reldate-list '())
(define (gnc:timepair->secs tp)
@@ -246,6 +242,7 @@
(set-tm:isdst zd -1)
zd))
(define SecDelta
(let ((ddt (make-zdate)))
(set-tm:sec ddt 1)
@@ -671,246 +668,242 @@
;;start-cur-fin-year start-prev-fin-year end-prev-fin-year
(define (gnc:reldate-initialize)
(begin
(gnc:reldate-string-db
'store 'start-cal-year-string
(N_ "Current Year Start"))
(gnc:reldate-string-db
'store 'start-cal-year-desc
(N_ "Start of the current calendar year"))
(gnc:reldate-string-db
'store 'start-cal-year-string
(N_ "Current Year Start"))
(gnc:reldate-string-db
'store 'end-cal-year-string
(N_ "Current Year End"))
(gnc:reldate-string-db
'store 'end-cal-year-desc
(N_ "End of the current calendar year"))
(gnc:reldate-string-db
'store 'start-cal-year-desc
(N_ "Start of the current calendar year"))
(gnc:reldate-string-db
'store 'start-prev-year-string
(N_ "Previous Year Start"))
(gnc:reldate-string-db
'store 'start-prev-year-desc
(N_ "Beginning of the previous calendar year"))
(gnc:reldate-string-db
'store 'end-cal-year-string
(N_ "Current Year End"))
(gnc:reldate-string-db
'store 'end-cal-year-desc
(N_ "End of the current calendar year"))
(gnc:reldate-string-db
'store 'end-prev-year-string
(N_ "Previous Year End"))
(gnc:reldate-string-db
'store 'end-prev-year-desc
(N_ "End of the Previous Year"))
(gnc:reldate-string-db
'store 'start-prev-year-string
(N_ "Previous Year Start"))
(gnc:reldate-string-db
'store 'start-prev-year-desc
(N_ "Beginning of the previous calendar year"))
(gnc:reldate-string-db
'store 'start-cur-fin-year-string
(N_ "Current Financial Year Start"))
(gnc:reldate-string-db
'store 'start-cur-fin-year-desc
(N_ "Start of the current financial year/accounting period"))
(gnc:reldate-string-db
'store 'end-prev-year-string
(N_ "Previous Year End"))
(gnc:reldate-string-db
'store 'end-prev-year-desc
(N_ "End of the Previous Year"))
(gnc:reldate-string-db
'store 'start-prev-fin-year-string
(N_ "Previous Financial Year Start"))
(gnc:reldate-string-db
'store 'start-prev-fin-year-desc
(N_ "The start of the previous financial year/accounting period"))
(gnc:reldate-string-db
'store 'start-cur-fin-year-string
(N_ "Current Financial Year Start"))
(gnc:reldate-string-db
'store 'start-cur-fin-year-desc
(N_ "Start of the current financial year/accounting period"))
(gnc:reldate-string-db
'store 'end-prev-fin-year-string
(N_ "End Previous Financial Year"))
(gnc:reldate-string-db
'store 'end-prev-fin-year-desc
(N_ "End of the previous Financial year/Accounting Period"))
(gnc:reldate-string-db
'store 'start-prev-fin-year-string
(N_ "Previous Financial Year Start"))
(gnc:reldate-string-db
'store 'start-prev-fin-year-desc
(N_ "The start of the previous financial year/accounting period"))
(gnc:reldate-string-db
'store 'end-cur-fin-year-string
(N_ "End Current Financial Year"))
(gnc:reldate-string-db
'store 'end-cur-fin-year-desc
(N_ "End of the current Financial year/Accounting Period"))
(gnc:reldate-string-db
'store 'end-prev-fin-year-string
(N_ "End Previous Financial Year"))
(gnc:reldate-string-db
'store 'end-prev-fin-year-desc
(N_ "End of the previous Financial year/Accounting Period"))
(gnc:reldate-string-db
'store 'start-this-month-string
(N_ "Start of this month"))
(gnc:reldate-string-db
'store 'start-this-month-desc
(N_ "Start of the current month"))
(gnc:reldate-string-db
'store 'end-cur-fin-year-string
(N_ "End Current Financial Year"))
(gnc:reldate-string-db
'store 'end-cur-fin-year-desc
(N_ "End of the current Financial year/Accounting Period"))
(gnc:reldate-string-db
'store 'end-this-month-string
(N_ "End of this month"))
(gnc:reldate-string-db
'store 'end-this-month-desc
(N_ "End of the current month"))
(gnc:reldate-string-db
'store 'start-this-month-string
(N_ "Start of this month"))
(gnc:reldate-string-db
'store 'start-this-month-desc
(N_ "Start of the current month"))
(gnc:reldate-string-db
'store 'start-prev-month-string
(N_ "Start of previous month"))
(gnc:reldate-string-db
'store 'start-prev-month-desc
(N_ "The beginning of the previous month"))
(gnc:reldate-string-db
'store 'end-this-month-string
(N_ "End of this month"))
(gnc:reldate-string-db
'store 'end-this-month-desc
(N_ "End of the current month"))
(gnc:reldate-string-db
'store 'end-prev-month-string
(N_ "End of previous month"))
(gnc:reldate-string-db
'store 'end-prev-month-desc
(N_ "Last day of previous month"))
(gnc:reldate-string-db
'store 'start-prev-month-string
(N_ "Start of previous month"))
(gnc:reldate-string-db
'store 'start-prev-month-desc
(N_ "The beginning of the previous month"))
(gnc:reldate-string-db
'store 'start-current-quarter-string
(N_ "Start of current quarter"))
(gnc:reldate-string-db
'store 'start-current-quarter-desc
(N_ "The start of the latest quarterly accounting period"))
(gnc:reldate-string-db
'store 'end-prev-month-string
(N_ "End of previous month"))
(gnc:reldate-string-db
'store 'end-prev-month-desc
(N_ "Last day of previous month"))
(gnc:reldate-string-db
'store 'end-current-quarter-string
(N_ "End of current quarter"))
(gnc:reldate-string-db
'store 'end-current-quarter-desc
(N_ "The end of the latest quarterly accounting period"))
(gnc:reldate-string-db
'store 'start-current-quarter-string
(N_ "Start of current quarter"))
(gnc:reldate-string-db
'store 'start-current-quarter-desc
(N_ "The start of the latest quarterly accounting period"))
(gnc:reldate-string-db
'store 'start-prev-quarter-string
(N_ "Start of previous quarter"))
(gnc:reldate-string-db
'store 'start-prev-quarter-desc
(N_ "The start of the previous quarterly accounting period"))
(gnc:reldate-string-db
'store 'end-current-quarter-string
(N_ "End of current quarter"))
(gnc:reldate-string-db
'store 'end-current-quarter-desc
(N_ "The end of the latest quarterly accounting period"))
(gnc:reldate-string-db
'store 'end-prev-quarter-string
(N_ "End of previous quarter"))
(gnc:reldate-string-db
'store 'end-prev-quarter-desc
(N_ "End of previous quarterly accounting period"))
(gnc:reldate-string-db
'store 'start-prev-quarter-string
(N_ "Start of previous quarter"))
(gnc:reldate-string-db
'store 'start-prev-quarter-desc
(N_ "The start of the previous quarterly accounting period"))
(gnc:reldate-string-db
'store 'today-string
(N_ "Today"))
(gnc:reldate-string-db
'store 'today-desc (N_ "The current date"))
(gnc:reldate-string-db
'store 'end-prev-quarter-string
(N_ "End of previous quarter"))
(gnc:reldate-string-db
'store 'end-prev-quarter-desc
(N_ "End of previous quarterly accounting period"))
(gnc:reldate-string-db
'store 'one-month-ago-string
(N_ "One Month Ago"))
(gnc:reldate-string-db
'store 'one-month-ago-desc (N_ "One Month Ago"))
(gnc:reldate-string-db
'store 'today-string
(N_ "Today"))
(gnc:reldate-string-db
'store 'today-desc (N_ "The current date"))
(gnc:reldate-string-db
'store 'one-week-ago-string
(N_ "One Week Ago"))
(gnc:reldate-string-db
'store 'one-week-ago-desc (N_ "One Week Ago"))
(gnc:reldate-string-db
'store 'one-month-ago-string
(N_ "One Month Ago"))
(gnc:reldate-string-db
'store 'one-month-ago-desc (N_ "One Month Ago"))
(gnc:reldate-string-db
'store 'three-months-ago-string
(N_ "Three Months Ago"))
(gnc:reldate-string-db
'store 'three-months-ago-desc (N_ "Three Months Ago"))
(gnc:reldate-string-db
'store 'one-week-ago-string
(N_ "One Week Ago"))
(gnc:reldate-string-db
'store 'one-week-ago-desc (N_ "One Week Ago"))
(gnc:reldate-string-db
'store 'six-months-ago-string
(N_ "Six Months Ago"))
(gnc:reldate-string-db
'store 'six-months-ago-desc (N_ "Six Months Ago"))
(gnc:reldate-string-db
'store 'three-months-ago-string
(N_ "Three Months Ago"))
(gnc:reldate-string-db
'store 'three-months-ago-desc (N_ "Three Months Ago"))
(gnc:reldate-string-db
'store 'one-year-ago-string (N_ "One Year Ago"))
(gnc:reldate-string-db
'store 'one-year-ago-desc (N_ "One Year Ago"))
(gnc:reldate-string-db
'store 'six-months-ago-string
(N_ "Six Months Ago"))
(gnc:reldate-string-db
'store 'six-months-ago-desc (N_ "Six Months Ago"))
(set! gnc:relative-date-values
(list
(vector 'start-cal-year
(gnc:reldate-string-db 'lookup 'start-cal-year-string)
(gnc:reldate-string-db 'lookup 'start-cal-year-desc)
gnc:get-start-cal-year)
(vector 'end-cal-year
(gnc:reldate-string-db 'lookup 'end-cal-year-string)
(gnc:reldate-string-db 'lookup 'end-cal-year-desc)
gnc:get-end-cal-year)
(vector 'start-prev-year
(gnc:reldate-string-db 'lookup 'start-prev-year-string)
(gnc:reldate-string-db 'lookup 'start-prev-year-desc)
gnc:get-start-prev-year)
(vector 'end-prev-year
(gnc:reldate-string-db 'lookup 'end-prev-year-string)
(gnc:reldate-string-db 'lookup 'end-prev-year-desc)
gnc:get-end-prev-year)
(vector 'start-cur-fin-year
(gnc:reldate-string-db 'lookup 'start-cur-fin-year-string)
(gnc:reldate-string-db 'lookup 'start-cur-fin-year-desc)
gnc:get-start-cur-fin-year)
(vector 'start-prev-fin-year
(gnc:reldate-string-db 'lookup 'start-prev-fin-year-string)
(gnc:reldate-string-db 'lookup 'start-prev-fin-year-desc)
gnc:get-start-prev-fin-year)
(vector 'end-prev-fin-year
(gnc:reldate-string-db 'lookup 'end-prev-fin-year-string)
(gnc:reldate-string-db 'lookup 'end-prev-fin-year-desc)
gnc:get-end-prev-fin-year)
(vector 'end-cur-fin-year
(gnc:reldate-string-db 'lookup 'end-cur-fin-year-string)
(gnc:reldate-string-db 'lookup 'end-cur-fin-year-desc)
gnc:get-end-cur-fin-year)
(vector 'start-this-month
(gnc:reldate-string-db 'lookup 'start-this-month-string)
(gnc:reldate-string-db 'lookup 'start-this-month-desc)
gnc:get-start-this-month)
(vector 'end-this-month
(gnc:reldate-string-db 'lookup 'end-this-month-string)
(gnc:reldate-string-db 'lookup 'end-this-month-desc)
gnc:get-end-this-month)
(vector 'start-prev-month
(gnc:reldate-string-db 'lookup 'start-prev-month-string)
(gnc:reldate-string-db 'lookup 'start-prev-month-desc)
gnc:get-start-prev-month)
(vector 'end-prev-month
(gnc:reldate-string-db 'lookup 'end-prev-month-string)
(gnc:reldate-string-db 'lookup 'end-prev-month-desc)
gnc:get-end-prev-month)
(vector 'start-current-quarter
(gnc:reldate-string-db 'lookup 'start-current-quarter-string)
(gnc:reldate-string-db 'lookup 'start-current-quarter-desc)
gnc:get-start-current-quarter)
(vector 'end-current-quarter
(gnc:reldate-string-db 'lookup 'end-current-quarter-string)
(gnc:reldate-string-db 'lookup 'end-current-quarter-desc)
gnc:get-end-current-quarter)
(vector 'start-prev-quarter
(gnc:reldate-string-db 'lookup 'start-prev-quarter-string)
(gnc:reldate-string-db 'lookup 'start-prev-quarter-desc)
gnc:get-start-prev-quarter)
(vector 'end-prev-quarter
(gnc:reldate-string-db 'lookup 'end-prev-quarter-string)
(gnc:reldate-string-db 'lookup 'end-prev-quarter-desc)
gnc:get-end-prev-quarter)
(vector 'today
(gnc:reldate-string-db 'lookup 'today-string)
(gnc:reldate-string-db 'lookup 'today-desc)
gnc:get-today)
(vector 'one-month-ago
(gnc:reldate-string-db 'lookup 'one-month-ago-string)
(gnc:reldate-string-db 'lookup 'one-month-ago-desc)
gnc:get-one-month-ago)
(vector 'three-months-ago
(gnc:reldate-string-db 'lookup 'three-months-ago-string)
(gnc:reldate-string-db 'lookup 'three-months-ago-desc)
gnc:get-three-months-ago)
(vector 'six-months-ago
(gnc:reldate-string-db 'lookup 'six-months-ago-string)
(gnc:reldate-string-db 'lookup 'six-months-ago-desc)
gnc:get-three-months-ago)
(vector 'one-year-ago
(gnc:reldate-string-db 'lookup 'one-year-ago-string)
(gnc:reldate-string-db 'lookup 'one-year-ago-desc)
gnc:get-one-year-ago)))
(gnc:reldate-string-db
'store 'one-year-ago-string (N_ "One Year Ago"))
(gnc:reldate-string-db
'store 'one-year-ago-desc (N_ "One Year Ago"))
(set! gnc:relative-date-values
(list
(vector 'start-cal-year
(gnc:reldate-string-db 'lookup 'start-cal-year-string)
(gnc:reldate-string-db 'lookup 'start-cal-year-desc)
gnc:get-start-cal-year)
(vector 'end-cal-year
(gnc:reldate-string-db 'lookup 'end-cal-year-string)
(gnc:reldate-string-db 'lookup 'end-cal-year-desc)
gnc:get-end-cal-year)
(vector 'start-prev-year
(gnc:reldate-string-db 'lookup 'start-prev-year-string)
(gnc:reldate-string-db 'lookup 'start-prev-year-desc)
gnc:get-start-prev-year)
(vector 'end-prev-year
(gnc:reldate-string-db 'lookup 'end-prev-year-string)
(gnc:reldate-string-db 'lookup 'end-prev-year-desc)
gnc:get-end-prev-year)
(vector 'start-cur-fin-year
(gnc:reldate-string-db 'lookup 'start-cur-fin-year-string)
(gnc:reldate-string-db 'lookup 'start-cur-fin-year-desc)
gnc:get-start-cur-fin-year)
(vector 'start-prev-fin-year
(gnc:reldate-string-db 'lookup 'start-prev-fin-year-string)
(gnc:reldate-string-db 'lookup 'start-prev-fin-year-desc)
gnc:get-start-prev-fin-year)
(vector 'end-prev-fin-year
(gnc:reldate-string-db 'lookup 'end-prev-fin-year-string)
(gnc:reldate-string-db 'lookup 'end-prev-fin-year-desc)
gnc:get-end-prev-fin-year)
(vector 'end-cur-fin-year
(gnc:reldate-string-db 'lookup 'end-cur-fin-year-string)
(gnc:reldate-string-db 'lookup 'end-cur-fin-year-desc)
gnc:get-end-cur-fin-year)
(vector 'start-this-month
(gnc:reldate-string-db 'lookup 'start-this-month-string)
(gnc:reldate-string-db 'lookup 'start-this-month-desc)
gnc:get-start-this-month)
(vector 'end-this-month
(gnc:reldate-string-db 'lookup 'end-this-month-string)
(gnc:reldate-string-db 'lookup 'end-this-month-desc)
gnc:get-end-this-month)
(vector 'start-prev-month
(gnc:reldate-string-db 'lookup 'start-prev-month-string)
(gnc:reldate-string-db 'lookup 'start-prev-month-desc)
gnc:get-start-prev-month)
(vector 'end-prev-month
(gnc:reldate-string-db 'lookup 'end-prev-month-string)
(gnc:reldate-string-db 'lookup 'end-prev-month-desc)
gnc:get-end-prev-month)
(vector 'start-current-quarter
(gnc:reldate-string-db 'lookup 'start-current-quarter-string)
(gnc:reldate-string-db 'lookup 'start-current-quarter-desc)
gnc:get-start-current-quarter)
(vector 'end-current-quarter
(gnc:reldate-string-db 'lookup 'end-current-quarter-string)
(gnc:reldate-string-db 'lookup 'end-current-quarter-desc)
gnc:get-end-current-quarter)
(vector 'start-prev-quarter
(gnc:reldate-string-db 'lookup 'start-prev-quarter-string)
(gnc:reldate-string-db 'lookup 'start-prev-quarter-desc)
gnc:get-start-prev-quarter)
(vector 'end-prev-quarter
(gnc:reldate-string-db 'lookup 'end-prev-quarter-string)
(gnc:reldate-string-db 'lookup 'end-prev-quarter-desc)
gnc:get-end-prev-quarter)
(vector 'today
(gnc:reldate-string-db 'lookup 'today-string)
(gnc:reldate-string-db 'lookup 'today-desc)
gnc:get-today)
(vector 'one-month-ago
(gnc:reldate-string-db 'lookup 'one-month-ago-string)
(gnc:reldate-string-db 'lookup 'one-month-ago-desc)
gnc:get-one-month-ago)
(vector 'three-months-ago
(gnc:reldate-string-db 'lookup 'three-months-ago-string)
(gnc:reldate-string-db 'lookup 'three-months-ago-desc)
gnc:get-three-months-ago)
(vector 'six-months-ago
(gnc:reldate-string-db 'lookup 'six-months-ago-string)
(gnc:reldate-string-db 'lookup 'six-months-ago-desc)
gnc:get-three-months-ago)
(vector 'one-year-ago
(gnc:reldate-string-db 'lookup 'one-year-ago-string)
(gnc:reldate-string-db 'lookup 'one-year-ago-desc)
gnc:get-one-year-ago)))
(gnc:make-reldate-hash gnc:relative-date-hash gnc:relative-date-values)
(set! gnc:reldate-list
(map (lambda (x) (vector-ref x 0)) gnc:relative-date-values))))
;; Startup
(let ((hook (gnc:hook-lookup 'startup-hook)))
(gnc:hook-add-dangler hook gnc:reldate-initialize))
(gnc:make-reldate-hash gnc:relative-date-hash gnc:relative-date-values)
(set! gnc:reldate-list
(map (lambda (x) (vector-ref x 0)) gnc:relative-date-values)))

165
src/app-utils/gfec.c Normal file
View File

@@ -0,0 +1,165 @@
/* Authors: Eric M. Ludlam <zappo@ultranet.com>
* Russ McManus <russell.mcmanus@gs.com>
* Dave Peticolas <dave@krondo.com>
*
* gfec stands for 'guile fancy error catching'.
* This code is in the public domain.
*/
#include <assert.h>
#include <string.h>
#include "gfec.h"
/* We assume that data is actually a char**. The way we return results
* from this function is to malloc a fresh string, and store it in
* this pointer. It is the caller's responsibility to do something
* smart with this freshly allocated storage. the caller can determine
* whether there was an error by initializing the char* passed in to
* NULL. If there is an error, the char string will not be NULL on
* return. */
static SCM
gfec_catcher(void *data, SCM tag, SCM throw_args)
{
SCM func;
SCM result;
char *msg = NULL;
func = gh_eval_str("gnc:error->string");
if (gh_procedure_p(func))
{
result = gh_call2(func, tag, throw_args);
if (gh_string_p(result))
msg = gh_scm2newstr(result, NULL);
}
if (msg == NULL)
{
msg = strdup("Error running guile function.");
assert(msg != NULL);
}
*(char**)data = msg;
return SCM_UNDEFINED;
}
/* The arguments to scm_internal_stack_catch:
------------------------------------------
SCM tag : this should be SCM_BOOL_T to catch all errors.
scm_catch_body_t body : the function to run.
void *body_data : a pointer to pass to body
scm_catch_handler_t handler : the hander function
void *handler_data : a pointer to pass to the handler
*/
static SCM
gfec_file_helper(void *data)
{
char *file = data;
return gh_eval_file(file);
}
SCM
gfec_eval_file(const char *file, gfec_error_handler error_handler)
{
char *err_msg = NULL;
SCM result;
result = scm_internal_stack_catch(SCM_BOOL_T,
gfec_file_helper,
(void *) file,
gfec_catcher,
&err_msg);
if (err_msg != NULL)
{
if (error_handler)
error_handler(err_msg);
free(err_msg);
return SCM_UNDEFINED;
}
return result;
}
static SCM
gfec_string_helper(void *data)
{
char *string = data;
return gh_eval_str(string);
}
SCM
gfec_eval_string(const char *str, gfec_error_handler error_handler)
{
char *err_msg = NULL;
SCM result;
result = scm_internal_stack_catch(SCM_BOOL_T,
gfec_string_helper,
(void *) str,
gfec_catcher,
&err_msg);
if (err_msg != NULL)
{
if (error_handler)
error_handler(err_msg);
free(err_msg);
return SCM_UNDEFINED;
}
return result;
}
struct gfec_apply_rec
{
SCM proc;
SCM arglist;
};
static SCM
gfec_apply_helper(void *data)
{
struct gfec_apply_rec *apply_rec = (struct gfec_apply_rec *)data;
return gh_apply(apply_rec->proc, apply_rec->arglist);
}
SCM
gfec_apply(SCM proc, SCM arglist, gfec_error_handler error_handler)
{
char *err_msg = NULL;
struct gfec_apply_rec apply_rec;
SCM result;
apply_rec.proc = proc;
apply_rec.arglist = arglist;
result = scm_internal_stack_catch(SCM_BOOL_T,
gfec_apply_helper,
&apply_rec,
gfec_catcher,
&err_msg);
if (err_msg != NULL)
{
if (error_handler)
error_handler(err_msg);
free(err_msg);
return SCM_UNDEFINED;
}
return result;
}

20
src/app-utils/gfec.h Normal file
View File

@@ -0,0 +1,20 @@
/* Authors: Eric M. Ludlam <zappo@ultranet.com>
* Russ McManus <russell.mcmanus@gs.com>
* Dave Peticolas <dave@krondo.com>
*
* gfec stands for 'guile fancy error catching'.
* This code is in the public domain.
*/
#ifndef GFEC_H
#define GFEC_H
#include <guile/gh.h>
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);
#endif

View File

@@ -0,0 +1,498 @@
/********************************************************************\
* global-options.c -- GNOME global option handling *
* Copyright (C) 1998,1999 Linas Vepstas *
* *
* 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 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/
#include "config.h"
#include "global-options.h"
#include "option-util.h"
#include "gnc-engine-util.h"
#include "gnc-ui-util.h"
/* This static indicates the debugging module that this .o belongs to. */
static short module = MOD_GUI;
static GNCOptionDB *global_options = NULL;
/********************************************************************\
* gnc_options_init *
* initialize the options structures from the guile side *
* *
* Args: none *
* Returns: nothing *
\********************************************************************/
void
gnc_options_init(void)
{
SCM func = gh_eval_str("gnc:send-global-options");
SCM options;
if (gh_procedure_p(func))
options = gh_call0(func);
else
{
PERR("gnc_options_init: no guile options!");
return;
}
global_options = gnc_option_db_new(options);
}
/********************************************************************\
* gnc_options_shutdown *
* unregister the scheme options and free the structure memory *
* *
* Args: none *
* Returns: nothing *
\********************************************************************/
void
gnc_options_shutdown(void)
{
gnc_option_db_destroy(global_options);
global_options = NULL;
}
/********************************************************************\
* gnc_register_option_change_callback *
* register a callback to be called whenever an option changes *
* *
* Args: callback - the callback function *
* user_data - the user data for the callback *
* section - the section to get callbacks for. *
* If NULL, get callbacks for any section changes.*
* name - the option name to get callbacks for. *
* If NULL, get callbacks for any option in the *
* section. Only used if section is non-NULL. *
* Returns: SCM handle for unregistering *
\********************************************************************/
SCM
gnc_register_option_change_callback(OptionChangeCallback callback,
void *user_data,
char *section,
char *name)
{
return gnc_option_db_register_change_callback(global_options, callback,
user_data, section, name);
}
/********************************************************************\
* gnc_unregister_option_change_callback_id *
* unregister the change callback associated with the given id *
* *
* Args: callback_id - the callback function id *
* Returns: nothing *
\********************************************************************/
void
gnc_unregister_option_change_callback_id(SCM callback_id)
{
gnc_option_db_unregister_change_callback_id(global_options, callback_id);
}
/********************************************************************\
* gnc_get_option_by_name *
* returns an option given section name and name *
* *
* Args: section_name - name of section to search for *
* name - name to search for *
* Returns: given option, or NULL if none *
\********************************************************************/
GNCOption *
gnc_get_option_by_name(const char *section_name, const char *name)
{
return gnc_option_db_get_option_by_name(global_options,
section_name, name);
}
/********************************************************************\
* gnc_get_option_by_SCM *
* returns an option given SCM handle. Uses section and name. *
* *
* Args: guile_option - SCM handle of option *
* Returns: given option, or NULL if none *
\********************************************************************/
GNCOption *
gnc_get_option_by_SCM(SCM guile_option)
{
return gnc_option_db_get_option_by_SCM(global_options, guile_option);
}
/********************************************************************\
* gnc_lookup_option *
* looks up an option. If present, returns its SCM value, *
* otherwise returns the default. *
* *
* Args: section - section name of option *
* name - name of option *
* default - default value if not found *
* Return: option value *
\********************************************************************/
SCM
gnc_lookup_option(const char *section, const char *name, SCM default_value)
{
return gnc_option_db_lookup_option(global_options, section,
name, default_value);
}
/********************************************************************\
* gnc_lookup_boolean_option *
* looks up a boolean option. If present, returns its value, *
* otherwise returns the default. *
* *
* Args: section - section name of option *
* name - name of option *
* default - default value if not found *
* Return: gboolean option value *
\********************************************************************/
gboolean
gnc_lookup_boolean_option(const char *section, const char *name,
gboolean default_value)
{
return gnc_option_db_lookup_boolean_option(global_options, section,
name, default_value);
}
/********************************************************************\
* gnc_lookup_string_option *
* looks up a string option. If present, returns its malloc'ed *
* value, otherwise returns the strdup'ed default, or NULL if *
* default was NULL. *
* *
* Args: section - section name of option *
* name - name of option *
* default - default value if not found *
* Return: char * option value *
\********************************************************************/
char *
gnc_lookup_string_option(const char *section, const char *name,
const char *default_value)
{
return gnc_option_db_lookup_string_option(global_options, section,
name, default_value);
}
/********************************************************************\
* gnc_lookup_font_option *
* looks up a font option. If present, returns its malloc'ed *
* string value, otherwise returns the strdup'ed default, or NULL *
* if default was NULL. *
* *
* Args: section - section name of option *
* name - name of option *
* default - default value if not found *
* Return: char * option value *
\********************************************************************/
char *
gnc_lookup_font_option(const char *section, const char *name,
const char *default_value)
{
return gnc_option_db_lookup_font_option(global_options, section,
name, default_value);
}
/********************************************************************\
* gnc_lookup_multichoice_option *
* looks up a multichoice option. If present, returns its *
* name as a malloc'ed string *
* value, otherwise returns the strdup'ed default, or NULL if *
* default was NULL. *
* *
* Args: section - section name of option *
* name - name of option *
* default - default value if not found *
* Return: char * option value *
\********************************************************************/
char *
gnc_lookup_multichoice_option(const char *section, const char *name,
const char *default_value)
{
return gnc_option_db_lookup_multichoice_option(global_options, section,
name, default_value);
}
/********************************************************************\
* gnc_lookup_number_option *
* looks up a number option. If present, return its value *
* as a gdouble, otherwise returns default_value. *
* *
* Args: section - section name of option *
* name - name of option *
* default - default value if not found *
* Return: char * option value *
\********************************************************************/
gdouble
gnc_lookup_number_option(const char *section, const char *name,
gdouble default_value)
{
return gnc_option_db_lookup_number_option(global_options, section,
name, default_value);
}
/********************************************************************\
* gnc_lookup_color_option *
* looks up a color option. If present, returns its value in the *
* color variable, otherwise leaves the color variable alone. *
* *
* Args: section - section name of option *
* name - name of option *
* red - where to store the red value *
* blue - where to store the blue value *
* green - where to store the green value *
* alpha - where to store the alpha value *
* Return: true if option was found *
\********************************************************************/
gboolean gnc_lookup_color_option(const char *section, const char *name,
gdouble *red, gdouble *green,
gdouble *blue, gdouble *alpha)
{
return gnc_option_db_lookup_color_option(global_options, section, name,
red, green, blue, alpha);
}
/********************************************************************\
* gnc_lookup_color_option_argb *
* looks up a color option. If present, returns its argb value, *
* otherwise returns the given default value. *
* *
* Args: odb - option database to search in *
* section - section name of option *
* name - name of option *
* default_value - default value to return if problem *
* Return: argb value *
\********************************************************************/
guint32
gnc_lookup_color_option_argb(const char *section, const char *name,
guint32 default_value)
{
return gnc_option_db_lookup_color_option_argb(global_options, section, name,
default_value);
}
/********************************************************************\
* gnc_lookup_list_option *
* looks up a list option. If present, returns its value as a *
* list of strings representing the symbols. *
* *
* Args: section - section name of option *
* name - name of option *
* default_value - default value to return if problem *
* Return: list of values *
\********************************************************************/
GSList *
gnc_lookup_list_option(const char *section, const char *name,
GSList *default_value)
{
return gnc_option_db_lookup_list_option(global_options, section, name,
default_value);
}
/********************************************************************\
* gnc_lookup_currency_option *
* looks up a currency option. *
* *
* Args: section - section name of option *
* name - name of option *
* default_value - default value to return if problem *
* Return: currency object or NULL *
\********************************************************************/
gnc_commodity *
gnc_lookup_currency_option(const char *section,
const char *name,
gnc_commodity *default_value)
{
return gnc_option_db_lookup_currency_option(global_options, section, name,
default_value);
}
/********************************************************************\
* gnc_default_currency *
* Return the default currency set by the user. *
* *
* Args: section - section name of option *
* name - name of option *
* default_value - default value to return if problem *
* Return: currency object or NULL *
\********************************************************************/
gnc_commodity *
gnc_default_currency (void)
{
gnc_commodity *currency;
currency = gnc_lookup_currency_option ("International",
"Default Currency", NULL);
if (currency)
return currency;
return gnc_locale_default_currency ();
}
/********************************************************************\
* gnc_set_option_default *
* set the option to its default value *
* *
* Args: section - section name of option *
* name - name of option *
* Returns: nothing *
\********************************************************************/
void
gnc_set_option_default(const char *section, const char *name)
{
gnc_option_db_set_option_default(global_options, section, name);
}
/********************************************************************\
* gnc_set_option *
* sets the option to the given value. If successful *
* returns TRUE, otherwise FALSE. *
* *
* Args: section - section name of option *
* name - name of option *
* value - value to set to *
* Return: success indicator *
\********************************************************************/
gboolean
gnc_set_option(const char *section, const char *name, SCM value)
{
return gnc_option_db_set_option(global_options, section, name, value);
}
/********************************************************************\
* gnc_set_number_option *
* sets the number option to the given value. If successful *
* returns TRUE, otherwise FALSE. *
* *
* Args: section - section name of option *
* name - name of option *
* value - value to set to *
* Return: success indicator *
\********************************************************************/
gboolean
gnc_set_number_option(const char *section, const char *name, gdouble value)
{
return gnc_option_db_set_number_option(global_options, section, name, value);
}
/********************************************************************\
* gnc_set_boolean_option *
* sets the boolean option to the given value. If successful *
* returns TRUE, otherwise FALSE. *
* *
* Args: section - section name of option *
* name - name of option *
* value - value to set to *
* Return: success indicator *
\********************************************************************/
gboolean
gnc_set_boolean_option(const char *section, const char *name, gboolean value)
{
return gnc_option_db_set_boolean_option(global_options, section, name, value);
}
/********************************************************************\
* _gnc_option_refresh_ui *
* sets the GUI representation of an option with its *
* current guile value. Designed to be called from guile *
* *
* Args: option - SCM handle to option *
* Return: nothing *
\********************************************************************/
void
_gnc_option_refresh_ui(SCM guile_option)
{
GNCOption *option;
option = gnc_option_db_get_option_by_SCM(global_options, guile_option);
gnc_option_set_ui_value(option, FALSE);
}
/********************************************************************\
* gnc_option_refresh_ui_by_name *
* sets the GUI representation of an option with its current *
* current guile value. Designed to be called from GUI *
* *
* Args: section_name: name of option's section *
* name : name of option *
* Return: nothing *
\********************************************************************/
void
gnc_option_refresh_ui_by_name(const char *section_name, const char *name)
{
GNCOption *option;
option = gnc_option_db_get_option_by_name(global_options, section_name,
name);
gnc_option_set_ui_value(option, FALSE);
}
/********************************************************************\
* gnc_set_option_selectable_by_name *
* sets the the sensitivity of a global option widget *
* *
* Args: section_name: name of option's section *
* name : name of option *
* Return: nothing *
\********************************************************************/
void
gnc_set_option_selectable_by_name(const char *section_name,
const char *name,
gboolean selectable)
{
GNCOption *option;
option = gnc_option_db_get_option_by_name(global_options, section_name,
name);
if (option)
gnc_set_option_selectable (option, selectable);
}
/********************************************************************\
* gnc_get_global_options *
* returns the global options database. Should only be called *
* be the options gui builder, nothing else *
* *
* Args: none *
* Return: global options database *
\********************************************************************/
GNCOptionDB *
gnc_get_global_options(void)
{
return global_options;
}

View File

@@ -0,0 +1,104 @@
/********************************************************************\
* global-options.h -- GNOME global option handling *
* Copyright (C) 1998,1999 Linas Vepstas *
* *
* 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 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/
#ifndef GLOBAL_OPTIONS_H
#define GLOBAL_OPTIONS_H
#include "config.h"
#include <glib.h>
#include "gnc-common.h"
#include "option-util.h"
void gnc_options_init(void);
void gnc_options_shutdown(void);
SCM gnc_register_option_change_callback(OptionChangeCallback callback,
void *user_data,
char *section,
char *name);
void gnc_unregister_option_change_callback_id(SCM callback_id);
GNCOption * gnc_get_option_by_name(const char *section_name, const char *name);
GNCOption * gnc_get_option_by_SCM(SCM guile_option);
SCM gnc_lookup_option(const char *section, const char *name,
SCM default_value);
gboolean gnc_lookup_boolean_option(const char *section, const char *name,
gboolean default_value);
char * gnc_lookup_string_option(const char *section, const char *name,
const char *default_value);
char * gnc_lookup_font_option(const char *section, const char *name,
const char *default_value);
char * gnc_lookup_multichoice_option(const char *section, const char *name,
const char *default_value);
gdouble gnc_lookup_number_option(const char *section, const char *name,
gdouble default_value);
gboolean gnc_lookup_color_option(const char *section, const char *name,
gdouble *red, gdouble *green,
gdouble *blue, gdouble *alpha);
guint32 gnc_lookup_color_option_argb(const char *section, const char *name,
guint32 default_value);
GSList * gnc_lookup_list_option(const char *section, const char *name,
GSList *default_value);
gnc_commodity *
gnc_lookup_currency_option(const char *section,
const char *name,
gnc_commodity *default_value);
gnc_commodity * gnc_default_currency (void);
void gnc_set_option_default(const char *section, const char *name);
gboolean gnc_set_option(const char *section, const char *name, SCM value);
gboolean gnc_set_number_option(const char *section, const char *name,
gdouble value);
gboolean gnc_set_boolean_option(const char *section, const char *name,
gboolean value);
void gnc_option_refresh_ui_by_name(const char *section_name,
const char *name);
void gnc_set_option_selectable_by_name(const char *section,
const char *name,
gboolean selectable);
/* private */
void _gnc_option_refresh_ui(SCM option);
GNCOptionDB * gnc_get_global_options(void);
#endif /* GLOBAL_OPTIONS_H */

View File

@@ -21,7 +21,6 @@
#include <stdio.h>
#include "FileDialog.h"
#include "Group.h"
#include "gnc-component-manager.h"
#include "gnc-engine-util.h"

View File

@@ -0,0 +1,10 @@
#include <string.h>
#include <messages.h>
char *
gnc_gettext_helper(const char *string)
{
return strdup(_(string));
}

View File

@@ -0,0 +1,3 @@
char * gnc_gettext_helper(const char * str);

106
src/app-utils/gnc-helpers.c Normal file
View File

@@ -0,0 +1,106 @@
/********************************************************************\
* gnc-helpers.c -- gnucash g-wrap helper functions *
* Copyright (C) 2000 Linas Vepstas *
* *
* 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 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
* *
\********************************************************************/
#include "config.h"
#include "gnc-ui-util.h"
#include "engine-helpers.h"
#include <guile/gh.h>
#include <string.h>
/* Type converters for GNCPrintAmountInfo */
SCM
gnc_printinfo2scm(GNCPrintAmountInfo info)
{
SCM info_scm = SCM_EOL;
info_scm = gh_cons (gh_bool2scm (info.monetary), info_scm);
info_scm = gh_cons (gh_bool2scm (info.use_locale), info_scm);
info_scm = gh_cons (gh_bool2scm (info.use_symbol), info_scm);
info_scm = gh_cons (gh_bool2scm (info.use_separators), info_scm);
info_scm = gh_cons (gh_int2scm (info.min_decimal_places), info_scm);
info_scm = gh_cons (gh_int2scm (info.max_decimal_places), info_scm);
info_scm = gh_cons (gnc_commodity_to_scm (info.commodity), info_scm);
info_scm = gh_cons (gh_symbol2scm ("print-info"), info_scm);
return info_scm;
}
GNCPrintAmountInfo
gnc_scm2printinfo(SCM info_scm)
{
GNCPrintAmountInfo info;
/* skip type */
info_scm = gh_cdr (info_scm);
info.commodity = gnc_scm_to_commodity (gh_car (info_scm));
info_scm = gh_cdr (info_scm);
info.max_decimal_places = gh_scm2int (gh_car (info_scm));
info_scm = gh_cdr (info_scm);
info.min_decimal_places = gh_scm2int (gh_car (info_scm));
info_scm = gh_cdr (info_scm);
info.use_separators = gh_scm2bool (gh_car (info_scm));
info_scm = gh_cdr (info_scm);
info.use_symbol = gh_scm2bool (gh_car (info_scm));
info_scm = gh_cdr (info_scm);
info.use_locale = gh_scm2bool (gh_car (info_scm));
info_scm = gh_cdr (info_scm);
info.monetary = gh_scm2bool (gh_car (info_scm));
return info;
}
int
gnc_printinfo_p(SCM info_scm)
{
char *symbol;
int retval;
if (!gh_list_p(info_scm) || gh_null_p(info_scm))
return 0;
info_scm = gh_car (info_scm);
if (!gh_symbol_p (info_scm))
return 0;
symbol = gh_symbol2newstr (info_scm, NULL);
if (symbol == NULL)
return 0;
retval = strcmp (symbol, "print-info") == 0;
free (symbol);
return retval;
}

View File

@@ -0,0 +1,34 @@
/********************************************************************\
* gnc-helpers.h -- gnucash g-wrap helper functions *
* Copyright (C) 2000 Linas Vepstas *
* *
* 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 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
* *
\********************************************************************/
#ifndef __GNC_HELPERS__
#define __GNC_HELPERS__
#include "gnc-ui-util.h"
#include <guile/gh.h>
SCM gnc_printinfo2scm(GNCPrintAmountInfo info);
GNCPrintAmountInfo gnc_scm2printinfo(SCM info_scm);
int gnc_printinfo_p(SCM info_scm);
#endif

View File

@@ -37,7 +37,6 @@
#include "FileDialog.h"
#include "Group.h"
#include "global-options.h"
#include "gnc-ui.h"
#include "gnc-ui-util.h"
#include "gnc-common.h"
#include "gnc-component-manager.h"

View File

@@ -0,0 +1,62 @@
/*********************************************************************
* gncmod-app-utils.c
* module definition/initialization for the report infrastructure
*
* Copyright (c) 2001 Linux Developers Group, Inc.
*********************************************************************/
#include <stdio.h>
#include <guile/gh.h>
#include <glib.h>
#include <libguile/strports.h>
#include <libguile/modules.h>
#include "gnc-module.h"
/* version of the gnc module system interface we require */
int gnc_module_system_interface = 0;
/* module versioning uses libtool semantics. */
int gnc_module_current = 0;
int gnc_module_revision = 0;
int gnc_module_age = 0;
char *
gnc_module_path(void) {
return g_strdup("gnucash/app-utils");
}
char *
gnc_module_description(void) {
return g_strdup("Utilities for building gnc applications");
}
static void
lmod(char * mn)
{
char * form = g_strdup_printf("(use-modules %s)\n", mn);
gh_eval_str(form);
g_free(form);
}
int
gnc_module_init(int refcount) {
/* load the engine (we depend on it) */
if(!gnc_module_load("gnucash/engine", 0)) {
return FALSE;
}
/* publish g-wrapped bindings */
/* load the scheme code */
lmod("(g-wrapped gw-app-utils)");
lmod("(gnucash app-utils)");
return TRUE;
}
void
gnc_module_finish(int refcount) {
}

1133
src/app-utils/guile-util.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,94 @@
/********************************************************************\
* guile-util.h -- utility functions for using guile for GnuCash *
* Copyright (C) 1999 Linas Vepstas *
* *
* 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 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
* *
\********************************************************************/
#ifndef GUILE_UTIL_H
#define GUILE_UTIL_H
#include <glib.h>
#include <guile/gh.h>
#include "date.h"
#include "gnc-book.h"
#include "gnc-numeric.h"
#include "Group.h"
/* Helpful functions for calling functions that return
* specific kinds of values. These functions do error
* checking to verify the result is of the correct type. */
char * gnc_guile_call1_to_string(SCM func, SCM arg);
char * gnc_guile_call1_symbol_to_string(SCM func, SCM arg);
SCM gnc_guile_call1_to_procedure(SCM func, SCM arg);
SCM gnc_guile_call1_to_list(SCM func, SCM arg);
SCM gnc_guile_list_ref(SCM list, int index);
SCM gnc_guile_call1_to_vector(SCM func, SCM arg);
/* Accessing the gnucash/guile dependency mechanism */
gboolean gnc_depend(const char *scm_file);
/* The next set of functions is for manipulating scheme
* representations of splits and transactions. */
gboolean gnc_is_split_scm(SCM scm);
gboolean gnc_is_trans_scm(SCM scm);
SCM gnc_copy_split(Split *split, gboolean use_cut_semantics);
void gnc_copy_split_scm_onto_split(SCM split_scm, Split *split);
void gnc_split_scm_set_account(SCM split_scm, Account *account);
void gnc_split_scm_set_memo(SCM split_scm, const char *memo);
void gnc_split_scm_set_action(SCM split_scm, const char *action);
void gnc_split_scm_set_reconcile_state(SCM split_scm, char reconcile_state);
void gnc_split_scm_set_amount(SCM split_scm, gnc_numeric amount);
void gnc_split_scm_set_value(SCM split_scm, gnc_numeric value);
char * gnc_split_scm_get_memo(SCM split_scm);
char * gnc_split_scm_get_action(SCM split_scm);
gnc_numeric gnc_split_scm_get_amount(SCM split_scm);
gnc_numeric gnc_split_scm_get_value(SCM split_scm);
SCM gnc_copy_trans(Transaction *trans, gboolean use_cut_semantics);
void gnc_copy_trans_scm_onto_trans(SCM trans_scm, Transaction *trans,
gboolean do_commit);
void gnc_copy_trans_scm_onto_trans_swap_accounts(SCM trans_scm,
Transaction *trans,
const GUID *guid_1,
const GUID *guid_2,
gboolean do_commit);
void gnc_trans_scm_set_date(SCM trans_scm, Timespec *ts);
void gnc_trans_scm_set_num(SCM trans_scm, const char *num);
void gnc_trans_scm_set_description(SCM trans_scm, const char *description);
void gnc_trans_scm_set_notes(SCM trans_scm, const char *notes);
void gnc_trans_scm_append_split_scm(SCM trans_scm, SCM split_scm);
SCM gnc_trans_scm_get_split_scm(SCM trans_scm, int index);
SCM gnc_trans_scm_get_other_split_scm(SCM trans_scm, SCM split_scm);
int gnc_trans_scm_get_num_splits(SCM trans_scm);
/* Two functions that return string synonyms for the terms 'debit' and
* 'credit' as appropriate for the given account type and user preferences.
* They should be g_freed when no longer needed. */
char * gnc_get_debit_string(GNCAccountType account_type);
char * gnc_get_credit_string(GNCAccountType account_type);
#endif

View File

@@ -0,0 +1,240 @@
(define-module (g-wrapped gw-app-utils-spec))
(use-modules (g-wrap))
(use-modules (g-wrapped gw-engine-spec))
(debug-set! maxdepth 100000)
(debug-set! stack 2000000)
(let ((mod (gw:new-module "gw-app-utils")))
(define (standard-c-call-gen result func-call-code)
(list (gw:result-get-c-name result) " = " func-call-code ";\n"))
(define (add-standard-result-handlers! type c->scm-converter)
(define (standard-pre-handler result)
(let* ((ret-type-name (gw:result-get-proper-c-type-name result))
(ret-var-name (gw:result-get-c-name result)))
(list "{\n"
" " ret-type-name " " ret-var-name ";\n")))
(gw:type-set-pre-call-result-ccodegen! type standard-pre-handler)
(gw:type-set-post-call-result-ccodegen!
type
(lambda (result)
(let* ((scm-name (gw:result-get-scm-name result))
(c-name (gw:result-get-c-name result)))
(list
(c->scm-converter scm-name c-name)
" }\n")))))
(gw:module-depends-on mod "gw-runtime")
(gw:module-depends-on mod "gw-engine")
(gw:module-set-guile-module! mod '(g-wrapped gw-app-utils))
(gw:module-set-declarations-ccodegen!
mod
(lambda (client-only?)
(list
"#include <global-options.h>\n"
"#include <option-util.h>\n"
"#include <gnc-ui-util.h>\n"
"#include <gnc-gettext-util.h>\n"
"#include <gnc-helpers.h>\n"
"#include <gnc-component-manager.h>\n"
)))
(let ((wt (gw:wrap-type
mod
'<gnc:print-amount-info-scm>
"GNCPrintAmountInfo" "const GNCPrintAmountInfo")))
(gw:type-set-scm-arg-type-test-ccodegen!
wt
(lambda (param)
(let ((old-func
(lambda (x) (list "gnc_printinfo_p(" x ")"))))
(old-func (gw:param-get-scm-name param)))))
(gw:type-set-pre-call-arg-ccodegen!
wt
(lambda (param)
(let* ((scm-name (gw:param-get-scm-name param))
(c-name (gw:param-get-c-name param))
(old-func
(lambda (x) (list "gnc_scm2printinfo(" x ")"))))
(list c-name
" = "
(old-func scm-name)
";\n"))))
(gw:type-set-call-ccodegen! wt standard-c-call-gen)
(add-standard-result-handlers!
wt
(lambda (scm-name c-name)
(let ((old-func
(lambda (x) (list "gnc_printinfo2scm(" x ")"))))
(list scm-name
" = "
(old-func c-name)
";\n")))))
(gw:wrap-non-native-type
mod '<gnc:OptionChangeCallback>
"OptionChangeCallback" "const OptionChangeCallback")
(gw:wrap-function
mod
'gnc:gettext-helper
'(<gw:m-chars-caller-owned> gw:const)
"gnc_gettext_helper"
'(((<gw:m-chars-caller-owned> gw:const) string))
"Returns the translated version of string")
(gw:wrap-function
mod
'gnc:c-options-init
'<gw:void>
"gnc_options_init"
'()
"Initialize the C side options code.")
(gw:wrap-function
mod
'gnc:c-options-shutdown
'<gw:void>
"gnc_options_shutdown"
'()
"Shutdown the C side options code.")
(gw:wrap-function
mod
'gnc:amount->string-helper
'(<gw:m-chars-callee-owned> gw: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
mod
'gnc:option-refresh-ui
'<gw:void>
"_gnc_option_refresh_ui"
'((<gw:scm> option))
"Refresh the gui option with the current values.")
(gw:wrap-function
mod
'gnc:option-invoke-callback
'<gw:void>
"_gnc_option_invoke_callback"
'((<gnc:OptionChangeCallback> callback) (<gw:void*> data))
"Invoke the c option callback on the given data.")
(gw:wrap-function
mod
'gnc:option-db-register-option
'<gw:void>
"_gnc_option_db_register_option"
'((<gw:int> db_handle) (<gw:scm> option))
"Register the option with the option database db_handle.")
(gw:wrap-function
mod
'gnc:locale-decimal-places
'<gw:int>
"gnc_locale_decimal_places"
'()
"Return the number of decimal places for this locale.")
(gw:wrap-function
mod
'gnc:locale-default-currency
'(<gnc:commodity*> gw:const)
"gnc_locale_default_currency"
'()
"Return the default currency for the current locale.")
(gw:wrap-function
mod
'gnc:suspend-gui-refresh
'<gw:void>
"gnc_suspend_gui_refresh"
'()
"Suspend gui refresh events.")
(gw:wrap-function
mod
'gnc:resume-gui-refresh
'<gw:void>
"gnc_resume_gui_refresh"
'()
"Resume gui refresh events.")
(gw:wrap-function
mod
'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
mod
'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
mod
'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
mod
'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
mod
'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
mod
'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
mod
'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
mod
'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"))

View File

@@ -21,8 +21,6 @@
;;;; This is not functional yet, but it should be close...
(gnc:support "hooks.scm")
;;; Private
;; Central repository for all hooks -- so we can look them up later by name.

2307
src/app-utils/option-util.c Normal file

File diff suppressed because it is too large Load Diff

242
src/app-utils/option-util.h Normal file
View File

@@ -0,0 +1,242 @@
/********************************************************************\
* option-util.h -- GNOME<->guile option interface *
* Copyright (C) 1998,1999 Linas Vepstas *
* Copyright (C) 2000 Dave Peticolas *
* *
* 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 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/
#ifndef OPTION_UTIL_H
#define OPTION_UTIL_H
#include "config.h"
#include <guile/gh.h>
#include <glib.h>
#include "gnc-common.h"
#include "gnc-commodity.h"
#include "date.h"
typedef struct _GNCOption GNCOption;
struct _GNCOption
{
/* Handle to the scheme-side option */
SCM guile_option;
/* Flag to indicate change by the UI */
gboolean changed;
/* The widget which is holding this option */
void * widget;
};
typedef struct _GNCOptionSection GNCOptionSection;
typedef struct _GNCOptionDB GNCOptionDB;
typedef int GNCOptionDBHandle;
typedef void (*OptionChangeCallback)(gpointer user_data);
/***** Prototypes ********************************************************/
GNCOptionDB * gnc_option_db_new(SCM guile_options);
void gnc_option_db_destroy(GNCOptionDB *odb);
SCM gnc_option_db_register_change_callback(GNCOptionDB *odb,
OptionChangeCallback callback,
void *data,
const char *section,
const char *name);
void gnc_option_db_unregister_change_callback_id(GNCOptionDB *odb,
SCM callback_id);
char * gnc_option_section(GNCOption *option);
char * gnc_option_name(GNCOption *option);
char * gnc_option_type(GNCOption *option);
char * gnc_option_sort_tag(GNCOption *option);
char * gnc_option_documentation(GNCOption *option);
SCM gnc_option_getter(GNCOption *option);
SCM gnc_option_setter(GNCOption *option);
SCM gnc_option_default_getter(GNCOption *option);
SCM gnc_option_value_validator(GNCOption *option);
SCM gnc_option_widget_changed_proc_getter(GNCOption *option);
int gnc_option_num_permissible_values(GNCOption *option);
int gnc_option_permissible_value_index(GNCOption *option, SCM value);
SCM gnc_option_permissible_value(GNCOption *option, int index);
char * gnc_option_permissible_value_name(GNCOption *option, int index);
char * gnc_option_permissible_value_description(GNCOption *option, int index);
gboolean gnc_option_show_time(GNCOption *option);
gboolean gnc_option_multiple_selection(GNCOption *option);
gboolean gnc_option_get_range_info(GNCOption *option,
double *lower_bound,
double *upper_bound,
int *num_decimals,
double *step_size);
gdouble gnc_option_color_range(GNCOption *option);
gdouble gnc_option_use_alpha(GNCOption *option);
guint32 gnc_option_get_color_argb(GNCOption *option);
gboolean gnc_option_get_color_info(GNCOption *option,
gboolean use_default,
gdouble *red,
gdouble *green,
gdouble *blue,
gdouble *alpha);
void gnc_option_call_option_widget_changed_proc (GNCOption *option);
void gnc_option_set_default(GNCOption *option);
guint gnc_option_db_num_sections(GNCOptionDB *odb);
const char * gnc_option_section_name(GNCOptionSection *section);
guint gnc_option_section_num_options(GNCOptionSection *section);
GNCOptionSection * gnc_option_db_get_section(GNCOptionDB *odb, gint i);
GNCOption * gnc_get_option_section_option(GNCOptionSection *section, int i);
GNCOption * gnc_option_db_get_option_by_name(GNCOptionDB *odb,
const char *section_name,
const char *name);
GNCOption * gnc_option_db_get_option_by_SCM(GNCOptionDB *odb,
SCM guile_option);
gboolean gnc_option_db_dirty(GNCOptionDB *odb);
void gnc_option_db_clean(GNCOptionDB *odb);
void gnc_option_db_commit(GNCOptionDB *odb);
char * gnc_option_db_get_default_section(GNCOptionDB *odb);
SCM gnc_option_db_lookup_option(GNCOptionDB *odb,
const char *section,
const char *name,
SCM default_value);
gboolean gnc_option_db_lookup_boolean_option(GNCOptionDB *odb,
const char *section,
const char *name,
gboolean default_value);
char * gnc_option_db_lookup_string_option(GNCOptionDB *odb,
const char *section,
const char *name,
const char *default_value);
char * gnc_option_db_lookup_font_option(GNCOptionDB *odb,
const char *section,
const char *name,
const char *default_value);
char * gnc_option_db_lookup_multichoice_option(GNCOptionDB *odb,
const char *section,
const char *name,
const char *default_value);
time_t gnc_option_db_lookup_date_option(GNCOptionDB *odb,
const char *section,
const char *name,
gboolean *is_relative,
Timespec *set_ab_value,
char **set_rel_value,
Timespec *default_value);
gdouble gnc_option_db_lookup_number_option(GNCOptionDB *odb,
const char *section,
const char *name,
gdouble default_value);
gboolean gnc_option_db_lookup_color_option(GNCOptionDB *odb,
const char *section,
const char *name,
gdouble *red,
gdouble *green,
gdouble *blue,
gdouble *alpha);
guint32 gnc_option_db_lookup_color_option_argb(GNCOptionDB *odb,
const char *section,
const char *name,
guint32 default_value);
GSList * gnc_option_db_lookup_list_option(GNCOptionDB *odb,
const char *section,
const char *name,
GSList *default_value);
void gnc_free_list_option_value(GSList *list);
gnc_commodity *
gnc_option_db_lookup_currency_option(GNCOptionDB *odb,
const char *section,
const char *name,
gnc_commodity *default_value);
void gnc_option_db_set_option_default(GNCOptionDB *odb,
const char *section,
const char *name);
gboolean gnc_option_db_set_option(GNCOptionDB *odb,
const char *section,
const char *name,
SCM value);
gboolean gnc_option_db_set_number_option(GNCOptionDB *odb,
const char *section,
const char *name,
gdouble value);
gboolean gnc_option_db_set_boolean_option(GNCOptionDB *odb,
const char *section,
const char *name,
gboolean value);
char * gnc_option_date_option_get_subtype(GNCOption *option);
char * gnc_date_option_value_get_type (SCM option_value);
Timespec gnc_date_option_value_get_absolute (SCM option_value);
SCM gnc_date_option_value_get_relative (SCM option_value);
void gnc_option_db_set_option_selectable_by_name(SCM guile_options,
const char *section,
const char *name,
gboolean selectable);
/* private */
void _gnc_option_db_register_option(GNCOptionDBHandle handle,
SCM guile_option);
void _gnc_option_invoke_callback(OptionChangeCallback callback, void *data);
/* These must be defined in gui-specific code */
SCM gnc_option_get_ui_value(GNCOption *option);
void gnc_option_set_ui_value(GNCOption *option, gboolean use_default);
void gnc_set_option_selectable (GNCOption *option, gboolean selectable);
#endif /* OPTION_UTIL_H */

View File

@@ -0,0 +1,17 @@
TESTS=test-link-module test-load-module
TESTS_ENVIRONMENT= \
GNC_MODULE_PATH=../../engine:../../gnc-module:.. \
GUILE_LOAD_PATH=${G_WRAP_MODULE_DIR}:../../engine:..:../../gnc-module:${top_srcdir}/lib \
LTDL_LIBRARY_PATH=.. \
LD_LIBRARY_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/src/gnc-module/.libs:${top_srcdir}/src/engine:${top_srcdir}/src/engine/.libs
LDADD = \
../../engine/libgncmod-engine.la \
../../gnc-module/libgncmodule.la
bin_PROGRAMS=test-link-module
test-link-module: test-link-module.c

View File

@@ -0,0 +1,6 @@
#include <stdlib.h>
int
main(int argc, char ** argv) {
exit(0);
}

View File

@@ -0,0 +1,18 @@
#! /bin/bash
exec guile -s "$0"
!#
(use-modules (gnucash gnc-module))
(gnc:module-system-init)
(if (gnc:module-load "gnucash/app-utils" 0)
(begin
(if (and (procedure? gnc:error->string)
(procedure? gnc:c-options-init)
(macro? N_)
(string=? (N_ "foobar") "foobar"))
(exit 0)
(exit -1)))
(exit -1))

View File

@@ -3,7 +3,5 @@ TESTS=test-load-module
TESTS_ENVIRONMENT=\
GNC_MODULE_PATH=${top_srcdir}/src/engine:${top_srcdir}/src/backend/postgres \
GUILE_LOAD_PATH=${G_WRAP_MODULE_DIR}:..:${top_srcdir}/src/gnc-module \
LTDL_LIBRARY_PATH=${top_srcdir}/src/gnc-module
LTDL_LIBRARY_PATH=${top_srcdir}/src/gnc-module \
LD_LIBRARY_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/src/gnc-module\.libs:${top_srcdir}/src/engine:${top_srcdir}/src/engine/.libs

View File

@@ -84,7 +84,7 @@ gncmod_DATA=engine.scm
gncscmdir=${GNC_SHAREDIR}/scm
gncscm_DATA=commodity-table.scm engine-init.scm engine-interface.scm \
engine-utilities.scm gnc-numeric.scm iso-4217-currencies.scm
engine-utilities.scm gnc-numeric.scm iso-4217-currencies.scm
gwmoddir=${GNC_SHAREDIR}/guile-modules/g-wrapped
gwmod_LTLIBRARIES=libgw-glib.la libgw-engine.la

View File

@@ -76,12 +76,6 @@ gnc_transaction_set_date(Transaction *t, Timespec ts)
xaccTransSetDatePostedTS(t, &ts);
}
char *
gnc_gettext_helper(const char *string)
{
return strdup(_(string));
}
SCM
gnc_timespec2timepair(Timespec t)
{

View File

@@ -44,9 +44,6 @@ void gnc_transaction_set_date_entered(Transaction *t, const Timespec d);
void gnc_transaction_set_date(Transaction *t, Timespec ts);
char * gnc_gettext_helper(const char *string);
/* Helpers for various types */
SCM gnc_timespec2timepair(Timespec t);

View File

@@ -1,11 +1,6 @@
(define-module (gnucash engine))
(use-modules (g-wrapped gw-engine))
(load-from-path "gnc-numeric.scm")
(load-from-path "commodity-table.scm")
(load-from-path "engine-interface.scm")
(load-from-path "engine-utilities.scm")
(export GNC-RND-FLOOR)
(export GNC-RND-CEIL)
(export GNC-RND-TRUNC)
@@ -103,3 +98,7 @@
(export trans-splits)
(export gnc:transaction-scm-onto-transaction)
(load-from-path "gnc-numeric.scm")
(load-from-path "commodity-table.scm")
(load-from-path "engine-interface.scm")
(load-from-path "engine-utilities.scm")

View File

@@ -254,7 +254,6 @@
"#include <Backend.h>\n"
"#include <gnc-book.h>\n"
"#include <gnc-engine-util.h>\n"
"#include <gnc-ui-util.h>\n"
"#include <date.h>\n"
"#include <engine-helpers.h>\n"
"#include <gnc-engine.h>\n"
@@ -2320,11 +2319,22 @@ of having a parent transaction with which one is working...")
'((<gnc:numeric> arg))
"Convert gnc_numeric to a printable string")
(gw:wrap-function
mod
'gnc:run-rpc-server
'<gw:void>
"gnc_run_rpc_server"
'()
"Run the RPC Server"))
"Run the RPC Server")
;; src/engine/date.h
(gw:wrap-function
mod
'gnc:timepair-canonical-day-time
'<gnc:time-pair>
"timespecCanonicalDayTime" '((<gnc:time-pair> tp))
"Convert a timepair on a certain day (localtime) to\
the timepair representing midday on that day"))

View File

@@ -138,6 +138,7 @@ INCLUDES = \
-I${top_srcdir}/src \
-I${top_srcdir}/src/calculation \
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/app-utils \
-I${top_srcdir}/src/backend/file \
-I${top_srcdir}/src/g-wrap \
-I${top_srcdir}/src/guile \

View File

@@ -43,6 +43,7 @@
#include "gnc-ui.h"
#include "messages.h"
#include "query-user.h"
#include "top-level.h"
#include "window-help.h"
#include "window-main.h"

View File

@@ -39,7 +39,7 @@
#include "gnc-dir.h"
#include "io-example-account.h"
#include "query-user.h"
#include "top-level.h"
static GtkWidget *hierarchy_window = NULL;
static AccountGroup *our_final_group = NULL;

View File

@@ -40,5 +40,8 @@ void gnc_ui_destroy(void);
int gnc_ui_show_main_window(void);
int gnc_ui_start_event_loop(void);
int gnc_ui_main(void);
const char * gnc_register_default_font(void);
const char * gnc_register_default_hint_font(void);
gboolean gnc_reverse_balance_type(GNCAccountType type);
gboolean gnc_reverse_balance(Account *account);
#endif

View File

@@ -56,7 +56,7 @@
#include "window-help.h"
#include "window-reconcile.h"
#include "window-register.h"
#include "top-level.h"
#define WINDOW_RECONCILE_CM_CLASS "window-reconcile"

View File

@@ -56,6 +56,7 @@
#include "window-help.h"
#include "window-reconcile.h"
#include "window-register.h"
#include "top-level.h"
typedef struct _RegDateWindow RegDateWindow;

View File

@@ -32,6 +32,7 @@ INCLUDES = \
-I${top_srcdir}/src \
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/app-utils \
-I${top_srcdir}/src/guile \
-I${top_srcdir}/src/gnome \
${GLIB_CFLAGS} \

View File

@@ -6,9 +6,6 @@
;;; $Id$
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gnc:depend "utilities.scm")
(gnc:depend "report-utilities.scm")
(define-module (gnucash import-export qif-import))
(use-modules (g-wrapped gw-runtime))
(use-modules (gnucash gnc-module))

View File

@@ -5,7 +5,7 @@ CFLAGS=@CFLAGS@ ${GLIB_CFLAGS}
INCLUDES = -I${top_srcdir}/src/gnc-module ${GUILE_INCS}
libgncmod_qifiocore_la_SOURCES=gnc-qifiocore.c
libgncmod_qifiocore_la_SOURCES=gncmod-qifiocore.c
libgncmod_qifiocore_la_LDFLAGS=-module
noinst_DATA=.scm-links

View File

@@ -6,5 +6,7 @@ TESTS=test-load-module test-parser test-reader test-file-formats \
test-import-phase-1
TESTS_ENVIRONMENT = \
GNC_MODULE_PATH="${top_srcdir}/src/modules/qif-io-core:${top_srcdir}/src/modules/engine" GUILE_LOAD_PATH="../:../../engine/:../../../gnc-module/:${G_WRAP_MODULE_DIR}"
GNC_MODULE_PATH="${top_srcdir}/src/modules/qif-io-core:${top_srcdir}/src/modules/engine" \
GUILE_LOAD_PATH="../:../../engine/:../../../gnc-module/:${G_WRAP_MODULE_DIR}" \
LD_LIBRARY_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/src/gnc-module/.libs:${top_srcdir}/src/engine:${top_srcdir}/src/engine/.libs:${top_srcdir}/src/app-utils:${top_srcdir}/src/app-utils/.libs

View File

@@ -3,5 +3,10 @@
(gnc:module-system-init)
(define (run-test)
(gnc:module-load "gnucash/qif-io/core" 0))
(if (gnc:module-load "gnucash/qif-io/core" 0)
(begin
(display "ok\n")
(exit 0))
(begin
(display "failed\n")
(exit -1))))

View File

@@ -23,6 +23,7 @@ INCLUDES= \
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/guile \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/app-utils \
-I${top_srcdir}/src/register/register-core \
${GNOME_INCLUDEDIR} \
${GLIB_CFLAGS}

View File

@@ -47,6 +47,7 @@ CFLAGS = @CFLAGS@
INCLUDES = \
-I${top_srcdir}/src \
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/app-utils \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/guile \
${GLIB_CFLAGS} \

View File

@@ -42,6 +42,7 @@ INCLUDES = \
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/guile \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/app-utils \
-I${top_srcdir}/src/register/ledger-core \
-I${top_srcdir}/src/register/register-core \
${GLIB_CFLAGS} \

7
src/report/Makefile.am Normal file
View File

@@ -0,0 +1,7 @@
SUBDIRS=\
report-system \
standard-reports \
utility-reports \
locale-specific \
stylesheets

View File

@@ -0,0 +1 @@
SUBDIRS=us

View File

@@ -0,0 +1,30 @@
SUBDIRS=. test
pkglib_LTLIBRARIES=libgncmod-locale-reports-us.la
libgncmod_locale_reports_us_la_SOURCES=\
gncmod-locale-reports-us.c
libgncmod_locale_reports_us_la_LDFLAGS=-module
INCLUDES=-I${top_srcdir}/src/gnc-module ${GLIB_CFLAGS}
.scm-links:
rm -f gnucash report locale-specific us
ln -sf . gnucash
ln -sf . report
ln -sf . locale-specific
ln -sf . us
touch .scm-links
noinst_DATA = .scm-links
gncscmmoddir=${GNC_SHAREDIR}/guile-modules/gnucash/report/locale-specific
gncscmmod_DATA = \
us.scm \
taxtxf.scm
gncscmdir=${GNC_SHAREDIR}/scm
gncscm_DATA = txf-export.scm txf-export-help.scm
CLEANFILES += gnucash report locale-specific us

View File

@@ -0,0 +1,52 @@
/*********************************************************************
* gncmod-locale-reports-us.c
* module definition/initialization for the standard reports
*
* Copyright (c) 2001 Linux Developers Group, Inc.
*********************************************************************/
#include <stdio.h>
#include <guile/gh.h>
#include <glib.h>
#include "gnc-module.h"
/* version of the gnc module system interface we require */
int gnc_module_system_interface = 0;
/* module versioning uses libtool semantics. */
int gnc_module_current = 0;
int gnc_module_revision = 0;
int gnc_module_age = 0;
char *
gnc_module_path(void) {
return g_strdup("gnucash/report/locale-specific/us");
}
char *
gnc_module_description(void) {
return g_strdup("US income tax reports and related material");
}
int
gnc_module_init(int refcount) {
/* load the report system */
if(!gnc_module_load("gnucash/report/report-system", 0)) {
return FALSE;
}
/* load the report generation scheme code */
if(gh_eval_str("(use-modules (gnucash report locale-specific us))")
== SCM_BOOL_F) {
return FALSE;
}
return TRUE;
}
void
gnc_module_finish(int refcount) {
}

View File

@@ -27,13 +27,6 @@
;; subtracts 2! see "(to-value"
;; depends must be outside module scope -- and should eventually go away.
(gnc:depend "text-export.scm")
(gnc:depend "report-utilities.scm")
(gnc:depend "options.scm")
(gnc:depend "date-utilities.scm")
(gnc:depend "report/txf-export.scm")
(gnc:depend "report/txf-export-help.scm")
(define-module (gnucash report taxtxf))
(use-modules (srfi srfi-1))
@@ -41,7 +34,10 @@
(require 'printf)
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/engine" 0)
(gnc:module-load "gnucash/report/report-system" 0)
(load-from-path "txf-export.scm")
(load-from-path "txf-export-help.scm")
(define (make-level-collector num-levels)
(let ((level-collector (make-vector num-levels)))

View File

@@ -0,0 +1,7 @@
TESTS=test-load-module
TESTS_ENVIRONMENT= \
GNC_MODULE_PATH=${top_srcdir}/src/engine:${top_srcdir}/src/report/report-system:${top_srcdir}/src/app-utils:.. \
GUILE_LOAD_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/lib:..:${G_WRAP_MODULE_DIR} \
LD_LIBRARY_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/src/gnc-module/.libs:${top_srcdir}/src/engine:${top_srcdir}/src/engine/.libs:${top_srcdir}/src/app-utils:${top_srcdir}/src/app-utils/.libs

View File

@@ -0,0 +1,16 @@
#! /bin/sh
exec guile -s "$0"
!#
(display " testing US locale-specific report module load ... ")
(use-modules (gnucash gnc-module))
(gnc:module-system-init)
(if (gnc:module-load "gnucash/report/locale-specific/us" 0)
(begin
(display "ok\n")
(exit 0))
(begin
(display "failed\n")
(exit -1)))

View File

@@ -7,7 +7,6 @@
;;
;; (n <- TurboTax (N <- IRS
;;
(gnc:support "report/txf-export-help.scm")
(define txf-help-strings
'(

View File

@@ -4,9 +4,6 @@
;; These are TXF codes and a brief description of each. See taxtxf.scm
;; and txf-export-help.scm
;;
(gnc:support "report/txf-export.scm")
(gnc:depend "report/txf-export-help.scm")
(define (gnc:txf-get-payer-name-source categories code)
(gnc:txf-get-code-info categories code 0))
(define (gnc:txf-get-form categories code)

View File

@@ -0,0 +1,3 @@
(define-module (gnucash report locale-specific us))
(use-modules (gnucash report taxtxf))

View File

@@ -0,0 +1,44 @@
SUBDIRS=. test
pkglib_LTLIBRARIES=libgncmod-report-system.la
libgncmod_report_system_la_SOURCES=gncmod-report-system.c
libgncmod_report_system_la_LDFLAGS=-module
libgncmod_report_system_la_LIBADD = \
-L../../gnc-module -L../../gnc-module/.libs -lgncmodule \
-L../../app-utils -L../../app-utils/.libs -lgncmod-app-utils \
${GLIB_LIBS} ${GUILE_LIBS}
INCLUDES=-I${top_srcdir}/src/gnc-module ${GLIB_CFLAGS}
.scm-links:
rm -f gnucash report
ln -sf . gnucash
ln -sf . report
touch .scm-links
gncscmmoddir=${GNC_SHAREDIR}/guile-modules/gnucash/report/
gncscmmod_DATA=report-system.scm
noinst_DATA=.scm-links
gncscmdir=${GNC_SHAREDIR}/scm
gncscm_DATA=\
commodity-utilities.scm \
html-barchart.scm \
html-document.scm \
html-piechart.scm \
html-scatter.scm \
html-style-info.scm \
html-style-sheet.scm \
html-table.scm \
html-text.scm \
html-utilities.scm \
options-utilities.scm \
report-utilities.scm \
report.scm
CLEANFILES += gnucash report .scm-links

View File

@@ -20,10 +20,6 @@
;; Boston, MA 02111-1307, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gnc:support "commodity-utilities.scm")
(gnc:depend "report-utilities.scm")
(use-modules (srfi srfi-1))
;; Returns true if the commodity comm represents a currency, false if
;; it represents a stock or mutual-fund.

View File

@@ -0,0 +1,66 @@
/*********************************************************************
* gncmod-report-system.c
* module definition/initialization for the report infrastructure
*
* Copyright (c) 2001 Linux Developers Group, Inc.
*********************************************************************/
#include <stdio.h>
#include <guile/gh.h>
#include <glib.h>
#include "gnc-module.h"
/* version of the gnc module system interface we require */
int gnc_module_system_interface = 0;
/* module versioning uses libtool semantics. */
int gnc_module_current = 0;
int gnc_module_revision = 0;
int gnc_module_age = 0;
char *
gnc_module_path(void) {
return g_strdup("gnucash/report/report-system");
}
char *
gnc_module_description(void) {
return g_strdup("Core components of Gnucash report generation system");
}
static void
lmod(char * mn)
{
char * form = g_strdup_printf("(use-modules %s)\n", mn);
gh_eval_str(form);
g_free(form);
}
int
gnc_module_init(int refcount) {
/* load the engine (we depend on it) */
if(!gnc_module_load("gnucash/engine", 0)) {
return FALSE;
}
if(!gnc_module_load("gnucash/app-utils", 0)) {
return FALSE;
}
lmod("(gnucash report report-system)");
/* if this is the first time the module's being loaded, initialize
* the relative date system */
if(refcount == 0) {
gh_eval_str("(gnc:reldate-initialize)");
}
return TRUE;
}
void
gnc_module_finish(int refcount) {
}

View File

@@ -21,9 +21,6 @@
;; Boston, MA 02111-1307, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gnc:support "html-barchart.scm")
(use-modules (ice-9 regex))
(define <html-barchart>
(make-record-type "<html-barchart>"
@@ -203,7 +200,7 @@
rows)
;; append the elements of 'newrow' to the rowumns
(for-each-in-order
(for-each
(lambda (newelt)
;; find the row, or append one
(if (not (null? rows))
@@ -246,7 +243,7 @@
(this-row #f)
(new-row #f)
(rownum 0))
(for-each-in-order
(for-each
(lambda (elt)
(if (not (null? rows))
(begin
@@ -389,7 +386,7 @@
(push "\">\n")))
(push " <param name=\"data\" value=\"")
(let loop ((col 0))
(for-each-in-order
(for-each
(lambda (row)
(push (ensure-numeric (list-ref-safe row col)))
(push " "))

View File

@@ -22,9 +22,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gnc:support "html-document.scm")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; <html-document> class
;; this is the top-level object representing an entire HTML document.
@@ -139,7 +136,7 @@
(push ((gnc:html-markup/no-end "body") doc))))
;; now render the children
(for-each-in-order
(for-each
(lambda (child)
(push (gnc:html-object-render child doc)))
(gnc:html-document-objects doc))

View File

@@ -21,10 +21,6 @@
;; Boston, MA 02111-1307, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gnc:support "html-piechart.scm")
(use-modules (ice-9 regex))
(define <html-piechart>
(make-record-type "<html-piechart>"
'(width height title subtitle data colors labels
@@ -211,7 +207,7 @@
(push " <param name=\"datasize\" value=\"")
(push (length data)) (push "\">\n")
(push " <param name=\"data\" value=\"")
(for-each-in-order
(for-each
(lambda (datum)
(push datum)
(push " "))

View File

@@ -24,8 +24,6 @@
;; Boston, MA 02111-1307, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gnc:support "html-scatter.scm")
(define <html-scatter>
(make-record-type "<html-scatter>"
'(width height title subtitle
@@ -210,13 +208,13 @@
(push " <param name=\"datasize\" value=\"")
(push datasize) (push "\">\n")
(push " <param name=\"x_data\" value=\"")
(for-each-in-order (lambda (x)
(for-each (lambda (x)
(push (ensure-numeric x))
(push " "))
x-data)
(push "\">\n")
(push " <param name=\"y_data\" value=\"")
(for-each-in-order (lambda (x)
(for-each (lambda (x)
(push (ensure-numeric x))
(push " "))
y-data)

View File

@@ -21,7 +21,6 @@
;; Boston, MA 02111-1307, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gnc:support "html-style-info.scm")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; <html-markup-style-info> class

View File

@@ -21,8 +21,6 @@
;; Boston, MA 02111-1307, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gnc:support "html-style-sheet.scm")
(define *gnc:_style-sheet-templates_* (make-hash-table 23))
(define *gnc:_style-sheets_* (make-hash-table 23))

View File

@@ -21,8 +21,6 @@
;; Boston, MA 02111-1307, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gnc:support "html-table.scm")
(define <html-table>
(make-record-type "<html-table>"
'(col-headers

View File

@@ -21,11 +21,6 @@
;; Boston, MA 02111-1307, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'record)
(require 'hash-table)
(gnc:support "html-text.scm")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; <html-text> class
@@ -212,7 +207,7 @@
(gnc:html-style-table-compile (gnc:html-text-style p)
(gnc:html-document-style-stack doc))
(gnc:html-document-push-style doc (gnc:html-text-style p))
(for-each-in-order
(for-each
(lambda (elt)
(cond ((procedure? elt)
(push (elt doc)))
@@ -227,7 +222,7 @@
(let* ((retval '())
(push (lambda (l) (set! retval (cons l retval)))))
(push (gnc:html-document-markup-start doc markup attrib))
(for-each-in-order
(for-each
(lambda (elt)
(cond ((procedure? elt)
(push (elt doc)))

View File

@@ -20,12 +20,6 @@
;; Boston, MA 02111-1307, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gnc:support "html-utilities.scm")
(gnc:depend "report-utilities.scm")
(gnc:depend "html-text.scm")
(gnc:depend "commodity-utilities.scm")
;; returns a list with n #f (empty cell) values
(define (gnc:html-make-empty-cells n)
(if (> n 0)
@@ -693,4 +687,5 @@
(gnc:html-markup-h2 (_ "No data"))
(gnc:html-markup-p
(_ "The selected accounts contain no data/transactions (or only zeroes) for the selected time period")))
p))
p))

View File

@@ -21,9 +21,6 @@
;; Boston, MA 02111-1307, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gnc:support "options-utilities.scm")
(gnc:depend "options.scm")
;; These are just a bunch of options which were useful in several
;; reports and hence they got defined in a seperate function.

View File

@@ -0,0 +1,544 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; report-system.scm
;; module definition for the report system code
;;
;; Copyright (c) 2001 Linux Developers Group, Inc.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-module (gnucash report report-system))
(use-modules (ice-9 slib))
(use-modules (ice-9 regex))
(use-modules (srfi srfi-1))
(use-modules (srfi srfi-19))
(use-modules (gnucash gnc-module))
(require 'hash-table)
(gnc:module-load "gnucash/engine" 0)
(gnc:module-load "gnucash/app-utils" 0)
;; commodity-utilities.scm
(export gnc:commodity-is-currency?)
(export gnc:get-match-commodity-splits)
(export gnc:get-match-commodity-splits-sorted)
(export gnc:get-all-commodity-splits )
(export gnc:commodity-numeric->string)
(export gnc:exchange-by-euro-numeric)
(export gnc:get-commodity-totalavg-prices)
(export gnc:get-commoditylist-totalavg-prices)
(export gnc:get-commodity-inst-prices)
(export gnc:get-commoditylist-inst-prices)
(export gnc:pricelist-price-find-nearest)
(export gnc:pricealist-lookup-nearest-in-time)
(export gnc:resolve-unknown-comm)
(export gnc:get-exchange-totals)
(export gnc:make-exchange-alist)
(export gnc:exchange-by-euro)
(export gnc:exchange-if-same)
(export gnc:make-exchange-function)
(export gnc:exchange-by-pricevalue-helper)
(export gnc:exchange-by-pricedb-helper)
(export gnc:exchange-by-pricedb-latest )
(export gnc:exchange-by-pricedb-nearest)
(export gnc:exchange-by-pricealist-nearest)
(export gnc:case-exchange-fn)
(export gnc:case-exchange-time-fn)
(export gnc:sum-collector-commodity)
(export gnc:sum-collector-stocks)
;; options-utilities.scm
(export gnc:options-add-report-date!)
(export gnc:options-add-date-interval!)
(export gnc:options-add-interval-choice!)
(export gnc:options-add-account-levels!)
(export gnc:options-add-account-selection!)
(export gnc:options-add-include-subaccounts!)
(export gnc:options-add-group-accounts!)
(export gnc:options-add-currency!)
(export gnc:options-add-currency-selection!)
(export gnc:options-add-price-source!)
(export gnc:options-add-plot-size!)
(export gnc:options-add-marker-choice!)
;; html-utilities.scm
(export gnc:html-make-empty-cells)
(export gnc:account-anchor-text)
(export gnc:split-anchor-text)
(export gnc:transaction-anchor-text)
(export gnc:report-anchor-text)
(export gnc:make-report-anchor)
(export gnc:html-account-anchor)
(export gnc:html-split-anchor)
(export gnc:html-transaction-anchor)
(export gnc:assign-colors)
(export gnc:html-table-append-ruler!)
(export gnc:html-table-append-ruler/markup!)
(export gnc:html-acct-table-cell)
(export gnc:html-acct-table-row-helper! )
(export gnc:html-acct-table-comm-row-helper!)
(export gnc:html-build-acct-table )
(export gnc:html-make-exchangerates)
(export gnc:html-make-no-account-warning)
(export gnc:html-make-empty-data-warning)
;; report.scm
(export gnc:menuname-reports)
(export gnc:menuname-asset-liability)
(export gnc:menuname-income-expense )
(export gnc:menuname-taxes)
(export gnc:menuname-utility)
(export gnc:pagename-general)
(export gnc:pagename-accounts)
(export gnc:pagename-display)
(export gnc:optname-reportname)
(export gnc:define-report)
(export <report>)
(export *gnc:_reports_*)
(export gnc:report-type)
(export gnc:report-set-type!)
(export gnc:report-id)
(export gnc:report-set-id!)
(export gnc:report-options)
(export gnc:report-set-options!)
(export gnc:report-needs-save?)
(export gnc:report-set-needs-save?!)
(export gnc:report-dirty?)
(export gnc:report-set-dirty?!)
(export gnc:report-editor-widget)
(export gnc:report-set-editor-widget!)
(export gnc:report-ctext)
(export gnc:report-set-ctext!)
(export gnc:report-edit-options)
(export gnc:make-report)
(export gnc:restore-report)
(export gnc:make-report-options)
(export gnc:report-options-editor)
(export gnc:report-export-thunk)
(export gnc:report-menu-name)
(export gnc:report-name)
(export gnc:report-stylesheet)
(export gnc:report-set-stylesheet!)
(export gnc:all-report-template-names)
(export gnc:report-remove-by-id)
(export gnc:find-report)
(export gnc:report-generate-restore-forms)
(export gnc:backtrace-if-exception)
(export gnc:report-render-html)
(export gnc:report-run)
;; html-barchart.scm
(export <html-barchart>)
(export gnc:html-barchart? )
(export gnc:make-html-barchart-internal)
(export gnc:make-html-barchart)
(export gnc:html-barchart-data)
(export gnc:html-barchart-set-data!)
(export gnc:html-barchart-width)
(export gnc:html-barchart-set-width!)
(export gnc:html-barchart-height)
(export gnc:html-barchart-set-height!)
(export gnc:html-barchart-x-axis-label)
(export gnc:html-barchart-set-x-axis-label!)
(export gnc:html-barchart-y-axis-label)
(export gnc:html-barchart-set-y-axis-label!)
(export gnc:html-barchart-row-labels)
(export gnc:html-barchart-set-row-labels!)
(export gnc:html-barchart-row-labels-rotated?)
(export gnc:html-barchart-set-row-labels-rotated?!)
(export gnc:html-barchart-stacked?)
(export gnc:html-barchart-set-stacked?!)
(export gnc:html-barchart-col-labels)
(export gnc:html-barchart-set-col-labels!)
(export gnc:html-barchart-col-colors)
(export gnc:html-barchart-set-col-colors!)
(export gnc:html-barchart-legend-reversed?)
(export gnc:html-barchart-set-legend-reversed?!)
(export gnc:html-barchart-title)
(export gnc:html-barchart-set-title!)
(export gnc:html-barchart-subtitle)
(export gnc:html-barchart-set-subtitle!)
(export gnc:html-barchart-button-1-bar-urls)
(export gnc:html-barchart-set-button-1-bar-urls!)
(export gnc:html-barchart-button-2-bar-urls)
(export gnc:html-barchart-set-button-2-bar-urls!)
(export gnc:html-barchart-button-3-bar-urls)
(export gnc:html-barchart-set-button-3-bar-urls!)
(export gnc:html-barchart-button-1-legend-urls)
(export gnc:html-barchart-set-button-1-legend-urls!)
(export gnc:html-barchart-button-2-legend-urls)
(export gnc:html-barchart-set-button-2-legend-urls!)
(export gnc:html-barchart-button-3-legend-urls)
(export gnc:html-barchart-set-button-3-legend-urls!)
(export gnc:html-barchart-append-row!)
(export gnc:html-barchart-prepend-row!)
(export gnc:html-barchart-append-column!)
(export gnc:not-all-zeros)
(export gnc:html-barchart-prepend-column!)
(export gnc:html-barchart-render barchart)
;; html-document.scm
(export <html-document>)
(export gnc:html-document?)
(export gnc:make-html-document-internal)
(export gnc:make-html-document)
(export gnc:html-document-set-title!)
(export gnc:html-document-title)
(export gnc:html-document-set-style-sheet!)
(export gnc:html-document-style-sheet)
(export gnc:html-document-set-style-stack!)
(export gnc:html-document-style-stack)
(export gnc:html-document-set-style-internal!)
(export gnc:html-document-style)
(export gnc:html-document-set-objects!)
(export gnc:html-document-objects)
(export gnc:html-document?)
(export gnc:html-document-set-style!)
(export gnc:html-document-tree-collapse)
(export gnc:html-document-render)
(export gnc:html-document-push-style)
(export gnc:html-document-pop-style)
(export gnc:html-document-add-object!)
(export gnc:html-document-append-objects!)
(export gnc:html-document-fetch-markup-style)
(export gnc:html-document-fetch-data-style)
(export gnc:html-document-markup-start)
(export gnc:html-document-markup-end)
(export gnc:html-document-render-data)
(export <html-object>)
(export gnc:html-object?)
(export gnc:make-html-object-internal)
(export gnc:make-html-object)
(export gnc:html-object-renderer)
(export gnc:html-object-set-renderer!)
(export gnc:html-object-data)
(export gnc:html-object-set-data!)
(export gnc:html-object-render)
;; html-piechart.scm
(export <html-piechart>)
(export gnc:html-piechart?)
(export gnc:make-html-piechart-internal)
(export gnc:make-html-piechart)
(export gnc:html-piechart-data)
(export gnc:html-piechart-set-data!)
(export gnc:html-piechart-width)
(export gnc:html-piechart-set-width!)
(export gnc:html-piechart-height)
(export gnc:html-piechart-set-height!)
(export gnc:html-piechart-labels)
(export gnc:html-piechart-set-labels!)
(export gnc:html-piechart-colors)
(export gnc:html-piechart-set-colors!)
(export gnc:html-piechart-title)
(export gnc:html-piechart-set-title!)
(export gnc:html-piechart-subtitle)
(export gnc:html-piechart-set-subtitle!)
(export gnc:html-piechart-button-1-slice-urls)
(export gnc:html-piechart-set-button-1-slice-urls!)
(export gnc:html-piechart-button-2-slice-urls)
(export gnc:html-piechart-set-button-2-slice-urls!)
(export gnc:html-piechart-button-3-slice-urls)
(export gnc:html-piechart-set-button-3-slice-urls!)
(export gnc:html-piechart-button-1-legend-urls)
(export gnc:html-piechart-set-button-1-legend-urls!)
(export gnc:html-piechart-button-2-legend-urls)
(export gnc:html-piechart-set-button-2-legend-urls!)
(export gnc:html-piechart-button-3-legend-urls)
(export gnc:html-piechart-set-button-3-legend-urls!)
(export gnc:html-piechart-render)
;; html-scatter.scm
(export <html-scatter>)
(export gnc:html-scatter?)
(export gnc:make-html-scatter-internal)
(export gnc:make-html-scatter)
(export gnc:html-scatter-width)
(export gnc:html-scatter-set-width!)
(export gnc:html-scatter-height)
(export gnc:html-scatter-set-height!)
(export gnc:html-scatter-title)
(export gnc:html-scatter-set-title!)
(export gnc:html-scatter-subtitle)
(export gnc:html-scatter-set-subtitle!)
(export gnc:html-scatter-x-axis-label)
(export gnc:html-scatter-set-x-axis-label!)
(export gnc:html-scatter-y-axis-label)
(export gnc:html-scatter-set-y-axis-label!)
(export gnc:html-scatter-data)
(export gnc:html-scatter-set-data!)
(export gnc:html-scatter-marker)
(export gnc:html-scatter-set-marker!)
(export gnc:html-scatter-markercolor)
(export gnc:html-scatter-set-markercolor!)
(export gnc:html-scatter-add-datapoint!)
(export gnc:html-scatter-render)
;; html-style-info.scm
(export make-kvtable)
(export kvt-ref)
(export kvt-set!)
(export kvt-fold)
(export <html-markup-style-info>)
(export gnc:html-markup-style-info?)
(export gnc:make-html-markup-style-info-internal)
(export gnc:make-html-markup-style-info)
(export gnc:html-markup-style-info-set!)
(export gnc:html-markup-style-info-tag)
(export gnc:html-markup-style-info-set-tag!)
(export gnc:html-markup-style-info-attributes)
(export gnc:html-markup-style-info-set-attributes!)
(export gnc:html-markup-style-info-font-face)
(export gnc:html-markup-style-info-set-font-face-internal!)
(export gnc:html-markup-style-info-set-font-face!)
(export gnc:html-markup-style-info-font-size)
(export gnc:html-markup-style-info-set-font-size-internal!)
(export gnc:html-markup-style-info-set-font-size!)
(export gnc:html-markup-style-info-font-color)
(export gnc:html-markup-style-info-set-font-color-internal!)
(export gnc:html-markup-style-info-set-font-color!)
(export gnc:html-markup-style-info-closing-font-tag)
(export gnc:html-markup-style-info-set-closing-font-tag!)
(export gnc:html-markup-style-info-inheritable?)
(export gnc:html-markup-style-info-set-inheritable?!)
(export gnc:html-markup-style-info-set-attribute!)
(export gnc:html-markup-style-info-merge)
(export gnc:html-style-info-merge)
(export gnc:html-data-style-info-merge)
(export <html-data-style-info>)
(export gnc:html-data-style-info?)
(export gnc:make-html-data-style-info-internal)
(export gnc:make-html-data-style-info)
(export gnc:html-data-style-info?)
(export gnc:html-data-style-info-renderer)
(export gnc:html-data-style-info-set-renderer!)
(export gnc:html-data-style-info-data)
(export gnc:html-data-style-info-set-data!)
(export gnc:html-data-style-info-inheritable?)
(export gnc:html-data-style-info-set-inheritable?!)
(export gnc:default-html-string-renderer)
(export gnc:default-html-gnc-numeric-renderer)
(export gnc:default-html-gnc-monetary-renderer)
(export gnc:default-html-number-renderer)
(export <html-style-table>)
(export gnc:html-style-table?)
(export gnc:make-html-style-table-internal)
(export gnc:make-html-style-table)
(export gnc:html-style-table-primary)
(export gnc:html-style-table-compiled)
(export gnc:html-style-table-set-compiled!)
(export gnc:html-style-table-inheritable)
(export gnc:html-style-table-set-inheritable!)
(export gnc:html-style-table-compiled?)
(export gnc:html-style-table-compile)
(export gnc:html-style-table-uncompile)
(export gnc:html-style-table-fetch)
(export gnc:html-style-table-set!)
;; html-style-sheet.scm
(export <html-style-sheet-template>)
(export gnc:html-style-sheet-template?)
(export gnc:html-style-sheet-template-version)
(export gnc:html-style-sheet-template-set-version!)
(export gnc:html-style-sheet-template-name)
(export gnc:html-style-sheet-template-set-name!)
(export gnc:html-style-sheet-template-options-generator)
(export gnc:html-style-sheet-template-set-options-generator!)
(export gnc:html-style-sheet-template-renderer)
(export gnc:html-style-sheet-template-set-renderer!)
(export gnc:html-style-sheet-template-find)
(export gnc:define-html-style-sheet)
(export <html-style-sheet>)
(export gnc:html-style-sheet?)
(export gnc:html-style-sheet-name)
(export gnc:html-style-sheet-set-name!)
(export gnc:html-style-sheet-type)
(export gnc:html-style-sheet-set-type!)
(export gnc:html-style-sheet-options)
(export gnc:html-style-sheet-set-options!)
(export gnc:html-style-sheet-renderer)
(export gnc:html-style-sheet-set-renderer!)
(export gnc:make-html-style-sheet-internal)
(export gnc:html-style-sheet-style)
(export gnc:save-style-sheet-options)
(export gnc:html-style-sheet-set-style!)
(export gnc:make-html-style-sheet)
(export gnc:restore-html-style-sheet)
(export gnc:html-style-sheet-apply-changes)
(export gnc:html-style-sheet-render)
(export gnc:get-html-style-sheets)
(export gnc:get-html-templates)
(export gnc:html-style-sheet-find)
(export gnc:html-style-sheet-remove)
;; html-table.scm
(export <html-table>)
(export gnc:html-table?)
(export <html-table-cell>)
(export gnc:make-html-table-cell-internal)
(export gnc:make-html-table-cell)
(export gnc:make-html-table-cell/size)
(export gnc:make-html-table-cell/markup)
(export gnc:make-html-table-cell/size/markup)
(export gnc:make-html-table-header-cell)
(export gnc:make-html-table-header-cell/markup)
(export gnc:make-html-table-header-cell/size)
(export gnc:html-table-cell?)
(export gnc:html-table-cell-rowspan)
(export gnc:html-table-cell-set-rowspan!)
(export gnc:html-table-cell-colspan)
(export gnc:html-table-cell-set-colspan!)
(export gnc:html-table-cell-tag)
(export gnc:html-table-cell-set-tag!)
(export gnc:html-table-cell-data)
(export gnc:html-table-cell-set-data-internal!)
(export gnc:html-table-cell-style)
(export gnc:html-table-cell-set-style-internal!)
(export gnc:html-table-cell-set-style!)
(export gnc:html-table-cell-append-objects!)
(export gnc:html-table-cell-render)
(export gnc:make-html-table-internal)
(export gnc:make-html-table)
(export gnc:html-table-data)
(export gnc:html-table-set-data!)
(export gnc:html-table-caption)
(export gnc:html-table-set-caption!)
(export gnc:html-table-col-headers)
(export gnc:html-table-set-col-headers!)
(export gnc:html-table-row-headers)
(export gnc:html-table-set-row-headers!)
(export gnc:html-table-style)
(export gnc:html-table-set-style-internal!)
(export gnc:html-table-row-styles)
(export gnc:html-table-set-row-styles!)
(export gnc:html-table-row-markup-table)
(export gnc:html-table-row-markup)
(export gnc:html-table-set-row-markup-table!)
(export gnc:html-table-set-row-markup!)
(export gnc:html-table-col-styles)
(export gnc:html-table-set-col-styles!)
(export gnc:html-table-col-headers-style)
(export gnc:html-table-set-col-headers-style!)
(export gnc:html-table-row-headers-style)
(export gnc:html-table-set-row-headers-style!)
(export gnc:html-table-set-style!)
(export gnc:html-table-set-col-style!)
(export gnc:html-table-set-row-style!)
(export gnc:html-table-row-style)
(export gnc:html-table-col-style)
(export gnc:html-table-num-rows)
(export gnc:html-table-set-num-rows-internal!)
(export gnc:html-table-num-columns)
(export gnc:html-table-append-row/markup!)
(export gnc:html-table-prepend-row/markup!)
(export gnc:html-table-append-row!)
(export gnc:html-table-remove-last-row!)
(export gnc:html-table-prepend-row!)
(export gnc:html-table-set-cell!)
(export gnc:html-table-append-column!)
(export gnc:html-table-prepend-column!)
(export gnc:html-table-render)
;; html-text.scm
(export <html-text>)
(export gnc:html-text?)
(export gnc:make-html-text-internal)
(export gnc:make-html-text)
(export gnc:html-text?)
(export gnc:html-text-body)
(export gnc:html-text-set-body-internal!)
(export gnc:html-text-set-body!)
(export gnc:html-text-style)
(export gnc:html-text-set-style-internal!)
(export gnc:html-text-set-style!)
(export gnc:html-text-append!)
(export gnc:html-markup)
(export gnc:html-markup/attr)
(export gnc:html-markup/no-end)
(export gnc:html-markup/attr/no-end)
(export gnc:html-markup/format)
(export gnc:html-markup-p)
(export gnc:html-markup-tt)
(export gnc:html-markup-em)
(export gnc:html-markup-b)
(export gnc:html-markup-i)
(export gnc:html-markup-h1)
(export gnc:html-markup-h2)
(export gnc:html-markup-h3)
(export gnc:html-markup-br)
(export gnc:html-markup-hr)
(export gnc:html-markup-ul)
(export gnc:html-markup-anchor)
(export gnc:html-markup-img)
(export gnc:html-text-render)
(export gnc:html-text-render-markup)
;; report-utilities.scm
(export list-ref-safe)
(export list-set-safe!)
(export gnc:amount->string)
(export gnc:commodity-value->string)
(export gnc:monetary->string)
(export gnc:account-has-shares?)
(export gnc:account-is-stock?)
(export gnc:account-is-inc-exp?)
(export gnc:filter-accountlist-type)
(export gnc:decompose-accountlist)
(export gnc:account-get-type-string-plural)
(export gnc:accounts-get-commodities)
(export gnc:get-current-group-depth)
(export gnc:account-separator-char)
(export gnc:account-get-full-name)
(export gnc:split-get-corr-account-full-name)
(export gnc:account-get-immediate-subaccounts)
(export gnc:account-get-all-subaccounts)
(export gnc:acccounts-get-all-subaccounts)
(export gnc:transaction-map-splits)
(export gnc:make-stats-collector)
(export gnc:make-drcr-collector)
(export gnc:make-value-collector)
(export gnc:make-numeric-collector)
(export gnc:make-commodity-collector)
(export gnc:account-get-balance-at-date)
(export gnc:account-get-comm-balance-at-date)
(export gnc:group-get-balance-at-date)
(export gnc:accounts-get-balance-helper)
(export gnc:accounts-get-comm-total-profit)
(export gnc:accounts-get-comm-total-income)
(export gnc:accounts-get-comm-total-expense)
(export gnc:accounts-get-comm-total-assets)
(export gnc:group-get-comm-balance-at-date)
(export gnc:account-get-balance-interval)
(export gnc:account-get-comm-balance-interval)
(export gnc:group-get-balance-interval)
(export gnc:group-get-comm-balance-interval)
(export gnc:transaction-get-splits)
(export gnc:split-get-other-splits)
(load-from-path "commodity-utilities.scm")
(load-from-path "html-barchart.scm")
(load-from-path "html-document.scm")
(load-from-path "html-piechart.scm")
(load-from-path "html-scatter.scm")
(load-from-path "html-style-info.scm")
(load-from-path "html-style-sheet.scm")
(load-from-path "html-table.scm")
(load-from-path "html-text.scm")
(load-from-path "html-utilities.scm")
(load-from-path "options-utilities.scm")
(load-from-path "report-utilities.scm")
(load-from-path "report.scm")

View File

@@ -17,7 +17,24 @@
;; 59 Temple Place - Suite 330 Fax: +1-617-542-2652
;; Boston, MA 02111-1307, USA gnu@gnu.org
(gnc:support "report-utilities.scm")
(define (list-ref-safe list elt)
(if (> (length list) elt)
(list-ref list elt)
#f))
(define (list-set-safe! l elt val)
(if (and (list? l) (> (length l) elt))
(list-set! l elt val)
(let ((filler (list val)))
(if (not (list? l))
(set! l '()))
(let loop ((i (length l)))
(if (< i elt)
(begin
(set! filler (cons #f filler))
(loop (+ 1 i)))))
(set! l (append! l filler))))
l)
(define gnc:amount->string gnc:amount->string-helper)

View File

@@ -20,10 +20,6 @@
;; Boston, MA 02111-1307, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'hash-table)
(require 'record)
(gnc:support "report.scm")
;; This hash should contain all the reports available and will be used
;; to generate the reports menu whenever a new window opens and to
@@ -51,7 +47,6 @@
(define gnc:pagename-display (N_ "Display"))
(define gnc:optname-reportname (N_ "Report name"))
(define (gnc:report-menu-setup)
;; since this menu gets added to every child window, we say it
;; comes after the "_File" menu.
@@ -152,7 +147,7 @@
#f ;; version
#f ;; name
#f ;; options-generator
gnc:default-options-editor ;; options-editor
#f ;; options-editor
#f ;; options-cleanup-cb
#f ;; options-changed-cb
#f ;; renderer
@@ -369,7 +364,9 @@
(hash-ref *gnc:_report-templates_*
(gnc:report-type report))))
(if template
(gnc:report-template-options-editor template)
(let ((ed (gnc:report-template-options-editor template)))
(if ed ed
gnc:default-options-editor))
#f)))
(define (gnc:report-export-thunk report)

View File

@@ -0,0 +1,15 @@
TESTS=test-link-module test-load-module
TESTS_ENVIRONMENT= \
GNC_MODULE_PATH=${top_srcdir}/src/engine:${top_srcdir}/src/app-utils:.. \
GUILE_LOAD_PATH=${top_srcdir}/src/gnc-module:..:${G_WRAP_MODULE_DIR}:${top_srcdir}/lib:${top_srcdir}/src/scm:${top_srcdir}/src/app-utils:${top_srcdir}/src/engine \
LTDL_LIBRARY_PATH=.. \
LD_LIBRARY_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/src/gnc-module/.libs:${top_srcdir}/src/app-utils:${top_srcdir}/src/app-utils/.libs:${top_srcdir}/src/engine:${top_srcdir}/src/engine/.libs
bin_PROGRAMS=test-link-module
LDADD = \
../libgncmod-report-system.la
test-link-module: test-link-module.c

View File

@@ -0,0 +1,6 @@
#include <stdlib.h>
int
main(int argc, char ** argv) {
exit(0);
}

View File

@@ -0,0 +1,26 @@
#! /bin/sh
exec guile -s "$0"
!#
(debug-enable 'debug)
(debug-enable 'backtrace)
(debug-set! stack 5000000)
(debug-set! maxdepth 10000)
(display " testing report module load ... ")
(use-modules (ice-9 syncase))
(use-modules (gnucash gnc-module))
(gnc:module-system-init)
(if (gnc:module-load "gnucash/report/report-system" 0)
(begin
(display "ok\n")
(exit 0))
(begin
(display "failed\n")
(exit -1)))

View File

@@ -0,0 +1,36 @@
SUBDIRS=. test
pkglib_LTLIBRARIES=libgncmod-standard-reports.la
libgncmod_standard_reports_la_SOURCES=\
gncmod-standard-reports.c
libgncmod_standard_reports_la_LDFLAGS=-module
INCLUDES=-I${top_srcdir}/src/gnc-module ${GLIB_CFLAGS}
.scm-links:
rm -f gnucash report
ln -sf . gnucash
ln -sf . report
touch .scm-links
noinst_DATA = .scm-links
gncscmmoddir=${GNC_SHAREDIR}/guile-modules/gnucash/report/
gncscmmod_DATA = \
account-piecharts.scm \
account-summary.scm \
average-balance.scm \
balance-sheet.scm \
category-barchart.scm \
net-barchart.scm \
payables.scm \
pnl.scm \
portfolio.scm \
price-scatter.scm \
register.scm \
standard-reports.scm \
transaction.scm
CLEANFILES += gnucash report .scm-links

View File

@@ -23,10 +23,6 @@
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; depends must be outside module scope -- and should eventually go away.
(gnc:depend "report-html.scm")
(gnc:depend "date-utilities.scm")
(define-module (gnucash report account-piecharts))
(use-modules (srfi srfi-1))
@@ -34,7 +30,7 @@
(require 'printf)
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/engine" 0)
(gnc:module-load "gnucash/report/report-system" 0)
(define menuname-income (N_ "Income Piechart"))
(define menuname-expense (N_ "Expense Piechart"))

View File

@@ -26,15 +26,12 @@
;; Boston, MA 02111-1307, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; depends must be outside module scope -- and should eventually go away.
(gnc:depend "report-html.scm")
(define-module (gnucash report account-summary))
(use-modules (srfi srfi-1))
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/engine" 0)
(gnc:module-load "gnucash/report/report-system" 0)
;; account summary report
;; prints a table of account information with clickable

View File

@@ -7,17 +7,12 @@
;; or indirect losses incurred as a result of using this software.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; depends must be outside module scope -- and should eventually go away.
(gnc:depend "report-html.scm")
(gnc:depend "report-utilities.scm")
(gnc:depend "date-utilities.scm")
(define-module (gnucash report average-balance))
(use-modules (srfi srfi-1))
(use-modules (ice-9 slib))
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/engine" 0)
(gnc:module-load "gnucash/report/report-system" 0)
(define optname-from-date (N_ "From"))
(define optname-to-date (N_ "To"))

View File

@@ -25,16 +25,13 @@
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; depends must be outside module scope -- and should eventually go away.
(gnc:depend "report-html.scm")
(define-module (gnucash report balance-sheet))
(use-modules (ice-9 slib))
(require 'printf)
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/engine" 0)
(gnc:module-load "gnucash/report/report-system" 0)
;; first define all option's names so that they are properly defined
;; in *one* place.

View File

@@ -23,16 +23,13 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; depends must be outside module scope -- and should eventually go away.
(gnc:depend "report-html.scm")
(gnc:depend "date-utilities.scm")
(define-module (gnucash report category-barchart))
(use-modules (srfi srfi-1))
(use-modules (ice-9 slib))
(require 'printf)
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/engine" 0)
(gnc:module-load "gnucash/report/report-system" 0)
;; The option names are defined here to 1. save typing and 2. avoid
;; spelling errors. The *reportnames* are defined here (and not only

View File

@@ -0,0 +1,51 @@
/*********************************************************************
* gncmod-standard-reports.c
* module definition/initialization for the standard reports
*
* Copyright (c) 2001 Linux Developers Group, Inc.
*********************************************************************/
#include <stdio.h>
#include <guile/gh.h>
#include <glib.h>
#include "gnc-module.h"
/* version of the gnc module system interface we require */
int gnc_module_system_interface = 0;
/* module versioning uses libtool semantics. */
int gnc_module_current = 0;
int gnc_module_revision = 0;
int gnc_module_age = 0;
char *
gnc_module_path(void) {
return g_strdup("gnucash/report/standard-reports");
}
char *
gnc_module_description(void) {
return g_strdup("Standard income, asset, balance sheet, etc. reports");
}
int
gnc_module_init(int refcount) {
/* load the report system */
if(!gnc_module_load("gnucash/report/report-system", 0)) {
return FALSE;
}
/* load the report generation scheme code */
if(gh_eval_str("(use-modules (gnucash report standard-reports))") ==
SCM_BOOL_F) {
return FALSE;
}
return TRUE;
}
void
gnc_module_finish(int refcount) {
}

View File

@@ -24,11 +24,6 @@
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; depends must be outside module scope -- and should eventually go away.
(gnc:depend "report-html.scm")
(gnc:depend "date-utilities.scm")
(define-module (gnucash report net-barchart))
(use-modules (srfi srfi-1))
@@ -36,7 +31,7 @@
(require 'printf)
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/engine" 0)
(gnc:module-load "gnucash/report/report-system" 0)
(define optname-from-date (N_ "From"))
(define optname-to-date (N_ "To"))

View File

@@ -22,11 +22,6 @@
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; depends must be outside module scope
(gnc:depend "report-html.scm")
(gnc:depend "date-utilities.scm")
(define-module (gnucash report payables))
(use-modules (ice-9 slib))
@@ -35,7 +30,7 @@
(require 'record)
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/engine" 0)
(gnc:module-load "gnucash/report/report-system" 0)
(define opt-pay-acc (N_ "Payables Account"))
(define sect-acc (N_ "Accounts"))

View File

@@ -22,9 +22,6 @@
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; depends must be outside module scope -- and should eventually go away.
(gnc:depend "report-html.scm")
(define-module (gnucash report pnl))
(use-modules (srfi srfi-1))
@@ -32,7 +29,7 @@
(require 'printf)
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/engine" 0)
(gnc:module-load "gnucash/report/report-system" 0)
;; Profit and loss report. Actually, people in finances might want
;; something different under this name, but they are welcomed to

View File

@@ -21,9 +21,6 @@
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; depends must be outside module scope -- and should eventually go away.
(gnc:depend "report-html.scm")
(define-module (gnucash report portfolio))
(use-modules (srfi srfi-1))
@@ -31,7 +28,7 @@
(require 'printf)
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/engine" 0)
(gnc:module-load "gnucash/report/report-system" 0)
(define optname-price-source (N_ "Price Source"))

View File

@@ -22,9 +22,6 @@
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; depends must be outside module scope -- and should eventually go away.
(gnc:depend "report-html.scm")
(define-module (gnucash report price-scatter))
(use-modules (srfi srfi-1))
@@ -32,7 +29,7 @@
(require 'printf)
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/engine" 0)
(gnc:module-load "gnucash/report/report-system" 0)
(define optname-from-date (N_ "From"))
(define optname-to-date (N_ "To"))

View File

@@ -1,11 +1,6 @@
;; -*-scheme-*-
;; register.scm
;; depends must be outside module scope -- and should eventually go away.
(gnc:depend "report-html.scm")
(gnc:depend "date-utilities.scm")
(define-module (gnucash report register))
(export gnc:show-register-report)
@@ -16,6 +11,9 @@
(use-modules (ice-9 slib))
(require 'record)
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/report/report-system" 0)
(define-macro (addto! alist element)
`(set! ,alist (cons ,element ,alist)))

View File

@@ -0,0 +1,21 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; standard-reports.scm
;; load the standard report definitions
;;
;; Copyright (c) 2001 Linux Developers Group, Inc.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-module (gnucash report standard-reports))
(use-modules (gnucash report account-piecharts))
(use-modules (gnucash report account-summary))
(use-modules (gnucash report average-balance))
(use-modules (gnucash report balance-sheet))
(use-modules (gnucash report category-barchart))
(use-modules (gnucash report net-barchart))
(use-modules (gnucash report payables))
(use-modules (gnucash report pnl))
(use-modules (gnucash report portfolio))
(use-modules (gnucash report price-scatter))
(use-modules (gnucash report register))
(use-modules (gnucash report transaction))

View File

@@ -0,0 +1,6 @@
TESTS=test-load-module
TESTS_ENVIRONMENT= \
GNC_MODULE_PATH=${top_srcdir}/src/engine:${top_srcdir}/src/report/report-system:${top_srcdir}/src/app-utils:.. \
GUILE_LOAD_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/lib:..:${G_WRAP_MODULE_DIR} \
LD_LIBRARY_PATH=${top_srcdir}/src/gnc-module:${top_srcdir}/src/gnc-module/.libs:${top_srcdir}/src/engine:${top_srcdir}/src/engine/.libs:${top_srcdir}/src/app-utils:${top_srcdir}/src/app-utils/.libs

View File

@@ -0,0 +1,19 @@
#! /bin/sh
exec guile -s "$0"
!#
(display " testing standard report module load ... ")
(use-modules (gnucash gnc-module))
(gnc:module-system-init)
(if (gnc:module-load "gnucash/report/standard-reports" 0)
(begin
(display "ok\n")
(exit 0))
(begin
(display "failed\n")
(exit -1)))

View File

@@ -27,10 +27,6 @@
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; depends must be outside module scope -- and should eventually go away.
(gnc:depend "report-html.scm")
(gnc:depend "date-utilities.scm")
(define-module (gnucash report transaction))
(use-modules (srfi srfi-1))
@@ -39,7 +35,7 @@
(require 'record)
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/engine" 0)
(gnc:module-load "gnucash/report/report-system" 0)
(define-macro (addto! alist element)
`(set! ,alist (cons ,element ,alist)))

Some files were not shown because too many files have changed in this diff Show More