Skip to content

Instantly share code, notes, and snippets.

View jralls's full-sized avatar

John Ralls jralls

View GitHub Profile
@jralls
jralls / Exception-experiments.patch
Last active October 22, 2017 18:59
Backtrace of GncNumeric abort
From 68ab5ae680d52b677696384377bfe63b13be0360 Mon Sep 17 00:00:00 2001
From: John Ralls <jralls@ceridwen.us>
Date: Sun, 22 Oct 2017 11:52:42 -0700
Subject: [PATCH] Exception experiments.
---
libgnucash/engine/gnc-numeric.cpp | 178 ++++++++++++++++++--------------
libgnucash/engine/gnc-numeric.hpp | 3 +
libgnucash/engine/test/test-numeric.cpp | 15 +++
3 files changed, 118 insertions(+), 78 deletions(-)
@jralls
jralls / gist:124311cdc8d44134c90a5d666f4854dd
Created April 13, 2018 19:52
GDB transcript showing scm_to_utf8_string() misbehavior.
Thread 1 hit Breakpoint 1, gnc_extension_name (extension=0x10e703c0)
at C:/gcdev64/gnucash/unstable/src/gnucash-git/gnucash/gnome-utils/gnc-menu-extensions.c:117
117 initialize_getters();
Thread 1 hit Breakpoint 2, gnc_scm_call_1_to_string (func=0xeb137a0,
arg=0x10e703c0)
at C:/gcdev64/gnucash/unstable/src/gnucash-git/libgnucash/core-utils/gnc-guile-utils.c:141
141 return gnc_scm_to_utf8_string(value);
$18 = (gchar *) 0xfba96e8 "Saldo (Sal▒rio)"
(gdb) s
PS C:\Users\René Romijn> & 'C:\Program Files (x86)\gnucash\bin\gnucash.exe' --debug --logto=gnucash.trace
(gnucash.exe:13056): gnc.core-utils-WARNING **: 13:39:11.536: C:\Users\René Romijn\AppData\Roaming is not a suitable base directory for the user data. Trying temporary directory instead.
(Error: C:\Users\René Romijn\AppData\Roaming is a descendant of a non-existing home directory. As GnuCash will never create a home directory this path can't be used: Permission denied: "C:\Users\René Romijn\AppData\Roaming")
3:2018/04/19 13-39-12:gwen(13056):C:/gcdev64/gnucash/maint/src/gwenhywfar-4.20.0/src/base/i18n.c: 120: No translation found for WIN32 locale [English_United States.1252]
(gnucash.exe:13056): Gdk-WARNING **: 13:39:14.954: gdkwindow-win32.c:2303: GetClientRect failed with code 1400: Invalid window handle.
Found Finance::Quote version 1.47
(gnucash.exe:13056): Gtk-WARNING **: 13:39:31.470: Allocating size to GncMainWindow 0c0802b8 without calling gtk_widget_get_preferred_width/height(). How does the
@jralls
jralls / bz.py
Created June 28, 2018 22:29
GnuCash bug update script.
from __future__ import print_function
import time
import bugzilla
URL = "bugzilla.gnome.org"
bzapi = bugzilla.Bugzilla(URL)
if not bzapi.logged_in:
print("You need to log in to %s" % URL)
bzapi.interactive_login()
@jralls
jralls / gist:39105f5c258e3be89362d97d7c68feae
Created July 22, 2018 23:54
Backtrace from compiling and-let-star.scm
make[2]: Entering directory '/c/gcdev64/gnucash/maint/build/guile-git/module'
GUILE_AUTO_COMPILE=0 \
../meta/build-env \
guild compile --target="i686-w64-mingw32" -Wunbound-variable -Wmacro-use-before-definition -Warity-mismatch -Wformat \
-L "/c/gcdev64/gnucash/maint/src/guile/module" -L "/c/gcdev64/gnucash/maint/build/guile-git/module" \
-L "/c/gcdev64/gnucash/maint/src/guile/guile-readline" \
-o "ice-9/and-let-star.go" "/c/gcdev64/gnucash/maint/src/guile/module/ice-9/and-let-star.scm"
Backtrace:
In ice-9/boot-9.scm:
152:2 19 (with-fluid* _ _ _)
@jralls
jralls / gist:3c7a0420574be5d8b8e084c3f04a0d36
Created April 29, 2019 19:08
Saved report scheme options from book.gcm
(let ((options (gnc:report-template-new-options/report-guid "c4173ac99b2b448289bf4d11c731af13" "Balance Sheet")))
(let ((option (gnc:lookup-option options "General" "Report Title")))
((lambda (option)
(if option ((gnc:option-setter option) "佳匯旅行社有限公司"))) option))
(let ((option (gnc:lookup-option options "General" "Report name")))
((lambda (option)
(if option ((gnc:option-setter option) "佳匯旅行社有限公司"))) option))
(if (defined? 'gnc:restore-report-by-guid-with-custom-template)
(gnc:restore-report-by-guid-with-custom-template 0 "c4173ac99b2b448289bf4d11c731af13" "Balance Sheet" "" options)
(gnc:restore-report-by-guid 0 "c4173ac99b2b448289bf4d11c731af13" "Balance Sheet" options)) )
@jralls
jralls / gist:12eb12adf9535cb47847cd901a9d324d
Created July 21, 2019 17:11
Sample SWIG unit test source and sink functions
test_engine_swig.h:
AccountValueList* test_account_value_list_source();
gboolean test_account_value_list_sink();
test_engine_swig.c:
AccountValueList*
test_account_value_list_source()
{
AccountValueList *avl = NULL;
QofBook* book = qof_book_new();
@jralls
jralls / gist:8a2afd5993b96fa5834ed014d0861b55
Created October 5, 2019 17:54
Change GnuCash CMakeLists.txt for C++17
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -532,18 +532,22 @@ endif()
add_definitions(-D_GNU_SOURCE)
# Also, set the C++ version to c++11
-set(CMAKE_CXX_FLAGS "-std=gnu++11 ${CMAKE_CXX_FLAGS}") # FIXME: should be -std=c++11
-
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
Backtrace:
4 (apply-smob/1 #<catch-closure 10f80cda0>)
In ice-9/boot-9.scm:
2312:4 3 (save-module-excursion #<procedure 10f81b5c0 at ice-9/e…>)
In ice-9/eval-string.scm:
38:6 2 (read-and-eval #<input: string 10ffa6000> #:lang _)
In ice-9/eval.scm:
223:20 1 (proc #<directory (guile-user) 10f7d9140>)
In unknown file:
0 (%resolve-variable (7 . gnc:cmdline-run-report) #<direc…>)
Added:
(define (template-export report template export-type output-file dry-run?)
(begin
(format #t "Template export ~a ~a ~a ~a ~a~%" report template export-type output-file dry-run?)
(let* ((report-guid (gnc:report-template-report-guid template))
Which printed
Template export Balance Sheet #<<report-template> version: 1 name: Balance Sheet report-guid: c4173ac99b2b448289bf4d11c731af13 parent-type: #f options-generator: #<procedure 1161d2df0 at standard/balsheet-pnl.scm:1294:20 ()> options-cleanup-cb: #f options-changed-cb: #f renderer: #<procedure 1161d2e00 at standard/balsheet-pnl.scm:1295:11 (rpt)> in-menu?: #t menu-path: (_Assets & Liabilities) menu-name: #f menu-tip: #f export-types: #f export-thunk: #f> #t
Backtrace:
2 (apply-smob/1 #<catch-closure 112e2bd80>)