diff --git a/ChangeLog b/ChangeLog index 1a10b5df683..27ac6ff637b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +2000-03-05 Rob Browning + + * src/scm/report/transaction-report.scm: add support for depend + mechanism. + + * src/scm/report/hello-world.scm: add support for depend + mechanism. + + * src/scm/report/folio.scm: add support for depend mechanism. + + * src/scm/report/balance-and-pnl.scm: add support for depend + mechanism. + + * src/scm/report/average-balance.scm: add support for depend + mechanism. + + * src/scm/report.scm (gnc:report-menu-setup): fixed minor + non-r5rsism (defines must be at the beginning of a ). + + * src/scm/report/report-list.scm: new file. This is where all of + the reports that should be loaded at startup should be listed. + + * src/scm/main.scm (gnc:startup): don't autoscan/load from the + report dir anymore. Use the depend mechanism instead. This isn't + as convenient, but it's safer. + + * src/scm/hooks.scm (gnc:hook-run-danglers): added a little + debugging code. + + * src/scm/extensions.scm (gnc:extensions-menu-setup): fixed minor + non-r5rsism (nested defines must be at the beginning of a ). + + * make-gnucash-patch: allow the user to override the default + locations with environment variables. + 2000-03-04 Dave Peticolas * src/guile/gnucash.c (main): load the locale from the environment diff --git a/make-gnucash-patch b/make-gnucash-patch index 972ae8743be..5a762b475dc 100755 --- a/make-gnucash-patch +++ b/make-gnucash-patch @@ -24,11 +24,24 @@ my $new = 'gnucash'; # The directory where the above two directories reside my $gnc_home = '/usr/src/misc/gnc'; - ########################################################### # This section should not need to be modified. # ########################################################### +# Allow the user to override the defaults with evnt vars. + +if($ENV{'GNC_MAKEPATCH_OLD_DIR'}) { + $old = $ENV{'GNC_MAKEPATCH_OLD_DIR'}; +} + +if($ENV{'GNC_MAKEPATCH_NEW_DIR'}) { + $new = $ENV{'GNC_MAKEPATCH_NEW_DIR'}; +} + +if($ENV{'GNC_MAKEPATCH_HOME_DIR'}) { + $gnc_home = $ENV{'GNC_MAKEPATCH_HOME_DIR'}; +} + # Switch to the home directory chdir $gnc_home or die "Can't cd!\n"; diff --git a/src/scm/hooks.scm b/src/scm/hooks.scm index 6ac3fad0509..2a0d98aa577 100644 --- a/src/scm/hooks.scm +++ b/src/scm/hooks.scm @@ -31,7 +31,11 @@ (define (gnc:hook-run-danglers hook . args) (gnc:debug "Running functions on hook " (gnc:hook-name-get hook)) - (for-each (lambda (dangler) (apply dangler args)) + (for-each (lambda (dangler) + (if (gnc:debugging?) + (begin + (display " ") (display dangler) (newline))) + (apply dangler args)) (gnc:hook-danglers-get hook))) ;;; Public diff --git a/src/scm/main.scm b/src/scm/main.scm index fc8dab45bc6..482ce99dd71 100644 --- a/src/scm/main.scm +++ b/src/scm/main.scm @@ -17,27 +17,7 @@ (gnc:depend "text-export.scm") (gnc:depend "importqif.scm") (gnc:depend "report.scm") - - ;; FIXME: These do not belong here, but for now, we're putting them - ;; here. Later we need a generalization of gnc:load that takes a - ;; path specifier, and then we should have a gnc:*report-path* that - ;; determines where we look to load report files. For now, though, - ;; I just want to get things going... - ;; - ;; Just load these since we might want to redefine them on the fly - ;; and we're going to change this mechanism anyway... - (let - ((repdir - (opendir (string-append gnc:_share-dir-default_ "/scm/report")))) - (while (let ((cf (readdir repdir))) - (if (string? cf) - (if (and - (not (directory? cf)) - (> (string-length cf) 4)) - (if (string=? (substring cf (- (string-length cf) 4) - (string-length cf)) ".scm") - (gnc:load (string-append "report/" cf))))) - (string? cf)) ())) + (gnc:depend "report/report-list.scm") ;; Load the system configs (if (not (gnc:load-system-config-if-needed)) diff --git a/src/scm/report.scm b/src/scm/report.scm index 3b21f0588af..9964f998f97 100644 --- a/src/scm/report.scm +++ b/src/scm/report.scm @@ -48,27 +48,29 @@ (define menu (gnc:make-menu "_Reports" (list "_Settings"))) (define menu-namer (gnc:new-menu-namer)) - - (gnc:add-extension menu) - - (hash-for-each - (lambda (name report) - (if (gnc:debugging?) - (let ((options (false-if-exception (gnc:report-new-options report)))) - (if options - (gnc:options-register-translatable-strings options)))) - (define item - (gnc:make-menu-item - ((menu-namer 'add-name) name) - (string-append "Display the " name " report.") - (list "_Reports" "") - (lambda () + (define (add-report-menu-item name report) + (let ((item #f)) + (if (gnc:debugging?) (let ((options (false-if-exception (gnc:report-new-options report)))) - (gnc:report-window (string-append "Report: " name) - (lambda () (gnc:run-report name options)) - options))))) - (gnc:add-extension item)) - *gnc:_report-info_*)) + (if options + (gnc:options-register-translatable-strings options)))) + + (set! item + (gnc:make-menu-item + ((menu-namer 'add-name) name) + (string-append "Display the " name " report.") + (list "_Reports" "") + (lambda () + (let ((options (false-if-exception + (gnc:report-new-options report)))) + (gnc:report-window (string-append "Report: " name) + (lambda () (gnc:run-report name options)) + options))))) + (gnc:add-extension item))) + + (gnc:add-extension menu) + + (hash-for-each add-report-menu-item *gnc:_report-info_*)) (define (gnc:define-report version name option-generator rendering-thunk) ;; For now the version is ignored, but in the future it'll let us diff --git a/src/scm/report/average-balance.scm b/src/scm/report/average-balance.scm index 7ec69eadf4f..3ac163c4c6b 100644 --- a/src/scm/report/average-balance.scm +++ b/src/scm/report/average-balance.scm @@ -7,13 +7,15 @@ ;; these calculations and accepts no responsibility for direct ;; or indirect losses incurred as a result of using this software. ;; -;; Note that this code uses functions defined in "transaction-report.scm" ;; Matt Martin +(gnc:support "report/average-balance.scm") + (use-modules (ice-9 regex)) (require 'hash-table) (gnc:depend "structure.scm") +(gnc:depend "report/transaction-report.scm") ;; Modify a date (define (moddate op adate delta) diff --git a/src/scm/report/balance-and-pnl.scm b/src/scm/report/balance-and-pnl.scm index ef2016bc624..a41afcb6a9d 100644 --- a/src/scm/report/balance-and-pnl.scm +++ b/src/scm/report/balance-and-pnl.scm @@ -1,5 +1,7 @@ ;; -*-scheme-*- +(gnc:support "report/balance-and-pnl.scm") + (gnc:depend "text-export.scm") (let () diff --git a/src/scm/report/folio.scm b/src/scm/report/folio.scm index e1d86502750..ea2fa7c46a5 100644 --- a/src/scm/report/folio.scm +++ b/src/scm/report/folio.scm @@ -1,4 +1,6 @@ +(gnc:support "report/folio.scm") + ;; I haven't finished converting this yet... ;(gnc:define-report diff --git a/src/scm/report/hello-world.scm b/src/scm/report/hello-world.scm index 9793778ceb1..5db5fcd5d9a 100644 --- a/src/scm/report/hello-world.scm +++ b/src/scm/report/hello-world.scm @@ -4,6 +4,8 @@ ;; It illustrates the basic techniques used to create ;; new reports for GnuCash. +(gnc:support "report/hello-world.scm") + ;; Putting your functions in a (let ()) block hides them ;; from the rest of guile. (let () diff --git a/src/scm/report/report-list.scm b/src/scm/report/report-list.scm new file mode 100644 index 00000000000..43902dadfe2 --- /dev/null +++ b/src/scm/report/report-list.scm @@ -0,0 +1,9 @@ +;; Index file to load all of the releavant reports. + +(gnc:support "report/report-list.scm") + +(gnc:depend "report/average-balance.scm") +(gnc:depend "report/balance-and-pnl.scm") +(gnc:depend "report/folio.scm") +(gnc:depend "report/hello-world.scm") +(gnc:depend "report/transaction-report.scm") diff --git a/src/scm/report/transaction-report.scm b/src/scm/report/transaction-report.scm index 00e6fa9b027..40995fc831f 100644 --- a/src/scm/report/transaction-report.scm +++ b/src/scm/report/transaction-report.scm @@ -3,6 +3,8 @@ ;; Report on all transactions in an account ;; Robert Merkel (rgmerk@mira.net) +(gnc:support "report/transaction-report.scm") + (require 'sort) ;hack alert - is this line necessary?