Replace sprintf with Guile's built-in format.

This commit is contained in:
John Ralls 2018-02-17 14:58:18 -08:00
parent e3cd9f88c9
commit 48bdab38d4
51 changed files with 151 additions and 1416 deletions

View File

@ -26,7 +26,6 @@
(use-modules (gnucash core-utils))
(use-modules (gnucash printf))
(use-modules (ice-9 regex))
(use-modules (srfi srfi-13))
(use-modules (ice-9 rdelim))
@ -1028,7 +1027,7 @@
(gnc:list-display-to-string (list
(_ "Parse ambiguity between formats") " "
formats "\n"
(sprintf #f (_ "Value '%s' could be %s or %s.")
(format #f (_ "Value '~a' could be ~a or ~a.")
parsed
(printer parsed)
(printer this-parsed))))))))))

View File

@ -23,9 +23,6 @@
;; Boston, MA 02110-1301, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-modules (gnucash printf))
(define qif-category-compiled-rexp
(make-regexp "^ *(\\[)?([^]/|]*)(]?)(/?)([^|]*)(\\|(\\[)?([^]/]*)(]?)(/?)(.*))? *$"))
@ -188,7 +185,7 @@
(list GNC-BANK-TYPE))
(#t
(errorproc errortype
(sprintf #f (_ "Unrecognized account type '%s'. Defaulting to Bank.")
(format #f (_ "Unrecognized account type '~s'. Defaulting to Bank.")
read-value))
(list GNC-BANK-TYPE)))))
@ -295,7 +292,7 @@
; 'vest)
(else
(errorproc errortype
(sprintf #f (_ "Unrecognized action '%s'.") read-value))
(format #f (_ "Unrecognized action '~a'.") read-value))
#f)))
#f))
@ -320,7 +317,7 @@
'budgeted)
(else
(errorproc errortype
(sprintf #f (_ "Unrecognized status '%s'. Defaulting to uncleared.")
(format #f (_ "Unrecognized status '~a'. Defaulting to uncleared.")
read-value))
#f)))
#f))

View File

@ -26,8 +26,6 @@
(use-modules (srfi srfi-13))
(use-modules (gnucash printf))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; qif-import:find-or-make-acct
@ -65,12 +63,12 @@
(if (not (null? (gnc-account-lookup-by-full-name old-root long-name)))
(let loop ((count 2))
(let* ((test-name
(string-append long-name (sprintf #f " %a" count)))
(string-append long-name (format #f " ~a" count)))
(test-acct
(gnc-account-lookup-by-full-name old-root test-name)))
(if (and (not (null? test-acct)) (not (compatible? test-acct)))
(loop (+ 1 count))
(string-append short-name (sprintf #f " %a" count)))))
(string-append short-name (format #f " ~a" count)))))
short-name))
;; If a GnuCash account already exists in the old root with the same

View File

@ -27,7 +27,6 @@
(define-module (gnucash report aging))
(use-modules (gnucash utilities))
(use-modules (gnucash printf))
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
@ -222,8 +221,8 @@
"\nClient Currency" (gnc-ommodity-get-mnemonic(company-get-currency company-info)))))
(gnc-error-dialog '() error-str)
(gnc:error error-str)
(cons #f (sprintf
(_ "Transactions relating to '%s' contain \
(cons #f (format
(_ "Transactions relating to '~a' contain \
more than one currency. This report is not designed to cope with this possibility.") (gncOwnerGetName owner))))
(begin
(gnc:debug "it's an old company")

View File

@ -30,7 +30,6 @@
(use-modules (srfi srfi-1))
(use-modules (gnucash gnc-module))
(use-modules (gnucash printf))
(use-modules (gnucash utilities)) ; for gnc:debug
(use-modules (gnucash gettext))
@ -904,8 +903,8 @@
(list
(gncOwnerGetName owner)
(gnc:make-gnc-monetary currency profit)
;;(sprintf #f (if (< (abs markupfloat) 10) "%2.1f%%" "%2.0f%%") markupfloat)
(sprintf #f "%2.0f%%" markupfloat)
;;(format #f (if (< (abs markupfloat) 10) "~2.1f%%" "%2.0f%%") markupfloat)
(format #f "~2,0f%" markupfloat)
(gnc:make-gnc-monetary currency sales))))
(if show-column-expense?
(set!
@ -928,7 +927,7 @@
(list
(_ "No Customer")
(gnc:make-gnc-monetary currency other-profit)
(sprintf #f "%2.0f%%" markupfloat)
(format #f "~2,0f%" markupfloat)
(gnc:make-gnc-monetary currency other-sales))))
(if show-column-expense?
(set!
@ -959,8 +958,8 @@
(list
(_ "Total")
(gnc:make-gnc-monetary currency total-profit)
;;(sprintf #f (if (< (abs markupfloat) 10) "%2.1f%%" "%2.0f%%") markupfloat)
(sprintf #f "%2.0f%%" markupfloat)
;;(format #f (if (< (abs markupfloat) 10) "~2,1f%" "~2,0f%") markupfloat)
(format #f "~2,0f%" markupfloat)
(gnc:make-gnc-monetary currency toplevel-total-income))))
(if show-column-expense?
(set!
@ -1000,8 +999,8 @@
(if any-valid-owner?
;; Report contains valid data
(let ((headline
(sprintf
#f (_ "%s %s - %s")
(format
#f (_ "~a ~a - ~a")
report-title
(qof-print-date start-date)
(qof-print-date end-date))))
@ -1020,9 +1019,9 @@
(gnc:html-document-add-object!
document
(gnc:make-html-text
(sprintf #f
(_ "No valid %s selected. Click on the Options button to select a company.")
(_ type-str))))) ;; FIXME because of translations: Please change this string into full sentences instead of sprintf, because in non-english languages the "no valid" has different forms depending on the grammatical gender of the "%s".
(format #f
(_ "No valid ~a selected. Click on the Options button to select a company.")
(_ type-str))))) ;; FIXME because of translations: Please change this string into full sentences instead of format, because in non-english languages the "no valid" has different forms depending on the grammatical gender of the "%s".
(qof-query-destroy owner-query)
(qof-query-destroy toplevel-income-query)

View File

@ -31,7 +31,6 @@
(define-module (gnucash report easy-invoice))
(use-modules (srfi srfi-1))
(use-modules (gnucash printf))
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
@ -714,7 +713,7 @@
(begin
(set! credit-note? #t)
(set! default-title (_ "Credit Note"))))))
(set! title (sprintf #f (_"%s #%d") (title-string default-title custom-title)
(set! title (format #f (_"~a #~d") (title-string default-title custom-title)
(gncInvoiceGetID invoice)))))
; (gnc:html-document-set-title! document title)
@ -735,7 +734,7 @@
(add-html! document "<td align='left'>")
(add-html! document "<b><u>")
(add-html! document title)
;; (add-html! document (sprintf #f (_ "Invoice #%d")
;; (add-html! document (format #f (_ "Invoice #~d")
;; (gncInvoiceGetID invoice)))
(add-html! document "</u></b></td>")
(add-html! document "<td align='right'>")

View File

@ -49,7 +49,6 @@
(define-module (gnucash report fancy-invoice))
(use-modules (srfi srfi-1))
(use-modules (gnucash printf))
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
@ -867,13 +866,13 @@
;; Translators: %s below is "Invoice" or "Bill" or even the
;; custom title from the options. The next column contains
;; the number of the document.
date-table (list (sprintf #f (_ "%s&nbsp;#") title) (gncInvoiceGetID invoice)))
date-table (list (format #f (_ "~s&nbsp;#") title) (gncInvoiceGetID invoice)))
;; Translators: The first %s below is "Invoice" or
;; "Bill" or even the custom title from the
;; options. This string sucks for i18n, but I don't
;; have a better solution right now without breaking
;; other people's invoices.
(make-date-row! date-table (sprintf #f (_ "%s&nbsp;Date") title) post-date date-format)
(make-date-row! date-table (format #f (_ "~s&nbsp;Date") title) post-date date-format)
(make-date-row! date-table (_ "Due&nbsp;Date") due-date date-format)
date-table)
(gnc:make-html-text

View File

@ -25,7 +25,6 @@
(define-module (gnucash report invoice))
(use-modules (srfi srfi-1))
(use-modules (gnucash printf))
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
@ -687,7 +686,7 @@
(set! title (title-string default-title custom-title))))
(gnc:html-document-set-title! document (sprintf #f (_"%s #%d") title
(gnc:html-document-set-title! document (format #f (_"~a #~d") title
(gncInvoiceGetID invoice)))
(if (not (null? invoice))

View File

@ -27,7 +27,6 @@
(define-module (gnucash report job-report))
(use-modules (srfi srfi-1))
(use-modules (gnucash printf))
(use-modules (gnucash gnc-module))
(use-modules (gnucash utilities)) ; for gnc:debug
(use-modules (gnucash gettext))
@ -632,9 +631,9 @@
(gnc:html-document-add-object!
document
(gnc:make-html-text
(sprintf #f
(_ "No valid %s selected. Click on the Options button to select a company.")
(_ type-str))))) ;; FIXME because of translations: Please change this string into full sentences instead of sprintf, because in non-english languages the "no valid" has different forms depending on the grammatical gender of the "%s".
(format #f
(_ "No valid ~a selected. Click on the Options button to select a company.")
(_ type-str))))) ;; FIXME because of translations: Please change this string into full sentences instead of format, because in non-english languages the "no valid" has different forms depending on the grammatical gender of the "%s".
(qof-query-destroy query)
document))

View File

@ -69,7 +69,6 @@
(define-module (gnucash report taxtxf-de_DE))
(use-modules (gnucash utilities))
(use-modules (srfi srfi-1))
(use-modules (gnucash printf))
(use-modules (gnucash core-utils)) ; for gnc:version
(use-modules (gnucash gettext))
@ -845,7 +844,7 @@
"center"
(gnc:html-markup-p
(gnc:html-markup/format
(_ "Period from %s to %s") from-date to-date)))))
(_ "Period from ~a to ~a") from-date to-date)))))
(gnc:html-document-add-object!
doc (gnc:make-html-text

View File

@ -102,7 +102,6 @@
(load-extension "libgncmod-gnome-utils" "scm_init_sw_gnome_utils_module"))
(use-modules (sw_gnome_utils)) ;; to get to gnc-error-dialog
(use-modules (gnucash printf))
(use-modules (gnucash core-utils)) ; for gnc:version
(gnc:module-load "gnucash/html" 0) ; added for 'gnc-html-engine-supports-css'
@ -594,7 +593,7 @@
(value (string-append "$" ; in txf output, income is positive; expense negative
; liabilities are positive, assets are negative;
; essentially, just reverse signs on dr's & cr's
(sprintf #f "%.2f" (gnc-numeric-to-double
(format #f "!0,2f" (gnc-numeric-to-double
(gnc-numeric-neg
account-value)))))
)
@ -3180,8 +3179,8 @@
(not (string=? ""
(gnc-get-current-book-tax-name))))
"Tax Name: %s<BR>"
"%s")
"Period from %s to %s<BR>Tax Year %s<BR>Tax Entity Type: %s<BR>All amounts in USD unless otherwise noted")
"~a")
"Period from ~a to ~s<BR>Tax Year ~a<BR>Tax Entity Type: %s<BR>All amounts in USD unless otherwise noted")
(gnc-get-current-book-tax-name)
from-date
to-date
@ -3456,27 +3455,27 @@
(string-append
"Selected Report Options:<BR>"
;; selected accounts
"&nbsp; &nbsp; &nbsp; %s <BR>"
"&nbsp; &nbsp; &nbsp; ~a <BR>"
;; suppress 0.00 values
"&nbsp; &nbsp; &nbsp; %s <BR>"
"&nbsp; &nbsp; &nbsp; ~a <BR>"
;; full acct names
"&nbsp; &nbsp; &nbsp; %s <BR>"
"&nbsp; &nbsp; &nbsp; ~a <BR>"
;; transfer detail
"&nbsp; &nbsp; &nbsp; %s <BR>"
"&nbsp; &nbsp; &nbsp; ~a <BR>"
;; TXF detail
"&nbsp; &nbsp; &nbsp; %s <BR>"
"&nbsp; &nbsp; &nbsp; ~a <BR>"
;; action:memo detail
"&nbsp; &nbsp; &nbsp; %s <BR>"
"&nbsp; &nbsp; &nbsp; ~a <BR>"
;; transaction detail
"&nbsp; &nbsp; &nbsp; %s <BR>"
"&nbsp; &nbsp; &nbsp; ~a <BR>"
;; special dates
"&nbsp; &nbsp; &nbsp; %s <BR>"
"&nbsp; &nbsp; &nbsp; ~a <BR>"
;; currency conversion date
"&nbsp; &nbsp; &nbsp; %s <BR>"
"&nbsp; &nbsp; &nbsp; ~a <BR>"
;; alternate transaction shading
(if (gnc-html-engine-supports-css)
""
"&nbsp; &nbsp; &nbsp; %s <BR>"
"&nbsp; &nbsp; &nbsp; ~a <BR>"
))
(if (not (null? user-sel-accnts))
"Subset of accounts"

View File

@ -31,8 +31,6 @@
(use-modules (gnucash gettext))
(use-modules (gnucash report utility-reports))
(use-modules (gnucash printf))
(eval-when
(compile load eval expand)
(load-extension "libgncmod-gnome-utils" "scm_init_sw_gnome_utils_module")
@ -67,7 +65,7 @@
(if (not menu-tip)
(set! menu-tip
(sprintf #f (_ "Display the %s report") (_ name))))
(format #f (_ "Display the ~a report") (_ name))))
(set! item
(gnc:make-menu-item

View File

@ -86,7 +86,6 @@
(use-modules (ice-9 regex)) ; for regular expressions
(use-modules (ice-9 rdelim)) ; for read-line
(use-modules (ice-9 local-eval)) ; for the-environment
(use-modules (gnucash printf))
(use-modules (gnucash app-utils)) ; for _
;; This is needed for displaying error messages -- note that it assumes that
@ -244,7 +243,7 @@
;; Process a template file and return the result as a string
(define (eguile-file-to-string infile environment)
(if (not (access? infile R_OK))
(sprintf #f (_ "Template file \"%s\" can not be read") infile)
(format #f (_ "Template file \"~a\" can not be read") infile)
(let ((script (with-input-from-file
infile
(lambda () (with-output-to-string template->script)))))

View File

@ -22,7 +22,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gnc:module-load "gnucash/html" 0)
(use-modules (gnucash printf))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; <html-document> class
@ -238,7 +237,7 @@
(if (not style-info)
(gnc:make-html-data-style-info
(lambda (datum parms)
(sprintf #f "%a %a" markup datum))
(format #f "~a ~a" markup datum))
#f)
style-info)))

View File

@ -33,8 +33,6 @@
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-modules (gnucash printf))
(define <html-table>
(make-record-type "<html-table>"
'(col-headers
@ -147,8 +145,8 @@
(gnc:html-document-push-style doc style)
(push (gnc:html-document-markup-start
doc (gnc:html-table-cell-tag cell) #t
(sprintf #f "rowspan=\"%a\"" (gnc:html-table-cell-rowspan cell))
(sprintf #f "colspan=\"%a\"" (gnc:html-table-cell-colspan cell))))
(format #f "rowspan=\"~a\"" (gnc:html-table-cell-rowspan cell))
(format #f "colspan=\"~a\"" (gnc:html-table-cell-colspan cell))))
(for-each
(lambda (child)
(push (gnc:html-object-render child doc)))

View File

@ -30,8 +30,6 @@
;; doc as arg to get the string out.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-modules (gnucash printf))
(define <html-text>
(make-record-type "<html-text>"
'(body style)))
@ -125,12 +123,12 @@
;; I'm not entirely pleased about the way this works, but I can't
;; really see a way around it. It still works within the style
;; system, but it flattens out its children's lists prematurely. Has
;; to, to pass them as args to sprintf.
;; to, to pass them as args to format.
(define (gnc:html-markup/format format . entities)
(lambda (doc)
(apply
sprintf #f format
format #f format
(map
(lambda (elt)
(let ((rendered-elt

View File

@ -22,8 +22,6 @@
;; Boston, MA 02110-1301, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-modules (gnucash printf))
;; returns a list with n #f (empty cell) values
(define (gnc:html-make-empty-cell) #f)
(define (gnc:html-make-empty-cells n)
@ -808,7 +806,7 @@
(gnc:html-markup-p
(gnc:html-markup-anchor
(gnc-build-url URL-TYPE-OPTIONS
(string-append "report-id=" (sprintf #f "%a" report-id))
(string-append "report-id=" (format #f "~a" report-id))
"")
(_ "Edit report options")))))

View File

@ -26,7 +26,6 @@
(use-modules (srfi srfi-1))
(use-modules (gnucash utilities))
(use-modules (gnucash printf))
(use-modules (gnucash report report-system))
(use-modules (gnucash app-utils))
(use-modules (gnucash engine))

View File

@ -18,7 +18,6 @@
;; Boston, MA 02110-1301, USA gnu@gnu.org
(use-modules (srfi srfi-13))
(use-modules (gnucash printf))
(define (list-ref-safe list elt)
(if (> (length list) elt)
@ -686,14 +685,14 @@
(xaccTransGetVoidStatus trans)))
(define (gnc:report-starting report-name)
(gnc-window-show-progress (sprintf #f
(_ "Building '%s' report ...")
(gnc-window-show-progress (format #f
(_ "Building '~a' report ...")
(gnc:gettext report-name))
0))
(define (gnc:report-render-starting report-name)
(gnc-window-show-progress (sprintf #f
(_ "Rendering '%s' report ...")
(gnc-window-show-progress (format #f
(_ "Rendering '~a' report ...")
(if (string-null? report-name)
(gnc:gettext "Untitled")
(gnc:gettext report-name)))

View File

@ -22,7 +22,6 @@
(use-modules (gnucash utilities))
(use-modules (gnucash app-utils))
(use-modules (gnucash printf))
(use-modules (gnucash gettext))
(eval-when
(compile load eval expand)

View File

@ -96,7 +96,6 @@
;(use-modules (gnucash engine))
;(use-modules (gnucash utilities))
;(use-modules (gnucash printf))
;(use-modules (gnucash report report-system))
;(use-modules (gnucash app-utils))
(use-modules (gnucash engine))

View File

@ -31,8 +31,6 @@
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
(use-modules (gnucash printf))
(gnc:module-load "gnucash/report/report-system" 0)
(define menuname-income (N_ "Income Piechart"))
@ -564,17 +562,17 @@ balance at a given time"))
(gnc:html-piechart-set-subtitle!
chart (string-append
(if do-intervals?
(sprintf #f
(_ "%s to %s")
(format #f
(_ "~a to ~a")
(qof-print-date from-date)
(qof-print-date to-date))
(sprintf #f
(_ "Balance at %s")
(format #f
(_ "Balance at ~a")
(qof-print-date to-date)))
(if show-total?
(let ((total (apply + (unzip1 combined))))
(sprintf
#f ": %s"
(format
#f ": ~a"
(xaccPrintAmount
(double-to-gnc-numeric
total
@ -602,8 +600,8 @@ balance at a given time"))
)
"")
(if show-percent?
(sprintf
#f " (%2.2f %%)"
(format
#f " (~2,2f %)"
(* 100.0 (/ (car pair) (apply + (unzip1 combined)))))
"")
))

View File

@ -32,8 +32,6 @@
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
(use-modules (gnucash printf))
(gnc:module-load "gnucash/report/report-system" 0)
(define reportname (N_ "Advanced Portfolio"))
@ -945,7 +943,7 @@
)
(if (= 0.0 moneyinvalue)
""
(sprintf #f "%.2f%%" (* 100 (/ bothgainvalue moneyinvalue)))))
(format #f "~0,2f%" (* 100 (/ bothgainvalue moneyinvalue)))))
)
(gnc:make-html-table-header-cell/markup "number-cell" income)))
(if (not (eq? handle-brokerage-fees 'ignore-brokerage))
@ -959,7 +957,7 @@
)
(if (= 0.0 moneyinvalue)
""
(sprintf #f "%.2f%%" (* 100 (/ totalreturnvalue moneyinvalue))))))
(format #f "~0,2f%" (* 100 (/ totalreturnvalue moneyinvalue))))))
)
)
@ -1027,7 +1025,7 @@
(gnc:html-document-set-title!
document (string-append
report-title
(sprintf #f " %s" (qof-print-date to-date))))
(format #f " ~a" (qof-print-date to-date))))
(if (not (null? accounts))
; at least 1 account selected
@ -1145,7 +1143,7 @@
)
(if (= 0.0 totalinvalue)
""
(sprintf #f "%.2f%%" (* 100 (/ totalgainvalue totalinvalue))))))
(format #f "~0,2f%" (* 100 (/ totalgainvalue totalinvalue))))))
(gnc:make-html-table-cell/markup
"total-number-cell" sum-total-income)))
(if (not (eq? handle-brokerage-fees 'ignore-brokerage))
@ -1164,7 +1162,7 @@
)
(if (= 0.0 totalinvalue)
""
(sprintf #f "%.2f%%" (* 100 (/ totalreturnvalue totalinvalue))))))
(format #f "~0,2f%" (* 100 (/ totalreturnvalue totalinvalue))))))
))

View File

@ -31,8 +31,6 @@
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
(use-modules (gnucash printf))
(gnc:module-load "gnucash/report/report-system" 0)
;; included since Bug726449

View File

@ -30,8 +30,6 @@
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
(use-modules (gnucash printf))
(gnc:module-load "gnucash/report/report-system" 0)
(gnc:module-load "gnucash/gnome-utils" 0) ;for gnc-build-url
@ -318,7 +316,7 @@
;; Display Title Name - Budget - Period
(gnc:html-document-set-title!
doc (sprintf #f (_ "%s: %s - %s")
doc (format #f (_ "~a: ~a - ~a")
report-name (gnc-budget-get-name budget)
(qof-print-date (gnc-budget-get-period-start-date budget (- period 1)))))

View File

@ -42,7 +42,6 @@
(define-module (gnucash report standard-reports budget-income-statement))
(use-modules (gnucash utilities))
(use-modules (gnucash printf))
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
@ -503,20 +502,20 @@
(period-for
(if use-budget-period-range?
(if (equal? user-budget-period-start user-budget-period-end)
(sprintf
(format
#f
(_ "for Budget %s Period %u")
(_ "for Budget ~a Period ~d")
budget-name
user-budget-period-start)
(sprintf
(format
#f
(_ "for Budget %s Periods %u - %u")
(_ "for Budget ~a Periods ~d - ~d")
budget-name
user-budget-period-start
user-budget-period-end))
(sprintf
(format
#f
(_ "for Budget %s")
(_ "for Budget ~a")
budget-name)))
)
@ -615,7 +614,7 @@
(gnc:html-document-set-title!
doc
(sprintf #f "%s %s %s" company-name report-title period-for))
(format #f "~a ~a ~a" company-name report-title period-for))
(set! table-env
(list

View File

@ -31,7 +31,6 @@
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
(use-modules (gnucash printf))
(use-modules (gnucash engine))
(use-modules (srfi srfi-1))
@ -876,7 +875,7 @@
)
(gnc:html-document-set-title!
doc (sprintf #f (_ "%s: %s")
doc (format #f (_ "~a: ~a")
report-name (gnc-budget-get-name budget)))
(set! accounts (sort accounts account-full-name<?))

View File

@ -32,7 +32,6 @@
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
(use-modules (gnucash engine))
(use-modules (gnucash printf))
(gnc:module-load "gnucash/report/report-system" 0)
(gnc:module-load "gnucash/gnome-utils" 0) ;for gnc-build-url
@ -164,7 +163,7 @@
doc (string-append
(get-option gnc:pagename-general gnc:optname-reportname)
" - "
(sprintf #f (_ "%s to %s")
(format #f (_ "~a to ~a")
(qof-print-date from-date-t64) (qof-print-date to-date-t64))))
@ -238,9 +237,9 @@
(if (and (= (gnc-account-get-current-depth account) tree-depth)
(not (eq? (gnc-account-get-children account) '())))
(if show-subaccts?
(_ "%s and subaccounts")
(_ "%s and selected subaccounts"))
"%s")
(_ "~a and subaccounts")
(_ "~a and selected subaccounts"))
"~a")
(gnc:html-markup-anchor
(gnc:account-anchor-text account)
(if show-full-names?

View File

@ -33,7 +33,6 @@
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
(use-modules (gnucash engine))
(use-modules (gnucash printf))
(gnc:module-load "gnucash/report/report-system" 0)
@ -309,8 +308,8 @@
(gnc:html-barchart-set-title! chart report-title)
(gnc:html-barchart-set-subtitle!
chart (sprintf #f
(_ "%s to %s")
chart (format #f
(_ "~a to ~a")
(qof-print-date from-date-t64)
(qof-print-date to-date-t64)))
(gnc:html-barchart-set-width! chart width)

View File

@ -32,8 +32,6 @@
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
(use-modules (gnucash printf))
(gnc:module-load "gnucash/report/report-system" 0)
;; included since Bug726449
@ -532,10 +530,10 @@ developing over time"))
(begin
(gnc:html-barchart-set-title! chart report-title)
(gnc:html-barchart-set-subtitle!
chart (sprintf #f
chart (format #f
(if do-intervals?
(_ "%s to %s")
(_ "Balances %s to %s"))
(_ "~a to ~a")
(_ "Balances ~a to ~a"))
(jqplot-escape-string (qof-print-date from-date-t64))
(jqplot-escape-string (qof-print-date to-date-t64))))
@ -558,10 +556,10 @@ developing over time"))
(begin
(gnc:html-linechart-set-title! chart report-title)
(gnc:html-linechart-set-subtitle!
chart (sprintf #f
chart (format #f
(if do-intervals?
(_ "%s to %s")
(_ "Balances %s to %s"))
(_ "~a to ~a")
(_ "Balances ~a to ~a"))
(jqplot-escape-string (qof-print-date from-date-t64))
(jqplot-escape-string (qof-print-date to-date-t64))))

View File

@ -35,8 +35,6 @@
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
(use-modules (gnucash printf))
(gnc:module-load "gnucash/report/report-system" 0)
(define menuname-income (N_ "Income vs. Day of Week"))
@ -475,14 +473,14 @@
(gnc:html-piechart-set-subtitle!
chart (string-append
(sprintf #f
(_ "%s to %s")
(format #f
(_ "~a to ~a")
(qof-print-date from-date)
(qof-print-date to-date))
(if show-total?
(let ((total (apply + daily-totals)))
(sprintf
#f ": %s"
(format
#f ": ~a"
(xaccPrintAmount
(double-to-gnc-numeric
total

View File

@ -50,8 +50,6 @@
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
(use-modules (gnucash printf))
(gnc:module-load "gnucash/report/report-system" 0)
(define reportname (N_ "Equity Statement"))
@ -277,9 +275,9 @@
)
(gnc:html-document-set-title!
doc (sprintf #f
(string-append "%s %s "
(_ "For Period Covering %s to %s"))
doc (format #f
(string-append "~a ~a "
(_ "For Period Covering ~a to ~a"))
company-name report-title
(qof-print-date start-date-printable)
(qof-print-date end-date)))
@ -344,7 +342,7 @@
(terse-period? #t)
(period-for (if terse-period?
(string-append " " (_ "for Period"))
(sprintf #f (string-append ", " (_ "%s to %s"))
(format #f (string-append ", " (_ "~a to ~a"))
(qof-print-date start-date-printable)
(qof-print-date end-date))
))

View File

@ -43,7 +43,6 @@
(define-module (gnucash report standard-reports income-statement))
(use-modules (gnucash utilities))
(use-modules (gnucash printf))
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
@ -430,8 +429,8 @@
(if (equal? tabbing 'canonically-tabbed) 1 0))))
(gnc:html-document-set-title!
doc (sprintf #f
(string-append "%s %s "
doc (format #f
(string-append "~a ~a "
(_ "For Period Covering %s to %s"))
company-name report-title
(qof-print-date start-date-printable)
@ -472,7 +471,7 @@
(terse-period? #t)
(period-for (if terse-period?
(string-append " " (_ "for Period"))
(sprintf #f (string-append ", " (_ "%s to %s"))
(format #f (string-append ", " (_ "~a to ~a"))
(qof-print-date start-date-printable)
(qof-print-date end-date))
)

View File

@ -31,7 +31,6 @@
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
(use-modules (gnucash printf))
(use-modules (gnucash report report-system report-collectors))
(use-modules (gnucash report report-system collectors))
(use-modules (gnucash report standard-reports category-barchart)) ; for guids of called reports
@ -333,8 +332,8 @@
(gnc:html-barchart-set-title!
chart report-title)
(gnc:html-barchart-set-subtitle!
chart (sprintf #f
(_ "%s to %s")
chart (format #f
(_ "~a to ~a")
(jqplot-escape-string (qof-print-date from-date-t64))
(jqplot-escape-string (qof-print-date to-date-t64))))
(gnc:html-barchart-set-width! chart width)

View File

@ -32,7 +32,6 @@
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
(use-modules (gnucash printf))
(use-modules (gnucash report report-system report-collectors))
(use-modules (gnucash report report-system collectors))
(use-modules (gnucash report standard-reports category-barchart)) ; for guids of called reports
@ -376,8 +375,8 @@
(gnc:html-linechart-set-title!
chart report-title)
(gnc:html-linechart-set-subtitle!
chart (sprintf #f
(_ "%s to %s")
chart (format #f
(_ "~a to ~a")
(qof-print-date from-date-t64)
(qof-print-date to-date-t64)))
(gnc:html-linechart-set-width! chart width)

View File

@ -28,8 +28,6 @@
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
(use-modules (gnucash printf))
(gnc:module-load "gnucash/report/report-system" 0)
(define reportname (N_ "Investment Portfolio"))
@ -156,7 +154,7 @@
(gnc:html-price-anchor price price-monetary))
(gnc:make-html-table-header-cell/markup
"number-cell" value)))
;;(display (sprintf #f "Shares: %6.6d " (gnc-numeric-to-double units)))
;;(display (format #f "Shares: ~6d " (gnc-numeric-to-double units)))
;;(display units) (newline)
(if price (gnc-price-unref price))
(table-add-stock-rows-internal rest (not odd-row?)))
@ -191,7 +189,7 @@
(gnc:html-document-set-title!
document (string-append
report-title
(sprintf #f " %s" (qof-print-date to-date))))
(format #f " ~a" (qof-print-date to-date))))
;(gnc:debug "accounts" accounts)
(if (not (null? accounts))

View File

@ -30,8 +30,6 @@
(use-modules (gnucash core-utils))
(use-modules (gnucash gettext))
(use-modules (gnucash printf))
(gnc:module-load "gnucash/report/report-system" 0)
(define optname-from-date (N_ "Start Date"))
@ -200,8 +198,8 @@
(gnc-commodity-get-mnemonic report-currency)
(gnc-commodity-get-mnemonic price-commodity))
" - "
(sprintf #f
(_ "%s to %s")
(format #f
(_ "~a to ~a")
(qof-print-date from-date)
(qof-print-date to-date))))
(gnc:html-scatter-set-width! chart width)

View File

@ -36,7 +36,6 @@
(use-modules (srfi srfi-1))
(use-modules (gnucash utilities))
(use-modules (gnucash printf))
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
@ -310,9 +309,9 @@
)
(gnc:html-document-set-title!
doc (sprintf #f
(string-append "%s %s "
(_ "For Period Covering %s to %s"))
doc (format #f
(string-append "~a ~a "
(_ "For Period Covering ~a to ~a"))
company-name report-title
(qof-print-date from-date)
(qof-print-date to-date))

View File

@ -27,7 +27,6 @@
(gnc:module-load "gnucash/report/report-system" 0)
(use-modules (gnucash utilities))
(use-modules (gnucash printf))
(use-modules (gnucash report report-system))
(use-modules (gnucash app-utils))
(use-modules (gnucash engine))

View File

@ -31,7 +31,6 @@
(gnc:module-begin-syntax (gnc:module-load "gnucash/report/report-system" 0))
(use-modules (gnucash utilities))
(use-modules (gnucash printf))
(use-modules (gnucash report report-system))
(use-modules (gnucash app-utils))
(use-modules (gnucash engine))

View File

@ -44,7 +44,6 @@
(use-modules (ice-9 regex))
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
(use-modules (gnucash printf))
(gnc:module-load "gnucash/report/report-system" 0)
@ -1845,8 +1844,8 @@ tags within description, notes or memo. ")
document
(gnc:make-html-text
(gnc:html-markup-h3
(sprintf #f
(_ "From %s to %s")
(format #f
(_ "From ~a to ~a")
(qof-print-date begindate)
(qof-print-date enddate)))))

View File

@ -52,7 +52,6 @@
(define-module (gnucash report standard-reports trial-balance))
(use-modules (gnucash utilities))
(use-modules (gnucash printf))
(use-modules (gnucash gnc-module))
(use-modules (gnucash gettext))
@ -388,7 +387,7 @@
(terse-period? #t)
(period-for (if terse-period?
(string-append " " (_ "for Period"))
(sprintf #f (string-append ", " (_ "%s to %s"))
(format #f (string-append ", " (_ "~a to ~a"))
(qof-print-date start-date-printable)
(qof-print-date end-date))
))
@ -396,11 +395,11 @@
(gnc:html-document-set-title!
doc (if (equal? report-variant 'current)
(sprintf #f (string-append "%s %s %s")
(format #f (string-append "~a ~a ~a")
company-name report-title
(qof-print-date end-date))
(sprintf #f (string-append "%s %s "
(_ "For Period Covering %s to %s"))
(format #f (string-append "~a ~a "
(_ "For Period Covering ~a to ~a"))
company-name report-title
(qof-print-date start-date-printable)
(qof-print-date end-date))

View File

@ -346,7 +346,7 @@ or extending existing reports.")))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "For help on writing reports, or to contribute your brand \
new, totally cool report, consult the mailing list %s.")
new, totally cool report, consult the mailing list ~a.")
(gnc:html-markup-anchor
"mailto:gnucash-devel@gnucash.org"
(gnc:html-markup-tt "gnucash-devel@gnucash.org")))
@ -355,47 +355,47 @@ new, totally cool report, consult the mailing list %s.")
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The current time is %s.")
(_ "The current time is ~a.")
(gnc:html-markup-b time-string)))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The boolean option is %s.")
(_ "The boolean option is ~a.")
(gnc:html-markup-b (if bool-val (_ "true") (_ "false")))))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The multi-choice option is %s.")
(_ "The multi-choice option is ~a.")
(gnc:html-markup-b (symbol->string mult-val))))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The string option is %s.")
(_ "The string option is ~a.")
(gnc:html-markup-b string-val)))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The date option is %s.")
(_ "The date option is ~a.")
(gnc:html-markup-b date-string)))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The date and time option is %s.")
(_ "The date and time option is ~a.")
(gnc:html-markup-b date-string2)))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The relative date option is %s.")
(_ "The relative date option is ~a.")
(gnc:html-markup-b rel-date-string)))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The combination date option is %s.")
(_ "The combination date option is ~a.")
(gnc:html-markup-b combo-date-string)))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The number option is %s.")
(_ "The number option is ~a.")
(gnc:html-markup-b (number->string num-val))))
;; Here we print the value of the number option formatted as
@ -406,7 +406,7 @@ new, totally cool report, consult the mailing list %s.")
;; it yourself -- it will be wrong in other locales.
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The number option formatted as currency is %s.")
(_ "The number option formatted as currency is ~a.")
(gnc:html-markup-b
(xaccPrintAmount
(inexact->exact num-val)

View File

@ -36,8 +36,6 @@
(load-extension "libgncmod-report-system" "scm_init_sw_report_system_module"))
(use-modules (sw_report_system))
(use-modules (gnucash printf))
(gnc:module-load "gnucash/report/report-system" 0)
(gnc:module-load "gnucash/html" 0) ;for gnc-build-url
@ -172,7 +170,7 @@
(gnc-build-url
URL-TYPE-OPTIONS
(string-append "report-id="
(sprintf #f "%a" (car report-info)))
(format #f "~a" (car report-info)))
"")
(_ "Edit Options"))
"&nbsp;"
@ -180,7 +178,7 @@
(gnc-build-url
URL-TYPE-REPORT
(string-append "id="
(sprintf #f "%a" (car report-info)))
(format #f "~a" (car report-info)))
"")
(_ "Single Report")))))

View File

@ -22,7 +22,6 @@
(use-modules (gnucash core-utils)
(gnucash printf)
(gnucash gettext))
(define gnc:reldate-list '())
@ -72,7 +71,7 @@
(gnc-locale-to-utf8 (strftime "%Y" datevec)))
(define (gnc:date-get-quarter-string datevec)
(sprintf #f "Q%d" (gnc:date-get-quarter datevec)))
(format #f "Q~d" (gnc:date-get-quarter datevec)))
(define (gnc:date-get-quarter-year-string datevec)
(string-append
@ -92,7 +91,7 @@
604800))
(begin-string (qof-print-date (+ beginweekt64 345600)))
(end-string (qof-print-date (+ beginweekt64 864000))))
(sprintf #f (_ "%s to %s") begin-string end-string)))
(format #f (_ "~s to ~s") begin-string end-string)))
; (let ((begin-string (qof-print-date
; (+ (* (gnc:date-get-week
@ -104,7 +103,7 @@
; (gnc:time64-start-day-time
; (gnc-mktime datevec)))
; 604800) 864000))))
; (sprintf #f (_ "%s to %s") begin-string end-string)))
; (format #f (_ "~s to ~s") begin-string end-string)))
;; is leap year?
(define (gnc:leap-year? year)

View File

@ -58,7 +58,7 @@ GNC_ADD_SCHEME_TARGETS(scm-test-c-interface
FALSE
)
GNC_ADD_SCHEME_TESTS(${test_app_utils_scheme_SOURCES})
GNC_ADD_SCHEME_TESTS("${test_app_utils_scheme_SOURCES}")
# Doesn't work yet:
GNC_ADD_TEST_WITH_GUILE(test-app-utils "${test_app_utils_SOURCES}" APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS)

View File

@ -3,9 +3,10 @@
(use-modules (gnucash engine test test-extras))
(define (run-test)
(and (test test-weeknum-calculator)))
(and (test test-weeknum-calculator)
(test test-date-get-quarter-string)))
(define (create-time64 l)
(define (create-datevec l)
(let ((now (gnc-localtime (current-time))))
(set-tm:sec now (list-ref l 5))
(set-tm:min now (list-ref l 4))
@ -14,6 +15,10 @@
(set-tm:mon now (list-ref l 1))
(set-tm:year now (list-ref l 0))
(set-tm:isdst now -1)
now))
(define (create-time64 l)
(let ((now (create-datevec l)))
(gnc-mktime now)))
(define (weeknums-equal? pair-of-dates)
@ -36,3 +41,15 @@
(not (weeknums-equal? (cons '(1969 12 28 0 0 1)
'(1970 1 5 0 0 1))))
))
(define (test-date-get-quarter-string)
(and (or (string=? "Q1" (gnc:date-get-quarter-string (create-datevec '(2001 2 14 11 42 23))))
(begin (format #t "Expected Q1, got ~a~%" (gnc:date-get-quarter-string (creaete-datevec '(2001 2 14 11 42 23))))
#f))
(or (string=? "Q2" (gnc:date-get-quarter-string (create-datevec '(2013 4 23 18 11 49))))
(begin (format #t "Expected Q1, got ~a~%" (gnc:date-get-quarter-string (create-datevec '(2001 2 14 11 42 23))))
#f))
(or (string=? "Q3" (gnc:date-get-quarter-string (create-datevec '(1997 9 11 08 14 21))))
(begin (format #t "Expected Q1, got ~a~%" (gnc:date-get-quarter-string (create-datevec '(2001 2 14 11 42 23)))))
#f)))

View File

@ -21,7 +21,6 @@
(use-modules (gnucash gnc-module))
(use-modules (gnucash printf))
(use-modules (gnucash app-utils))
(use-modules (gnucash engine))
(use-modules (srfi srfi-1))

View File

@ -1,5 +1,5 @@
SET(GUILE_DEPENDS scm-core-utils scm-gnc-module)
SET(scm_scm_1_SCHEME printf.scm string.scm utilities.scm)
SET(scm_scm_1_SCHEME string.scm utilities.scm)
GNC_ADD_SCHEME_TARGETS(scm-scm-1

File diff suppressed because it is too large Load Diff

View File

@ -694,7 +694,6 @@ libgnucash/gnc-module/example/gncmod-example.c
libgnucash/gnc-module/gnc-module.c
libgnucash/gnc-module/gnc-module.scm
libgnucash/scm/price-quotes.scm
libgnucash/scm/printf.scm
libgnucash/scm/string.scm
libgnucash/scm/utilities.scm
libgnucash/tax/us/de_DE.scm