changes from Rob Browning Date: 22 May 1999 17:03:37 -0500

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1707 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1999-05-29 23:46:49 +00:00
parent 42b93ac314
commit 935d2436f1
44 changed files with 876 additions and 740 deletions

View File

@ -80,7 +80,7 @@ obj/qt/%.o: %.c
${cleanupdeps}
clean-files:
rm -f *~ *.bak \#* $(TRASH)
rm -f *~ *.bak \#*
rm -rf obj
-rm -rf ${TRASH}

View File

@ -7,19 +7,24 @@
# AC_OUTPUT, and prefix isn't guaranteed to be defined until AC_OUTPUT
# is called.
# We use a makefile because it gives us the proper variable expansions
# for free.
include ./Makefile.init
PWD := $(shell pwd)
all:
perl -p \
-e "s|\@GNC_RUNTIME_SHAREDIR\@|${GNC_SHAREDIR}|o;" \
-e "s|\@GNC_RUNTIME_CONFIGDIR\@|${GNC_SHAREDIR}|o" \
< src/scm/startup/init.scm.in > src/scm/startup/init.scm
< src/scm/bootstrap.scm.in > src/scm/bootstrap.scm
perl -p \
-e "s|\@GNC_RUNTIME_SHAREDIR\@|${GNC_SHAREDIR}|o;" \
-e "s|\@GNC_RUNTIME_CONFIGDIR\@|${GNC_SHAREDIR}|o" \
< src/guile/gnucash.h.in > src/guile/gnucash.h
cd lib/g-wrap && \
./configure --prefix=${PWD}/lib/g-wrap-install
# Local Variables:
# tab-width: 2
# End:

View File

@ -2,6 +2,8 @@
@SET_MAKE@
export PATH := @GUILE_BIN@:@ABSOLUTE_TOP_SRCDIR@/lib/g-wrap-install/bin/:${PATH}
srcdir = @srcdir@
VPATH = @srcdir@
@ -29,6 +31,7 @@ RANLIB = @RANLIB@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
SWIG = @SWIG@
GWRAP = @top_srcdir@/lib/g-wrap-install/bin
PERL = @PERL@
CPU = @target_cpu@

60
README
View File

@ -1,3 +1,4 @@
-*-text-*-
************ BETA RELEASE ******************
The version 1.1.x series of gnucash are considered BETA development code.
@ -129,13 +130,41 @@ the latter has Motif statically linked in. If you have Motif,
then just run xacc. If you do not have Motif, then copy
'gnucash-static.bin' to 'gnucash.bin'.
You can then start GnuCash at the command-line, with
"gnucash" or "gnucash <filename>", where <filename> is a
GnuCash account file. Sample accounts can be found in
"data" subdirectory. *.dat files are GnuCash accounts that can
opened with the "Open File" menu entry. *.qif files are
Quicken Import Format files that can be opened with the
"Import QIF" menu entry.
Invocation:
-----------
You can start GnuCash at the command-line, with "gnucash" or "gnucash
<filename>", where <filename> is a GnuCash account file. Sample
accounts can be found in "data" subdirectory. *.dat files are GnuCash
accounts that can opened with the "Open File" menu entry. *.qif files
are Quicken Import Format files that can be opened with the "Import
QIF" menu entry.
GnuCash responds to the following environment variables:
GNC_RUN_AS_SHELL - if set, makes GnuCash pop up in a guile shell
with all the gnucash functions loaded. From there, you can get the
normal startup behavior like this:
GNC_RUN_AS_SHELL=t ./gnucash
guile> (primitive-load (getenv "GNC_BOOTSTRAP_SCM"))
guile> (gnc:load "startup.scm")
guile> (gnc:main)
which is the same thing that happens if you don't use the --shell
option. This can be helpful when trying to write and test new .scm
files.
GNC_BOOTSTRAP_SCM - the location of the initial bootstrapping scheme code.
GNC_SCM_LOAD_PATH - an override for the GnuCash scheme load path.
it should be a string representing a proper scheme list. Each
element can either be a string representing a directory, the symbol
'default which will expand to the default path, or 'current which
will expand to the current load-path.
GNC_DEBUG - enable debugging output. This allows you to turn on
debugging earlier in the startup process than you can with --debug.
Important Note:
---------------
@ -283,23 +312,6 @@ Flag --with-gtk-config. The way gtk phiolosphy goes,
you should *only* specify the config program location and
rely on it to tell you the right CFLAGS and XLIBS values.
The new --shell option should work properly now too. There is no
gnucash-shell anymore. There's just one binary. You can invoke
gnucash with the --shell option now to get a guile shell with all the
gnucash functions loaded. You can also get the normal startup
behavior from that shell like this:
./gnucash --shell
guile> (load (string-append gnc:_startup-dir-default_ "/init.scm"))
guile> (gnc:main)
which is the same thing that happens if you don't use the --shell
option.
The --shell option can be helpful when trying to write and test new
.scm files. I set it up so that I (or someone else) could
(eventually) work on the graphing stuff...
Anyone who's having the same problem with the added termcap libs that
I am can look in configure.in and comment out the TERMCAP_TMP line and
re-run autoconf and configure. We'll have a better fix later.

131
configure vendored
View File

