Remove swig from tree.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3224 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2000-12-01 21:54:50 +00:00
parent 93a49d1cc1
commit 4838eb859d
16 changed files with 3 additions and 321 deletions

View File

@ -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

View File

@ -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

View File

@ -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__ */

View File

@ -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__ */

View File

@ -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

View File

@ -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;

View File

@ -1,5 +1,3 @@
#SUBDIRS = swig
EXTRA_DIST = \
.cvsignore

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 <filename>" 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);

View File

@ -1,3 +0,0 @@
#define sv_undef PL_sv_undef
#define sv_yes PL_sv_yes
#define na PL_na

View File

@ -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;
}

View File

@ -1,10 +0,0 @@
#ifndef __HELPERFUNCS_H__
#define __HELPERFUNCS_H__
#include <stdio.h>
FILE *get_fileptr_stdin();
FILE *get_fileptr_stdout();
FILE *get_fileptr_stderr();
#endif

View File

@ -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 */