html - expose wrapped api directly from a newly created html.scm

With that in place we no longer need to (gnc:module-load "gnucash/html" 0)
the html gncmodule. An ordinary (use-modules (gnucash html)) suffices

html.scm is newly created. It serves two purposes:
1. expose the swigified html api to scheme
2. ensure gnc_html_initialize is run before first use (in scheme) of the api
This commit is contained in:
Geert Janssens 2019-11-23 21:21:10 +01:00
parent bd311d5dfb
commit b96dc6ff89
17 changed files with 74 additions and 39 deletions

View File

@ -32,7 +32,21 @@ else ()
set(html_EXTRA_DIST gnc-html-webkit1.h gnc-html-webkit1.c)
endif ()
set_dist_list(html_DIST CMakeLists.txt ${html_HEADERS} ${html_SOURCES} gnc-html.i ${html_EXTRA_DIST})
set (gnc_html_SCHEME html.scm)
set(GUILE_OUTPUT_DIR gnucash)
set(GUILE_DEPENDS gncmod-html gnucash-guile)
gnc_add_scheme_targets(scm-gnc-html
"${gnc_html_SCHEME}"
${GUILE_OUTPUT_DIR}
"${GUILE_DEPENDS}"
FALSE
)
set_dist_list(html_DIST CMakeLists.txt ${html_HEADERS} ${html_SOURCES} gnc-html.i ${html_EXTRA_DIST} html.scm)
add_library (gncmod-html
${html_SOURCES}

View File

@ -48,6 +48,7 @@ SCM scm_init_sw_gnc_html_module(void);
%include "gnc-html-extras.h"
void gnc_html_initialize(void);
%init {
{

39
gnucash/html/html.scm Normal file
View File

@ -0,0 +1,39 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; gnc-html.scm
;;; Guile module for gnc-html
;;;
;;; Copyright 2019 Geert Janssens <geert@kobaltwit.be>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-module (gnucash html))
;; Guile 2 needs to find the symbols from the extension at compile time already
(eval-when
(compile load eval expand)
(load-extension "libgncmod-html" "scm_init_sw_gnc_html_module"))
(use-modules (sw_gnc_html))
; Export the swig-wrapped symbols in the public interface of this module
(let ((i (module-public-interface (current-module))))
(module-use! i (resolve-interface '(sw_gnc_html))))
(gnc-html-initialize)

View File

@ -89,7 +89,7 @@ set (report_eguile_SCHEME
)
set(GUILE_DEPENDS
gncmod-html
scm-gnc-html
scm-gnome-utils
gncmod-report
scm-app-utils

View File

@ -21,7 +21,7 @@
;; Boston, MA 02110-1301, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(gnc:module-load "gnucash/html" 0)
(use-modules (gnucash html))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; <html-document> class

View File

@ -33,9 +33,7 @@
(use-modules (gnucash engine))
(use-modules (gnucash app-utils))
(use-modules (gnucash gnome-utils))
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/html" 0)
(use-modules (gnucash html))
;; commodity-utilities.scm
(export gnc:get-match-commodity-splits)

View File

@ -72,19 +72,17 @@ set (reports_SCHEME
)
set(scm_rpts_GUILE_DEPENDS
gncmod-html
scm-gnc-html
scm-core-utils
scm-engine
scm-core-utils
scm-gnome-utils
scm-report
)
set(scm_rpt_example_GUILE_DEPENDS
gncmod-html
scm-gnc-html
scm-app-utils
scm-core-utils
scm-core-utils
scm-gnc-module
scm-engine
scm-reports-example-links
@ -93,8 +91,7 @@ set(scm_rpt_example_GUILE_DEPENDS
)
set(scm_rpt_locale_specific_GUILE_DEPENDS
gncmod-html
scm-core-utils
scm-gnc-html
scm-core-utils
scm-gnc-module
scm-engine

View File

@ -30,12 +30,10 @@
(use-modules (gnucash core-utils))
(use-modules (gnucash app-utils))
(use-modules (gnucash report))
(use-modules (gnucash html))
(debug-enable 'backtrace)
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/html" 0) ;for gnc-build-url
;; This function will generate a set of options that GnuCash
;; will use to display a dialog where the user can select
;; values for your report's parameters.

View File

@ -107,9 +107,7 @@
(use-modules (gnucash gnome-utils))
(use-modules (gnucash report))
(use-modules (srfi srfi-1))
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/html" 0)
(use-modules (gnucash html))
(define reportname (N_ "Tax Schedule Report/TXF Export"))

View File

@ -38,13 +38,11 @@
(use-modules (gnucash app-utils))
(use-modules (gnucash eguile))
(use-modules (gnucash report))
(use-modules (gnucash html))
(use-modules (ice-9 local-eval)) ; for the-environment
(use-modules (srfi srfi-13)) ; for extra string functions
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/html" 0)
(define debugging? #f)
(define (debug . args)

View File

@ -22,9 +22,7 @@
(use-modules (gnucash core-utils))
(use-modules (gnucash app-utils))
(use-modules (gnucash report))
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/html" 0)
(use-modules (gnucash html))
(use-modules (gnucash eguile))

View File

@ -30,9 +30,7 @@
(use-modules (gnucash core-utils))
(use-modules (gnucash app-utils))
(use-modules (gnucash report))
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/html" 0)
(use-modules (gnucash html))
(use-modules (gnucash eguile))

View File

@ -32,9 +32,7 @@
(use-modules (gnucash core-utils))
(use-modules (gnucash app-utils))
(use-modules (gnucash report))
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/html" 0) ;for gnc-build-url
(use-modules (gnucash html))
(define (make-options)
(let* ((options (gnc:new-options))

View File

@ -39,10 +39,9 @@
(use-modules (gnucash engine))
(use-modules (gnucash utilities))
(use-modules (gnucash core-utils))
(use-modules (gnucash app-utils))
(use-modules (gnucash report))
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/html" 0)
(use-modules (gnucash html))
(define (easy-fancy-footer-options)
(let* ((options (gnc:new-options))

View File

@ -38,10 +38,9 @@
(use-modules (gnucash engine))
(use-modules (gnucash utilities))
(use-modules (gnucash core-utils)) ; for gnc:version and (_ ...)
(use-modules (gnucash app-utils))
(use-modules (gnucash report))
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/html" 0)
(use-modules (gnucash html))
(define (head-or-tail-options)
(let* ((options (gnc:new-options))

View File

@ -27,12 +27,11 @@
(use-modules (gnucash engine))
(use-modules (gnucash utilities))
(use-modules (gnucash core-utils))
(use-modules (gnucash app-utils))
(use-modules (gnucash report))
(use-modules (srfi srfi-13))
(use-modules (srfi srfi-14))
(use-modules (gnucash gnc-module))
(gnc:module-load "gnucash/html" 0)
(use-modules (gnucash html))
;; plain style sheet
;; this should generally be the default style sheet for most reports.

View File

@ -300,6 +300,7 @@ gnucash/html/gnc-html-history.c
gnucash/html/gnc-html-webkit1.c
gnucash/html/gnc-html-webkit2.c
gnucash/html/gncmod-html.c
gnucash/html/html.scm
gnucash/import-export/aqb/assistant-ab-initial.c
gnucash/import-export/aqb/assistant-ab-initial.glade
gnucash/import-export/aqb/dialog-ab-daterange.c