mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
start g-wrapping register-core
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6388 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
465fa68ee6
commit
15161dabf3
@ -1,6 +1,11 @@
|
|||||||
Makefile
|
Makefile
|
||||||
|
Makefile.in
|
||||||
.deps
|
.deps
|
||||||
.libs
|
.libs
|
||||||
Makefile.in
|
.scm-links
|
||||||
*.lo
|
*.lo
|
||||||
*.la
|
*.la
|
||||||
|
gw-register-core.c
|
||||||
|
gw-register-core.h
|
||||||
|
gw-register-core.html
|
||||||
|
gw-register-core.scm
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
SUBDIRS = . test
|
SUBDIRS = . test
|
||||||
|
|
||||||
pkglib_LTLIBRARIES = libgncmod-register-core.la
|
pkglib_LTLIBRARIES = libgncmod-register-core.la libgw-register-core.la
|
||||||
|
|
||||||
libgncmod_register_core_la_LDFLAGS = -module
|
libgncmod_register_core_la_LDFLAGS = -module
|
||||||
libgncmod_register_core_la_LIBADD = \
|
libgncmod_register_core_la_LIBADD = \
|
||||||
@ -47,8 +47,15 @@ gncinclude_HEADERS = \
|
|||||||
table-layout.h \
|
table-layout.h \
|
||||||
table-model.h
|
table-model.h
|
||||||
|
|
||||||
|
libgw_register_core_la_SOURCES = gw-register-core.c
|
||||||
|
libgw_register_core_la_LDFLAGS = -module
|
||||||
|
|
||||||
|
gwmoddir = ${GNC_GWRAP_LIBDIR}
|
||||||
|
gwmod_DATA = gw-register-core.scm gw-register-core-spec.scm
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
.cvsignore
|
.cvsignore \
|
||||||
|
${gwmod_DATA}
|
||||||
|
|
||||||
AM_CFLAGS = \
|
AM_CFLAGS = \
|
||||||
-I${top_srcdir}/src \
|
-I${top_srcdir}/src \
|
||||||
@ -60,3 +67,22 @@ AM_CFLAGS = \
|
|||||||
${GLADE_CFLAGS} \
|
${GLADE_CFLAGS} \
|
||||||
${GNOME_INCLUDEDIR} \
|
${GNOME_INCLUDEDIR} \
|
||||||
${GUILE_INCS}
|
${GUILE_INCS}
|
||||||
|
|
||||||
|
gw-register-core.scm gw-register-core.c gw-register-core.h: .scm-links gw-register-core-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-register-core-spec.scm\") \
|
||||||
|
(gw:generate-module \"gw-register-core\")"
|
||||||
|
|
||||||
|
BUILT_SOURCES += gw-register-core.scm gw-register-core.c gw-register-core.h
|
||||||
|
CLEANFILES = gw-register-core.scm gw-register-core.c gw-register-core.h \
|
||||||
|
gw-register-core.html gnucash g-wrapped register .scm-links
|
||||||
|
|
||||||
|
.scm-links:
|
||||||
|
rm -f gnucash g-wrapped
|
||||||
|
ln -sf . gnucash
|
||||||
|
ln -sf . g-wrapped
|
||||||
|
ln -sf . register
|
||||||
|
touch .scm-links
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <guile/gh.h>
|
||||||
|
|
||||||
#include "gnc-module.h"
|
#include "gnc-module.h"
|
||||||
#include "gnc-module-api.h"
|
#include "gnc-module-api.h"
|
||||||
@ -28,8 +29,17 @@ gnc_module_description(void) {
|
|||||||
return g_strdup("Toolkit-independent GUI for ledger-like table displays");
|
return g_strdup("Toolkit-independent GUI for ledger-like table displays");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
lmod(char * mn)
|
||||||
|
{
|
||||||
|
char * form = g_strdup_printf("(use-modules %s)\n", mn);
|
||||||
|
gh_eval_str(form);
|
||||||
|
g_free(form);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
gnc_module_init(int refcount) {
|
gnc_module_init(int refcount)
|
||||||
|
{
|
||||||
if(!gnc_module_load("gnucash/engine", 0))
|
if(!gnc_module_load("gnucash/engine", 0))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -42,7 +52,7 @@ gnc_module_init(int refcount) {
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lmod("(g-wrapped gw-register-core)");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
52
src/register/register-core/gw-register-core-spec.scm
Normal file
52
src/register/register-core/gw-register-core-spec.scm
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
(define-module (g-wrapped gw-register-core-spec))
|
||||||
|
|
||||||
|
(use-modules (g-wrap))
|
||||||
|
|
||||||
|
(debug-set! maxdepth 100000)
|
||||||
|
(debug-set! stack 2000000)
|
||||||
|
|
||||||
|
(let ((mod (gw:new-module "gw-register-core")))
|
||||||
|
(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-set-guile-module! mod '(g-wrapped gw-register-core))
|
||||||
|
|
||||||
|
(gw:module-set-declarations-ccodegen!
|
||||||
|
mod
|
||||||
|
(lambda (client-only?)
|
||||||
|
(list
|
||||||
|
"#include <basiccell.h>\n"
|
||||||
|
)))
|
||||||
|
|
||||||
|
(gw:wrap-non-native-type
|
||||||
|
mod '<gnc:basic-cell>
|
||||||
|
"BasicCell*" "const BasicCell*")
|
||||||
|
|
||||||
|
(gw:wrap-function
|
||||||
|
mod
|
||||||
|
'gnc:basic-cell-get-value
|
||||||
|
'(<gw:m-chars-callee-owned> gw:const)
|
||||||
|
"gnc_basic_cell_get_value"
|
||||||
|
'((<gnc:basic-cell> cell))
|
||||||
|
"Return the value of the cell.")
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user