@ -47,6 +47,8 @@ ac_help="$ac_help
--with-xmhtml-includes=DIR specify where to look for xmhtml headers"
ac_help="$ac_help
--with-xmhtml-libraries=DIR specify where to look for xmhtml libs"
ac_help="$ac_help
--with-guile-config=executable which guile-config to use to find guile "
ac_help="$ac_help
--with-guile=PATH specify where to look for guile includes and libs"
@ -590,7 +592,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:594: checking for a BSD compatible install" >&5
echo "configure:596: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -645,7 +647,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:649: checking for $ac_word" >&5
echo "configure:651: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -677,7 +679,7 @@ fi
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:681: checking for $ac_word" >&5
echo "configure:683: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -707,7 +709,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:711: checking for $ac_word" >&5
echo "configure:713: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -758,7 +760,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:762: checking for $ac_word" >&5
echo "configure:764: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -790,7 +792,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:794: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
echo "configure:796: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -801,12 +803,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
#line 805 "configure"
#line 807 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
if { (eval echo configure:810: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@ -832,12 +834,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:836: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "configure:838: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:841: checking whether we are using GNU C" >&5
echo "configure:843: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -846,7 +848,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:850: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:852: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@ -865,7 +867,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
echo "configure:869: checking whether ${CC-cc} accepts -g" >&5
echo "configure:871: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -898,7 +900,7 @@ fi
echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
echo "configure:902: checking for POSIXized ISC" >&5
echo "configure:904: checking for POSIXized ISC" >&5
if test -d /etc/conf/kconfig.d &&
grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
then
@ -919,14 +921,14 @@ else
fi
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
echo "configure:923: checking whether byte ordering is bigendian" >&5
echo "configure:925: checking whether byte ordering is bigendian" >&5
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF
#line 930 "configure"
#line 932 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@ -937,11 +939,11 @@ int main() {
#endif
; return 0; }
EOF
if { (eval echo configure:941: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:943: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
# It does; now see whether it defined to BIG_ENDIAN or not.
cat > conftest.$ac_ext <<EOF
#line 945 "configure"
#line 947 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@ -952,7 +954,7 @@ int main() {
#endif
; return 0; }
EOF
if { (eval echo configure:956: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:958: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
@ -972,7 +974,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
#line 976 "configure"
#line 978 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
@ -985,7 +987,7 @@ main () {
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
if { (eval echo configure:989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:991: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_bigendian=no
else
@ -1009,7 +1011,7 @@ EOF
fi
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
echo "configure:1013: checking whether ${MAKE-make} sets \${MAKE}" >&5
echo "configure:1015: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1121,7 +1123,7 @@ fi
# Extract the first word of "perl", so it can be a program name with args.
set dummy perl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1125: checking for $ac_word" >&5
echo "configure:1127: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1196,7 +1198,7 @@ fi
# Extract the first word of "swig", so it can be a program name with args.
set dummy swig; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1200: checking for $ac_word" >&5
echo "configure:1202: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_SWIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1255,7 +1257,7 @@ then
# Extract the first word of "gnome-config", so it can be a program name with args.
set dummy gnome-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1259: checking for $ac_word" >&5
echo "configure:1261: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_GNOME_CONFIG_BIN'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1291,21 +1293,6 @@ fi
fi
# Let the user specify a guile-config executable.
# XXX My guile-1.3 doesn't have a guile-config, but maybe I'm
# downlevel... are there guile 1.3 .rpms or .debs that have
# guilec-config in them? if so we need to publish them.
# AC_ARG_WITH( guile-config,
# [ --with-guile-config=executable
# which guile-config to use to find guile ],
# GUILE_CONFIG="$with_guile_config")
# AC_PATH_PROG(GUILE_CONFIG,guile-config,no)
# if test x"$GUILE_CONFIG" = xno; then
# AC_MSG_ERROR([Can't find guile-config.
# Install Guile 1.3, then specify the path to guile-config with
# --with-guile-config=...])
# fi
### --------------------------------------------------------------------------
### Libraries
LIBS="$LIBS -lm"
@ -1316,7 +1303,7 @@ LIBS="$LIBS -lm"
# important.
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:1320: checking how to run the C preprocessor" >&5
echo "configure:1307: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@ -1331,13 +1318,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 1335 "configure"
#line 1322 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1341: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1328: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1348,13 +1335,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 1352 "configure"
#line 1339 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1358: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1345: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1365,13 +1352,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
#line 1369 "configure"
#line 1356 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1375: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1362: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1400,7 +1387,7 @@ echo "$ac_t""$CPP" 1>&6
# Uses ac_ vars as temps to allow command line to override cache and checks.
# --without-x overrides everything else, but does not touch the cache.
echo $ac_n "checking for X""... $ac_c" 1>&6
echo "configure:1404: checking for X" >&5
echo "configure:1391: checking for X" >&5
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
@ -1462,12 +1449,12 @@ if test "$ac_x_includes" = NO; then
# First, try using that file with no special directory specified.
cat > conftest.$ac_ext <<EOF
#line 1466 "configure"
#line 1453 "configure"
#include "confdefs.h"
#include <$x_direct_test_include>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1471: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1458: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1536,14 +1523,14 @@ if test "$ac_x_libraries" = NO; then
ac_save_LIBS="$LIBS"
LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1540 "configure"
#line 1527 "configure"
#include "confdefs.h"
int main() {
${x_direct_test_function}()
; return 0; }
EOF
if { (eval echo configure:1547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
LIBS="$ac_save_LIBS"
# We can link X programs with no special library path.
@ -1649,17 +1636,17 @@ else
case "`(uname -sr) 2>/dev/null`" in
"SunOS 5"*)
echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
echo "configure:1653: checking whether -R must be followed by a space" >&5
echo "configure:1640: checking whether -R must be followed by a space" >&5
ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
cat > conftest.$ac_ext <<EOF
#line 1656 "configure"
#line 1643 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
if { (eval echo configure:1663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_R_nospace=yes
else
@ -1675,14 +1662,14 @@ rm -f conftest*
else
LIBS="$ac_xsave_LIBS -R $x_libraries"
cat > conftest.$ac_ext <<EOF
#line 1679 "configure"
#line 1666 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
if { (eval echo configure:1686: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_R_space=yes
else
@ -1714,7 +1701,7 @@ rm -f conftest*
# libraries were built with DECnet support. And karl@cs.umb.edu says
# the Alpha needs dnet_stub (dnet does not exist).
echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
echo "configure:1718: checking for dnet_ntoa in -ldnet" >&5
echo "configure:1705: checking for dnet_ntoa in -ldnet" >&5
ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1722,7 +1709,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1726 "configure"
#line 1713 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1733,7 +1720,7 @@ int main() {
dnet_ntoa()
; return 0; }
EOF
if { (eval echo configure:1737: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1724: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1755,7 +1742,7 @@ fi
if test $ac_cv_lib_dnet_dnet_ntoa = no; then
echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
echo "configure:1759: checking for dnet_ntoa in -ldnet_stub" >&5
echo "configure:1746: checking for dnet_ntoa in -ldnet_stub" >&5
ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1763,7 +1750,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet_stub $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1767 "configure"
#line 1754 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1774,7 +1761,7 @@ int main() {
dnet_ntoa()
; return 0; }
EOF
if { (eval echo configure:1778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1803,12 +1790,12 @@ fi
# The nsl library prevents programs from opening the X display
# on Irix 5.2, according to dickey@clark.net.
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
echo "configure:1807: checking for gethostbyname" >&5
echo "configure:1794: checking for gethostbyname" >&5
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1812 "configure"
#line 1799 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
@ -2844,7 +2831,7 @@ fi
# We have to handle these here because they are the *runtime* (not install
# time) defaults, and they're substituted into startup.scm and gnucash.h
# time) defaults, and they're substituted into bootstrap.scm and gnucash.h
# directly, so:
# 1) We don't want them to change if you do
# make prefix=foo install
@ -2865,6 +2852,9 @@ GTKSHEET_DIR="gtksheet"
CFLAGS="${CFLAGS} -Werror -Wno-unused"
ABSOLUTE_TOP_SRCDIR=`pwd`
trap '' 1 2 15
@ -2974,14 +2964,13 @@ trap 'rm -fr `echo "Makefile
src/engine/Makefile
src/guile/Makefile
src/scm/Makefile
src/scm/startup/Makefile
src/g-wrap/Makefile
src/gnome/Makefile
src/motif/Makefile
src/qt/Makefile
src/register/Makefile
src/reports/Makefile
src/swig/Makefile
src/swig/guile/Makefile
src/swig/perl5/Makefile
lib/Makefile
lib/${GTKSHEET_DIR}/Makefile
@ -3039,10 +3028,10 @@ s%@X_LIBS@%$X_LIBS%g
s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g
s%@XMHTML_TARGET@%$XMHTML_TARGET%g
s%@XMHTML_INC@%$XMHTML_INC%g
s%@GUILE_CONFIG@%$GUILE_CONFIG%g
s%@GUILE_BIN@%$GUILE_BIN%g
s%@GUILE_INC@%$GUILE_INC%g
s%@GUILELIBS@%$GUILELIBS%g
s%@HAVE_PLOTUTILS@%$HAVE_PLOTUTILS%g
s%@PLOTUTILS_LIBS@%$PLOTUTILS_LIBS%g
s%@MOTIF_LIBS@%$MOTIF_LIBS%g
s%@GNC_DOCDIR@%$GNC_DOCDIR%g
s%@GNC_BINDIR@%$GNC_BINDIR%g
@ -3052,6 +3041,7 @@ s%@GNC_SHAREDIR@%$GNC_SHAREDIR%g
s%@GNC_RUNTIME_SHAREDIR@%$GNC_RUNTIME_SHAREDIR%g
s%@GNC_RUNTIME_CONFIGDIR@%$GNC_RUNTIME_CONFIGDIR%g
s%@GTKSHEET_DIR@%$GTKSHEET_DIR%g
s%@ABSOLUTE_TOP_SRCDIR@%$ABSOLUTE_TOP_SRCDIR%g
CEOF
EOF
@ -3099,14 +3089,13 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile
src/engine/Makefile
src/guile/Makefile
src/scm/Makefile
src/scm/startup/Makefile
src/g-wrap/Makefile
src/gnome/Makefile
src/motif/Makefile
src/qt/Makefile
src/register/Makefile
src/reports/Makefile
src/swig/Makefile
src/swig/guile/Makefile
src/swig/perl5/Makefile
lib/Makefile
lib/${GTKSHEET_DIR}/Makefile

View File

@ -1,4 +1,4 @@
#
# -*-shell-script-*-
# FILE:
# configure.in
#
@ -129,21 +129,6 @@ then
fi
AC_SUBST(GNOME_CONFIG_BIN)
# Let the user specify a guile-config executable.
# XXX My guile-1.3 doesn't have a guile-config, but maybe I'm
# downlevel... are there guile 1.3 .rpms or .debs that have
# guilec-config in them? if so we need to publish them.
# AC_ARG_WITH( guile-config,
# [ --with-guile-config=executable
# which guile-config to use to find guile ],
# GUILE_CONFIG="$with_guile_config")
# AC_PATH_PROG(GUILE_CONFIG,guile-config,no)
# if test x"$GUILE_CONFIG" = xno; then
# AC_MSG_ERROR([Can't find guile-config.
# Install Guile 1.3, then specify the path to guile-config with
# --with-guile-config=...])
# fi
### --------------------------------------------------------------------------
### Libraries
LIBS="$LIBS -lm"
@ -262,26 +247,56 @@ AC_CHECK_LIB(nana,L_buffer_create,
# If readline exists, just assume that guile needs it. It probably does.
AC_CHECK_LIB(readline, readline)
### Guile
# Set GUILELIBS according to the set of libraries needed to link
# with guile.
### --------------------------------------------------------------------------
### Guile (libraries and executable)
# Don't disable this. It's the only reliable way to detect guile's
# settings on current guile installs. If it doesn't work for you, then
# don't specify --with-guile-config. (RLB)
# In the long run, --with-guile should go away in favor of
# --with-guile-config. It might make sense to do this now. If you have
# guile 1.3 installed, but don't have guile-config, your install is
# most likely broken anyway, and should be fixed. (RLB)
# Let the user override the guile-config executable.
AC_ARG_WITH( guile-config,
[ --with-guile-config=executable which guile-config to use to find guile ],
AC_MSG_CHECKING([for guile-config])
AC_MSG_RESULT([${with_guile_config}])
GUILE_CONFIG="$with_guile_config"
LIBS="`${GUILE_CONFIG} link` ${LIBS}"
CFLAGS="$CFLAGS `${GUILE_CONFIG} compile`")
if test x"$GUILE_CONFIG" = x; then
# Try to find a default guile-config
AC_PATH_PROG(GUILE_CONFIG,guile-config)
fi
# Still allow the old method (for now).
AC_ARG_WITH( guile,
[ --with-guile=PATH specify where to look for guile includes and libs],
LIBS="-L$with_guile/lib ${LIBS}" CFLAGS="$CFLAGS -I$with_guile/include" )
[ --with-guile=PATH specify where to look for guile includes and libs],
LIBS="-L$with_guile/lib ${LIBS}" CFLAGS="$CFLAGS -I$with_guile/include")
# Have to use AC_TRY_LINK here because AC_CHECK_LIB caches the
# results, so one failure makes all further attempts fail.
# You can't have both...
if test x"$GUILE_CONFIG" != x && test x"$with_guile" != x ; then
AC_MSG_ERROR([${GUILE_CONFIG} ================ ${with_guile}])
AC_MSG_ERROR([You cannot specify both --with-guile and --with-guile-config])
fi
AC_MSG_CHECKING([for guile])
if test x"$GUILE_CONFIG" = x; then
# If we didn't get GUILE_CONFIG, then do things the old, dumb way.
GNC_LIBS_SAFE=${LIBS}
AC_CACHE_CHECK([for guile], ac_cv_lib_guile,
# Have to use AC_TRY_LINK here because AC_CHECK_LIB caches the
# results, so one failure makes all further attempts fail.
GNC_LIBS_SAFE=${LIBS}
AC_CACHE_CHECK([for guile], ac_cv_lib_guile,
for GNC_TEST_LIBS in "-lguile" "-lguile -ldl" "-lguile -lqthreads" \
"-lguile -ltermcap" "-lguile -lqthreads -ltermcap" \
"-lguile -lreadline -lncurses"; do
if test x"${GUILELIBS}" != x; then
# AC_MSG_RESULT([found in ${GUILELIBS}])
ac_cv_lib_guile=${GUILELIBS}
break
else
@ -289,29 +304,56 @@ AC_CACHE_CHECK([for guile], ac_cv_lib_guile,
AC_TRY_LINK([#include<guile/gh.h>], [gh_eval_file;],
GUILELIBS="${GNC_TEST_LIBS}")
fi
done
)
GUILELIBS=${ac_cv_lib_guile}
if test x"${GUILELIBS}" = x; then
AC_MSG_ERROR([Cannot link with guile. Do you have guile 1.3 installed?])
done)
GUILELIBS=${ac_cv_lib_guile}
else
# We did find a suitable guile-config. Use that.
# and use any guile binary in that same directory.
GUILE_INC=`${GUILE_CONFIG} compile`
GUILELIBS=`${GUILE_CONFIG} link`
fi
# Find the appropriate guile binary.
if test x"$GUILE_CONFIG" != x; then
AC_PATH_PROG(GUILE_BIN, guile,,`dirname ${GUILE_CONFIG}`)
fi
# If that didn't work, try the --with-guile directory, if any.
if test x"$GUILE_BIN" = x && test x"$with_guile" != x; then
AC_PATH_PROG(GUILE_BIN, guile,,`${with_guile}/bin`)
fi
# Final stab at locating a guile binary.
if test x"${GUILE_BIN}" = x; then
AC_PATH_PROG(GUILE_BIN,guile)
fi
if test x"${GUILELIBS}" = x || test x"${GUILE_BIN}" = x; then
AC_MSG_ERROR([Cannot configure guile bits. Do you have guile 1.3 installed?])
fi
# Get just the directory for the guile binary.
GUILE_BIN=`dirname ${GUILE_BIN}`
AC_SUBST(GUILE_CONFIG)
AC_SUBST(GUILE_BIN)
AC_SUBST(GUILE_INC)
AC_SUBST(GUILELIBS)
### --------------------------------------------------------------------------
### Plotutils
AC_CHECK_LIB(plot, openpl,
AC_DEFINE(HAVE_PLOTUTILS,1)
AC_DEFINE(PLOTUTILS_LIBS,"-lXaw -lXt -lplot"),
,
$X_PRE_LIBS $MOTIF_LIBS $X_EXTRA_LIBS -lXaw $X_LIBS)
#AC_CHECK_LIB(plot, pl_openpl,
# AC_DEFINE(HAVE_PLOTUTILS,1)
# HAVE_PLOTUTILS=1
# AC_DEFINE(PLOTUTILS_LIBS,"-lXaw -lXt -lplot"),
# ,
# $X_PRE_LIBS $MOTIF_LIBS $X_EXTRA_LIBS -lXaw $X_LIBS)
# We need this in at least one of the Makefile.in's
AC_SUBST(HAVE_PLOTUTILS)
AC_SUBST(PLOTUTILS_LIBS)
#AC_SUBST(HAVE_PLOTUTILS)
#AC_SUBST(PLOTUTILS_LIBS)
AC_SUBST(MOTIF_LIBS)
@ -346,7 +388,7 @@ AC_SUBST(GNC_CONFIGDIR)
AC_SUBST(GNC_SHAREDIR)
# We have to handle these here because they are the *runtime* (not install
# time) defaults, and they're substituted into startup.scm and gnucash.h
# time) defaults, and they're substituted into bootstrap.scm and gnucash.h
# directly, so:
# 1) We don't want them to change if you do
# make prefix=foo install
@ -367,6 +409,9 @@ AC_SUBST(GTKSHEET_DIR)
CFLAGS="${CFLAGS} -Werror -Wno-unused"
ABSOLUTE_TOP_SRCDIR=`pwd`
AC_SUBST(ABSOLUTE_TOP_SRCDIR)
AC_CONFIG_HEADER(config.h)
AC_OUTPUT(Makefile
@ -375,14 +420,13 @@ AC_OUTPUT(Makefile
src/engine/Makefile
src/guile/Makefile
src/scm/Makefile
src/scm/startup/Makefile
src/g-wrap/Makefile
src/gnome/Makefile
src/motif/Makefile
src/qt/Makefile
src/register/Makefile
src/reports/Makefile
src/swig/Makefile
src/swig/guile/Makefile
src/swig/perl5/Makefile
lib/Makefile
lib/${GTKSHEET_DIR}/Makefile

16
gnucash
View File

@ -1,11 +1,13 @@
#! /bin/sh
GNC_ARGS="${GNC_ARGS} --debug"
GNC_ARGS="${GNC_ARGS} --startup-dir ./share/scm/startup"
GNC_ARGS="${GNC_ARGS} --share-dir ./share"
GNC_ARGS="${GNC_ARGS} --config-dir ./etc"
GNC_ARGS="${GNC_ARGS} --load-path (\"(./share/scm)\")"
GNC_ARGS="${GNC_ARGS} --doc-path (\"(./Docs)\"\"(./Reports)\")"
export GNC_BOOTSTRAP_SCM=./share/scm/bootstrap.scm
export GNC_SCM_LOAD_PATH='("./share/scm")'
export GNC_DEBUG=t
# Run whichever one was built last.
exec ./gnucash.bin ${GNC_ARGS} "$@"
exec ./gnucash.bin \
--debug \
--share-dir ./share \
--config-dir ./etc \
--doc-path '("./Docs" "./Reports")' \
"$@"

View File

@ -3,6 +3,8 @@
#
# Secrets: gdb requires that parens be escaped as well as quotes ...
THESE ARE BROKEN We need a new strategy that handles the GNC_ envt vars.
file gnucash.bin
define run-gnucash

View File

@ -36,7 +36,7 @@ GTKSHEET_DIR := @GTKSHEET_DIR@
######################################################################
# See Makefile.common for information about these variables.
CLEAN_SUBDIRS := XmHTML-1.1.0 ComboBox-1.33 Xbae-4.6.2-linas
CLEAN_SUBDIRS := XmHTML-1.1.0 ComboBox-1.33 Xbae-4.6.2-linas g-wrap
CLEAN_SUBDIRS += ${GTKSHEET_DIR}
######################################################################

View File

@ -28,6 +28,8 @@
#include "config.h"
#include "ui-callbacks.h"
#include "gnc-common.h"
#include "Session.h"
/** GLOBALS *********************************************************/
typedef enum {
@ -42,7 +44,8 @@ typedef enum {
/** PROTOTYPES ******************************************************/
void mainWindow();
void gnc_show_help(const gncHelpTypes t);
void mainWindow();
void gnc_show_help(const gncHelpTypes t);
Session *gnc_main_window_get_session(gncUIWidget w);
#endif

View File

@ -39,7 +39,7 @@ CFLAGS = @CFLAGS@ @X_CFLAGS@ ${INCLPATH} ${CPPFLAGS}
######################################################################
# See Makefile.common for information about these variables.
COMMON_SRCS := MultiLedger.c SplitLedger.c Destroy.c
CLEAN_SUBDIRS := engine gnome motif register guile reports swig qt scm
CLEAN_SUBDIRS := engine gnome motif register g-wrap guile reports swig qt scm
MOTIF_SRCS := FileDialog.c
GNOME_SRCS := FileDialog.c
######################################################################
@ -56,6 +56,7 @@ motif: ${MOTIF_OBJS}
@cd engine; $(MAKE) default
@cd register; $(MAKE) motif
@cd reports; $(MAKE) default
@cd g-wrap; $(MAKE) motif
@cd swig; $(MAKE) motif
@cd guile; $(MAKE) default
@cd motif; $(MAKE) motif
@ -64,6 +65,7 @@ gnome: ${GNOME_OBJS}
@cd engine; $(MAKE) default
@cd register; $(MAKE) gnome
@cd reports; $(MAKE) default
@cd g-wrap; $(MAKE) gnome
@cd swig; $(MAKE) gnome
@cd guile; $(MAKE) default
@cd gnome; $(MAKE) gnome
@ -73,7 +75,7 @@ qt: $(QT_OBJS)
@cd register; $(MAKE) qt
@cd reports; $(MAKE) default
@cd swig; $(MAKE) qt
@cd guile; $(MAKE) default
@cd guile; $(MAKE) default
@cd qt; $(MAKE) qt
.PHONY: default qt gnome motif all

View File

@ -27,6 +27,36 @@
/* =========================================================== */
#define GNC_RETURN_ENUM_AS_STRING(x) case x: return #x;
char *
xaccAccountTypeEnumAsString(int type) {
switch(type) {
GNC_RETURN_ENUM_AS_STRING(BANK);
GNC_RETURN_ENUM_AS_STRING(CASH);
GNC_RETURN_ENUM_AS_STRING(CREDIT);
GNC_RETURN_ENUM_AS_STRING(ASSET);
GNC_RETURN_ENUM_AS_STRING(LIABILITY);
GNC_RETURN_ENUM_AS_STRING(STOCK);
GNC_RETURN_ENUM_AS_STRING(MUTUAL);
GNC_RETURN_ENUM_AS_STRING(CURRENCY);
GNC_RETURN_ENUM_AS_STRING(INCOME);
GNC_RETURN_ENUM_AS_STRING(EXPENSE);
GNC_RETURN_ENUM_AS_STRING(EQUITY);
GNC_RETURN_ENUM_AS_STRING(CHECKING);
GNC_RETURN_ENUM_AS_STRING(SAVINGS);
GNC_RETURN_ENUM_AS_STRING(MONEYMRKT);
GNC_RETURN_ENUM_AS_STRING(CREDITLINE);
default:
fprintf(stderr,
"Big problem asked to translate unknown account type %d.\n", type);
break;
};
return(NULL);
};
/* =========================================================== */
char *account_type_name[NUM_ACCOUNT_TYPES] =
{
BANK_STR,

View File

@ -34,7 +34,11 @@
* from one release to the next. Note that if values are added,
* the file IO translation routines need to be updated. Note
* also that GUI code depends on these numbers.
*
* If you do change the enumeration names (not the numbers), you need
* to update xaccAccountTypeEnumAsString --- used for text file exports
*/
enum
{
BANK = 0,
@ -92,7 +96,11 @@ enum
};
char * xaccAccountGetTypeStr (int type);
char * xaccAccountGetTypeStr (int type); /* GUI names */
/* Just the name of the enum as a string. i.e. INCOME -> "INCOME".
Used for text exports */
char * xaccAccountTypeEnumAsString (int type);
typedef struct _BankAcct BankAcct;
typedef struct _InvAcct InvAcct;

View File

@ -221,6 +221,16 @@ xaccGetAccountID (Account *acc)
/********************************************************************\
\********************************************************************/
char
xaccGetAccountFlags (Account *acc)
{
if (!acc) return -1;
return acc->flags;
}
/********************************************************************\
\********************************************************************/
#define CHECK(acc) { \
if (0 == acc->open) { \
/* not today, some day in the future ... */ \
@ -1122,5 +1132,4 @@ IthAccount (Account **list, int i)
return list[i];
}
/*************************** END OF FILE **************************** */

View File

@ -51,6 +51,7 @@ void xaccAccountBeginEdit (Account *, int defer);
void xaccAccountCommitEdit (Account *);
int xaccGetAccountID (Account *);
char xaccGetAccountFlags (Account *);
/*
* The xaccAccountInsertSplit() method will insert the indicated
@ -154,4 +155,5 @@ int xaccAccountGetNumSplits (Account *acc);
*/
Account * IthAccount (Account **list, int i);
#endif /* __XACC_ACCOUNT_H__ */

113
src/gnome/scripts_menu.c Normal file
View File

@ -0,0 +1,113 @@
/********************************************************************\
* scripts_menu.h -- functions to build the dynamic scripts menu *
* Copyright (C) 1999 Rob Browning *
* *
* 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, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\********************************************************************/
#include "scripts_menu.h"
#include <nana.h>
#include <guile/gh.h>
#include "top-level.h"
/* FIXME: is this always kosher? Will SCM's always fit in a gpointer? */
static void
gnc_extensions_menu_cb( GtkWidget *w, gpointer p) {
SCM closure = (SCM) p;
if(!p) return;
gh_call0(closure);
}
void
gnc_extensions_menu_add_item(char name[],
char hint[],
gpointer data) {
gint pos;
GnomeUIInfo item_info[2];
GnomeUIInfo tmpi;
tmpi.type = GNOME_APP_UI_ITEM;
tmpi.label = N_(name);
tmpi.hint = N_(hint);
tmpi.moreinfo = gnc_extensions_menu_cb;
tmpi.user_data = data;
tmpi.unused_data = NULL;
tmpi.pixmap_type = GNOME_APP_PIXMAP_NONE;
tmpi.pixmap_info = NULL;
tmpi.accelerator_key = 0;
tmpi.ac_mods = (GdkModifierType) 0;
tmpi.widget = NULL;
item_info[0] = tmpi;
tmpi.type = GNOME_APP_UI_ENDOFINFO;
tmpi.label = NULL;
tmpi.moreinfo = NULL;
item_info[1] = tmpi;
/* GtkWidget *w = gnome_app_find_menu_pos(www, "Extensions/", &pos); */
printf("%s %s %p\n", name, hint, data);
gnome_app_insert_menus(GNOME_APP(gnc_get_ui_data()), "Extensions/", item_info);
}
#if 0
/* FIXME: This is ugly. Shouldn't use a static for this... */
static GnomeUIInfo *scripts_menu_data = NULL;
GnomeUIInfo *create_scripts_menu_data() {
I(scripts_menu_data == NULL);
{
GnomeUIInfo tmpi;
scripts_menu_data = (GnomeUIInfo *) malloc(2 * sizeof(GnomeUIInfo));
tmpi.type = GNOME_APP_UI_ITEM;
tmpi.label = NULL;
tmpi.hint = NULL;
tmpi.moreinfo = NULL;
tmpi.user_data = NULL;
tmpi.unused_data = NULL;
tmpi.pixmap_type = GNOME_APP_PIXMAP_NONE;
tmpi.pixmap_info = NULL;
tmpi.accelerator_key = 0;
tmpi.ac_mods = (GdkModifierType) 0;
tmpi.widget = NULL;
tmpi.label = N_("Test menu item");
tmpi.hint = N_("A simple test menu item");
tmpi.moreinfo = gnc_extensions_menu_cb;
scripts_menu_data[0] = tmpi;
tmpi.type = GNOME_APP_UI_ENDOFINFO;
tmpi.label = NULL;
tmpi.moreinfo = NULL;
scripts_menu_data[1] = tmpi;
}
return(scripts_menu_data);
};
void
destroy_scripts_menu_data(GnomeUIInfo *sm) {
if(scripts_menu_data) {
free(scripts_menu_data);
scripts_menu_data = NULL;
}
}
#endif

30
src/gnome/scripts_menu.h Normal file
View File

@ -0,0 +1,30 @@
/********************************************************************\
* scripts_menu.h -- functions to build the dynamic scripts menu *
* Copyright (C) 1999 Rob Browning *
* *
* 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, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\********************************************************************/
#ifndef __SCRIPTS_MENU_H__
#define __SCRIPTS_MENU_H__
#include <gnome.h>
void gnc_extensions_menu_add_item(char name[], char hint[], gpointer data);
GnomeUIInfo *create_scripts_menu_data();
void destroy_scripts_menu_data();
#endif

View File

@ -20,7 +20,7 @@ include @top_srcdir@/Makefile.init
######################################################################
# See Makefile.common for information about these variables.
#
CLEAN_SUBDIRS := startup
# CLEAN_SUBDIRS :=
######################################################################
all: default

128
src/scm/bootstrap.scm.in Normal file
View File

@ -0,0 +1,128 @@
;;;; bootstrap.scm -*-scheme-*-
;;
;; Minimal startup code. This file should just contain enough code to
;; get gnc:load defined, and the "default" environment setup. After
;; that *everything* should be loaded via gnc:load, starting with
;; startup.scm
;; (use-modules (gnc))
;; In pre 1.3 guile's you have to do this manually, unless you call
;; scm_shell, which we can't.
(if (or (string=? (version) "1.2")
(string=? (version) "1.3a"))
(let ((boot-file (if (assoc 'prefix %guile-build-info)
(string-append (cdr (assoc 'prefix %guile-build-info))
"/share/guile/"
(version)
"/ice-9/boot-9.scm")
"/usr/share/guile/1.3a/ice-9/boot-9.scm")))
(primitive-load boot-file)))
;; Automatically generated defaults...
(define gnc:_config-dir-default_ "@GNC_RUNTIME_CONFIGDIR@")
(define gnc:_share-dir-default_ "@GNC_RUNTIME_SHAREDIR@")
;; These will be converted to config vars later (see prefs.scm)
(define gnc:*load-path* #f)
(define gnc:*debugging?* (if (getenv "GNC_DEBUG") #t #f))
;;;; Status output functions.
(define (gnc:warn . items)
(display "gnucash: [W] ")
(for-each (lambda (i) (write i)) items)
(newline))
(define (gnc:error . items)
(display "gnucash: [E] ")
(for-each (lambda (i) (write i)) items)
(newline))
(define (gnc:msg . items)
(display "gnucash: [M] ")
(for-each (lambda (i) (write i)) items)
(newline))
(define (gnc:debug . items)
(let ((debugging? (if (boolean? gnc:*debugging?*)
gnc:*debugging?*
(gnc:config-var-value-get gnc:*debugging?*))))
(if debugging?
(begin
(display "gnucash: [D] ")
(for-each (lambda (i) (write i)) items)
(newline)))))
;;; Set up gnc:load.
(define (gnc:find-in-directories file directories)
"Find file named 'file' anywhere in 'directories'. 'file' must be a
string and 'directories' must be a list of strings."
(gnc:debug "gnc:find-in-directories looking for " file " in " directories)
(do ((rest directories (cdr rest))
(finished? #f)
(result #f))
((or (null? rest) finished?) result)
(let ((file-name (string-append (car rest) "/" file)))
(gnc:debug " checking for " file-name)
(if (access? file-name F_OK)
(begin
(gnc:debug "found file " file-name)
(set! finished? #t)
(set! result file-name))))))
(define (gnc:load name)
"Name must be a string. The system attempts to locate the file of
the given name and load it. The system will attempt to locate the
file in all of the directories specified by gnc:*load-path*."
(let* ((path (if (list? gnc:*load-path*)
gnc:*load-path*
(gnc:config-var-value-get gnc:*load-path*)))
(file-name (gnc:find-in-directories name path)))
(if (not file-name)
#f
(if
;;(false-if-exception (primitive-load file-name))
(primitive-load file-name)
(begin
(gnc:debug "loaded file " file-name)
#t)
(begin
(gnc:warn "failure loading " file-name)
#f)))))
(define (gnc:_expand-load-path_ new-path)
;; FIXME: Bad items should probably cause this to abort with #f or
;; throw an exception.
(let ((load-path-interpret
(lambda (item)
(cond ((string? item) (list item))
((symbol? item)
(case item
((default)
(list
(string-append (getenv "HOME") "/.gnucash/scm")
(string-append gnc:_share-dir-default_ "/scm")))
((current)
(if (list? gnc:*load-path*)
gnc:*load-path*
(gnc:config-var-value-get gnc:*load-path*)))
(else
(gnc:warn "bad item " item " in load-path. Ignoring.")
'())))
(else
(gnc:warn "bad item " item " in load-path. Ignoring.")
'())))))
(apply append (map load-path-interpret new-path))))
(let* ((load-path-override (getenv "GNC_SCM_LOAD_PATH"))
(new-path (if load-path-override
(call-with-input-string
load-path-override (lambda (p) (read p)))
'(default))))
(set! gnc:*load-path* (gnc:_expand-load-path_ new-path)))

View File

@ -6,10 +6,6 @@
(define gnc:*arg-defs*
(list
(cons
"shell"
(cons 'boolean (lambda (val) #t)))
(cons
"usage"
(cons 'boolean
@ -26,12 +22,6 @@
(lambda (val)
(gnc:config-var-value-set! gnc:*debugging?* #f val))))
(cons
"startup-dir"
(cons 'string
(lambda (val)
(gnc:config-var-value-set! gnc:*startup-dir* #f val))))
(cons
"config-dir"
(cons 'string
@ -61,6 +51,7 @@
"doc-path"
(cons 'string
(lambda (val)
(gnc:debug "parsing --doc-path " val)
(let ((path-list
(call-with-input-string val (lambda (port) (read port)))))
(if (list? path-list)
@ -98,6 +89,7 @@
(list value (cdr args)))))))
(define (gnc:cmd-line-get-string-arg args)
(gnc:debug "got string arg returning " (car args) " and " (cdr args))
(list (car args) (cdr args)))
(define (gnc:prefs-show-usage)
@ -105,7 +97,7 @@
(define (gnc:handle-command-line-args)
(gnc:debug "handling command line arguments")
(gnc:debug "handling command line arguments" (program-arguments))
(let ((files-to-open '())
(result #t))

19
src/scm/extensions.scm Normal file
View File

@ -0,0 +1,19 @@
(define (gnc:extensions-menu-test-func)
(gnc:debug "Extension called from scheme.\n"))
(define (gnc:extensions-menu-setup win)
;; Should take window as a parameter?
(gnc:debug "Setting up extensions menu " win "\n")
(gnc:extensions-menu-add-item "Export data as text."
"Export data as text hint."
(lambda ()
(gnc:main-win-export-data-as-text win)))
(gnc:extensions-menu-add-item "Scheme test2"
"Scheme test2 hint"
gnc:extensions-menu-test-func))
(gnc:hook-add-dangler gnc:*main-window-opened-hook* gnc:extensions-menu-setup)

View File

@ -10,12 +10,6 @@
;; Central repository for all hooks -- so we can look them up later by name.
(define gnc:*hooks* '())
(define (gnc:hook-danglers-get hook)
(vector-ref hook 2))
(define (gnc:hook-danglers-set! hook danglers)
(vector-set! hook 2 danglers))
;;; Developers
(define (gnc:hook-define name description)
@ -23,15 +17,22 @@
(set! gnc:*hooks* (assoc-set! gnc:*hooks* name hook-data))
hook-data))
(define (gnc:hook-danglers-get hook)
(vector-ref hook 2))
(define (gnc:hook-danglers-set! hook danglers)
(vector-set! hook 2 danglers))
(define (gnc:hook-danglers->list hook)
(gnc:hook-danglers-get hook))
(define (gnc:hook-replace-danglers hook function-list)
(gnc:hook-danglers-set! hook function-list))
(define (gnc:hook-run-danglers hook)
(define (gnc:hook-run-danglers hook . args)
(gnc:debug "Running functions on hook " (gnc:hook-name-get hook))
(for-each (lambda (dangler) (dangler)) (gnc:hook-danglers-get hook)))
(for-each (lambda (dangler) (apply dangler args))
(gnc:hook-danglers-get hook)))
;;; Public
@ -53,10 +54,19 @@
(vector-ref hook 0))
(define gnc:*startup-hook*
(gnc:hook-define 'startup-hook "Functions to run at startup."))
(gnc:hook-define
'startup-hook
"Functions to run at startup. Hook args: ()"))
(define gnc:*shutdown-hook*
(gnc:hook-define 'shutdown-hook "Functions to run at shutdown."))
(gnc:hook-define
'shutdown-hook
"Functions to run at shutdown. Hook args: ()"))
(define gnc:*main-window-opened-hook*
(gnc:hook-define
'main-window-opened-hook
"Functions to run whenever the main window is opened. Hook args: (window)"))
;;(let ((hook (gnc:hook-lookup 'startup-hook)))
;; (display (gnc:hook-name-get hook))

3
src/scm/macros.scm Normal file
View File

@ -0,0 +1,3 @@
;;; Macros to conditionally define various things.

View File

@ -8,9 +8,10 @@
(gnc:load "hooks.scm")
(gnc:load "doc.scm")
(gnc:load "extensions.scm") ; Should this be here or somewhere else?
(gnc:load "text-export.scm")
;; Load the system and user configs
(if (not (gnc:load-system-config-if-needed))
(gnc:shutdown 1))
@ -23,14 +24,13 @@
(gnc:config-var-value-get gnc:*arg-show-help*))
(begin
(gnc:prefs-show-usage)
(gnc:shutdown 0)))
)
(gnc:shutdown 0))))
(define (gnc:shutdown exit-status)
(gnc:debug "Shutdown -- exit-status: " exit-status)
(gnc:hook-run-danglers gnc:*shutdown-hook*)
(_gnc_shutdown_ exit-status)
(gnc:_shutdown_ exit-status)
(exit exit-status))
(define (gnc:main)
@ -39,14 +39,14 @@
(gnc:startup)
(if (not (= (gnucash_lowlev_app_init) 0))
(if (not (= (gnc:lowlev-app-init) 0))
(gnc:shutdown 0))
(if (pair? gnc:*command-line-files*)
;; You can only open single files right now...
(gnucash_ui_open_file (car gnc:*command-line-files*))
(gnucash_ui_select_file))
(gnc:ui-open-file (car gnc:*command-line-files*))
(gnc:ui-select-file))
(gnucash_lowlev_app_main)
(gnc:lowlev-app-main)
(gnc:shutdown 0))

70
src/scm/path.scm Normal file
View File

@ -0,0 +1,70 @@
(define (gnc:_expand-doc-path_ new-path)
;; FIXME: Bad items should probably cause this to abort with #f or
;; throw an exception.
(gnc:debug "expanding doc-path value " new-path)
(let ((path-interpret
(lambda (item)
(cond ((string? item) (list item))
((symbol? item)
(case item
((default)
(list
(string-append (getenv "HOME") "/.gnucash/doc")
(string-append gnc:_share-dir-default_ "/Docs")
(string-append gnc:_share-dir-default_ "/Reports")))
((current)
(gnc:config-var-value-get gnc:*doc-path*))
(else
(gnc:warn "bad item " item " in doc-path. Ignoring.")
'())))
(else
(gnc:warn "bad item " item " in doc-path. Ignoring.")
'())))))
(apply append (map path-interpret new-path))))
(define gnc:load-user-config-if-needed
(let ((user-config-loaded? #f))
(lambda ()
(if (not user-config-loaded?)
(begin
(gnc:debug "loading user configuration")
(let ((user-file
(string-append (getenv "HOME") "/.gnucash/config.user"))
(auto-file
(string-append (getenv "HOME") "/.gnucash/config.auto")))
(if (access? user-file F_OK)
(if (false-if-exception (primitive-load user-file))
(set! user-config-loaded? #t)
(begin
(gnc:warn "failure loading " user-file)
#f))
(if (access? auto-file F_OK)
(if (false-if-exception (primitive-load auto-file))
(set! user-config-loaded? #t)
(begin
(gnc:warn "failure loading " auto-file)
#f))))))))))
;; the system config should probably be loaded from some directory
;; that wouldn't be a site wide mounted directory, like /usr/share
;; However, the code below seems to zero in on /usr/share/gnucash/config
;; ... ahh but that's OK, right ??
(define gnc:load-system-config-if-needed
(let ((system-config-loaded? #f))
(lambda ()
(if (not system-config-loaded?)
(begin
(gnc:debug "loading system configuration")
(let ((system-config (string-append
(gnc:config-var-value-get gnc:*config-dir*)
"/config")))
(if (false-if-exception (primitive-load system-config))
(set! system-config-loaded? #t)
(begin
(gnc:warn "failure loading " system-config)
#f))))))))

View File

@ -305,23 +305,6 @@
eq?
#f))
(define gnc:*debugging?*
(gnc:make-config-var
"Enable debugging code."
(lambda (var value) (if (boolean? value) (list value) #f))
eq?
#f))
(define gnc:*startup-dir*
(gnc:make-config-var
"Location of initial lowest level scheme startup files."
(lambda (var value)
;; You can't change the startup dir from here. It's considered
;; hard-coded once known -- see startup/init.scm.
#f)
string=?
gnc:_startup-dir-default_))
(define gnc:*config-dir*
(gnc:make-config-var
"Configuration directory."
@ -336,41 +319,46 @@
string=?
gnc:_share-dir-default_))
(define gnc:*load-path*
(gnc:make-config-var
"A list of strings indicating the load path for (gnc:load name).
Any path element enclosed in parentheses will automatically be
expanded to that directory and all its subdirectories whenever this
variable is modified. The symbol element default will expand to the default directory. i.e. (gnc:config-var-value-set! gnc:*load-path* '(\"/my/dir/\" default))"
(lambda (var value)
(if (not (list? value))
#f
(let ((result (gnc:_load-path-update_ var value)))
(if (list? result)
(list result)
#f))))
equal?
(list
(string-append "(" (getenv "HOME") "/.gnucash/scm)")
(string-append "(" gnc:_share-dir-default_ "/scm)"))))
;; Convert the temporary startup value into a config var.
(let ((current-value gnc:*debugging?*))
(set!
gnc:*debugging?*
(gnc:make-config-var
"Enable debugging code."
(lambda (var value) (if (boolean? value) (list value) #f))
eq?
#f))
(gnc:config-var-value-set! gnc:*debugging?* #f current-value))
;; Convert the temporary startup value into a config var.
(let ((current-load-path gnc:*load-path*))
(set!
gnc:*load-path*
(gnc:make-config-var
"A list of strings indicating the load path for (gnc:load name).
Each element must be a string representing a directory or a symbol
where 'default expands to the default path, and 'current expands to
the current value of the path."
(lambda (var value)
(let ((result (gnc:_expand-load-path_ value)))
(if (list? result)
(list result)
#f)))
equal?
'(default)))
(gnc:config-var-value-set! gnc:*load-path* #f current-load-path))
(define gnc:*doc-path*
(gnc:make-config-var
"A list of strings indicating where to look for html and parsed-html files
Any path element enclosed in parentheses will automatically be
expanded to that directory and all its subdirectories whenever this
variable is modified. The symbol element default will expand to the
default directory. i.e. (gnc:config-var-value-set! gnc:*doc-path*
'(\"/my/dir/\" default))"
Each element must be a string representing a directory or a symbol
where 'default expands to the default path, and 'current expands to
the current value of the path."
(lambda (var value)
(if (not (list? value))
#f
(let ((result (gnc:_doc-path-update_ var value)))
(if (list? result)
(list result)
#f))))
(let ((result (gnc:_expand-doc-path_ value)))
(if (list? result)
(list result)
#f)))
equal?
(list
(string-append "(" (getenv "HOME") "/.gnucash/doc)")
(string-append "(" gnc:_share-dir-default_ "/Docs)")
(string-append "(" gnc:_share-dir-default_ "/Reports)"))))
'(default)))

View File

@ -1,25 +1,25 @@
The startup process looks like this right now:
1) (at the C level) search args from right to left to see if there's
any --startup-dir override, use it if there is.
* (at the C level) look for any environment variables affecting
startup (GNC_BOOTSTRAP_SCM, GNC_SCM_LOAD_PATH, GNC_RUN_AS_SHELL).
2) load the desired <startup-dir>/init.scm (either the default or
the override) -- all the rest of the steps happen from init.scm
and files loaded from there. Any files in <startup>/ cannot be
overridden by --load-path because they'll be loaded before the
load-path mechanism is operational.
* load the desired bootstrap file (either the default
sharedir/scm/bootstrap.scm, or the override). This sets up
gnc:load, and minimal defaults.
3) setup the default config-vars (including the ones that represent
the command-line options).
* (gnc:load "startup.scm")
4) parse the command line
* setup the default config-vars (including the ones that represent
the command-line options).
5) load the system config if we haven't already (there's a
command-line option to load the file earlier,
--load-system-config)
* parse the command line
6) load the user's ~/gnucash/config.user if it exists, otherwise
load the user's ~/gnucash/config.auto if it exists.
* load the system config if we haven't already (there's a
command-line option to load the file earlier,
--load-system-config)
* load the user's ~/gnucash/config.user if it exists, otherwise
load the user's ~/gnucash/config.auto if it exists.
config.auto is where we'll eventually spit out UI selected prefs.

13
src/scm/startup.scm Normal file
View File

@ -0,0 +1,13 @@
;;;; startup.scm -*-scheme-*-
;; Load all the files we need from wherever the user has specified.
;; None of these loads will be affected by any command line arguments
;; since arguments aren't parsed until gnc:main is executed.
(gnc:load "macros.scm")
(gnc:load "config-var.scm")
(gnc:load "utilities.scm")
(gnc:load "path.scm")
(gnc:load "prefs.scm")
(gnc:load "command-line.scm")
(gnc:load "main.scm")

View File

@ -1,7 +0,0 @@
init.scm
Makefile
tmp
obj
*.diff
*.diffs
*.patch

View File

@ -1,38 +0,0 @@
# Makefile -- makefile for gnucash/scm
# Copyright (C) 1998 Rob Browning <rlb@cs.utexas.edu>
#
# 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, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include @top_srcdir@/Makefile.init
######################################################################
# See Makefile.common for information about these variables.
#
######################################################################
all: default
# This inclusion must come after the first target, and after the
# definitions of *_SRCS, etc., but before the usage of *_OBJS.
include @top_srcdir@/Makefile.common
default:
@echo Nothing to do.
.PHONY: default
# Local Variables:
# tab-width: 2
# End:

View File

@ -1,40 +0,0 @@
;;;; startup.scm -*-scheme-*-
;;
;; Minimal startup code. This file should just contain (or load)
;; enough code to get the arguments parsed and things like
;; gnc:*load-path* set up. After that *everything* should be loaded
;; via gnc:load.
;; In pre 1.3 guile's you have to do this manually, unless you call
;; scm_shell, which we can't.
(if (or (string=? (version) "1.2")
(string=? (version) "1.3a"))
(let ((boot-file (if (assoc 'prefix %guile-build-info)
(string-append (cdr (assoc 'prefix %guile-build-info))
"/share/guile/"
(version)
"/ice-9/boot-9.scm")
"/usr/share/guile/1.3a/ice-9/boot-9.scm")))
(primitive-load boot-file)))
;; Automatically generated defaults...
(define gnc:_config-dir-default_ "@GNC_RUNTIME_CONFIGDIR@")
(define gnc:_share-dir-default_ "@GNC_RUNTIME_SHAREDIR@")
(let ((lowlev-files
'("utilities.scm"
"config-var.scm"
"path.scm"
"prefs.scm"
"command-line.scm"
"main.scm")))
(for-each (lambda (filename)
(display "loading startup file ")
(display (string-append gnc:_startup-dir-default_ "/" filename))
(newline)
(primitive-load
(string-append gnc:_startup-dir-default_ "/" filename)))
lowlev-files))

View File

@ -1,128 +0,0 @@
(define gnc:_load-path-directories_ #f)
(define gnc:_doc-path-directories_ #f)
(define (gnc:_path-expand_ items default-items)
(if
(null? items)
'()
(let ((item (car items))
(other-items (cdr items)))
(cond
((eq? item 'default)
(append
(gnc:_path-expand_ default-items))
(gnc:_path-expand_ other-items default-items))
((string? item)
(if (and (char=? #\( (string-ref item 0))
(char=? #\) (string-ref item (- (string-length item) 1))))
(let ((current-dir
(make-shared-substring item 1 (- (string-length item) 1))))
(if (directory? current-dir)
(let ((subdirs (gnc:directory-subdirectories current-dir))
(rest (gnc:_path-expand_ other-items default-items)))
(cons current-dir (append subdirs rest)))
(begin
(gnc:warn "Ignoring non-directory " current-dir
" in gnc:_path-expand_ item.")
(gnc:_path-expand_ other-items default-items))))
(if (directory? item)
(begin
(gnc:warn "Ignoring non-directory " item
" in gnc:_path-expand_ item.")
(gnc:_path-expand_ other-items default-items))
(cons item (gnc:_path-expand_ other-items default-items)))))
(else (gnc:warn "Ignoring invalid item " item " in gnc:_path-expand_.")
(gnc:_path-expand_ other-items default-items))))))
(define (gnc:_load-path-update_ var items)
(gnc:msg "Updating load path from " items)
(let ((result (gnc:_path-expand_
items
(gnc:config-var-default-value-get var))))
(if result
(begin
(set! gnc:_load-path-directories_ result)
(gnc:msg " Setting path to " result)
result)
(begin
(gnc:msg " No path... " result)
#f))))
(define (gnc:_doc-path-update_ var items)
(let ((result (gnc:_path-expand_
items
(gnc:config-var-default-value-get var))))
(if result
(begin
(set! gnc:_doc-path-directories_ result)
result)
#f)))
;; It may make sense to dump this in favor of guile's load-path later,
;; but for now this works, and having gnc things separate may be less
;; confusing and avoids shadowing problems.
(define (gnc:load name)
"Name must be a string. The system attempts to locate the file of
the given name and load it. The system will attempt to locate the
file in all of the directories specified by gnc:*load-path*."
(let ((file-name (gnc:find-in-directories name gnc:_load-path-directories_)))
(if (not file-name)
#f
(if (false-if-exception (primitive-load file-name))
(begin
(gnc:debug "loaded file " file-name)
#t)
(begin
(gnc:warn "failure loading " file-name)
#f)))))
(define gnc:load-user-config-if-needed
(let ((user-config-loaded? #f))
(lambda ()
(if (not user-config-loaded?)
(begin
(gnc:debug "loading user configuration")
(let ((user-file
(string-append (getenv "HOME") "/.gnucash/config.user"))
(auto-file
(string-append (getenv "HOME") "/.gnucash/config.auto")))
(if (access? user-file F_OK)
(if (false-if-exception (primitive-load user-file))
(set! user-config-loaded? #t)
(begin
(gnc:warn "failure loading " user-file)
#f))
(if (access? auto-file F_OK)
(if (false-if-exception (primitive-load auto-file))
(set! user-config-loaded? #t)
(begin
(gnc:warn "failure loading " auto-file)
#f))))))))))
;; the system config should probably be loaded from some directory
;; that wouldn't be a site wide mounted directory, like /usr/share
;; However, the code below seems to zero in on /usr/share/gnucash/config
;; ... ahh but that's OK, right ??
(define gnc:load-system-config-if-needed
(let ((system-config-loaded? #f))
(lambda ()
(if (not system-config-loaded?)
(begin
(gnc:debug "loading system configuration")
(let ((system-config (string-append
(gnc:config-var-value-get gnc:*config-dir*)
"/config")))
(if (false-if-exception (primitive-load system-config))
(set! system-config-loaded? #t)
(begin
(gnc:warn "failure loading " system-config)
#f))))))))

134
src/scm/text-export.scm Normal file
View File

@ -0,0 +1,134 @@
(require 'pretty-print)
(define (gnc:group-map-accounts thunk group)
(let loop ((num-accounts (gnc:group-get-num-accounts group))
(i 0))
(if (= i num-accounts)
'()
(cons (thunk (gnc:group-get-account group i))
(loop num-accounts (+ i 1))))))
; (define (gnc:account-transactions-for-each thunk account)
; ;; You must call gnc:group-reset-write-flags on the account group
; ;; before using this...
; (let loop ((num-splits (gnc:account-get-split-count account))
; (i 0))
; (if (< i num-splits)
; (let* ((split (gnc:account-get-split account i))
; (transaction (gnc:split-get-parent split)))
; ;; We don't use the flags just like FileIO does (only 1 pass here)...
; (if (= (gnc:transaction-get-write-flag transaction) 0)
; (begin
; (thunk transaction)
; (gnc:transaction-set-write-flag transaction 2)))
; (loop num-splits (+ i 1))))))
(define (gnc:transaction-map-splits thunk transaction)
(let loop ((num-splits (gnc:transaction-get-split-count transaction))
(i 0))
(if (< i num-splits)
(cons
(thunk (gnc:transaction-get-split transaction i))
(loop num-splits (+ i 1)))
'())))
(define (gnc:split->output-form split)
(list
'split
(gnc:split-get-memo split)
(gnc:split-get-action split)
(gnc:split-get-reconcile-state split)
(gnc:split-get-reconciled-date split)
(gnc:split-get-docref split)
(gnc:split-get-share-amount split)
(gnc:split-get-share-price split)
(gnc:split-get-share-price split)
(let ((xfer-account (gnc:split-get-account split))
(xfer-account-id #f))
(if (not (pointer-token-null? xfer-account))
(set! xfer-account-id (gnc:account-get-id xfer-account)))
xfer-account-id)))
(define (gnc:transaction->output-form transaction)
(list
'transaction
(gnc:transaction-get-num transaction)
(gnc:transaction-get-date-posted transaction)
(gnc:transaction-get-date-entered transaction)
(gnc:transaction-get-description transaction)
(gnc:transaction-get-docref transaction)
(gnc:transaction-map-splits gnc:split->output-form transaction)
))
(define (gnc:account->output-form a)
(list
'account
(gnc:account-get-id a)
(gnc:account-get-name a)
(gnc:account-get-flags a)
(gnc:account-type->symbol (gnc:account-get-type a))
(gnc:account-get-code a)
(gnc:account-get-description a)
(gnc:account-get-notes a)
(gnc:account-get-currency a)
(gnc:account-get-security a)
(let* ((accinfo (gnc:account-get-acc-info a))
(invacct (gnc:cast-to-inv-acct accinfo)))
(if (not (pointer-token-null? invacct))
(gnc:inv-acct-get-price-source invacct)
#f))
(list 'children
(gnc:group-map-accounts
gnc:account->output-form
(gnc:account-get-children a)))))
(define (gnc:account-transactions-export-as-text account)
(gnc:account-staged-transaction-traversal
account
1
(lambda (t) (pretty-print (gnc:transaction->output-form t)))))
(define (gnc:main-win-export-data-as-text win)
(let ((account-group #f)
(session (gnc:main-window-get-session win)))
(if session (set! account-group (gnc:session-get-group session)))
(if (not account-group)
(gnc:error-message-dialog "No account group available for text export.")
(gnc:account-group-export-as-text account-group))))
(define (gnc:account-group-export-as-text account-group)
(let ((file-name (gnc:file-selection-dialog "Select file for text export" "")))
(if file-name
(begin
(gnc:debug "Running text exporting to (not really) " file-name)
(pretty-print 'gnucash-data-file)
(pretty-print '(version "1.0"))
(display "\n\n;;; Account information\n")
;; Print all the accounts
(pretty-print
(gnc:group-map-accounts
gnc:account->output-form
account-group))
(display "\n\n;;; Transactions\n\n")
;; Now print all the transactions
(gnc:group-begin-staged-transaction-traversals account-group)
(gnc:group-map-accounts
gnc:account-transactions-export-as-text
account-group)))))

View File

@ -1,30 +1,4 @@
;;;; Warning functions...
(define (gnc:warn . items)
(display "gnucash: [W] ")
(for-each (lambda (i) (display i)) items)
(newline))
(define (gnc:error . items)
(display "gnucash: [E] ")
(for-each (lambda (i) (display i)) items)
(newline))
(define (gnc:msg . items)
(display "gnucash: [M] ")
(for-each (lambda (i) (display i)) items)
(newline))
(define (gnc:debug . items)
(if (gnc:config-var-value-get gnc:*debugging?*)
(begin
(display "gnucash: [D] ")
(for-each (lambda (i) (display i)) items)
(newline))))
(define (directory? path)
;; This follows symlinks normally.
(let* ((status (false-if-exception (stat path)))

View File

@ -22,7 +22,7 @@ include @top_srcdir@/Makefile.init
######################################################################
# See Makefile.common for information about these variables.
INDEP_SRCS := helperfuncs.c
CLEAN_SUBDIRS := guile perl5
CLEAN_SUBDIRS := perl5
######################################################################
# This inclusion must come after the first target, and after the
@ -35,17 +35,7 @@ else
plotutils:
endif
guile: plotutils ${OBJS}
@cd guile && $(MAKE) default
gnome: plotutils ${OBJS} perl5
@cd guile && $(MAKE) gnome
motif: plotutils ${OBJS} perl5
@cd guile && $(MAKE) motif
qt: plotutils ${OBJS} perl5
@cd guile && $(MAKE) qt
gnome motif qt: plotutils ${OBJS} perl5
DIST_TRASH += plot.preproc.h
@ -56,7 +46,7 @@ plot.preproc.h: /usr/include/plot.h
perl5: ${OBJS} ../engine/libengine.a
@cd perl5 && $(MAKE) default
.PHONY: guile motif
.PHONY: motif
# Local Variables:
# tab-width: 2

View File

@ -1,21 +1,20 @@
This README needs some serious help.
SWIG is now used only to wrap perl5, and I make no guarantees about
the safety of the resulting interface. It may or may not have large
memory leaks and other problems. Anyone who wants to investigate this
is welcome to. (RLB)
The guile interface is now handled via g-wrap (../../lib/g-wrap). As
far as I know, it is reasonably solid. Anyone who wants to know why I
switched to g-wrap can ask, and I'll explain. Sooner or later I'll
probably generate a FAQ entry, but I want to get this out the door.
Part of the reason has to do with the fact the SWIG's guile interface
leaked memory like a sieve. (RLB)
./examples contains whatever examples we've accumulated to date.
Each language interface is built in a separate subdirectory. Right
now we have guile and perl5. A simple "make" should build everything.
Building guile will result in guile/xacc-guile, a simple interpreter
that will let you execute scheme forms (including xacc commands). We
need to add an example of building a dynamically loadable guile module
later, but guile/xacc-guile.c shows you how easy it is to embed a
guile interpreter in your app, and then load all the xacc functions
into the interpreter.
Building perl5 will result in a perl module. For an example of how to
use it, see ../cbb/cbb-to-xacc.
----------------------
TBD:
-- modify configure to check perl paths

View File

@ -1,8 +0,0 @@
(define (list-accts filename)
(let ((db (xaccReadAccountGroup filename)))
(do ((total (xaccGroupGetNumAccounts db))
(i 0 (+ i 1)))
((= i total))
(let ((acct (xaccGroupGetAccount db i)))
(write (xaccAccountGetName acct))))))

View File

@ -1,8 +0,0 @@
Makefile
tmp
obj
gnucash.all.i
gnucash.engine.i
gnucash.gnome.i
*_wrap.c
*_wrap.doc

View File

@ -1,128 +0,0 @@
# Makefile -- makefile for gnucash/src/swig
# Copyright (C) 1998 Rob Browning <rlb@cs.utexas.edu>
#
# 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, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# These three lines are suggested defs for autoconf (see the info pages).
include @top_srcdir@/Makefile.init
INCLPATH = \
-I. \
-I@top_srcdir@/ \
-I@top_srcdir@/src \
-I@top_srcdir@/src/gnome \
-I@top_srcdir@/src/swig\
-I@top_srcdir@/src/engine \
-I@top_srcdir@/src/register \
-I@top_srcdir@/src/guile \
-I@top_srcdir@/include \
-I@top_srcdir@/lib/ComboBox-1.33 \
-I@top_srcdir@/lib/Xbae-4.6.2-linas \
-I$(prefix)/include
CFLAGS := @CFLAGS@ @X_CFLAGS@ -DCELL_WIDGETS=1 ${INCLPATH} -Wno-unused
CFLAGS := $(filter-out -Werror,${CFLAGS})
SWIG_FLAGS := -stat -guile ${INCLPATH}
######################################################################
# SEE Makefile.common for information about these variables.
INDEP_SRCS := gnucash-all-guile_wrap.c
GNOME_SRCS := gnucash-gnome-guile_wrap.c
######################################################################
# This inclusion must come after the first target, and after the
# definitions of *_SRCS, etc., but before the usage of *_OBJS.
include @top_srcdir@/Makefile.common
default: ${OBJS}
.PHONY: default
gnome: default ${GNOME_OBJS}
motif: default
qt: default
SWIG_FILTER := %P.h %/util.h
SWIG_ENGINE_HDRS := \
$(filter-out ${SWIG_FILTER},$(wildcard @top_srcdir@/src/engine/*.h))
SWIG_ALL_HDRS := \
${SWIG_ENGINE_HDRS} \
../helperfuncs.h \
$(filter-out ${SWIG_FILTER},$(wildcard @top_srcdir@/src/guile/gnucash.h))
ifeq (${HAVE_PLOTUTILS},1)
SWIG_ALL_HDRS += ../plot.preproc.h
endif
SWIG_GNOME_HDRS := ${SWIG_ALL_HDRS} \
$(wildcard @top_srcdir@/src/gnome/options-dialog.h)
# Because Swig's include mechanism is not too smart.
SWIG_ENGINE_BASENAMES := $(notdir ${SWIG_ENGINE_HDRS})
SWIG_ALL_BASENAMES := $(notdir ${SWIG_ALL_HDRS})
SWIG_GNOME_BASENAMES := $(notdir ${SWIG_GNOME_HDRS})
# This is .PHONY because it has to be re-generated *every* time. Who
# knows when headers are added to the engine dir?
gnucash.engine.i: guile_swig_annotations.i ${SWIG_ENGINE_HDRS}
@echo "%module gnucash" > $@
@echo "%include guile_swig_annotations.i" >> $@
@echo "%{" >> $@
@($(foreach hdr,${SWIG_ENGINE_BASENAMES},echo "#include <${hdr}>"; )) >> $@
@echo "%}" >> $@
@($(foreach hdr,${SWIG_ENGINE_BASENAMES},echo %include ${hdr}; )) >> $@
TRASH += gnucash.engine.i gnucash.engine_wrap.doc
gnucash.all.i: guile_swig_annotations.i ${SWIG_ALL_HDRS}
@echo "%module gnucash" > $@
@echo "%include guile_swig_annotations.i" >> $@
@echo "%{" >> $@
@($(foreach hdr,${SWIG_ALL_BASENAMES},echo "#include <${hdr}>"; )) >> $@
@echo "%}" >> $@
@($(foreach hdr,${SWIG_ALL_BASENAMES},echo %include ${hdr}; )) >> $@
TRASH += gnucash.all.i gnucash.all_wrap.doc
gnucash.gnome.i: guile_swig_annotations.i ${SWIG_GNOME_HDRS}
@echo "%module gnucash" > $@
@echo "%include \"guile_swig_annotations.i\"" >> $@
@echo "%{" >> $@
@($(foreach hdr,${SWIG_GNOME_BASENAMES},echo "#include <${hdr}>"; )) >> $@
@echo "%}" >> $@
@($(foreach hdr,${SWIG_GNOME_BASENAMES},echo %include \"${hdr}\"; )) >> $@
TRASH += gnucash.gnome.i gnucash.gnome_wrap.doc
gnucash-engine-guile_wrap.c: gnucash.engine.i
${SWIG} ${SWIG_FLAGS} -o $@ $<
${PERL} -pi -e 's/^void gnucash\(\)/void gnucash_swig_init\(\)/' $@
TRASH += gnucash-engine-guile_wrap.c
gnucash-all-guile_wrap.c: gnucash.all.i
${SWIG} ${SWIG_FLAGS} -o $@ $<
${PERL} -pi -e 's/^void gnucash\(\)/void gnucash_swig_init\(\)/' $@
TRASH += gnucash-all-guile_wrap.c
gnucash-gnome-guile_wrap.c: gnucash.gnome.i
swig ${SWIG_FLAGS} -o $@ $<
perl -pi -e 's/^void gnucash\(\)/void gnucash_swig_init\(\)/' $@
TRASH += gnucash-gnome-guile_wrap.c
# Local Variables:
# tab-width: 2
# End:

View File

@ -1,33 +0,0 @@
#include <stdio.h>
#include <readline.h>
#include <history.h>
#include <guile/gh.h>
#include <FileIO.h>
/* Because swig doesn't declare the prototype anywhere */
void gnucash_swig_init();
static void
guile_entry_point(int argc, char *argv[]) {
char *input;
// gnucash_swig_init();
/* input = readline("gnucash> "); */
/* while(input) { */
/* SCM result = gh_eval_str(input); */
/* gh_display(result); */
/* gh_newline(); */
/* add_history(input); */
/* free(input); */
/* input = readline("gnucash> "); */
/* } */
gnucash_swig_init();
gh_repl(argc, argv);
}
int
main(int argc, char *argv[]) {
gh_enter(argc, argv, guile_entry_point);
return 0;
}

View File

@ -1,6 +0,0 @@
/* SWIG insists that the entry function to the module be gnucash(), so
we redirect the name */
void
gnucash_guile_init();

View File

@ -1,42 +0,0 @@
/* -*-c-*- */
/* This tells SWIG to pass SCM values straight through. I'm not sure
how kosher this is, so we may have to watch it in future SWIG
releases, but it works for now. It's designed to allow you to have
something like this on the C side:
void foo(SCM f) {
gh_call0(f);
}
And call it from Guile like this:
(foo (lambda (x) (display "OK") (newline)))
*/
%typemap(guile,out) SCM {
$target = $source;
}
%typemap(guile,in) SCM* {
$target = &$source;
}
/* Treat time_t as a floating point number at the guile level. On
many of the common platforms it's just an integer, but there are
supposedly platforms (acording to the GNU libc info pages) where it
may be a real, and a real is always safe here. */
typedef double time_t;
/*
%typemap(guile, out) time_t {
$target = gh_double2scm((double) (* $source));
}
%typemap(guile, in) time_t {
$target = gh_scm2double($source);
}
*/