From 2590f3ef7e53080fc7a595462d679d032eb9108c Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Thu, 15 Oct 1998 03:53:12 +0000 Subject: [PATCH] patches from rob browning git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1306 57a11ea4-9604-0410-9ed3-97b8803252fd --- Makefile.in | 4 +- configure | 199 +++++++++++++++++---------------- configure.in | 8 +- gnucash.in => gnucash | 5 +- src/Makefile.in | 2 +- src/coding-style.txt | 15 +++ src/scm/doc.scm | 0 src/scm/hooks.scm | 67 ++++++----- src/scm/startup.scm | 172 ++++++++++++++++------------ src/swig/guile/gnucash-guile.c | 24 ++-- src/swig/guile/simple-plot.scm | 0 11 files changed, 278 insertions(+), 218 deletions(-) rename gnucash.in => gnucash (80%) mode change 100644 => 100755 create mode 100644 src/scm/doc.scm create mode 100644 src/swig/guile/simple-plot.scm diff --git a/Makefile.in b/Makefile.in index 1efebe1757..7119f3fc6f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -94,8 +94,8 @@ clean: @cd src; $(MAKE) clean distclean: clean - rm -f *~ *.o *.bak Makefile share/scm gnucash.bin - rm -f gnucash gnucash.motif gnucash.motif.static \ + rm -f Makefile *~ *.o *.bak share/scm gnucash.bin + rm -f gnucash.motif gnucash.motif.static \ gnucash.gnome gnucash.gnome.static gnucash.qt rm -f config.cache config.log config.status config.h rm -f src/guile/path-defaults.h diff --git a/configure b/configure index e6e7e4eb46..5ebb8424a8 100755 --- a/configure +++ b/configure @@ -23,6 +23,8 @@ ac_help="$ac_help --with-motif-includes=DIR specify where to look for motif includes" ac_help="$ac_help --with-motif-libraries=DIR specify where to look for motif libs" +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 @@ -633,6 +635,13 @@ if test "${with_motif_libraries+set}" = set; then fi +# Check whether --with-xmhtml-includes or --without-xmhtml-includes was given. +if test "${with_xmhtml_includes+set}" = set; then + withval="$with_xmhtml_includes" + X_CFLAGS="${X_CFLAGS} -I$with_xmhtml_includes" +fi + + # Check whether --with-xmhtml-libraries or --without-xmhtml-libraries was given. if test "${with_xmhtml_libraries+set}" = set; then withval="$with_xmhtml_libraries" @@ -695,7 +704,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:699: checking for a BSD compatible install" >&5 +echo "configure:708: 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 @@ -747,7 +756,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:751: checking for $ac_word" >&5 +echo "configure:760: 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 @@ -776,7 +785,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:780: checking for $ac_word" >&5 +echo "configure:789: 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 @@ -805,7 +814,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:809: checking for $ac_word" >&5 +echo "configure:818: 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 @@ -853,7 +862,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:857: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:866: 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. @@ -863,11 +872,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 @@ -887,12 +896,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:891: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:900: 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:896: checking whether we are using GNU C" >&5 +echo "configure:905: 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 @@ -901,7 +910,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:905: \"$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:914: \"$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 @@ -916,7 +925,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:920: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:929: 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 @@ -944,7 +953,7 @@ else fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:948: checking for POSIXized ISC" >&5 +echo "configure:957: 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 @@ -965,14 +974,14 @@ else fi echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:969: checking whether byte ordering is bigendian" >&5 +echo "configure:978: 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 < #include @@ -983,11 +992,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:987: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:996: \"$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 < #include @@ -998,7 +1007,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1011: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -1018,7 +1027,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 <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -1055,7 +1064,7 @@ EOF fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1059: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1068: 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 @@ -1085,7 +1094,7 @@ fi # ******************************************* # check for UI libs: echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1089: checking how to run the C preprocessor" >&5 +echo "configure:1098: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1100,13 +1109,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1110: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1119: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1117,13 +1126,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1127: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1136: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1150,7 +1159,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:1154: checking for X" >&5 +echo "configure:1163: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -1212,12 +1221,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1221: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1230: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1286,14 +1295,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -1399,17 +1408,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:1403: checking whether -R must be followed by a space" >&5 +echo "configure:1412: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_R_nospace=yes else @@ -1425,14 +1434,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_R_space=yes else @@ -1464,7 +1473,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:1468: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:1477: 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 @@ -1472,7 +1481,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1505,7 +1514,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:1509: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:1518: 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 @@ -1513,7 +1522,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1537: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1553,12 +1562,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:1557: checking for gethostbyname" >&5 +echo "configure:1566: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -1602,7 +1611,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:1606: checking for gethostbyname in -lnsl" >&5 +echo "configure:1615: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1610,7 +1619,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1651,12 +1660,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:1655: checking for connect" >&5 +echo "configure:1664: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -1700,7 +1709,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:1704: checking for connect in -lsocket" >&5 +echo "configure:1713: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1708,7 +1717,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1743,12 +1752,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:1747: checking for remove" >&5 +echo "configure:1756: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -1792,7 +1801,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:1796: checking for remove in -lposix" >&5 +echo "configure:1805: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1800,7 +1809,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1835,12 +1844,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:1839: checking for shmat" >&5 +echo "configure:1848: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -1884,7 +1893,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:1888: checking for shmat in -lipc" >&5 +echo "configure:1897: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1892,7 +1901,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1936,7 +1945,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:1940: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:1949: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1944,7 +1953,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1968: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1984,7 +1993,7 @@ LIBS="-lm" # the XmHTML widget needs libz, libjpeg, libpng and libm # it also uses #ifdef's not #if's so DONT #def to zero. echo $ac_n "checking for deflateEnd in -lz""... $ac_c" 1>&6 -echo "configure:1988: checking for deflateEnd in -lz" >&5 +echo "configure:1997: checking for deflateEnd in -lz" >&5 ac_lib_var=`echo z'_'deflateEnd | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1992,7 +2001,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2027,7 +2036,7 @@ else fi echo $ac_n "checking for jpeg_read_scanlines in -ljpeg""... $ac_c" 1>&6 -echo "configure:2031: checking for jpeg_read_scanlines in -ljpeg" >&5 +echo "configure:2040: checking for jpeg_read_scanlines in -ljpeg" >&5 ac_lib_var=`echo jpeg'_'jpeg_read_scanlines | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2035,7 +2044,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ljpeg $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2070,7 +2079,7 @@ else fi echo $ac_n "checking for png_read_image in -lpng""... $ac_c" 1>&6 -echo "configure:2074: checking for png_read_image in -lpng" >&5 +echo "configure:2083: checking for png_read_image in -lpng" >&5 ac_lib_var=`echo png'_'png_read_image | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2078,7 +2087,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpng $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2102: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2119,7 +2128,7 @@ fi # LIBS="-lXmu -lXt -lXext $X_PRE_LIBS -lX11 $X_LIBS $X_EXTRA_LIBS $LIBS" echo $ac_n "checking for XpmReadFileToXpmImage in -lXpm""... $ac_c" 1>&6 -echo "configure:2123: checking for XpmReadFileToXpmImage in -lXpm" >&5 +echo "configure:2132: checking for XpmReadFileToXpmImage in -lXpm" >&5 ac_lib_var=`echo Xpm'_'XpmReadFileToXpmImage | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2127,7 +2136,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXpm -L $x_libraries -lX11 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2169,15 +2178,15 @@ fi # Don't build the xmhtml source if user already has it installed... # this is ugly, there must be a nicer way of setting this up ... echo $ac_n "checking for XmHTMLTextScrollToLine in -lXmHTML""... $ac_c" 1>&6 -echo "configure:2173: checking for XmHTMLTextScrollToLine in -lXmHTML" >&5 +echo "configure:2182: checking for XmHTMLTextScrollToLine in -lXmHTML" >&5 ac_lib_var=`echo XmHTML'_'XmHTMLTextScrollToLine | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" -LIBS="-lXmHTML -lXm -L $x_libraries -lXext -lX11 $LIBS" +LIBS="-lXmHTML -lXm -L $x_libraries $X_LIBS -lXext -lXt -lX11 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2219,7 +2228,7 @@ fi # Set GUILELIBS according to the set of libraries needed to link # with guile. echo $ac_n "checking for gh_enter in -lguile""... $ac_c" 1>&6 -echo "configure:2223: checking for gh_enter in -lguile" >&5 +echo "configure:2232: checking for gh_enter in -lguile" >&5 ac_lib_var=`echo guile'_'gh_enter | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2227,7 +2236,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lguile $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2257,7 +2266,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for gh_define in -lguile""... $ac_c" 1>&6 -echo "configure:2261: checking for gh_define in -lguile" >&5 +echo "configure:2270: checking for gh_define in -lguile" >&5 ac_lib_var=`echo guile'_'gh_define | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2265,7 +2274,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lguile -ldl -lreadline $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2295,7 +2304,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for gh_eval_file in -lguile""... $ac_c" 1>&6 -echo "configure:2299: checking for gh_eval_file in -lguile" >&5 +echo "configure:2308: checking for gh_eval_file in -lguile" >&5 ac_lib_var=`echo guile'_'gh_eval_file | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2303,7 +2312,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lguile -ldl -lreadline -lqthreads $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2327: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2446,7 +2455,7 @@ done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo "gnucash Makefile src/Makefile src/engine/Makefile src/guile/Makefile src/gnome/Makefile src/motif/Makefile src/qt/Makefile src/register/Makefile src/reports/Makefile lib/Makefile lib/XmHTML-1.1.0/Makefile lib/XmHTML-1.1.0/src/Makefile lib/Xbae-4.6.2-linas/Makefile lib/Xbae-4.6.2-linas/src/Makefile lib/ComboBox-1.33/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "Makefile src/Makefile src/engine/Makefile src/guile/Makefile src/gnome/Makefile src/motif/Makefile src/qt/Makefile src/register/Makefile src/reports/Makefile lib/Makefile lib/XmHTML-1.1.0/Makefile lib/XmHTML-1.1.0/src/Makefile lib/Xbae-4.6.2-linas/Makefile lib/Xbae-4.6.2-linas/src/Makefile lib/ComboBox-1.33/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then diff --git a/configure.in b/configure.in index 61e3fe641b..036175cb86 100644 --- a/configure.in +++ b/configure.in @@ -45,6 +45,10 @@ AC_ARG_WITH( motif-libraries, [ --with-motif-libraries=DIR specify where to look for motif libs], X_LIBS="${X_LIBS} -L$with_motif_libraries" ) +AC_ARG_WITH( xmhtml-includes, + [ --with-xmhtml-includes=DIR specify where to look for xmhtml headers], + X_CFLAGS="${X_CFLAGS} -I$with_xmhtml_includes" ) + AC_ARG_WITH( xmhtml-libraries, [ --with-xmhtml-libraries=DIR specify where to look for xmhtml libs], X_LIBS="${X_LIBS} -L$with_xmhtml_libraries" ) @@ -104,7 +108,7 @@ AC_CHECK_LIB(XmHTML, XmHTMLTextScrollToLine, XMHTML_TARGET=default XMHTML_INC=/lib/XmHTML-1.1.0/src LIBS="-L $srcdir/lib/XmHTML-1.1.0 $LIBS" , - -lXm -L $x_libraries -lXext -lX11) + -lXm -L $x_libraries $X_LIBS -lXext -lXt -lX11) AC_SUBST(XMHTML_TARGET) AC_SUBST(XMHTML_INC) @@ -126,6 +130,6 @@ AC_SUBST(GUILELIBS) # ******************************************* AC_CONFIG_HEADER(config.h) -AC_OUTPUT(gnucash Makefile src/Makefile src/engine/Makefile src/guile/Makefile src/gnome/Makefile src/motif/Makefile src/qt/Makefile src/register/Makefile src/reports/Makefile lib/Makefile lib/XmHTML-1.1.0/Makefile lib/XmHTML-1.1.0/src/Makefile lib/Xbae-4.6.2-linas/Makefile lib/Xbae-4.6.2-linas/src/Makefile lib/ComboBox-1.33/Makefile) +AC_OUTPUT(Makefile src/Makefile src/engine/Makefile src/guile/Makefile src/gnome/Makefile src/motif/Makefile src/qt/Makefile src/register/Makefile src/reports/Makefile lib/Makefile lib/XmHTML-1.1.0/Makefile lib/XmHTML-1.1.0/src/Makefile lib/Xbae-4.6.2-linas/Makefile lib/Xbae-4.6.2-linas/src/Makefile lib/ComboBox-1.33/Makefile) chmod +x gnucash diff --git a/gnucash.in b/gnucash old mode 100644 new mode 100755 similarity index 80% rename from gnucash.in rename to gnucash index c4f7d7ceb0..16b37c5c54 --- a/gnucash.in +++ b/gnucash @@ -1,14 +1,11 @@ #! /bin/sh -# @configure_input@ GNC_ARGS="${GNC_ARGS} --debug" GNC_ARGS="${GNC_ARGS} --startup-file ./share/scm/startup.scm" GNC_ARGS="${GNC_ARGS} --share-dir ./share" GNC_ARGS="${GNC_ARGS} --config-dir ./etc" GNC_ARGS="${GNC_ARGS} --load-path (\"(./share/scm)\")" - -XACC_HELP=${XACC_HELP}:./Docs:./Reports -export XACC_HELP +GNC_ARGS="${GNC_ARGS} --doc-path (\"(./Docs)\"\"(./Reports)\")" # Run whichever one was built last. exec gnucash.bin ${GNC_ARGS} $@ diff --git a/src/Makefile.in b/src/Makefile.in index 65cb07afe8..916c14d905 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -34,7 +34,7 @@ CFLAGS = @CFLAGS@ @X_CFLAGS@ ${INCLPATH} ###################################################################### # See Makefile.common for information about these variables. COMMON_SRCS := MultiLedger.c SplitLedger.c -CLEAN_SUBDIRS := engine gnome motif register guile swig qt +CLEAN_SUBDIRS := engine gnome motif register guile reports swig qt ###################################################################### all: default diff --git a/src/coding-style.txt b/src/coding-style.txt index 7b998a4893..0189a17cd3 100644 --- a/src/coding-style.txt +++ b/src/coding-style.txt @@ -28,3 +28,18 @@ So here is the law: -- Linas Vepstas 17 August 1998 + + +Rob's Style conventions (for anyone who cares): + +Scheme: + * all gnucash functions and global variables are prefixed with gnc: + * all global variables are enclosed in ** (i.e. gnc:*load-path*) + * all private functions are enclosed in __ (i.e. gnc:_do-not-call_) + * all C functions exported via swig have underscores in place of dashes + +C: + * all gnucash functions and global variables are prefixed with gnc_ + * all private functions are enclosed in __ (i.e. _gnc_do_not_call_) + * use static functions whenever possible + * use const whenever possible diff --git a/src/scm/doc.scm b/src/scm/doc.scm new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/scm/hooks.scm b/src/scm/hooks.scm index 9a23bcf7b5..7682957d8a 100644 --- a/src/scm/hooks.scm +++ b/src/scm/hooks.scm @@ -8,57 +8,62 @@ ;;; Private ;; Central repository for all hooks -- so we can look them up later by name. -(define gnucash:*hooks* '()) +(define gnc:*hooks* '()) -(define (gnucash:hook-danglers-get hook) +(define (gnc:hook-danglers-get hook) (vector-ref hook 2)) -(define (gnucash:hook-danglers-set! hook danglers) +(define (gnc:hook-danglers-set! hook danglers) (vector-set! hook 2 danglers)) ;;; Developers -(define (gnucash:hook-define name description) +(define (gnc:hook-define name description) (let ((hook-data (vector name description '()))) - (set! gnucash:*hooks* (assoc-set! gnucash:*hooks* name hook-data)) + (set! gnc:*hooks* (assoc-set! gnc:*hooks* name hook-data)) hook-data)) -(define (gnucash:hook-danglers->list hook) - (gnucash:hook-danglers-get hook)) +(define (gnc:hook-danglers->list hook) + (gnc:hook-danglers-get hook)) -(define (gnucash:hook-replace-danglers hook function-list) - (gnucash:hook-danglers-set! hook function-list)) +(define (gnc:hook-replace-danglers hook function-list) + (gnc:hook-danglers-set! hook function-list)) -(define (gnucash:hook-run-danglers hook) - (for-each (lambda (dangler) (dangler)) (gnucash:hook-danglers-get hook))) +(define (gnc:hook-run-danglers hook) + (gnc:debug "Running functions on hook " (gnc:hook-name-get hook)) + (for-each (lambda (dangler) (dangler)) (gnc:hook-danglers-get hook))) ;;; Public -(define (gnucash:hook-lookup name) - (assoc-ref gnucash:*hooks* name)) +(define (gnc:hook-lookup name) + (assoc-ref gnc:*hooks* name)) -(define (gnucash:hook-add-dangler hook function) - (let ((danglers (gnucash:hook-danglers-get hook))) - (gnucash:hook-danglers-set! hook (append danglers (list function))))) +(define (gnc:hook-add-dangler hook function) + (let ((danglers (gnc:hook-danglers-get hook))) + (gnc:hook-danglers-set! hook (append danglers (list function))))) -(define (gnucash:hook-remove-dangler hook function) - (let ((danglers (gnucash:hook-danglers-get hook))) - (gnucash:hook-danglers-set! hook (delq! function danglers)))) +(define (gnc:hook-remove-dangler hook function) + (let ((danglers (gnc:hook-danglers-get hook))) + (gnc:hook-danglers-set! hook (delq! function danglers)))) -(define (gnucash:hook-description-get hook) +(define (gnc:hook-description-get hook) (vector-ref hook 1)) -(define (gnucash:hook-name-get hook) +(define (gnc:hook-name-get hook) (vector-ref hook 0)) -(gnucash:hook-define 'startup-hook "Startup hooks") +(define gnc:*startup-hook* + (gnc:hook-define 'startup-hook "Functions to run at startup.")) -(let ((hook (gnucash:hook-lookup 'startup-hook))) - (display (gnucash:hook-name-get hook)) - (newline) - (display (gnucash:hook-description-get hook)) - (newline) - (gnucash:hook-add-dangler hook (lambda () - (display "Running a simple startup hook") - (newline))) - (gnucash:hook-run-danglers hook)) +(define gnc:*shutdown-hook* + (gnc:hook-define 'shutdown-hook "Functions to run at shutdown.")) + +;;(let ((hook (gnc:hook-lookup 'startup-hook))) +;; (display (gnc:hook-name-get hook)) +;; (newline) +;; (display (gnc:hook-description-get hook)) +;; (newline) +;; (gnc:hook-add-dangler hook (lambda () +;; (display "Running a simple startup hook") +;; (newline))) +;; (gnc:hook-run-danglers hook)) diff --git a/src/scm/startup.scm b/src/scm/startup.scm index ed1ee8fcee..7fcf7cc4a0 100644 --- a/src/scm/startup.scm +++ b/src/scm/startup.scm @@ -40,11 +40,12 @@ (gnc:debug "starting up.") #t) -(define (gnc:shutdown value) - ;; FIXME: This should be synchronized with the C shutdown process... - (gnc:debug "shutting down.") - (exit 0)) +(define (gnc:shutdown exit-status) + (gnc:debug "Shutdown -- exit-status: " exit-status) + (gnc:hook-run-danglers gnc:*shutdown-hook*) + (_gnc_shutdown_ exit-status) + (exit exit-status)) (define gnc:*user-config-loaded?* #f) @@ -85,6 +86,7 @@ #f)))) (define gnc:_load-path-directories_ #f) +(define gnc:_doc-path-directories_ #f) (define (directory? path) ;; This follows symlinks normally. @@ -118,7 +120,7 @@ (gnc:directory-subdirectories full-path) dirs)))))))))))) -(define (gnc:_load-path-expand_ items) +(define (gnc:_path-expand_ items default-items) (if (null? items) '() @@ -127,9 +129,8 @@ (cond ((eq? item 'default) (append - (gnc:_load-path-expand_ - (gnc:config-var-default-value-get gnc:*load-path*))) - (gnc:_load-path-expand_ other-items)) + (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)))) @@ -139,30 +140,61 @@ (if (directory? current-dir) (let ((subdirs (gnc:directory-subdirectories current-dir)) - (rest (gnc:_load-path-expand_ other-items))) + (rest (gnc:_path-expand_ other-items default-items))) (cons current-dir (append subdirs rest))) (begin (gnc:warn "Non-directory " current-dir - "in gnc:*load-path* value." + "in gnc:_path-expand_ item." "Ignoring.") '()))) (if (directory? item) (begin - (gnc:warn "Non-directory " item "in gnc:*load-path* value." + (gnc:warn "Non-directory " item "in gnc:_path-expand_ item." "Ignoring.") '()) - (cons item (gnc:_load-path-expand_ other-items))))) - (else (gnc:warn "Invalid item " item " in gnc:*load-path*. Ignoring") - (gnc:_load-path-expand_ other-items)))))) + (cons item (gnc:_path-expand_ other-items default-items))))) + (else (gnc:warn "Invalid item " item " in gnc:_path-expand_. Ignoring") + (gnc:_path-expand_ other-items default-items)))))) (define (gnc:_load-path-update_ items) - (let ((result (gnc:_load-path-expand_ items))) + (let ((result (gnc:_path-expand_ + items + (gnc:config-var-default-value-get gnc:*load-path*)))) (if result (begin (set! gnc:_load-path-directories_ result) result) #f))) +(define (gnc:_doc-path-update_ items) + (let ((result (gnc:_path-expand_ + items + (gnc:config-var-default-value-get gnc:*doc-path*)))) + (if result + (begin + (set! gnc:_doc-path-directories_ result) + result) + #f))) + +(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)))))) + ;; 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. @@ -171,28 +203,17 @@ "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 ((directories gnc:_load-path-directories_)) - (gnc:debug "gnc:load looking for " name " in " directories) - - (do ((rest directories (cdr rest)) - (finished? #f) - (result #f)) - ((or (null? rest) finished?) result) - - (let ((file-name (string-append (car rest) "/" name))) - (gnc:debug " checking for " file-name) - (if (access? file-name F_OK) - (if (false-if-exception (primitive-load file-name)) - (begin - (gnc:debug "loaded file " file-name) - (set! finished? #t) - (set! result #t)) - (begin - (gnc:warn "failure loading " file-name) - (set! finished? #t) - (set! result #f)))))))) - + + (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))))) ;;; config-var: You can create them, set values, find out of the value ;;; is different from the default, and you can get a description. You @@ -314,6 +335,27 @@ variable is modified. The symbol element default will expand to the default dir (string-append "(" (getenv "HOME") "/.gnucash/scm)") (string-append "(" gnc:_share-dir-default_ "/scm)")))) +(define gnc:*doc-path* + (gnc:make-config-var + "A list of strings indicating where to look for documentation 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))" + (lambda (var value) + (if (not (list? value)) + #f + (let ((result (gnc:_doc-path-update_ value))) + (if (list? result) + (list result) + #f)))) + equal? + (list + (string-append "(" (getenv "HOME") "/.gnucash/doc)") + (string-append "(" gnc:_doc-dir-default_ ")")))) + + (define gnc:*prefs* (list @@ -364,21 +406,25 @@ variable is modified. The symbol element default will expand to the default dir (gnc:error "non-list given for --load-path: " val) (gnc:shutdown 1))))))) + (cons + "doc-path" + (cons 'string + (lambda (val) + (let ((path-list + (call-with-input-string val (lambda (port) (read port))))) + (if (list? path-list) + (gnc:config-var-value-set! gnc:*doc-path* #f path-list) + (begin + (gnc:error "non-list given for --doc-path: " val) + (gnc:shutdown 1))))))) + (cons "load-user-config" (cons 'boolean gnc:load-user-config)) (cons "load-system-config" (cons 'boolean gnc:load-system-config)))) -;;TODO - -;;help-path... - -;; /* get environment var stuff... TODO let cmd-line opts override this stuff */ -;; if( (helpPath = getenv(HELP_VAR)) == NULL ) -;; helpPath = HELP_ROOT; ;; also "-c" - (define (gnc:cmd-line-get-boolean-arg args) ;; --arg means #t ;; --arg true means #t @@ -410,29 +456,6 @@ variable is modified. The symbol element default will expand to the default dir (define (gnc:prefs-show-usage) (display "usage: gnucash [ option ... ] [ datafile ]") (newline)) -; (for-each -; (lambda (item) -; (display -; (string-append -; " --" (gnc:pref-name-get (cdr item)) " " -; (gnc:pref-value-name-get (cdr item)))) -; (newline) -; (display -; (string-append -; " description: " (gnc:pref-description-get (cdr item)))) -; (newline) -; (display -; (string-append -; " type: " (symbol->string (gnc:pref-type-get (cdr item))))) -; (newline) -; (display -; " default: ") -; (display (gnc:pref-default-get (cdr item))) -; (newline) -; (newline) -; ) - -; gnc:*prefs*)) (define (gnc:handle-command-line-args) (gnc:debug "handling command line arguments") @@ -491,28 +514,29 @@ variable is modified. The symbol element default will expand to the default dir result)) - ;;;; Now the fun begins. (gnc:startup) (if (not (gnc:handle-command-line-args)) - (gnucash:shutdown 1)) + (gnc:shutdown 1)) ;;; Now we can load a bunch of files. -;; (gnc:load 'hooks) + +(gnc:load "hooks.scm") +(gnc:load "doc.scm") ;;; Load the system and user configs (if (not gnc:*user-config-loaded?*) (if (not (gnc:load-system-config)) - (gnucash:shutdown 1))) + (gnc:shutdown 1))) (if (not gnc:*system-config-loaded?*) (if (not (gnc:load-user-config)) - (gnucash:shutdown 1))) + (gnc:shutdown 1))) -; (gnc:hook-run-danglers gnc:*startup-hooks*) +(gnc:hook-run-danglers gnc:*startup-hook*) (if (or (gnc:config-var-value-get gnc:*arg-show-usage*) (gnc:config-var-value-get gnc:*arg-show-help*)) diff --git a/src/swig/guile/gnucash-guile.c b/src/swig/guile/gnucash-guile.c index 0bb29db0f9..9366328e41 100644 --- a/src/swig/guile/gnucash-guile.c +++ b/src/swig/guile/gnucash-guile.c @@ -4,20 +4,26 @@ #include #include +/* 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> "); - } +/* 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 diff --git a/src/swig/guile/simple-plot.scm b/src/swig/guile/simple-plot.scm new file mode 100644 index 0000000000..e69de29bb2