gnucash/bindings/guile/gnc-numeric.scm

95 lines
3.2 KiB
Scheme
Raw Normal View History

Bill Gribble's big patch. * doc/html/C/account-tree-demo.html: add a simple demo of embedding a gnucash main window widget in HTML * src/gnome/dialog-options.c: add a 'pixmap' option type to the GNC options * src/gnome-dialog-style-sheet.{c,h}: new dialog for creating and editing HTML style sheets * src/gnome/druid-qif-import.c: add support for false-if-exception error handling within QIF import process * src/gnome/gnc-html-embedded.c: add backslash escaping for converting string arrays to and from single HTML strings * src/gnome/gnc-html-embedded.c: error handling in creating guppi plots, and add new embedded object type for embedding a gnucash mainwindow-account-tree in HTML (preliminary). Add x axis label rotation as an option to the barchart. * src/gnome/gnc-html.c: fixes for renaming of report objects and handling false-if-exception returns from report runs. Use async mode for ghttp requests and add a gtk_timeout callback to check on their status. Add a gnc_html_cancel() which gets rid of pending ghttp requests (called by the stop buttons in help, report windows) * src/gnome/window-help.c: bug fixes for search results printing. Don't expand help topics nodes on creation. Add stop and reload buttons to the toolbar. * src/gnome/window-report.c: Add stop and reload buttons to the toolbar. * src/guile/gnc-helpers.c: fix helpers for recordization of <gnc-numeric> on Scheme side * src/scm/engine-utilities.scm: rewrite transaction map functions to eliminate ith-transaction calls * src/scm/gnc-numeric.scm: make gnc-numeric into a first class type on the scheme side (<gnc-numeric>) * src/scm/html-*.scm (7 files): new architecture for generating HTML within reports. See src/scm/report-html.txt for an overview. * src/scm/options.scm: support for pixmap options * src/scm/qif-import/: add false-if-exception error catching in QIF import entry points. * src/scm/report-utilities.scm: add functions to get immediate subaccounts; rewrite get-balance-at-date. * src/scm/report.scm: rename report objects; now the thing that gets created by define-report is a <report-template> and the thing that has a window and a set of parameters is a <report>. Add a "style sheet" option automatcally to EVERY report, and a "General" section to put it in; report with only 1 page of options should use "General". Add false-if-exception error catching to report run. * src/scm/report/account-summary.scm, src/scm/report/hello-world.scm, src/scm/report/average-balance.scm: rewrite some reports using the new HTML generation infrastructure. Old reports won't work until they are rewritten. * src/scm/report/stylesheet-*.scm (2 files): create some sample stylesheet templates. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3452 57a11ea4-9604-0410-9ed3-97b8803252fd
2001-01-12 17:07:14 -06:00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; gnc-numeric.scm : rational number representation for gnucash
;; Copyright 2000 Bill Gribble <grib@gnumatic.com>
;; Copyright 2001 Christian Stimming <stimming@tu-harburg.de>
Bill Gribble's big patch. * doc/html/C/account-tree-demo.html: add a simple demo of embedding a gnucash main window widget in HTML * src/gnome/dialog-options.c: add a 'pixmap' option type to the GNC options * src/gnome-dialog-style-sheet.{c,h}: new dialog for creating and editing HTML style sheets * src/gnome/druid-qif-import.c: add support for false-if-exception error handling within QIF import process * src/gnome/gnc-html-embedded.c: add backslash escaping for converting string arrays to and from single HTML strings * src/gnome/gnc-html-embedded.c: error handling in creating guppi plots, and add new embedded object type for embedding a gnucash mainwindow-account-tree in HTML (preliminary). Add x axis label rotation as an option to the barchart. * src/gnome/gnc-html.c: fixes for renaming of report objects and handling false-if-exception returns from report runs. Use async mode for ghttp requests and add a gtk_timeout callback to check on their status. Add a gnc_html_cancel() which gets rid of pending ghttp requests (called by the stop buttons in help, report windows) * src/gnome/window-help.c: bug fixes for search results printing. Don't expand help topics nodes on creation. Add stop and reload buttons to the toolbar. * src/gnome/window-report.c: Add stop and reload buttons to the toolbar. * src/guile/gnc-helpers.c: fix helpers for recordization of <gnc-numeric> on Scheme side * src/scm/engine-utilities.scm: rewrite transaction map functions to eliminate ith-transaction calls * src/scm/gnc-numeric.scm: make gnc-numeric into a first class type on the scheme side (<gnc-numeric>) * src/scm/html-*.scm (7 files): new architecture for generating HTML within reports. See src/scm/report-html.txt for an overview. * src/scm/options.scm: support for pixmap options * src/scm/qif-import/: add false-if-exception error catching in QIF import entry points. * src/scm/report-utilities.scm: add functions to get immediate subaccounts; rewrite get-balance-at-date. * src/scm/report.scm: rename report objects; now the thing that gets created by define-report is a <report-template> and the thing that has a window and a set of parameters is a <report>. Add a "style sheet" option automatcally to EVERY report, and a "General" section to put it in; report with only 1 page of options should use "General". Add false-if-exception error catching to report run. * src/scm/report/account-summary.scm, src/scm/report/hello-world.scm, src/scm/report/average-balance.scm: rewrite some reports using the new HTML generation infrastructure. Old reports won't work until they are rewritten. * src/scm/report/stylesheet-*.scm (2 files): create some sample stylesheet templates. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3452 57a11ea4-9604-0410-9ed3-97b8803252fd
2001-01-12 17:07:14 -06:00
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2 of
;; the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, contact:
;;
;; Free Software Foundation Voice: +1-617-542-5942
;; 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
;; Boston, MA 02110-1301, USA gnu@gnu.org
Bill Gribble's big patch. * doc/html/C/account-tree-demo.html: add a simple demo of embedding a gnucash main window widget in HTML * src/gnome/dialog-options.c: add a 'pixmap' option type to the GNC options * src/gnome-dialog-style-sheet.{c,h}: new dialog for creating and editing HTML style sheets * src/gnome/druid-qif-import.c: add support for false-if-exception error handling within QIF import process * src/gnome/gnc-html-embedded.c: add backslash escaping for converting string arrays to and from single HTML strings * src/gnome/gnc-html-embedded.c: error handling in creating guppi plots, and add new embedded object type for embedding a gnucash mainwindow-account-tree in HTML (preliminary). Add x axis label rotation as an option to the barchart. * src/gnome/gnc-html.c: fixes for renaming of report objects and handling false-if-exception returns from report runs. Use async mode for ghttp requests and add a gtk_timeout callback to check on their status. Add a gnc_html_cancel() which gets rid of pending ghttp requests (called by the stop buttons in help, report windows) * src/gnome/window-help.c: bug fixes for search results printing. Don't expand help topics nodes on creation. Add stop and reload buttons to the toolbar. * src/gnome/window-report.c: Add stop and reload buttons to the toolbar. * src/guile/gnc-helpers.c: fix helpers for recordization of <gnc-numeric> on Scheme side * src/scm/engine-utilities.scm: rewrite transaction map functions to eliminate ith-transaction calls * src/scm/gnc-numeric.scm: make gnc-numeric into a first class type on the scheme side (<gnc-numeric>) * src/scm/html-*.scm (7 files): new architecture for generating HTML within reports. See src/scm/report-html.txt for an overview. * src/scm/options.scm: support for pixmap options * src/scm/qif-import/: add false-if-exception error catching in QIF import entry points. * src/scm/report-utilities.scm: add functions to get immediate subaccounts; rewrite get-balance-at-date. * src/scm/report.scm: rename report objects; now the thing that gets created by define-report is a <report-template> and the thing that has a window and a set of parameters is a <report>. Add a "style sheet" option automatcally to EVERY report, and a "General" section to put it in; report with only 1 page of options should use "General". Add false-if-exception error catching to report run. * src/scm/report/account-summary.scm, src/scm/report/hello-world.scm, src/scm/report/average-balance.scm: rewrite some reports using the new HTML generation infrastructure. Old reports won't work until they are rewritten. * src/scm/report/stylesheet-*.scm (2 files): create some sample stylesheet templates. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3452 57a11ea4-9604-0410-9ed3-97b8803252fd
2001-01-12 17:07:14 -06:00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2020-12-03 08:53:37 -06:00
(define-module (gnucash engine gnc-numeric))
(use-modules (srfi srfi-9))
2020-12-03 08:53:37 -06:00
(export GNC-RND-FLOOR)
(export GNC-RND-CEIL)
(export GNC-RND-TRUNC)
(export GNC-RND-PROMOTE)
(export GNC-RND-ROUND-HALF-DOWN)
(export GNC-RND-ROUND-HALF-UP)
(export GNC-RND-ROUND)
(export GNC-RND-NEVER)
(export GNC-DENOM-AUTO)
(export GNC-DENOM-REDUCE)
(export GNC-DENOM-FIXED)
(export GNC-DENOM-LCD)
(export GNC-DENOM-SIGFIG)
(export GNC-DENOM-SIGFIGS)
(export GNC-ERROR-OK)
(export GNC-ERROR-ARG)
(export GNC-ERROR-OVERFLOW)
(export GNC-ERROR-DENOM-DIFF)
(export GNC-ERROR-REMAINDER)
(export :gnc-monetary)
(export gnc:gnc-monetary?)
(export gnc:make-gnc-monetary)
(export gnc:gnc-monetary-commodity)
(export gnc:gnc-monetary-amount)
(export gnc:monetary-neg)
;; use 'logior' in guile to bit-combine RND and DENOM flags.
(define GNC-RND-FLOOR 1)
(define GNC-RND-CEIL 2)
(define GNC-RND-TRUNC 3)
(define GNC-RND-PROMOTE 4)
(define GNC-RND-ROUND-HALF-DOWN 5)
(define GNC-RND-ROUND-HALF-UP 6)
(define GNC-RND-ROUND 7)
(define GNC-RND-NEVER 8)
(define GNC-DENOM-AUTO 0)
(define GNC-DENOM-REDUCE 32)
(define GNC-DENOM-FIXED 64)
(define GNC-DENOM-LCD 48)
(define GNC-DENOM-SIGFIG 80)
(define (GNC-DENOM-SIGFIGS n)
(logior GNC-DENOM-SIGFIG (* n 256)))
(define GNC-ERROR-OK 0)
(define GNC-ERROR-ARG -1)
(define GNC-ERROR-OVERFLOW -2)
(define GNC-ERROR-DENOM-DIFF -3)
(define GNC-ERROR-REMAINDER -4)
(define-record-type :gnc-monetary
(make-gnc-monetary commodity amount)
gnc-monetary?
(commodity gnc-monetary-commodity)
(amount gnc-monetary-amount))
Bill Gribble's big patch. * doc/html/C/account-tree-demo.html: add a simple demo of embedding a gnucash main window widget in HTML * src/gnome/dialog-options.c: add a 'pixmap' option type to the GNC options * src/gnome-dialog-style-sheet.{c,h}: new dialog for creating and editing HTML style sheets * src/gnome/druid-qif-import.c: add support for false-if-exception error handling within QIF import process * src/gnome/gnc-html-embedded.c: add backslash escaping for converting string arrays to and from single HTML strings * src/gnome/gnc-html-embedded.c: error handling in creating guppi plots, and add new embedded object type for embedding a gnucash mainwindow-account-tree in HTML (preliminary). Add x axis label rotation as an option to the barchart. * src/gnome/gnc-html.c: fixes for renaming of report objects and handling false-if-exception returns from report runs. Use async mode for ghttp requests and add a gtk_timeout callback to check on their status. Add a gnc_html_cancel() which gets rid of pending ghttp requests (called by the stop buttons in help, report windows) * src/gnome/window-help.c: bug fixes for search results printing. Don't expand help topics nodes on creation. Add stop and reload buttons to the toolbar. * src/gnome/window-report.c: Add stop and reload buttons to the toolbar. * src/guile/gnc-helpers.c: fix helpers for recordization of <gnc-numeric> on Scheme side * src/scm/engine-utilities.scm: rewrite transaction map functions to eliminate ith-transaction calls * src/scm/gnc-numeric.scm: make gnc-numeric into a first class type on the scheme side (<gnc-numeric>) * src/scm/html-*.scm (7 files): new architecture for generating HTML within reports. See src/scm/report-html.txt for an overview. * src/scm/options.scm: support for pixmap options * src/scm/qif-import/: add false-if-exception error catching in QIF import entry points. * src/scm/report-utilities.scm: add functions to get immediate subaccounts; rewrite get-balance-at-date. * src/scm/report.scm: rename report objects; now the thing that gets created by define-report is a <report-template> and the thing that has a window and a set of parameters is a <report>. Add a "style sheet" option automatcally to EVERY report, and a "General" section to put it in; report with only 1 page of options should use "General". Add false-if-exception error catching to report run. * src/scm/report/account-summary.scm, src/scm/report/hello-world.scm, src/scm/report/average-balance.scm: rewrite some reports using the new HTML generation infrastructure. Old reports won't work until they are rewritten. * src/scm/report/stylesheet-*.scm (2 files): create some sample stylesheet templates. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3452 57a11ea4-9604-0410-9ed3-97b8803252fd
2001-01-12 17:07:14 -06:00
(define gnc:make-gnc-monetary make-gnc-monetary)
(define gnc:gnc-monetary? gnc-monetary?)
(define gnc:gnc-monetary-commodity gnc-monetary-commodity)
(define gnc:gnc-monetary-amount gnc-monetary-amount)
(define (gnc:monetary-neg a)
(gnc:make-gnc-monetary
(gnc:gnc-monetary-commodity a)
(- (gnc:gnc-monetary-amount a))))