diff --git a/configure.in b/configure.in index 39eaf7d975..f2fc7cc001 100644 --- a/configure.in +++ b/configure.in @@ -208,19 +208,6 @@ fi AC_SUBST(PERLINCL) -### ------------------------------------------------------------------- - -# Check for 'swig' -AC_PATH_PROG(SWIG,swig,no) # Sets @SWIG@ -AC_ARG_WITH(swig, - [ --with-swig=FILE which swig executable to use ], - SWIG="${with_swig}") - -if test x"$SWIG" = xno; then - AC_MSG_ERROR([Cannot find Swig. Try using the --with-swig flag.]) -fi - - ### -------------------------------------------------------------------------- ### Libraries LIBS="$LIBS -lm" @@ -324,7 +311,6 @@ AC_OUTPUT( src/gnome/Makefile src/guile/Makefile src/optional/Makefile - src/optional/swig/Makefile src/pixmaps/Makefile src/quotes/Makefile src/register/Makefile diff --git a/src/FileDialog.h b/src/FileDialog.h index b7870ff15e..2ed5213a34 100644 --- a/src/FileDialog.h +++ b/src/FileDialog.h @@ -32,7 +32,7 @@ * These utilities are written in a GUI-independent fashion, and should * work just fine with the Motif, gnome/gtk and Qt interfaces. * These utilities are appropriate for direct invocation from guile. - * (they should be wrapped by swig or g-wrap). + * (they should be wrapped by g-wrap). * * These GUI dialogues implement and maintain a single global "session" * that defines the currently edited account group. In a sense, these diff --git a/src/engine/Account.c b/src/engine/Account.c index 54eafcf4d6..8480fe73f4 100644 --- a/src/engine/Account.c +++ b/src/engine/Account.c @@ -1286,7 +1286,7 @@ xaccAccountSetTaxRelated (Account *account, gboolean tax_related) /********************************************************************\ \********************************************************************/ -Account * +Account * IthAccount (Account **list, int i) { if (!list || 0 > i) return NULL; diff --git a/src/engine/Account.h b/src/engine/Account.h index fc7d6c31c9..0dfeb530f5 100644 --- a/src/engine/Account.h +++ b/src/engine/Account.h @@ -316,13 +316,10 @@ const char * xaccAccountGetPriceSrc (Account *acc); void xaccAccountSortSplits(Account *); -#ifndef SWIG - gpointer xaccAccountForEachSplit(Account *s, gpointer (*thunk)(Split *s, gpointer data), gpointer data); - /* Traverse all of the transactions in the given account. Continue processing IFF proc does not return FALSE. This function does not descend recursively to traverse transactions in child accounts. @@ -357,6 +354,4 @@ xaccAccountVisitUnvisitedTransactions(Account *acc, void *data, GHashTable *visited_txns); -#endif /* SWIG */ - #endif /* __XACC_ACCOUNT_H__ */ diff --git a/src/engine/Group.h b/src/engine/Group.h index 597633ea0f..11cc4eb0de 100644 --- a/src/engine/Group.h +++ b/src/engine/Group.h @@ -197,8 +197,6 @@ char * xaccAccountGetNextChildCode (Account *acc, int num_digits); void xaccGroupAutoCode (AccountGroup *grp, int num_digits); void xaccGroupDepthAutoCode (AccountGroup *grp); -#ifndef SWIG - /* if the function returns null for a given item, it won't show up in the result list */ GSList *xaccGroupMapAccounts(AccountGroup *grp, @@ -354,6 +352,4 @@ xaccGroupVisitUnvisitedTransactions(AccountGroup *g, void *data, GHashTable *visited_txns); -#endif /* SWIG */ - #endif /* __XACC_ACCOUNT_GROUP_H__ */ diff --git a/src/engine/Transaction.h b/src/engine/Transaction.h index 9411cc2dd3..bac61b7861 100644 --- a/src/engine/Transaction.h +++ b/src/engine/Transaction.h @@ -215,9 +215,7 @@ const char * xaccTransGetNum (Transaction *trans); const char * xaccTransGetDescription (Transaction *trans); const char * xaccTransGetNotes (Transaction *trans); time_t xaccTransGetDate (Transaction *trans); -#ifndef SWIG /* swig chokes on long long */ long long xaccTransGetDateL (Transaction *trans); -#endif void xaccTransGetDateTS (Transaction *trans, Timespec *ts); #define xaccTransGetDatePostedTS xaccTransGetDateTS diff --git a/src/engine/date.h b/src/engine/date.h index 1b2b03e137..26356d74d7 100644 --- a/src/engine/date.h +++ b/src/engine/date.h @@ -64,13 +64,12 @@ typedef enum * even on the 32-bit Intel x86 and PowerPC architectures. I'm * assuming that all the other modern compilers are clean on this * issue too. */ -#ifndef SWIG /* swig 1.1p5 can't hack the long long type */ + struct timespec64 { long long int tv_sec; long int tv_nsec; }; -#endif /* SWIG */ typedef struct timespec64 Timespec; diff --git a/src/optional/Makefile.am b/src/optional/Makefile.am index 2398cb8cf2..b782904cc3 100644 --- a/src/optional/Makefile.am +++ b/src/optional/Makefile.am @@ -1,5 +1,3 @@ -#SUBDIRS = swig - EXTRA_DIST = \ .cvsignore diff --git a/src/optional/swig/.cvsignore b/src/optional/swig/.cvsignore deleted file mode 100644 index c4971b3e45..0000000000 --- a/src/optional/swig/.cvsignore +++ /dev/null @@ -1,11 +0,0 @@ -Makefile -Makefile.in -.deps -.libs -*.lo -*.la -gnucash.engine.i -gnucash-engine-perl5_wrap.c -gnucash-engine-perl5_wrap_int.c -gnucash.engine_wrap.doc -gnucash.pm diff --git a/src/optional/swig/Makefile.am b/src/optional/swig/Makefile.am deleted file mode 100644 index 68f78b0e62..0000000000 --- a/src/optional/swig/Makefile.am +++ /dev/null @@ -1,115 +0,0 @@ - -docdir = ${GNC_DOC_INSTALL_DIR} -doc_DATA = \ - gnucash.engine_wrap.doc - -perlsharedir = ${GNC_SHAREDIR}/perl -perlshare_DATA = gnucash.pm - -perllibdir = ${GNC_LIBDIR}/perl - -perllib_LTLIBRARIES = libgncswig.la - -libgncswig_la_SOURCES = \ - helperfuncs.c \ - gnucash-engine-perl5_wrap.c - -libgncswig_la_LDFLAGS = -version-info 1:1:1 - -noinst_HEADERS = \ - helperfuncs.h - -EXTRA_DIST = \ - .cvsignore \ - examples/scan-acct.pl \ - perl5_swig_annotations.i \ - gnucash-swig-defines.c - -CFLAGS = @CFLAGS@ ${GLIB_CFLAGS} -Dbool=char - -INCLUDES = \ - -I@PERLINCL@/CORE \ - -I${top_srcdir}/src/engine - -libgncswig_la_LIBADD = \ - @GLIB_LIBS@ \ - ${top_srcdir}/src/engine/Account.lo \ - ${top_srcdir}/src/engine/DateUtils.lo \ - ${top_srcdir}/src/engine/FileIO.lo \ - ${top_srcdir}/src/engine/GNCId.lo \ - ${top_srcdir}/src/engine/Group.lo \ - ${top_srcdir}/src/engine/Query.lo \ - ${top_srcdir}/src/engine/Scrub.lo \ - ${top_srcdir}/src/engine/Session.lo \ - ${top_srcdir}/src/engine/TransLog.lo \ - ${top_srcdir}/src/engine/Transaction.lo \ - ${top_srcdir}/src/engine/Backend.lo \ - ${top_srcdir}/src/engine/date.lo \ - ${top_srcdir}/src/engine/util.lo \ - ${top_srcdir}/src/engine/guid.lo \ - ${top_srcdir}/src/engine/md5.lo - -SWIG_INPUT_HDRS := \ - ${top_srcdir}/src/engine/Account.h \ - ${top_srcdir}/src/engine/DateUtils.h \ - ${top_srcdir}/src/engine/FileIO.h \ - ${top_srcdir}/src/engine/GNCId.h \ - ${top_srcdir}/src/engine/Group.h \ - ${top_srcdir}/src/engine/Query.h \ - ${top_srcdir}/src/engine/Scrub.h \ - ${top_srcdir}/src/engine/Session.h \ - ${top_srcdir}/src/engine/TransLog.h \ - ${top_srcdir}/src/engine/Transaction.h \ - ${top_srcdir}/src/engine/date.h - -## This is kinda ugly, but swig insists that the .so file be named the -## same as the .pm file, and automake won't tolerate libraries that -## aren't named lib*.so... -install-data-local: libgncswig.la - cd ${DESTDIR}${perllibdir} && rm -f gnucash.so - if [ -f ${DESTDIR}${perllibdir}/libgncswig.so ]; then \ - cd ${DESTDIR}${perllibdir} && ln -s libgncswig.so gnucash.so; \ - elif [ -f ${DESTDIR}${perllibdir}/libgncswig.so.1.1 ]; then \ - cd ${DESTDIR}${perllibdir} && \ - ln -s libgncswig.so.1.1 gnucash.so; \ - else \ - echo "Can't find libgncswig shared library!" \ - exit 1; \ - fi - -uninstall-local: - rm -f ${DESTDIR}${perllibdir}/gnucash.so - -gnucash.engine.i: ${SWIG_INPUT_HDRS} perl5_swig_annotations.i - @echo Making $@. - @echo "%module gnucash" > $@ - @echo "%include perl5_swig_annotations.i" >> $@ - @echo "%{" >> $@ - @for file in ${SWIG_INPUT_HDRS}; \ - do \ - echo "#include <`basename $$file`>" >> $@; \ - done - @echo "%}" >> $@ - @for file in ${SWIG_INPUT_HDRS}; \ - do \ - echo "%include `basename $$file`" >> $@; \ - done - -CLEANFILES += gnucash.engine.i - -gnucash.engine_wrap.doc gnucash-engine-perl5_wrap_int.c: gnucash.engine.i - ${SWIG} -perl5 -I.. -I${top_srcdir}/src/engine -o $@ gnucash.engine.i -CLEANFILES += gnucash.engine_wrap.doc gnucash-engine-perl5_wrap_int.c - -gnucash-engine-perl5_wrap.c: gnucash-swig-defines.c \ - gnucash-engine-perl5_wrap_int.c - cat gnucash-swig-defines.c gnucash-engine-perl5_wrap_int.c > $@ -CLEANFILES += gnucash-engine-perl5_wrap.c - -CLEANFILES += gnucash.pm gnucash.so - -# We have to do this because otherwise automake insists on putting -# these files into the dist tarfile. If there's a a better way, -# by all means, let us know... -dist-hook: - rm -f ${distdir}/gnucash-engine-perl5_wrap.c diff --git a/src/optional/swig/README b/src/optional/swig/README deleted file mode 100644 index 452cd91707..0000000000 --- a/src/optional/swig/README +++ /dev/null @@ -1,20 +0,0 @@ - -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. - ----------------------- -TBD: --- modify configure to check perl paths diff --git a/src/optional/swig/examples/scan-acct.pl b/src/optional/swig/examples/scan-acct.pl deleted file mode 100755 index bccebc2034..0000000000 --- a/src/optional/swig/examples/scan-acct.pl +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/perl -w - -# gnucash perl demo: -# -# This file demonstrates how to open an acount file and print -# the names and balances of the top-level accounts in the file. -# -# use lib '../swig/perl5/'; -use lib '../perl5/'; -use gnucash; -package gnucash; - -die "Usage: $0 " if $#ARGV < 0; -print "its $ARGV[0]\n"; - -$sess = gnucash::xaccMallocSession (); -$grp = gnucash::xaccSessionBeginFile ($sess,$ARGV[0]); -$numacc = gnucash::xaccGroupGetNumAccounts ($grp); -print "Loaded $numacc accounts\n\n"; - -for ($i=0; $i<$numacc; $i++) { - $acct = gnucash::xaccGroupGetAccount ($grp, $i); - $acctname = gnucash::xaccAccountGetName ($acct); - $baln = gnucash::xaccAccountGetBalance ($acct); - print "\tAccount: $acctname \tBalance: $baln\n"; -} - -gnucash::xaccSessionEnd ($sess); diff --git a/src/optional/swig/gnucash-swig-defines.c b/src/optional/swig/gnucash-swig-defines.c deleted file mode 100644 index 3ac531362a..0000000000 --- a/src/optional/swig/gnucash-swig-defines.c +++ /dev/null @@ -1,3 +0,0 @@ -#define sv_undef PL_sv_undef -#define sv_yes PL_sv_yes -#define na PL_na diff --git a/src/optional/swig/helperfuncs.c b/src/optional/swig/helperfuncs.c deleted file mode 100644 index e382fbc124..0000000000 --- a/src/optional/swig/helperfuncs.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "helperfuncs.h" - -FILE * -get_fileptr_stdin() { - return stdin; -} - -FILE * -get_fileptr_stdout() { - return stdout; -} - -FILE * -get_fileptr_stderr() { - return stderr; -} diff --git a/src/optional/swig/helperfuncs.h b/src/optional/swig/helperfuncs.h deleted file mode 100644 index 749f38fdaa..0000000000 --- a/src/optional/swig/helperfuncs.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __HELPERFUNCS_H__ -#define __HELPERFUNCS_H__ - -#include - -FILE *get_fileptr_stdin(); -FILE *get_fileptr_stdout(); -FILE *get_fileptr_stderr(); - -#endif diff --git a/src/optional/swig/perl5_swig_annotations.i b/src/optional/swig/perl5_swig_annotations.i deleted file mode 100644 index aa1938be9a..0000000000 --- a/src/optional/swig/perl5_swig_annotations.i +++ /dev/null @@ -1,87 +0,0 @@ -/* - * FILE: - * perl5_swig_annotations.i - * - * FUNCTION: - * clean up various aspects of the gnucash engine interface with - * respect to the SWIG-generated perl bindings. This includes: - * -- handling time_t values as ints - * -- converting C ** arrays to perl arrays - * - * HISTORY: - * Created by Linas Vepstas January 1999 - * Copyright (c) 1999 Linas Vepstas - */ - -#ifdef DOESNT_WORK_DONT_KNOW_WHY -%apply int {time_t } -#endif /* DOESNT_WORK_DONT_KNOW_WHY */ - -/* Convert the return values from the function to perl values */ -/* specifically, create a new perl scalar and store the int value there */ -%typemap(perl5, out) time_t { - - $target = newSViv ((IV) *($source)); - /* - * An alternate way of writing this code would have been ... - * $target = sv_newmortal (); - * sv_setiv ($target, (IV) $source); - */ - argvi ++; - // printf ("Info: converted return time_t secs to %d \n", (int) SvIV($target)); -} - -%typemap(perl5, in) time_t *(time_t temp) { - /* Convert function arguments from perl to the C represntation */ - /* in particular, convert perl scalar into integer, then cast to time_t */ - temp = (time_t) SvIV($source); - $target = &temp; - // printf ("Info: time_t input arg is %ld \n", * ($target)); -} - -/* Convert gboolean values */ -%typemap(perl5, in) gboolean *(gboolean temp) { - temp = (gboolean) SvIV($source); - $target = &temp; -} - -%typemap(perl5, out) gboolean { - $target = newSViv ((IV) *($source)); -} - -/* --------------------------------------------------------- */ - -#ifdef DOESNT_WORK_DONT_KNOW_WHY -// well, this sort of works ... it does create an array, -// but it doesn't seem to be an array of SplitPtr, -// which is what we want if we are to have -// foreach $split (@splits) {...} - - -// Creates a new Perl array and places a Split ** into it -%typemap(perl5,out) Split ** { - AV *myav; - SV **svs; - int i = 0,len = 0; - - /* Figure out how many elements we have */ - while ($source[len]) len++; - svs = (SV **) malloc(len*sizeof(SV *)); - printf ("Info: measured Split array length of len=%d\n", len); - - /* fill in array of scalar values */ - for (i = 0; i < len ; i++) { - svs[i] = sv_newmortal(); - sv_setref_pv (svs[i], "SplitPtr", $source[i]); - }; - - /* convert array of scalars into perl array */ - myav = av_make(len,svs); - free(svs); - // $target = myav; - $target = newRV((SV*)myav); - sv_2mortal($target); - argvi ++; -} - -#endif /* DOESNT_WORK_DONT_KNOW_WHY */