From 6166c5eae1ad6acd05bd3b0861dec6f368802ab2 Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Thu, 8 Jun 2000 06:08:58 +0000 Subject: [PATCH] Move raw to src/experimental git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2441 57a11ea4-9604-0410-9ed3-97b8803252fd --- Makefile.am | 4 +- Makefile.in | 4 +- configure | 18 +- configure.in | 9 +- src/experimental/Makefile.am | 6 +- src/experimental/Makefile.in | 7 +- src/experimental/README | 3 + src/experimental/ofx/.cvsignore | 1 + src/experimental/ofx/Makefile.am | 9 + src/experimental/ofx/Makefile.in | 334 ++ src/experimental/ofx/README | 45 + src/experimental/ofx/basic.ofx | 16 + src/experimental/ofx/dtd/.cvsignore | 1 + src/experimental/ofx/dtd/Makefile.am | 13 + src/experimental/ofx/dtd/Makefile.in | 228 ++ src/experimental/ofx/dtd/README | 8 + src/experimental/ofx/dtd/ofxact.dtd | 118 + src/experimental/ofx/dtd/ofxbank.dtd | 601 +++ src/experimental/ofx/dtd/ofxbill.dtd | 285 ++ src/experimental/ofx/dtd/ofxinv.dtd | 556 +++ src/experimental/ofx/dtd/ofxmail.dtd | 54 + src/experimental/ofx/dtd/ofxmain.dtd | 440 +++ src/experimental/ofx/dtd/ofxmain.dtd.original | 436 +++ src/experimental/ofx/dtd/ofxprof.dtd | 71 + src/experimental/ofx/dtd/ofxsign.dtd | 61 + src/experimental/ofx/explore/.cvsignore | 1 + src/experimental/ofx/explore/Makefile.am | 12 + src/experimental/ofx/explore/Makefile.in | 228 ++ src/experimental/ofx/explore/README.OFX | 76 + src/experimental/ofx/explore/length.cc | 51 + src/experimental/ofx/explore/parse_error | 7 + src/experimental/ofx/explore/post2.ofx | 29 + src/experimental/ofx/explore/reply_post2 | 26 + src/experimental/ofx/explore/req1 | 43 + src/experimental/ofx/explore/req1_orig | 33 + src/experimental/ofx/explore/req5 | 23 + src/experimental/ofx/explore/req7 | 57 + src/experimental/ofx/ofx-dtd-idl.txt | 82 + src/experimental/ofx/ofx1.5.0.10.dtd | 3291 +++++++++++++++++ src/experimental/ofx/parser/.cvsignore | 1 + src/experimental/ofx/parser/DtdParser.C | 341 ++ src/experimental/ofx/parser/DtdParser.h | 120 + src/experimental/ofx/parser/LICENSE | 11 + src/experimental/ofx/parser/Makefile.am | 18 + src/experimental/ofx/parser/Makefile.in | 228 ++ src/experimental/ofx/parser/README | 53 + src/experimental/ofx/parser/example.txt | 126 + src/experimental/ofx/parser/parseDtd.C | 301 ++ src/experimental/ofx/parser/parseOfx.C | 245 ++ src/experimental/ofx/parser/pfxBaseTypes.C | 238 ++ src/experimental/ofx/parser/pfxBaseTypes.h | 51 + src/experimental/ofx/parser/pfxCompTypes.C | 438 +++ src/experimental/ofx/parser/pfxCompTypes.h | 57 + src/experimental/ofx/parser/pfxLangOut.C | 319 ++ src/experimental/ofx/parser/pfxLangOut.h | 107 + src/experimental/ofx/parser/pfxUtils.C | 92 + src/experimental/ofx/parser/pfxUtils.h | 40 + src/experimental/ofx/parser/simple.C | 60 + 58 files changed, 10112 insertions(+), 21 deletions(-) create mode 100644 src/experimental/README create mode 100644 src/experimental/ofx/.cvsignore create mode 100644 src/experimental/ofx/Makefile.am create mode 100644 src/experimental/ofx/Makefile.in create mode 100644 src/experimental/ofx/README create mode 100644 src/experimental/ofx/basic.ofx create mode 100644 src/experimental/ofx/dtd/.cvsignore create mode 100644 src/experimental/ofx/dtd/Makefile.am create mode 100644 src/experimental/ofx/dtd/Makefile.in create mode 100644 src/experimental/ofx/dtd/README create mode 100644 src/experimental/ofx/dtd/ofxact.dtd create mode 100644 src/experimental/ofx/dtd/ofxbank.dtd create mode 100644 src/experimental/ofx/dtd/ofxbill.dtd create mode 100644 src/experimental/ofx/dtd/ofxinv.dtd create mode 100644 src/experimental/ofx/dtd/ofxmail.dtd create mode 100644 src/experimental/ofx/dtd/ofxmain.dtd create mode 100644 src/experimental/ofx/dtd/ofxmain.dtd.original create mode 100644 src/experimental/ofx/dtd/ofxprof.dtd create mode 100644 src/experimental/ofx/dtd/ofxsign.dtd create mode 100644 src/experimental/ofx/explore/.cvsignore create mode 100644 src/experimental/ofx/explore/Makefile.am create mode 100644 src/experimental/ofx/explore/Makefile.in create mode 100644 src/experimental/ofx/explore/README.OFX create mode 100644 src/experimental/ofx/explore/length.cc create mode 100644 src/experimental/ofx/explore/parse_error create mode 100644 src/experimental/ofx/explore/post2.ofx create mode 100644 src/experimental/ofx/explore/reply_post2 create mode 100644 src/experimental/ofx/explore/req1 create mode 100644 src/experimental/ofx/explore/req1_orig create mode 100644 src/experimental/ofx/explore/req5 create mode 100644 src/experimental/ofx/explore/req7 create mode 100644 src/experimental/ofx/ofx-dtd-idl.txt create mode 100644 src/experimental/ofx/ofx1.5.0.10.dtd create mode 100644 src/experimental/ofx/parser/.cvsignore create mode 100644 src/experimental/ofx/parser/DtdParser.C create mode 100644 src/experimental/ofx/parser/DtdParser.h create mode 100644 src/experimental/ofx/parser/LICENSE create mode 100644 src/experimental/ofx/parser/Makefile.am create mode 100644 src/experimental/ofx/parser/Makefile.in create mode 100644 src/experimental/ofx/parser/README create mode 100644 src/experimental/ofx/parser/example.txt create mode 100644 src/experimental/ofx/parser/parseDtd.C create mode 100644 src/experimental/ofx/parser/parseOfx.C create mode 100644 src/experimental/ofx/parser/pfxBaseTypes.C create mode 100644 src/experimental/ofx/parser/pfxBaseTypes.h create mode 100644 src/experimental/ofx/parser/pfxCompTypes.C create mode 100644 src/experimental/ofx/parser/pfxCompTypes.h create mode 100644 src/experimental/ofx/parser/pfxLangOut.C create mode 100644 src/experimental/ofx/parser/pfxLangOut.h create mode 100644 src/experimental/ofx/parser/pfxUtils.C create mode 100644 src/experimental/ofx/parser/pfxUtils.h create mode 100644 src/experimental/ofx/parser/simple.C diff --git a/Makefile.am b/Makefile.am index a9ae4f6e88..eba690c879 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ -SUBDIRS = debian doc intl lib po raw rpm src +SUBDIRS = debian doc intl lib po rpm src docdir = ${GNC_DOC_INSTALL_DIR} @@ -30,6 +30,8 @@ EXTRA_DIST = \ gnucash.lsm \ intl/.cvsignore \ make-gnucash-patch.in \ + old/country.sql \ + old/currencynames \ old/Gnucash.app-defaults \ old/gnome/graph/Makefile \ old/gnome/graph/colors.c \ diff --git a/Makefile.in b/Makefile.in index b09009849f..a31d85b5ff 100644 --- a/Makefile.in +++ b/Makefile.in @@ -116,7 +116,7 @@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ l = @l@ -SUBDIRS = debian doc intl lib po raw rpm src +SUBDIRS = debian doc intl lib po rpm src docdir = ${GNC_DOC_INSTALL_DIR} @@ -137,7 +137,7 @@ doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README # Don't list any directories or you'll get *everything*, including the # CVS dirs. -EXTRA_DIST = .cvsignore gnucash.lsm intl/.cvsignore make-gnucash-patch.in old/Gnucash.app-defaults old/gnome/graph/Makefile old/gnome/graph/colors.c old/gnome/graph/design.txt old/gnome/graph/plot-test.c old/perl-reports/report-baln.phtml old/perl-reports/report-folio.phtml old/perl-reports/report-formtest.html old/perl-reports/report-main.html old/perl-reports/report-menu.html old/perl-reports/report-null.html old/perl-reports/report-pnl.phtml old/xacc-shell.c po/.cvsignore po/extract-macros.perl.in po/guile_strings.txt +EXTRA_DIST = .cvsignore gnucash.lsm intl/.cvsignore make-gnucash-patch.in old/country.sql old/currencynames old/Gnucash.app-defaults old/gnome/graph/Makefile old/gnome/graph/colors.c old/gnome/graph/design.txt old/gnome/graph/plot-test.c old/perl-reports/report-baln.phtml old/perl-reports/report-folio.phtml old/perl-reports/report-formtest.html old/perl-reports/report-main.html old/perl-reports/report-menu.html old/perl-reports/report-null.html old/perl-reports/report-pnl.phtml old/xacc-shell.c po/.cvsignore po/extract-macros.perl.in po/guile_strings.txt CLEANFILES = make-gnucash-patch diff --git a/configure b/configure index 172918848d..84a3bd1cd9 100755 --- a/configure +++ b/configure @@ -6035,11 +6035,6 @@ trap 'rm -fr `echo " Makefile intl/Makefile lib/Makefile po/Makefile.in - raw/Makefile - raw/ofx/Makefile - raw/ofx/dtd/Makefile - raw/ofx/explore/Makefile - raw/ofx/parser/Makefile rpm/Makefile src/Makefile src/doc/Makefile @@ -6049,6 +6044,10 @@ trap 'rm -fr `echo " Makefile src/experimental/cbb/Makefile src/experimental/cbb/cbb-engine/Makefile src/experimental/gg/Makefile + src/experimental/ofx/Makefile + src/experimental/ofx/dtd/Makefile + src/experimental/ofx/explore/Makefile + src/experimental/ofx/parser/Makefile src/gnome/Makefile src/guile/Makefile src/optional/Makefile @@ -6226,11 +6225,6 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile intl/Makefile lib/Makefile po/Makefile.in - raw/Makefile - raw/ofx/Makefile - raw/ofx/dtd/Makefile - raw/ofx/explore/Makefile - raw/ofx/parser/Makefile rpm/Makefile src/Makefile src/doc/Makefile @@ -6240,6 +6234,10 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile src/experimental/cbb/Makefile src/experimental/cbb/cbb-engine/Makefile src/experimental/gg/Makefile + src/experimental/ofx/Makefile + src/experimental/ofx/dtd/Makefile + src/experimental/ofx/explore/Makefile + src/experimental/ofx/parser/Makefile src/gnome/Makefile src/guile/Makefile src/optional/Makefile diff --git a/configure.in b/configure.in index 92e9e5215e..27d68e0f05 100644 --- a/configure.in +++ b/configure.in @@ -456,11 +456,6 @@ AC_OUTPUT( intl/Makefile lib/Makefile po/Makefile.in - raw/Makefile - raw/ofx/Makefile - raw/ofx/dtd/Makefile - raw/ofx/explore/Makefile - raw/ofx/parser/Makefile rpm/Makefile src/Makefile src/doc/Makefile @@ -470,6 +465,10 @@ AC_OUTPUT( src/experimental/cbb/Makefile src/experimental/cbb/cbb-engine/Makefile src/experimental/gg/Makefile + src/experimental/ofx/Makefile + src/experimental/ofx/dtd/Makefile + src/experimental/ofx/explore/Makefile + src/experimental/ofx/parser/Makefile src/gnome/Makefile src/guile/Makefile src/optional/Makefile diff --git a/src/experimental/Makefile.am b/src/experimental/Makefile.am index df53dba6e5..49bcdd9a18 100644 --- a/src/experimental/Makefile.am +++ b/src/experimental/Makefile.am @@ -1,2 +1,6 @@ -SUBDIRS = cbb gg +SUBDIRS = cbb gg ofx + +EXTRA_DIST = \ + .cvsignore \ + README diff --git a/src/experimental/Makefile.in b/src/experimental/Makefile.in index 76fe8f9970..96d2ba2c5f 100644 --- a/src/experimental/Makefile.in +++ b/src/experimental/Makefile.in @@ -116,11 +116,14 @@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ l = @l@ -SUBDIRS = cbb gg +SUBDIRS = cbb gg ofx + +EXTRA_DIST = .cvsignore README + mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../../config.h CONFIG_CLEAN_FILES = -DIST_COMMON = Makefile.am Makefile.in +DIST_COMMON = README Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) diff --git a/src/experimental/README b/src/experimental/README new file mode 100644 index 0000000000..3d7d7feb1d --- /dev/null +++ b/src/experimental/README @@ -0,0 +1,3 @@ +This directory contains misc experimental/unfinished/unmaintained/unsupported +code. The stuff in here is waiting for someone to take it over and do something +useful with it. diff --git a/src/experimental/ofx/.cvsignore b/src/experimental/ofx/.cvsignore new file mode 100644 index 0000000000..f3c7a7c5da --- /dev/null +++ b/src/experimental/ofx/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/src/experimental/ofx/Makefile.am b/src/experimental/ofx/Makefile.am new file mode 100644 index 0000000000..f9a7963be5 --- /dev/null +++ b/src/experimental/ofx/Makefile.am @@ -0,0 +1,9 @@ + +SUBDIRS = dtd explore parser + +EXTRA_DIST = \ + .cvsignore \ + README \ + basic.ofx \ + ofx-dtd-idl.txt \ + ofx1.5.0.10.dtd diff --git a/src/experimental/ofx/Makefile.in b/src/experimental/ofx/Makefile.in new file mode 100644 index 0000000000..f454d85813 --- /dev/null +++ b/src/experimental/ofx/Makefile.in @@ -0,0 +1,334 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = ../../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AS = @AS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +DATADIRNAME = @DATADIRNAME@ +DLLTOOL = @DLLTOOL@ +GENCAT = @GENCAT@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_CONFIG_BIN = @GLIB_CONFIG_BIN@ +GLIB_LIBS = @GLIB_LIBS@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNC_CONFIGDIR = @GNC_CONFIGDIR@ +GNC_DOC_INSTALL_DIR = @GNC_DOC_INSTALL_DIR@ +GNC_LIBDIR = @GNC_LIBDIR@ +GNC_SCM_INSTALL_DIR = @GNC_SCM_INSTALL_DIR@ +GNC_SHAREDIR = @GNC_SHAREDIR@ +GNOME_CFLAGS = @GNOME_CFLAGS@ +GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ +GNOME_LIBS = @GNOME_LIBS@ +GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ +GNOME_TARGET = @GNOME_TARGET@ +GTK_XMHTML = @GTK_XMHTML@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +GUILE = @GUILE@ +GUILE_COMPILE_ARGS = @GUILE_COMPILE_ARGS@ +GUILE_CONFIG = @GUILE_CONFIG@ +GUILE_LINK_ARGS = @GUILE_LINK_ARGS@ +G_WRAP = @G_WRAP@ +G_WRAP_COMPILE_ARGS = @G_WRAP_COMPILE_ARGS@ +G_WRAP_CONFIG = @G_WRAP_CONFIG@ +G_WRAP_LINK_ARGS = @G_WRAP_LINK_ARGS@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LOCALE_DIR = @LOCALE_DIR@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +PERL = @PERL@ +PERLINCL = @PERLINCL@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SWIG = @SWIG@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +l = @l@ + +SUBDIRS = dtd explore parser + +EXTRA_DIST = .cvsignore README basic.ofx ofx-dtd-idl.txt ofx1.5.0.10.dtd + +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../../../config.h +CONFIG_CLEAN_FILES = +DIST_COMMON = README Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu src/experimental/ofx/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. + +@SET_MAKE@ + +all-recursive install-data-recursive install-exec-recursive \ +installdirs-recursive install-recursive uninstall-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + test "$$subdir" = "." && dot_seen=yes; \ + done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = src/experimental/ofx + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/experimental/ofx/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ + done +info-am: +info: info-recursive +dvi-am: +dvi: dvi-recursive +check-am: all-am +check: check-recursive +installcheck-am: +installcheck: installcheck-recursive +install-exec-am: +install-exec: install-exec-recursive + +install-data-am: +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: +uninstall: uninstall-recursive +all-am: Makefile +all-redirect: all-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-tags clean-generic mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-tags distclean-generic clean-am + -rm -f libtool + +distclean: distclean-recursive + +maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-recursive + +.PHONY: install-data-recursive uninstall-data-recursive \ +install-exec-recursive uninstall-exec-recursive installdirs-recursive \ +uninstalldirs-recursive all-recursive check-recursive \ +installcheck-recursive info-recursive dvi-recursive \ +mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +install-exec install-data-am install-data install-am install \ +uninstall-am uninstall all-redirect all-am all installdirs-am \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/experimental/ofx/README b/src/experimental/ofx/README new file mode 100644 index 0000000000..7c78d9a338 --- /dev/null +++ b/src/experimental/ofx/README @@ -0,0 +1,45 @@ + +This directory contains some experimental code to handle +OFX (Open Financial Exchange) messages. + +The most interesting thing here is the DTD parser "parseOfx" +which attempts to build a C++ interface that models the +structure of the OFX DTD's. It *almost* works. +Its in the parser directory. + +-------------------------------------------------------------- +Ueli has some exploratory scripts in "explore" + +-------------------------------------------------------------- + +OFX Specs: +http://www.ofx.net +http://www.ofx.net/ofx/de_spec.asp + +HTTP tool: +http://www.inf.ufrgs.br/~sagula/urlget.html +can be found in this tree, at xacc/src/lib/urlget + +OFX financicial institution list: +https://ofx-prod-filist.intuit.com/qw0700/filist.asp + +SSLeay rpm's: +http://www.sabotage.net/redhat/ssl.html +http://ftp.tu-clausthal.de/pub/TEXT/EXPERT/linux/redhat-security/i386 +http://ftp.tu-clausthal.de/pub/TEXT/EXPERT/linux/redhat-security/SRPMS + +SGML tutorials: +http://www.hex.net/~cbbrowne/sgml.html + +-------------------------------------------------------------- + +dtd/ofxmain.dtd: a hacked version of the original dtd, with + the intent of exposing the base types. + + +TBD: +get new version 1.5 ofx dtd's from www.ofx.org + + +--linas +March 1998 diff --git a/src/experimental/ofx/basic.ofx b/src/experimental/ofx/basic.ofx new file mode 100644 index 0000000000..026b5b461e --- /dev/null +++ b/src/experimental/ofx/basic.ofx @@ -0,0 +1,16 @@ + + + + + + 19980311233000.000 +linas +r00tsh3ll +en +xacc +0116 + + + + + diff --git a/src/experimental/ofx/dtd/.cvsignore b/src/experimental/ofx/dtd/.cvsignore new file mode 100644 index 0000000000..f3c7a7c5da --- /dev/null +++ b/src/experimental/ofx/dtd/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/src/experimental/ofx/dtd/Makefile.am b/src/experimental/ofx/dtd/Makefile.am new file mode 100644 index 0000000000..7e0bf7c872 --- /dev/null +++ b/src/experimental/ofx/dtd/Makefile.am @@ -0,0 +1,13 @@ + +EXTRA_DIST = \ + .cvsignore \ + README \ + ofxact.dtd \ + ofxbank.dtd \ + ofxbill.dtd \ + ofxinv.dtd \ + ofxmail.dtd \ + ofxmain.dtd \ + ofxmain.dtd.original \ + ofxprof.dtd \ + ofxsign.dtd diff --git a/src/experimental/ofx/dtd/Makefile.in b/src/experimental/ofx/dtd/Makefile.in new file mode 100644 index 0000000000..ff11a4ef46 --- /dev/null +++ b/src/experimental/ofx/dtd/Makefile.in @@ -0,0 +1,228 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = ../../../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AS = @AS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +DATADIRNAME = @DATADIRNAME@ +DLLTOOL = @DLLTOOL@ +GENCAT = @GENCAT@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_CONFIG_BIN = @GLIB_CONFIG_BIN@ +GLIB_LIBS = @GLIB_LIBS@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNC_CONFIGDIR = @GNC_CONFIGDIR@ +GNC_DOC_INSTALL_DIR = @GNC_DOC_INSTALL_DIR@ +GNC_LIBDIR = @GNC_LIBDIR@ +GNC_SCM_INSTALL_DIR = @GNC_SCM_INSTALL_DIR@ +GNC_SHAREDIR = @GNC_SHAREDIR@ +GNOME_CFLAGS = @GNOME_CFLAGS@ +GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ +GNOME_LIBS = @GNOME_LIBS@ +GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ +GNOME_TARGET = @GNOME_TARGET@ +GTK_XMHTML = @GTK_XMHTML@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +GUILE = @GUILE@ +GUILE_COMPILE_ARGS = @GUILE_COMPILE_ARGS@ +GUILE_CONFIG = @GUILE_CONFIG@ +GUILE_LINK_ARGS = @GUILE_LINK_ARGS@ +G_WRAP = @G_WRAP@ +G_WRAP_COMPILE_ARGS = @G_WRAP_COMPILE_ARGS@ +G_WRAP_CONFIG = @G_WRAP_CONFIG@ +G_WRAP_LINK_ARGS = @G_WRAP_LINK_ARGS@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LOCALE_DIR = @LOCALE_DIR@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +PERL = @PERL@ +PERLINCL = @PERLINCL@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SWIG = @SWIG@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +l = @l@ + +EXTRA_DIST = .cvsignore README ofxact.dtd ofxbank.dtd ofxbill.dtd ofxinv.dtd ofxmail.dtd ofxmain.dtd ofxmain.dtd.original ofxprof.dtd ofxsign.dtd + +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../../../../config.h +CONFIG_CLEAN_FILES = +DIST_COMMON = README Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu src/experimental/ofx/dtd/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = src/experimental/ofx/dtd + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/experimental/ofx/dtd/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: tags distdir info-am info dvi-am dvi check check-am \ +installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/experimental/ofx/dtd/README b/src/experimental/ofx/dtd/README new file mode 100644 index 0000000000..0b182ff0ae --- /dev/null +++ b/src/experimental/ofx/dtd/README @@ -0,0 +1,8 @@ + +These are the Open Financial Exchange (OFX) DTD's + +They are *not* the original dtd's; they have been slightly +hacked to fix a few bugs, and to simplify parsing ever so slightly. +Hopefully the changes do not affect the correctness. + + diff --git a/src/experimental/ofx/dtd/ofxact.dtd b/src/experimental/ofx/dtd/ofxact.dtd new file mode 100644 index 0000000000..e234fd42a9 --- /dev/null +++ b/src/experimental/ofx/dtd/ofxact.dtd @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/experimental/ofx/dtd/ofxbank.dtd b/src/experimental/ofx/dtd/ofxbank.dtd new file mode 100644 index 0000000000..49818e88eb --- /dev/null +++ b/src/experimental/ofx/dtd/ofxbank.dtd @@ -0,0 +1,601 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/experimental/ofx/dtd/ofxbill.dtd b/src/experimental/ofx/dtd/ofxbill.dtd new file mode 100644 index 0000000000..f9ce36ec6c --- /dev/null +++ b/src/experimental/ofx/dtd/ofxbill.dtd @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/experimental/ofx/dtd/ofxinv.dtd b/src/experimental/ofx/dtd/ofxinv.dtd new file mode 100644 index 0000000000..204095fa83 --- /dev/null +++ b/src/experimental/ofx/dtd/ofxinv.dtd @@ -0,0 +1,556 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/experimental/ofx/dtd/ofxmail.dtd b/src/experimental/ofx/dtd/ofxmail.dtd new file mode 100644 index 0000000000..f9ca5770db --- /dev/null +++ b/src/experimental/ofx/dtd/ofxmail.dtd @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/experimental/ofx/dtd/ofxmain.dtd b/src/experimental/ofx/dtd/ofxmain.dtd new file mode 100644 index 0000000000..8d4729cb1b --- /dev/null +++ b/src/experimental/ofx/dtd/ofxmain.dtd @@ -0,0 +1,440 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%signon-dtd; + + +%banking-dtd; + + +%billpay-dtd; + + +%activate-dtd; + + +%invest-dtd; + + +%mail-dtd; + + +%prof-dtd; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]> diff --git a/src/experimental/ofx/dtd/ofxmain.dtd.original b/src/experimental/ofx/dtd/ofxmain.dtd.original new file mode 100644 index 0000000000..6300555838 --- /dev/null +++ b/src/experimental/ofx/dtd/ofxmain.dtd.original @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%signon-dtd; + + +%banking-dtd; + + +%billpay-dtd; + + +%activate-dtd; + + +%invest-dtd; + + +%mail-dtd; + + +%prof-dtd; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]> diff --git a/src/experimental/ofx/dtd/ofxprof.dtd b/src/experimental/ofx/dtd/ofxprof.dtd new file mode 100644 index 0000000000..df6a4dcd78 --- /dev/null +++ b/src/experimental/ofx/dtd/ofxprof.dtd @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/experimental/ofx/dtd/ofxsign.dtd b/src/experimental/ofx/dtd/ofxsign.dtd new file mode 100644 index 0000000000..fc819a4bfd --- /dev/null +++ b/src/experimental/ofx/dtd/ofxsign.dtd @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/experimental/ofx/explore/.cvsignore b/src/experimental/ofx/explore/.cvsignore new file mode 100644 index 0000000000..f3c7a7c5da --- /dev/null +++ b/src/experimental/ofx/explore/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/src/experimental/ofx/explore/Makefile.am b/src/experimental/ofx/explore/Makefile.am new file mode 100644 index 0000000000..7d8629653e --- /dev/null +++ b/src/experimental/ofx/explore/Makefile.am @@ -0,0 +1,12 @@ + +EXTRA_DIST = \ + .cvsignore \ + README.OFX \ + length.cc \ + parse_error \ + post2.ofx \ + reply_post2 \ + req1 \ + req1_orig \ + req5 \ + req7 diff --git a/src/experimental/ofx/explore/Makefile.in b/src/experimental/ofx/explore/Makefile.in new file mode 100644 index 0000000000..f460a7cf9a --- /dev/null +++ b/src/experimental/ofx/explore/Makefile.in @@ -0,0 +1,228 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = ../../../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AS = @AS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +DATADIRNAME = @DATADIRNAME@ +DLLTOOL = @DLLTOOL@ +GENCAT = @GENCAT@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_CONFIG_BIN = @GLIB_CONFIG_BIN@ +GLIB_LIBS = @GLIB_LIBS@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNC_CONFIGDIR = @GNC_CONFIGDIR@ +GNC_DOC_INSTALL_DIR = @GNC_DOC_INSTALL_DIR@ +GNC_LIBDIR = @GNC_LIBDIR@ +GNC_SCM_INSTALL_DIR = @GNC_SCM_INSTALL_DIR@ +GNC_SHAREDIR = @GNC_SHAREDIR@ +GNOME_CFLAGS = @GNOME_CFLAGS@ +GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ +GNOME_LIBS = @GNOME_LIBS@ +GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ +GNOME_TARGET = @GNOME_TARGET@ +GTK_XMHTML = @GTK_XMHTML@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +GUILE = @GUILE@ +GUILE_COMPILE_ARGS = @GUILE_COMPILE_ARGS@ +GUILE_CONFIG = @GUILE_CONFIG@ +GUILE_LINK_ARGS = @GUILE_LINK_ARGS@ +G_WRAP = @G_WRAP@ +G_WRAP_COMPILE_ARGS = @G_WRAP_COMPILE_ARGS@ +G_WRAP_CONFIG = @G_WRAP_CONFIG@ +G_WRAP_LINK_ARGS = @G_WRAP_LINK_ARGS@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LOCALE_DIR = @LOCALE_DIR@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +PERL = @PERL@ +PERLINCL = @PERLINCL@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SWIG = @SWIG@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +l = @l@ + +EXTRA_DIST = .cvsignore README.OFX length.cc parse_error post2.ofx reply_post2 req1 req1_orig req5 req7 + +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../../../../config.h +CONFIG_CLEAN_FILES = +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu src/experimental/ofx/explore/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = src/experimental/ofx/explore + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/experimental/ofx/explore/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: tags distdir info-am info dvi-am dvi check check-am \ +installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/experimental/ofx/explore/README.OFX b/src/experimental/ofx/explore/README.OFX new file mode 100644 index 0000000000..8c7df4db04 --- /dev/null +++ b/src/experimental/ofx/explore/README.OFX @@ -0,0 +1,76 @@ + +some notes about the OFX test implementation for GNUCash. +--------------------------------------------------------- + +Ueli Rutishauser (urutishauser@bigfoot.com ) / 10.4.1998 + +All the following informationen depends on version 1.5 and 1.0.2 of the +Open Financial Exchange Specification (OFX). + +version notes +------------- + +The actual OFXHEADER Version is 1.00 (100) + +The actual OFXSGML DTD Version is 1.02 (102) + + +urlget +------ + +urlget -i -v http://localhost/ + +urlget -i -v https://swww.etrade.com/ + +urlget -i -v -T post2.ofx https://ofx.etrade.com/cgi-ofx/etradeofx/ + +anonymous login +--------------- + +to login anonymous, USERID and/or USERPASS must be set to anonymous +followed by 23 zeros. + + +BROKERID +-------- + +BROKERID (page 102 and 256) must set to the domain of the broker eg. etrade.com + +general notes +------------- + +-OFX-Files cannot contain comments (<-- not allowed) +-All Tags must be written Uppercase ( not ) + +test files +---------- + +req1_orig Original Request for Investement Statements download (with comments) + +req1 ready to send request for a "Investement Statement download" +get1 response of such a request (not yet available) + +req5 login anonymous +get5 result of a anonymous login (not yet available) + +req6 login anonymous/get FI profile +get6 result of a anonymous login with a profile request + +req7 Request for a "Investement Statement download" +reply_req7 response when a false Account-ID is provided +reply_req7_2 regular response + +post4.ofx login +reply_post4 response to a valid login request + +PLEASE: do not test this examples with any OFX-server when you not +really develop on the OFX-part. We have only one working OFX URL at the +moment... + +programs/code +------------- + +length the program length calculates the length (Content-Length) for the + HTTP Header of a file. + + diff --git a/src/experimental/ofx/explore/length.cc b/src/experimental/ofx/explore/length.cc new file mode 100644 index 0000000000..1423424da7 --- /dev/null +++ b/src/experimental/ofx/explore/length.cc @@ -0,0 +1,51 @@ +/* this little program calculate the content-length for a HTTP-POST + Statement. Count begins not until the first OFX (uppercase) occures. + + Copyright (c) 1998 by Ueli Rutishauser + GPL'ed + + */ + +#include +#include + +void main( int argc, char **argv) +{ + char character; + int input_length=0, count=0, input_alphnum=0, O_yes=0, F_yes=0, X_yes=0; + + cout << "This program calculates the field content-length for a HTTP Header. Counting begins after the first occurens of the string OFX (uppercase)" << endl; + + if ( argc < 2) + cout << "error - no command line argument given" << endl; + + + cout << "use " << argv[1] << endl; + ifstream input(argv[1],ios::in); + + if (!input) + cout << "error open input file" << endl; + else + { + while (input.get(character)) + { + //cout << character; + if (character == 'O') + O_yes++; + if (character == 'F' && O_yes > 0) + F_yes++; + if (character == 'X' && O_yes > 0 && F_yes) + X_yes++; + + if (X_yes>0) + input_length++; + } + + input_length += 2; //add OF + + input.close(); + + cout << "content-length of this file is (dec)" << dec << input_length << endl; + } + +} diff --git a/src/experimental/ofx/explore/parse_error b/src/experimental/ofx/explore/parse_error new file mode 100644 index 0000000000..d10f25f83d --- /dev/null +++ b/src/experimental/ofx/explore/parse_error @@ -0,0 +1,7 @@ +up result 0 +HTTP/1.0 400 OFX Request Parsing Error +Server: Netscape-Enterprise/2.01 +Date: Fri, 10 Apr 1998 18:26:55 GMT +Content-type: application/x-ofx + +down result 0 1901 diff --git a/src/experimental/ofx/explore/post2.ofx b/src/experimental/ofx/explore/post2.ofx new file mode 100644 index 0000000000..7d09f5ef95 --- /dev/null +++ b/src/experimental/ofx/explore/post2.ofx @@ -0,0 +1,29 @@ +POST /cgi-ofx/etradeofx HTTP/1.0 +User-Agent: MyApp 5.0 +Content-Type: application/x-ofx +Content-Length: 298 + +OFXHEADER:100 +DATA:OFXSGML +VERSION:102 +SECURITY:TYPE1 +ENCODING:USASCII + + + + +19980410083500 + +xxxxxx + +xxxxxx + +ENG + +MyApp + +0500 + + + + diff --git a/src/experimental/ofx/explore/reply_post2 b/src/experimental/ofx/explore/reply_post2 new file mode 100644 index 0000000000..756a355a87 --- /dev/null +++ b/src/experimental/ofx/explore/reply_post2 @@ -0,0 +1,26 @@ +up result 0 +HTTP/1.0 200 OK +Server: Netscape-Enterprise/2.01 +Date: Sat, 11 Apr 1998 12:44:11 GMT +Content-type: application/x-ofx + +OFXHEADER:100 +DATA:OFXSGML +VERSION:102 +SECURITY:NONE +ENCODING:USASCII + + + + + +0 +INFO + +19980411124411.000 +ENG +19971105140000 + + + +down result 0 2024 diff --git a/src/experimental/ofx/explore/req1 b/src/experimental/ofx/explore/req1 new file mode 100644 index 0000000000..6e450185b4 --- /dev/null +++ b/src/experimental/ofx/explore/req1 @@ -0,0 +1,43 @@ +POST /cgi-ofx/etradeofx HTTP/1.0 +User-Agent: MyApp 5.0 +Content-Type: application/x-ofx +Content-Length: 537 + +OFXHEADER:100 +DATA:OFXSGML +VERSION:102 +SECURITY:TYPE1 +ENCODING:USASCII + + + + +19980410101000 +FW5853 +xxxxx +ENG +GNUCash_OFX +0001 + + + + +1001 + + +etrade.com +5853 + + +19970824130105 +Y + +Y + +Y + +Y + + + + diff --git a/src/experimental/ofx/explore/req1_orig b/src/experimental/ofx/explore/req1_orig new file mode 100644 index 0000000000..4a0f9cc77f --- /dev/null +++ b/src/experimental/ofx/explore/req1_orig @@ -0,0 +1,33 @@ + + + +19980410101000 +FW5853 +xxxxx +ENG +GNUCash OFX Test +0001 + + + + +1001 + + +etrade.com +5853 + + +19970824130105 + +Y + +Y + +Y + +Y + + + + diff --git a/src/experimental/ofx/explore/req5 b/src/experimental/ofx/explore/req5 new file mode 100644 index 0000000000..ac6c61a73e --- /dev/null +++ b/src/experimental/ofx/explore/req5 @@ -0,0 +1,23 @@ +POST /cgi-ofx/etradeofx HTTP/1.0 +User-Agent: MyApp 5.0 +Content-Type: application/x-ofx +Content-Length: 288 + +OFXHEADER:100 +DATA:OFXSGML +VERSION:102 +SECURITY:TYPE1 +ENCODING:USASCII + + + + +19980410093500 +anonymous00000000000000000000000 +anonymous00000000000000000000000 +ENG +GNUCash +0001 + + + diff --git a/src/experimental/ofx/explore/req7 b/src/experimental/ofx/explore/req7 new file mode 100644 index 0000000000..1cf3e4076c --- /dev/null +++ b/src/experimental/ofx/explore/req7 @@ -0,0 +1,57 @@ +POST /cgi-ofx/etradeofx HTTP/1.0 +User-Agent: MyApp 5.0 +Content-Type: application/x-ofx +Content-Length: 692 + +OFXHEADER:100 +DATA:OFXSGML +VERSION:102 +SECURITY:TYPE1 +ENCODING:USASCII + + + + +19980411101000 + +xxxxxx + +xxxxxx + +ENG + +GNUCash_OFX + +0001 + + + + + +1001 + + + +etrade.com + +xxxx-xxxx + + + +19970824130105 + +Y + + +Y + + +Y + + +Y + + + + + diff --git a/src/experimental/ofx/ofx-dtd-idl.txt b/src/experimental/ofx/ofx-dtd-idl.txt new file mode 100644 index 0000000000..c102950732 --- /dev/null +++ b/src/experimental/ofx/ofx-dtd-idl.txt @@ -0,0 +1,82 @@ + +I have this nutty idea that maybe SGML/XML DTD's can be used as a +kind-of corba-like IDL of sorts. Has anyone pondered this, or know +of any resources? + +---------- + +To be concrete, here's an example: +OFX (Open Financial Exchange) defines some SGML DTD's that describe a +document that contains financial data. An OFX document would look +vaguely like this: + + + March 10, 1998 + $300.00 + Buy new microwave oven + + +Quicken and bank web sites send these things to each other to do on-line +banking. + +I am involved in a project to create a GPL'ed Quicken look-alike / +work-alike personal-finance package. Currently, our C++ classes +look vaguely like: + +class Transaction { + public: + void SetDate (time_t date); + time_t GetDate (void); + void SetAmount (double amt); + double GetAmount (void); + void SetDescription (char *); + char * GetDescription (void); + private: + time_t date; + double amount; + char * description; +}; + +Lists of transactions form an account, etc. + +I hope it is now obvious to the casual reader that our in-memory layout +of accounts and transactions vaguely resembles the ASCII layout of an +OFX document. In order to provide on-line banking features in our app, +I'd like to get the in-memory layout resemble the ofx document as much +as possible. Thus, the obvious should now be obvious: + +Are there any packages that can +(a) take SGML/XML DTD's and turn them into C/C++ structs/classes? +(b) parse the incoming text document, and build the corresponding + C/C++ linked-lists/trees in memory? + +--------------------------------------------------------------- + +More specifically, given the DTD + + + + + + +I want something that will read this, and *automatically* spit out the +following ascii stream: + +class Transaction { + time_t date; + double amount; + char * description; +}; + +--------------------------------------------------------------- +James Clark's SGML/Parser (SP) http://www.jclark.com/sp/index.htm +Jade + +dssslist@mulberrytech.com + +-------------------------------------------------------------- +--linas + +10 March 1998 + + diff --git a/src/experimental/ofx/ofx1.5.0.10.dtd b/src/experimental/ofx/ofx1.5.0.10.dtd new file mode 100644 index 0000000000..75ec2f3a69 --- /dev/null +++ b/src/experimental/ofx/ofx1.5.0.10.dtd @@ -0,0 +1,3291 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]> diff --git a/src/experimental/ofx/parser/.cvsignore b/src/experimental/ofx/parser/.cvsignore new file mode 100644 index 0000000000..f3c7a7c5da --- /dev/null +++ b/src/experimental/ofx/parser/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/src/experimental/ofx/parser/DtdParser.C b/src/experimental/ofx/parser/DtdParser.C new file mode 100644 index 0000000000..d57c4ee85c --- /dev/null +++ b/src/experimental/ofx/parser/DtdParser.C @@ -0,0 +1,341 @@ +// $Id$ +// Copyright (C) 1997 ISOGEN International Corp. and TechnoTeacher, Inc. +// All Rights Reserved. +// +// +// This file and its associated materials are copyrighted material of +// ISOGEN International Corp. (ISOGEN) and TechnoTeacher, +// Inc. (TechnoTeacher). License to copy and use this file and its +// associated materials is granted to everyone, free of charge, with +// the following restrictions: (1) The ISOGEN and TechnoTeacher +// copyright statement must be maintained in any copies. (2) New +// materials derived from these materials must indicate their source, +// including references to the ISOGEN and TechnoTeacher web sites +// (www.isogen.com and www.techno.com). (3) These materials may not be +// sold in any form without the express written permission of ISOGEN +// and TechnoTeacher. [However, feel free to sell things you create +// from these materials as long as the things you create are truly +// different in function--we want to encourage people to learn from +// these materials and benefit from having learned--we just don't want +// others to sell what we're giving away.] +// + +#include "config.h" +#include "DtdParser.h" + +#include "macros.h" +#include "sptchar.h" +#include "CodingSystemKit.h" + +#include "PosixStorage.h" +#ifdef SP_WININET +#include "WinInetStorage.h" +#else +#include "URLStorage.h" +#endif +#include "LiteralStorage.h" +#include "NotationStorage.h" +#include "ExtendEntityManager.h" +#include "SOEntityCatalog.h" + +#include "ErrorCountEventHandler.h" + +#ifndef SP_DEFAULT_ENCODING +#ifdef WIN32 +#define SP_DEFAULT_ENCODING SP_T("WINDOWS") +#else +#define SP_DEFAULT_ENCODING SP_T("IS8859-1") +#endif +#endif /* not SP_DEFAULT_ENCODING */ + +#ifndef SGML_SEARCH_PATH_DEFAULT +#define SGML_SEARCH_PATH_DEFAULT SP_T("") +#endif + +#ifndef SGML_CATALOG_FILES_DEFAULT +#define SGML_CATALOG_FILES_DEFAULT SP_T("") +#endif /* not SGML_CATALOG_FILES_DEFAULT */ + +#ifdef SP_NAMESPACE +namespace SP_NAMESPACE { +#endif + +#ifdef SP_MSDOS_FILENAMES +const Char FILE_SEP = ';'; +#else +const Char FILE_SEP = ':'; +#endif + +DtdParser:: +DtdParser( const char * requiredInternalCode) +: internalCharsetIsDocCharset_( 1), + codingSystem_( 0), + mapCatalogDocument_(0), + mgr_( &nullMgr_) +{ + initCodingSystem( requiredInternalCode); +} + +void +DtdParser:: +setMessenger( Messenger * mgr) +{ + mgr_ = mgr ? mgr : &nullMgr_; +} + +class DtdParserEventHandler +: public ErrorCountEventHandler +{ + public: + DtdParserEventHandler( Messenger *); + void message( MessageEvent *); + private: + Messenger * mgr_; +}; + +DtdParserEventHandler:: +DtdParserEventHandler( Messenger * mgr) +: mgr_( mgr) +{ +} + +void +DtdParserEventHandler:: +message( MessageEvent * event) +{ + // ignore ParserMessages::documentEndProlog and ParserMessages::documentElementUndefined + if ( event->message().type->number() != 45 && event->message().type->number() != 319) { + mgr_->dispatchMessage( event->message()); + } + ErrorCountEventHandler::message( event); +} + +ConstPtr< Dtd> +DtdParser:: +parseDtd( const StringC & sysid) +{ + DtdParserEventHandler handler( mgr_); + + SgmlParser::Params sdParams; + sdParams.sysid = convertInput( SP_T( " ")); + sdParams.entityManager = entityManager().pointer(); + sdParams.options = &options_; + sdParser_.init( sdParams); + sdParser_.parseAll( handler, handler.cancelPtr()); + + SgmlParser::Params params; + params.sysid = sysid; + params.entityType = SgmlParser::Params::dtd; +// unnecessary, since params.doctypeName starts out empty anyway. +// params.doctypeName = convertInput( SP_T( "")); + params.entityManager = entityManager().pointer(); + params.options = &options_; + params.parent = &sdParser_; + parser_.init( params); + parser_.parseAll( handler, handler.cancelPtr()); + + Ptr< Dtd> dtd( parser_.baseDtd()); + delete dtd->removeElementType( params.doctypeName); + + return dtd; +} + +Boolean +stringMatches( const SP_TCHAR * s, const char * key) +{ + for (; *key != '\0'; s++, key++) { + if (*s != tolower(*key) && *s != toupper(*key)) + return 0; + } + return *s == '\0'; +} + +void +DtdParser:: +initCodingSystem( const char * requiredInternalCode) +{ + const char *name = requiredInternalCode; +#ifdef SP_MULTI_BYTE + char buf[256]; + if (!name) { + const SP_TCHAR *internalCode = tgetenv(SP_T("SP_SYSTEM_CHARSET")); + if (internalCode) { + buf[255] = '\0'; + for (size_t i = 0; i < 255; i++) { + buf[i] = internalCode[i]; + if (buf[i] == '\0') + break; + } + name = buf; + } + } + if (requiredInternalCode) + internalCharsetIsDocCharset_ = 0; + else { + const SP_TCHAR *useInternal = tgetenv(SP_T("SP_CHARSET_FIXED")); + if (useInternal + && (stringMatches(useInternal, "YES") + || stringMatches(useInternal, "1"))) + internalCharsetIsDocCharset_ = 0; + } +#endif /* SP_MULTI_BYTE */ + codingSystemKit_ = CodingSystemKit::make(name); + const SP_TCHAR *codingName = tgetenv(internalCharsetIsDocCharset_ + ? SP_T("SP_BCTF") + : SP_T("SP_ENCODING")); + if (codingName) + codingSystem_ = lookupCodingSystem(codingName); +#ifdef SP_MULTI_BYTE + if (!codingSystem_ && !internalCharsetIsDocCharset_) + codingSystem_ = lookupCodingSystem(SP_DEFAULT_ENCODING); +#endif + if (!codingSystem_ +#ifndef SP_WIDE_SYSTEM + || codingSystem_->fixedBytesPerChar() > 1 +#endif + ) + codingSystem_ = codingSystemKit_->identityCodingSystem(); +} + +const CodingSystem * +DtdParser:: +lookupCodingSystem( const AppChar * codingName) +{ +#define MAX_CS_NAME 50 + if (tcslen(codingName) < MAX_CS_NAME) { + char buf[MAX_CS_NAME]; + int i; + for (i = 0; codingName[i] != SP_T('\0'); i++) { + SP_TUCHAR c = codingName[i]; +#ifdef SP_WIDE_SYSTEM + if (c > (unsigned char)-1) + return 0; +#endif + buf[i] = char(c); + } + buf[i] = '\0'; + return codingSystemKit_->makeCodingSystem(buf, internalCharsetIsDocCharset_); + } + return 0; +} + +StringC +DtdParser:: +convertInput( const SP_TCHAR * s) +{ +#ifdef SP_WIDE_SYSTEM + StringC str(s, wcslen(s)); +#else + StringC str(codingSystem()->convertIn(s)); +#endif + for (size_t i = 0; i < str.size(); i++) + if (str[i] == '\n') + str[i] = '\r'; + return str; +} + +Boolean +DtdParser:: +makeSystemId( int nFiles, AppChar * const * files, StringC & result) +{ + Vector filenames(nFiles == 0 ? 1 : nFiles); + int i; + for (i = 0; i < nFiles; i++) + filenames[i] = convertInput(tcscmp(files[i], SP_T("-")) == 0 + ? SP_T("0") + : files[i]); + if (nFiles == 0) + filenames[0] = convertInput(SP_T("0")); + return entityManager()->mergeSystemIds(filenames, + mapCatalogDocument_, + systemCharset(), + *mgr_, + result); +} + +Ptr< ExtendEntityManager> & +DtdParser:: +entityManager() +{ + if (!entityManager_.isNull()) + return entityManager_; + PosixStorageManager *sm + = new PosixStorageManager("OSFILE", + &systemCharset(), +#ifndef SP_WIDE_SYSTEM + codingSystem(), +#endif + 5); + size_t i; + for (i = 0; i < searchDirs_.size(); i++) + sm->addSearchDir(convertInput(searchDirs_[i])); + { + const AppChar *e = tgetenv(SP_T("SGML_SEARCH_PATH")); + if (!e) + e = SGML_SEARCH_PATH_DEFAULT; + if (*e) { + StringC str(convertInput(e)); + size_t i = 0; + size_t start = 0; + for (;;) { + if (i == str.size() || str[i] == FILE_SEP) { + sm->addSearchDir(StringC(str.data() + start, + i - start)); + if (i == str.size()) + break; + start = ++i; + } + else + i++; + } + } + } + + entityManager_ = ExtendEntityManager::make(sm, + codingSystem(), + inputCodingSystemKit(), + internalCharsetIsDocCharset_); +#ifdef SP_WININET + entityManager_->registerStorageManager(new WinInetStorageManager("URL")); +#else + entityManager_->registerStorageManager(new URLStorageManager("URL")); +#endif + entityManager_->registerStorageManager(new LiteralStorageManager("LITERAL")); + entityManager_->registerStorageManager(new NotationStorageManager("CLSID")); + entityManager_->registerStorageManager(new NotationStorageManager("MIMETYPE")); + Vector v; + for (i = 0; i < catalogSysids_.size(); i++) + // filenames specified on command-line must exist + v.push_back(convertInput(catalogSysids_[i])); + { + const AppChar *e = tgetenv(SP_T("SGML_CATALOG_FILES")); + if (!e) + e = SGML_CATALOG_FILES_DEFAULT; + if (*e) { + StringC str(convertInput(e)); + size_t i = 0; + size_t start = 0; + for (;;) { + if (i == str.size() || str[i] == FILE_SEP) { + v.push_back(StringC(str.data() + start, + i - start)); + if (i == str.size()) + break; + start = ++i; + } + else + i++; + } + } + } + entityManager_->setCatalogManager(SOCatalogManager::make(v, + catalogSysids_.size(), + &systemCharset(), + &systemCharset(), + 0)); + return entityManager_; +} + +#ifdef SP_NAMESPACE +} +#endif diff --git a/src/experimental/ofx/parser/DtdParser.h b/src/experimental/ofx/parser/DtdParser.h new file mode 100644 index 0000000000..e2103d2122 --- /dev/null +++ b/src/experimental/ofx/parser/DtdParser.h @@ -0,0 +1,120 @@ +// $Id$ +// Copyright (C) 1997 ISOGEN International Corp. and TechnoTeacher, Inc. +// All Rights Reserved. +// +// +// This file and its associated materials are copyrighted material of +// ISOGEN International Corp. (ISOGEN) and TechnoTeacher, +// Inc. (TechnoTeacher). License to copy and use this file and its +// associated materials is granted to everyone, free of charge, with +// the following restrictions: (1) The ISOGEN and TechnoTeacher +// copyright statement must be maintained in any copies. (2) New +// materials derived from these materials must indicate their source, +// including references to the ISOGEN and TechnoTeacher web sites +// (www.isogen.com and www.techno.com). (3) These materials may not be +// sold in any form without the express written permission of ISOGEN +// and TechnoTeacher. [However, feel free to sell things you create +// from these materials as long as the things you create are truly +// different in function--we want to encourage people to learn from +// these materials and benefit from having learned--we just don't want +// others to sell what we're giving away.] +// + +#ifndef DtdParser_INCLUDED +#define DtdParser_INCLUDED 1 + +#include "Dtd.h" +#include "Ptr.h" +#include "Vector.h" +#include "CodingSystem.h" +#include "CodingSystemKit.h" +#include "SgmlParser.h" +#include "ParserOptions.h" +#include "ExtendEntityManager.h" + +#ifdef SP_NAMESPACE +namespace SP_NAMESPACE { +#endif + +class DtdParser { + public: + DtdParser( const char * requiredInternalCode = 0); + void setMessenger( Messenger *); + + ConstPtr< Dtd> parseDtd( const StringC & sysid); + +#ifdef SP_WIDE_SYSTEM + typedef wchar_t AppChar; +#else + typedef char AppChar; +#endif + const CodingSystem * codingSystem(); + const CharsetInfo & systemCharset(); + ConstPtr< InputCodingSystemKit> inputCodingSystemKit(); + StringC convertInput( const AppChar * s); + + Boolean makeSystemId( int nFiles, AppChar * const * files, StringC & result); + Ptr< ExtendEntityManager> & entityManager(); + + SgmlParser & parser(); + + private: + Messenger * mgr_; + NullMessenger nullMgr_; + + // Coding system stuff + void initCodingSystem( const char * requiredInternalCode); + const CodingSystem * lookupCodingSystem( const AppChar * codingName); + Boolean internalCharsetIsDocCharset_; + Ptr< CodingSystemKit> codingSystemKit_; + const CodingSystem * codingSystem_; + + // Entity manager stuff + Vector< const AppChar *> searchDirs_; + Vector< const AppChar *> catalogSysids_; + Boolean mapCatalogDocument_; + Ptr< ExtendEntityManager> entityManager_; + + // SGML Parser stuff + ParserOptions options_; + SgmlParser sdParser_; + SgmlParser parser_; +}; + +inline +const CodingSystem * +DtdParser:: +codingSystem() +{ + return codingSystem_; +} + +inline +ConstPtr< InputCodingSystemKit> +DtdParser:: +inputCodingSystemKit() +{ + return codingSystemKit_.pointer(); +} + +inline +const CharsetInfo & +DtdParser:: +systemCharset() +{ + return codingSystemKit_->systemCharset(); +} + +inline +SgmlParser & +DtdParser:: +parser() +{ + return parser_; +} + +#ifdef SP_NAMESPACE +} +#endif + +#endif /* not DtdParser_INCLUDED */ diff --git a/src/experimental/ofx/parser/LICENSE b/src/experimental/ofx/parser/LICENSE new file mode 100644 index 0000000000..e23392682b --- /dev/null +++ b/src/experimental/ofx/parser/LICENSE @@ -0,0 +1,11 @@ + +Note that some of the code in this directory is covered by +ISOGEN and TechnoTeacher copyrights. On first reading, these +copyrights appear to be restrictive. However, the parenthetical +remarks in thier license seems to indicate that a larger, derived +work is no longer subject to thier license. Since all of the rest +of the stuff in this directory is a larger, derived work, it would +appear that thier license doesn't apply, and that the whole can be +safely GPL'ed. + + diff --git a/src/experimental/ofx/parser/Makefile.am b/src/experimental/ofx/parser/Makefile.am new file mode 100644 index 0000000000..6e493c24eb --- /dev/null +++ b/src/experimental/ofx/parser/Makefile.am @@ -0,0 +1,18 @@ + +EXTRA_DIST = \ + DtdParser.C \ + DtdParser.h \ + LICENSE \ + README \ + example.txt \ + parseDtd.C \ + parseOfx.C \ + pfxBaseTypes.C \ + pfxBaseTypes.h \ + pfxCompTypes.C \ + pfxCompTypes.h \ + pfxLangOut.C \ + pfxLangOut.h \ + pfxUtils.C \ + pfxUtils.h \ + simple.C diff --git a/src/experimental/ofx/parser/Makefile.in b/src/experimental/ofx/parser/Makefile.in new file mode 100644 index 0000000000..826067be59 --- /dev/null +++ b/src/experimental/ofx/parser/Makefile.in @@ -0,0 +1,228 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = ../../../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AS = @AS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +DATADIRNAME = @DATADIRNAME@ +DLLTOOL = @DLLTOOL@ +GENCAT = @GENCAT@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_CONFIG_BIN = @GLIB_CONFIG_BIN@ +GLIB_LIBS = @GLIB_LIBS@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNC_CONFIGDIR = @GNC_CONFIGDIR@ +GNC_DOC_INSTALL_DIR = @GNC_DOC_INSTALL_DIR@ +GNC_LIBDIR = @GNC_LIBDIR@ +GNC_SCM_INSTALL_DIR = @GNC_SCM_INSTALL_DIR@ +GNC_SHAREDIR = @GNC_SHAREDIR@ +GNOME_CFLAGS = @GNOME_CFLAGS@ +GNOME_CONFIG_BIN = @GNOME_CONFIG_BIN@ +GNOME_LIBS = @GNOME_LIBS@ +GNOME_STATIC_TARGET = @GNOME_STATIC_TARGET@ +GNOME_TARGET = @GNOME_TARGET@ +GTK_XMHTML = @GTK_XMHTML@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +GUILE = @GUILE@ +GUILE_COMPILE_ARGS = @GUILE_COMPILE_ARGS@ +GUILE_CONFIG = @GUILE_CONFIG@ +GUILE_LINK_ARGS = @GUILE_LINK_ARGS@ +G_WRAP = @G_WRAP@ +G_WRAP_COMPILE_ARGS = @G_WRAP_COMPILE_ARGS@ +G_WRAP_CONFIG = @G_WRAP_CONFIG@ +G_WRAP_LINK_ARGS = @G_WRAP_LINK_ARGS@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LOCALE_DIR = @LOCALE_DIR@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +PERL = @PERL@ +PERLINCL = @PERLINCL@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SWIG = @SWIG@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +l = @l@ + +EXTRA_DIST = DtdParser.C DtdParser.h LICENSE README example.txt parseDtd.C parseOfx.C pfxBaseTypes.C pfxBaseTypes.h pfxCompTypes.C pfxCompTypes.h pfxLangOut.C pfxLangOut.h pfxUtils.C pfxUtils.h simple.C + +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../../../../config.h +CONFIG_CLEAN_FILES = +DIST_COMMON = README Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu src/experimental/ofx/parser/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = src/experimental/ofx/parser + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/experimental/ofx/parser/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: tags distdir info-am info dvi-am dvi check check-am \ +installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/experimental/ofx/parser/README b/src/experimental/ofx/parser/README new file mode 100644 index 0000000000..c0fab7c700 --- /dev/null +++ b/src/experimental/ofx/parser/README @@ -0,0 +1,53 @@ + +This directory contains some experimental code to handle +OFX (Open Financial Exchange) messages. + +The most interesting thing here is the DTD parser "parseOfx" +which attempts to build a C++ interface that models the +structure of the OFX DTD's. It *almost* works. There +are some exceptional cases that are not properly handled. + +Next on the list of work items is to extend the parser so +that it will also generate an implementation for the interface. +Specifically, it should automatically create code for constructors, +destructors, as well as SGML input & output routines (parsers, +of a sort). + +To check this out, run parseOfx like so: +> parseOfx dtd/ofxmain.dtd + +It will print the C++ decls to stdout. + +-------------------------------------------------------------- + +HTTP tool: +http://www.inf.ufrgs.br/~sagula/urlget.html + +OFX financicial institution list: +https://ofx-prod-filist.intuit.com/qw0700/filist.asp + +SSLeay rpm's: +http://www.sabotage.net/redhat/ssl.html +http://ftp.tu-clausthal.de/pub/TEXT/EXPERT/linux/redhat-security/i386 +http://ftp.tu-clausthal.de/pub/TEXT/EXPERT/linux/redhat-security/SRPMS + +-------------------------------------------------------------- + +To build stuff in this directory, you will needs James Clark's +SGML Parser. This can be obtained at +http://www.jclark.com/sp/index.htm +Also: +ftp.debian.org/pub/debian/dists/frozen/main/binary-i386/text/sp_1.3-1.1-4.deb + +This directory contains code from +ftp://ftp.techno.com/TechnoTeacher/parseDtd/parseDtd.zip + +parseDtd.C: the sample parser from TechnoTeacher + +parseOfx.C: the mangled parser I'm hacking on. + +dtd/ofxmain.dtd: a hacked version of the original dtd, with + the intent of exposing the base types. + +--linas +March 1998 diff --git a/src/experimental/ofx/parser/example.txt b/src/experimental/ofx/parser/example.txt new file mode 100644 index 0000000000..02170ee6b8 --- /dev/null +++ b/src/experimental/ofx/parser/example.txt @@ -0,0 +1,126 @@ +From: ueli (urutishauser@bigfoot.com) + +as example, a logon request. the result is something like that: + +--------------- + + + +19980411101000 + +xxxxxx + +xxxxxx + +ENG + +GNUCash_OFX + +0001 + + + +[...something more like a investement statement download request...] + +---------------------------------------------------------- + +class hierarchy + + OFX + ---> SIGNONMSGSRQV1 + --> SONRQ + -->DTCLIENT + -->USERID + -->USERPASS + -->LANGUAGE + -->APPID + -->APPVER + + +---------------------------------------------------------- +(copy from junk.C) + +class cfxSignonmsgsrsv1; +class cfxSonrs; + +class cfxSignonmsgsrsv1 +{ + public: + cfxSignonmsgsrsv1 (void); // constructor + virtual ~cfxSignonmsgsrsv1 (); // destructor + + + // Sonrs *must* be present + cfxSonrs *sonrs; + nchtrnrs *pinchtrnrs; + + // Challengetrnrs may be a null pointer + cfxChallengetrnrs *challengetrnrs; +}; + + +class cfxSonrs +{ + public: + cfxSonrs (void); // constructor + virtual ~cfxSonrs (); // destructor + + + // Status *must* be present + cfxStatus *status; + bfxDttm *dtserver; + bfxStr *userkey; + bfxDttm *tskeyexpire; + bfxStr *language; + bfxDttm *dtprofup; + bfxDttm *dtacctup; + + // Fi may be a null pointer + cfxFi *fi; + bfxStr *sesscookie; +}; + +class cfxOfx +{ + public: + // Signonmsgsrsv1 *must* be present + cfxSignonmsgsrsv1 *signonmsgsrsv1; + +.. +} + +---------------------------------------------------------- +some pseudo-code to produce a login request: + +{ + ofxrequest = new cfxOfx(); + ofxreqeust->signonmsgsrsv1->sonrs->dtserver="199811111"; + + ... + + //all needed variables + + + // ofx_request_type = login/investement statement + // download/billings/creditcard + if (ofxrequest->Valid(ofx_request_type)) + { + ofxrequest->ExportRequest(ofx_request_type); + + request = new HTTPRequest(); + repuest->CreateHeader(); + request->AddContent(ofxrequest->GetContent()); + if (request->SendRequest()) + { + //now read in the result in a new ofxrequest structure + ofxresponse = new cfxOfx(); + //or not cfxOfx, cfxOfx i eventually only for request + + request->ParseResponse( ofxresponse ); + + } + + } +} + + diff --git a/src/experimental/ofx/parser/parseDtd.C b/src/experimental/ofx/parser/parseDtd.C new file mode 100644 index 0000000000..8e0b8fb19e --- /dev/null +++ b/src/experimental/ofx/parser/parseDtd.C @@ -0,0 +1,301 @@ +// $Id$ +// Copyright (C) 1997 ISOGEN International Corp. and TechnoTeacher, Inc. +// All Rights Reserved. +// +// +// This file and its associated materials are copyrighted material of +// ISOGEN International Corp. (ISOGEN) and TechnoTeacher, +// Inc. (TechnoTeacher). License to copy and use this file and its +// associated materials is granted to everyone, free of charge, with +// the following restrictions: (1) The ISOGEN and TechnoTeacher +// copyright statement must be maintained in any copies. (2) New +// materials derived from these materials must indicate their source, +// including references to the ISOGEN and TechnoTeacher web sites +// (www.isogen.com and www.techno.com). (3) These materials may not be +// sold in any form without the express written permission of ISOGEN +// and TechnoTeacher. [However, feel free to sell things you create +// from these materials as long as the things you create are truly +// different in function--we want to encourage people to learn from +// these materials and benefit from having learned--we just don't want +// others to sell what we're giving away.] +// + +#include "config.h" +#include "DtdParser.h" +#include "OutputCharStream.h" + +#define OUTPUT_MESSAGES + +#ifdef OUTPUT_MESSAGES +#include "sptchar.h" +#include "MessageReporter.h" +#include "MessageTable.h" +#endif + +#ifdef SP_NAMESPACE +namespace SP_NAMESPACE { +#endif + + +#ifdef SP_MANUAL_INST + +#define SP_DEFINE_TEMPLATES +#include "Owner.h" +#undef SP_DEFINE_TEMPLATES + +#include "Message.h" + +#ifdef SP_ANSI_CLASS_INST +template class Owner< Messenger>; +#else +typedef Owner< Messenger> Dummy_0; +#endif + +#endif /* SP_MANUAL_INST */ + + +static FileOutputByteStream standardOutput(1, 0); +static FileOutputByteStream standardError(2, 0); + +#ifdef OUTPUT_MESSAGES + +class MyMessageReporter +: public MessageReporter +{ + public: + MyMessageReporter( const InputCodingSystem *, OutputCharStream *); + private: + Boolean getMessageText( const MessageFragment &, StringC &); + const InputCodingSystem * codingSystem_; +}; + +MyMessageReporter:: +MyMessageReporter( const InputCodingSystem * codesys, + OutputCharStream * errorStream) +: MessageReporter( errorStream), + codingSystem_( codesys) +{ +} + +Boolean +MyMessageReporter:: +getMessageText( const MessageFragment & frag, StringC & text) +{ + String str; + if (!MessageTable::instance()->getText(frag, str)) + return 0; +#ifdef SP_WIDE_SYSTEM + text.assign((const Char *)str.data(), str.size()); +#else + str += 0; + text = codingSystem_->convertIn(str.data()); +#endif + return 1; +} + +#endif /* OUTPUT_MESSAGES */ + +void +outputModelGroup( OutputCharStream & os, const ModelGroup * modelGroup, unsigned level) +{ + os << "( "; + level++; + const char * connector = 0x0; + switch ( modelGroup->connector()) { + case ModelGroup::andConnector: + connector = " &"; + break; + case ModelGroup::orConnector: + connector = " |"; + break; + case ModelGroup::seqConnector: + connector = ","; + break; + } + unsigned i = 0; + while ( i < modelGroup->nMembers()) { + const ContentToken & token = modelGroup->member( i); + const ModelGroup * subModel = token.asModelGroup(); + Boolean tokenIsPcdata = false; + if ( subModel) + outputModelGroup( os, subModel, level); + else { + const LeafContentToken * leaf = token.asLeafContentToken(); + const ElementType * elementType = leaf->elementType(); + if ( elementType) + os << elementType->name(); + else { + tokenIsPcdata = true; + os << "#PCDATA"; + } + } + if ( !tokenIsPcdata) { + switch ( token.occurrenceIndicator()) { + case ContentToken::none: + break; + case ContentToken::opt: + os << "?"; + break; + case ContentToken::plus: + os << "+"; + break; + case ContentToken::rep: + os << "*"; + break; + } + } + if ( ++i >= modelGroup->nMembers()) + break; + os << connector << "\n"; + unsigned l = level; + while ( l--) + os << " "; + continue; + } + os << " )"; +} + +extern "C" +int +main( int argc, char ** argv) +{ + if ( argc < 2) + return 1; + + DtdParser parser; + +#ifdef OUTPUT_MESSAGES + Owner< Messenger> mgr; + if ( argv[ 1][ 0] != '-' || argv[ 1][ 1] != 's' || argv[ 1][ 2] != '\0') { + mgr = new MyMessageReporter( parser.codingSystem(), + new EncodeOutputCharStream( &standardError, + parser.codingSystem())); + parser.setMessenger( mgr.pointer()); + } +#endif + + StringC sysid; + parser.makeSystemId( argc - 1, argv + 1, sysid); + ConstPtr< Dtd> dtd = parser.parseDtd( sysid); + + if ( dtd.isNull()) + return 1; + + EncodeOutputCharStream os( &standardOutput, parser.codingSystem()); + Dtd::ConstElementTypeIter e( dtd->elementTypeIter()); + const ElementType * type = e.next(); + while ( type) { + os << type->name() << " =\n "; + switch ( type->definition()->declaredContent()) { + case ElementDefinition::modelGroup: + outputModelGroup( os, type->definition()->compiledModelGroup()->modelGroup(), 1); + break; + case ElementDefinition::any: { + Dtd::ConstElementTypeIter i( dtd->elementTypeIter()); + os << "( #PCDATA"; + const ElementType * type; + while ( ( type = i.next())) + os << " |\n " << type->name(); + os << " )*"; + break; + } + case ElementDefinition::cdata: + os << "CDATA"; + break; + case ElementDefinition::rcdata: + os << "RCDATA"; + break; + case ElementDefinition::empty: + os << "EMPTY"; + break; + } + os << "\n"; + const AttributeDefinitionList * attlist = type->attributeDefTemp(); + if ( attlist) { + os << "[\n"; + for ( size_t a = 0; a < attlist->size(); a++) { + const AttributeDefinition * def = attlist->def( a); + os << " " << def->name() << " : "; + size_t indent = def->name().size() + 5; + AttributeDefinitionDesc desc; + def->getDesc( desc); + switch ( desc.declaredValue) { + case AttributeDefinitionDesc::cdata: + os << "CDATA"; + break; + case AttributeDefinitionDesc::name: + os << "NAME"; + break; + case AttributeDefinitionDesc::number: + os << "NUMBER"; + break; + case AttributeDefinitionDesc::nmtoken: + os << "NMTOKEN"; + break; + case AttributeDefinitionDesc::nutoken: + os << "NUTOKEN"; + break; + case AttributeDefinitionDesc::entity: + os << "ENTITY"; + break; + case AttributeDefinitionDesc::idref: + os << "IDREF"; + break; + case AttributeDefinitionDesc::names: + os << "NAMES"; + break; + case AttributeDefinitionDesc::numbers: + os << "NUMBERS"; + break; + case AttributeDefinitionDesc::nmtokens: + os << "NMTOKENS"; + break; + case AttributeDefinitionDesc::nutokens: + os << "NUTOKENS"; + break; + case AttributeDefinitionDesc::entities: + os << "ENTITIES"; + break; + case AttributeDefinitionDesc::idrefs: + os << "IDREFS"; + break; + case AttributeDefinitionDesc::id: + os << "ID"; + break; + case AttributeDefinitionDesc::notation: + os << "NOTATION"; + indent += 8; + case AttributeDefinitionDesc::nameTokenGroup: { + os << "( "; + indent += 2; + size_t i; + size_t v = 0; + while ( v < desc.allowedValues.size()) { + os << desc.allowedValues[ v]; + if ( ++v >= desc.allowedValues.size()) + break; + os << " |\n"; + i = indent; + while ( i--) + os << " "; + continue; + } + os << " )"; + break; + } + } + os << "\n"; + } + os << "]\n"; + } + if ( !( type = e.next())) + break; + os << "\n"; + continue; + } + return 0; +} + +#ifdef SP_NAMESPACE +} +#endif diff --git a/src/experimental/ofx/parser/parseOfx.C b/src/experimental/ofx/parser/parseOfx.C new file mode 100644 index 0000000000..1647f2cded --- /dev/null +++ b/src/experimental/ofx/parser/parseOfx.C @@ -0,0 +1,245 @@ +// +// FILE: +// parseOfx.C +// +// FUNCTION: +// Parses OFX dtd's +// +// HISTORY: +// Written by Linas Vepstas March 1998 + +#include +#include +#include +#include + +#include "config.h" +#include "DtdParser.h" +#include "OutputCharStream.h" + +#include "pfxBaseTypes.h" +#include "pfxCompTypes.h" +#include "pfxLangOut.h" +#include "pfxUtils.h" + + +// output messages is used to set up the SP parser +// to dump it's error messages to stderr +#define OUTPUT_MESSAGES + +#ifdef OUTPUT_MESSAGES +#include "sptchar.h" +#include "MessageReporter.h" +#include "MessageTable.h" +#endif /* OUTPUT_MESSAGES */ + +#ifdef SP_NAMESPACE +namespace SP_NAMESPACE { +#endif + +#ifdef OUTPUT_MESSAGES +#ifdef SP_MANUAL_INST + +#define SP_DEFINE_TEMPLATES +#include "Owner.h" +#undef SP_DEFINE_TEMPLATES + +#include "Message.h" + +#ifdef SP_ANSI_CLASS_INST +template class Owner< Messenger>; +#else +typedef Owner< Messenger> Dummy_0; +#endif + +#endif /* SP_MANUAL_INST */ +#endif /* OUTPUT_MESSAGES */ + + +static FileOutputByteStream standardOutput(1, 0); +static FileOutputByteStream standardError(2, 0); + +#ifdef OUTPUT_MESSAGES + +class MyMessageReporter +: public MessageReporter +{ + public: + MyMessageReporter( const InputCodingSystem *, OutputCharStream *); + private: + Boolean getMessageText( const MessageFragment &, StringC &); + const InputCodingSystem * codingSystem_; +}; + +MyMessageReporter:: +MyMessageReporter( const InputCodingSystem * codesys, + OutputCharStream * errorStream) +: MessageReporter( errorStream), + codingSystem_( codesys) +{ +} + +Boolean +MyMessageReporter:: +getMessageText( const MessageFragment & frag, StringC & text) +{ + String str; + if (!MessageTable::instance()->getText(frag, str)) + return 0; +#ifdef SP_WIDE_SYSTEM + text.assign((const Char *)str.data(), str.size()); +#else + str += 0; + text = codingSystem_->convertIn(str.data()); +#endif + return 1; +} + +#endif /* OUTPUT_MESSAGES */ + +// =========================================================== + +extern "C" + +void Usage (char *progname) +{ + printf ("Usage: %s \n", progname); + exit (1); +} + +int +main( int argc, char ** argv) +{ + if ( argc < 2) Usage (argv[0]); + + DtdParser parser; + + pfxCompoundType compoundTypeHandler; + +#ifdef OUTPUT_MESSAGES + Owner< Messenger> mgr; + if ( argv[ 1][ 0] != '-' || argv[ 1][ 1] != 's' || argv[ 1][ 2] != '\0') { + mgr = new MyMessageReporter( parser.codingSystem(), + new EncodeOutputCharStream( &standardError, + parser.codingSystem())); + parser.setMessenger( mgr.pointer()); + } +#endif + + StringC sysid; + parser.makeSystemId( argc - 1, argv + 1, sysid); + ConstPtr< Dtd> dtd = parser.parseDtd( sysid); + + if ( dtd.isNull()) { + printf ("Error: specified dtd %s was null \n", argv[1]); + return 1; + } + + // ---------------------------------------------------- + + compoundTypeHandler.prtout = new pfxOutDecl; + + // ---------------------------------------------------- + // print everything + time_t now = time (0); + char * cnow = ctime (&now); + + printf ("//\n"); + printf ("// This file automatically generated by %s \n", argv[0]); + printf ("// Do not edit -- your changes will be lost! \n"); + printf ("// Generated on %s \n", cnow); + printf ("//\n"); + printf ("//\n"); + compoundTypeHandler.PrintBaseTypes (0); + + + printf ("//----------------------------------------------\n"); + printf ("//\n"); + printf ("// Forward declarations of classes\n"); + printf ("//\n"); + printf ("//\n"); + const ElementType * type; + Dtd::ConstElementTypeIter e( dtd->elementTypeIter()); + type = e.next(); + while ( type) { + + // see if is a base type + char * varname = compoundTypeHandler.AddBaseVar (type); + + if (!varname) { + compoundTypeHandler.AddCompoundType (type); + + switch ( type->definition()->declaredContent()) { + case ElementDefinition::modelGroup: + break; + case ElementDefinition::any: + break; + default: { + char * vname = pfxCharify (type->name()); + printf ("unexpected duuuuuuuuuuuuuuuuuuude: %s \n", vname); + delete vname; + } + } + } + + const AttributeDefinitionList * attlist = type->attributeDefTemp(); + if ( attlist) { + printf (" attribute lists duuuuuuuuuuuuuuuuuuuuuuuuuude \n"); + } + + if ( !( type = e.next())) + break; + continue; + } + + // ---------------------------------------------------- + // print classes + printf ("//----------------------------------------------\n"); + printf ("//\n"); + printf ("// Class declarations\n"); + printf ("//\n"); + printf ("//\n"); + + Dtd::ConstElementTypeIter ee( dtd->elementTypeIter()); + type = ee.next(); + while ( type) { + + // see if is a base type + char * varname = compoundTypeHandler.AddBaseVar (type); + + if (!varname) { + compoundTypeHandler.PrintClass (type); + } + + type = ee.next(); + } + + // ---------------------------------------------------- + // print constructors + printf ("//----------------------------------------------\n"); + printf ("//\n"); + printf ("// Constructors\n"); + printf ("//\n"); + printf ("//\n"); + + compoundTypeHandler.prtout = new pfxOutConstructor; + + Dtd::ConstElementTypeIter eee( dtd->elementTypeIter()); + type = eee.next(); + while ( type) { + + // see if is a base type + char * varname = compoundTypeHandler.AddBaseVar (type); + + if (!varname) { + compoundTypeHandler.PrintClass (type); + } + + type = eee.next(); + } + return 0; +} + +#ifdef SP_NAMESPACE +} +#endif diff --git a/src/experimental/ofx/parser/pfxBaseTypes.C b/src/experimental/ofx/parser/pfxBaseTypes.C new file mode 100644 index 0000000000..756a7f39af --- /dev/null +++ b/src/experimental/ofx/parser/pfxBaseTypes.C @@ -0,0 +1,238 @@ +// +// FILE: +// basTypes.C +// +// FUNCTION: +// Handles OFX base types +// +// HISTORY: +// Written by Linas Vepstas March 1998 + +#include +#include +#include +#include + +#include "config.h" +#include "DtdParser.h" + +#include "pfxUtils.h" +#include "pfxBaseTypes.h" + +// =========================================================== +// class pfxBaseType stores & handles base types + + +pfxBaseType :: pfxBaseType (void) +{ + prtout = 0x0; + nvars = 0; + varname[0] = 0x0; + vartype[0] = 0x0; +} + +char * +pfxBaseType :: AddBaseVar (const ElementType *type) +{ + + // its not a base type unless we have a model group. + if (ElementDefinition::modelGroup != + type->definition()->declaredContent()) return 0x0; + + const ModelGroup * mg; + mg = type->definition()->compiledModelGroup()->modelGroup(); + + // to be a base type, it must have exactly one member + if (1 != mg->nMembers()) return 0x0; + + const ContentToken & token = mg->member (0); + + // anything with a sub-model cannot be a base type + const ModelGroup * subModel = token.asModelGroup(); + if (subModel) return 0x0; + + const LeafContentToken * leaf = token.asLeafContentToken(); + const ElementType * elementType = leaf->elementType(); + + if (!elementType) { + char * name = pfxCharify (type->name()); + + printf ("Unkonwon, unexpected PCDATA: %s \n", name); + return 0x0; + } + + // now look to see if we have already processed this one + char *vname = pfxCharify (type->name()); + + // if its already in out database, just return + for (int i = 0; iname()); + if (strcmp ("XACC-AMOUNT", vtype) && + strcmp ("XACC-BOOL", vtype) && + strcmp ("XACC-DTTM", vtype) && + strcmp ("XACC-ID", vtype) && + strcmp ("XACC-INT", vtype) && + strcmp ("XACC-PRICE", vtype) && + strcmp ("XACC-RATE", vtype) && + strcmp ("XACC-SRVRID", vtype) && + strcmp ("XACC-STR", vtype) && + strcmp ("XACC-URL", vtype) && + strcmp ("XACC-UUID", vtype)) { + + delete vtype; + delete vname; + return 0x0; + } + + // we haven't encounterd this before. Add it to our list. + varname[nvars] = vname; + vartype[nvars] = vtype; + nvars ++; + + return vname; +} + +void +pfxBaseType :: PrintBaseTypes (int dent) +{ + + DENT (dent); printf ("// Basic Types \n"); + DENT (dent); printf ("typedef double bfxAmount; \n"); + DENT (dent); printf ("typedef int bfxBool; \n"); + DENT (dent); printf ("typedef long int bfxDttm; \n"); + DENT (dent); printf ("typedef char * bfxId; \n"); + DENT (dent); printf ("typedef int bfxInt; \n"); + DENT (dent); printf ("typedef double bfxPrice; \n"); + DENT (dent); printf ("typedef double bfxRate; \n"); + DENT (dent); printf ("typedef char * bfxStr; \n"); + DENT (dent); printf ("typedef char * bfxSrvrid; \n"); + DENT (dent); printf ("typedef char * bfxUrl; \n"); + DENT (dent); printf ("typedef char bfxUuid [36]; \n"); + printf ("\n\n"); +} + +void +pfxBaseType :: PrintBaseDecl (const ContentToken & token) +{ + // print an individual member + const LeafContentToken * leaf = token.asLeafContentToken(); + const ElementType * elementType = leaf->elementType(); + if (!elementType) return; + + char * varname = pfxCharify (elementType->name()); + + if (!varname) return; + + char * vtype = GetBaseType (varname); + if (!vtype) return; + + char * decl; + + if (!strcmp ("XACC-AMOUNT", vtype)) { + decl = "bfxAmount"; + } else + + if (!strcmp ("XACC-BOOL", vtype)) { + decl = "bfxBool"; + } else + + if (!strcmp ("XACC-DTTM", vtype)) { + decl = "bfxDttm"; + } else + + if (!strcmp ("XACC-ID", vtype)) { + decl = "bfxId"; + } else + + if (!strcmp ("XACC-INT", vtype)) { + decl = "bfxInt"; + } else + + if (!strcmp ("XACC-PRICE", vtype)) { + decl = "bfxPrice"; + } else + + if (!strcmp ("XACC-RATE", vtype)) { + decl = "bfxRate"; + } else + + if (!strcmp ("XACC-STR", vtype)) { + decl = "bfxStr"; + } else + + if (!strcmp ("XACC-SRVRID", vtype)) { + decl = "bfxSrvrid"; + } else + + if (!strcmp ("XACC-URL", vtype)) { + decl = "bfxUrl"; + } else + + if (!strcmp ("XACC-UUID", vtype)) { + decl = "bfxUuid"; + } else + + printf ("---> unknown type >%s<\n", vtype); + + + // handle repeated lists + pfxLangOutput::occ currance; + switch ( token.occurrenceIndicator()) { + + // element *must* occur + case ContentToken::none: + currance = pfxLangOutput::MUST; + break; + + // element may or may not occur + case ContentToken::opt: + currance = pfxLangOutput::OPT; + break; + + // element must occur at least once, maybe more times. + case ContentToken::plus: + currance = pfxLangOutput::PLUS; + break; + + // element may occur zero or more times + case ContentToken::rep: + currance = pfxLangOutput::REP; + break; + } + + // printed var names will be lower case + char * vname = pfxToLower (varname); + + char * saveprefix = prtout->prefix; + + prtout -> prefix = ""; + prtout -> PrintMember (currance, decl, vname); + prtout -> prefix = saveprefix; + + delete vname; + delete varname; +} + + +char * +pfxBaseType :: GetBaseType (char * vname) +{ + + for (int i = 0; i +#include +#include +#include + +#include "config.h" +#include "DtdParser.h" + +#include "pfxBaseTypes.h" +#include "pfxCompTypes.h" +#include "pfxUtils.h" + + +// ===================================================== + +pfxCompoundType :: pfxCompoundType (void) +{ + nclasses = 0; + classname[0] = 0x0; +} + +char * +pfxCompoundType :: IsClass (char * vname) +{ + for (int i = 0; idefinition()->declaredContent()) return 0x0; + + // make sure its not a base type + char * basename = AddBaseVar (type); + if (basename) return 0x0; + + const ModelGroup * mg; + mg = type->definition()->compiledModelGroup()->modelGroup(); + + char * cname = pfxCharify (type->name()); + + classname [nclasses] = cname; + nclasses ++; + + char * pname = pfxCapLower (cname); + printf ("class cfx%s;\n", pname); + delete pname; + + return cname; +} + +void +pfxCompoundType :: PrintMember (const ContentToken & token) +{ + if (!prtout) return; + + // print an individual member + const LeafContentToken * leaf = token.asLeafContentToken(); + const ElementType * elementType = leaf->elementType(); + if (!elementType) return; + + char * varname = pfxCharify (elementType->name()); + + // see if its a base type -- e.g. int, double, etc. + char * basetype = GetBaseType (varname); + if (basetype) { + PrintBaseDecl (token); + } else { + + // Not base type. Must be a class + char * classtype = IsClass (varname); + if (classtype) { + char * decl = pfxCapLower (varname); + char * var = pfxToLower (varname); + + // look to see if the element occurs + // once, more than once, etc. + switch ( token.occurrenceIndicator()) { + + // element *must* occur + case ContentToken::none: + prtout -> PrintMember (pfxLangOutput::MUST, decl, var); + break; + + // element may or may not occur + case ContentToken::opt: + prtout -> PrintMember (pfxLangOutput::OPT, decl, var); + break; + + // element must occur at least once, maybe more times. + case ContentToken::plus: + prtout -> PrintMember (pfxLangOutput::PLUS, decl, var); + break; + + // element may occur zero or more times + case ContentToken::rep: + prtout -> PrintMember (pfxLangOutput::REP, decl, var); + break; + } + + delete decl; + delete var; + } else { + printf (" this variable has no type -----> %s \n", varname); + } + } + delete varname; +} + +int +pfxCompoundType :: IsUnion (const ModelGroup * mg) +{ + if (ModelGroup::orConnector == mg->connector()) return 1; + return 0; +} + +char * +pfxCompoundType :: GetUnnamedClassName (const ContentToken & untoken) +{ + const ModelGroup * mg = untoken.asModelGroup(); + + if (!mg) { + printf ("Error: GetUnnamedClassName: unexpected non model \n"); + return 0x0; + } + + // The connector *must* be a sequence or a logical-AND type in order + // for this to be a struct. + if ((ModelGroup::andConnector != mg->connector()) && + (ModelGroup::seqConnector != mg->connector())) return 0x0; + + + // create a long compound name + // first, count the length of that name + int i = 0; + int namelen = 0; + while (i < mg->nMembers()) { + const ContentToken & token = mg->member( i); + const ModelGroup * subModel = token.asModelGroup(); + + if (!subModel) { + const LeafContentToken * leaf = token.asLeafContentToken(); + const ElementType * elementType = leaf->elementType(); + namelen += (elementType->name()).size() + 1; + } + i++; + } + + // now, build the compund name + i = 0; + char * name = new char [namelen+1]; + name[0] = 0x0; + while (i < mg->nMembers()) { + const ContentToken & token = mg->member( i); + const ModelGroup * subModel = token.asModelGroup(); + + if (!subModel) { + const LeafContentToken * leaf = token.asLeafContentToken(); + const ElementType * elementType = leaf->elementType(); + + char * varname = pfxCharify (elementType->name()); + char * capname = pfxCapLower (varname); + strcat (name, "_"); + strcat (name, capname); + } + i++; + } + + return name; +} + +void +pfxCompoundType :: PrintMacroDecl (const ContentToken & untoken) +{ + const ModelGroup * mg = untoken.asModelGroup(); + + if (!mg) { + printf ("Error: PrintMacroDecl: unexpected non model \n"); + return; + } + + // If connector is a sequence or a logical-AND type, + // then treat as a class. + if ((ModelGroup::andConnector == mg->connector()) || + (ModelGroup::seqConnector == mg->connector())) { + + PrintUnnamedClassDecl (untoken); + PrintUnnamedInstance (untoken); + } else + + // If the connector is a logical-OR connector, + // then treat as a union + if (ModelGroup::orConnector == mg->connector()) { + PrintUnionDecl (untoken); + } +} + +void +pfxCompoundType :: PrintUnnamedClassDecl (const ContentToken & untoken) +{ + const ModelGroup * mg = untoken.asModelGroup(); + + if (!mg) { + printf ("Error: PrintUnnamedClassDecl: unexpected non model \n"); + return; + } + + // The connector *must* be a sequence or a logical-AND type in order + // for this to be a struct. + if ((ModelGroup::andConnector != mg->connector()) && + (ModelGroup::seqConnector != mg->connector())) return; + + char * name = GetUnnamedClassName (untoken); + + // If the returned name of the thing is null, then + // I think we can safely assume that this thing is + // the result of a macro expansion in the DTD. + // This means that there is no true heirarchy, even + // though there is an appearent heirarchy. So, + // don't let things nest. Just flatten it. + // We flatten by not printing the prolog or epilogue + // (since there really isn't a prolog or epilog). + + // now, print the class definition + if (name[0]) prtout->PrintClassProlog (name); + int i = 0; + while (i < mg->nMembers()) { + const ContentToken & token = mg->member( i); + const ModelGroup * subModel = token.asModelGroup(); + if (subModel) { + printf (" // -------> begin flattening \n"); + PrintMacroDecl (token); + printf (" // -------> end flattening \n"); + } else { + // put the member elements into the class declaration + PrintMember(token); + } + i++; + } + if (name[0]) prtout->PrintClassEpilog (name); +} + +void +pfxCompoundType :: PrintUnnamedInstance (const ContentToken & untoken) +{ + const ModelGroup * mg = untoken.asModelGroup(); + + if (!mg) { + printf ("Error: PrintUnnamedInstance: unexpected non model \n"); + return; + } + + // The connector *must* be a sequence or a logical-AND type in order + // for this to be a struct. + if ((ModelGroup::andConnector != mg->connector()) && + (ModelGroup::seqConnector != mg->connector())) return; + + + char * name = GetUnnamedClassName (untoken); + + // now handle repeated lists + pfxLangOutput::occ currance; + switch ( untoken.occurrenceIndicator()) { + + // element *must* occur + case ContentToken::none: + currance = pfxLangOutput::MUST; + break; + + // element may or may not occur + case ContentToken::opt: + currance = pfxLangOutput::OPT; + break; + + // element must occur at least once, maybe more times. + case ContentToken::plus: + currance = pfxLangOutput::PLUS; + break; + + // element may occur zero or more times + case ContentToken::rep: + currance = pfxLangOutput::REP; + break; + } + + prtout ->PrintMember (currance, name, name); +} + +void +pfxCompoundType :: PrintUnionDecl (const ContentToken & untoken) +{ + + const ModelGroup * mg = untoken.asModelGroup(); + + if (!mg) { + printf ("Error: PrintUnionDecl: unexpected non model \n"); + return; + } + + // The connector *must* be logical-OR type in order + // for this to be a union. + if (ModelGroup::orConnector != mg->connector()) return; + + // now handle repeated lists + pfxLangOutput::occ currance; + switch ( untoken.occurrenceIndicator()) { + + // element *must* occur + case ContentToken::none: + currance = pfxLangOutput::MUST; + break; + + // element may or may not occur + case ContentToken::opt: + currance = pfxLangOutput::OPT; + break; + + // element must occur at least once, maybe more times. + case ContentToken::plus: + currance = pfxLangOutput::PLUS; + break; + + // element may occur zero or more times + case ContentToken::rep: + currance = pfxLangOutput::REP; + break; + } + + // if there are any groups that occur, + // lets create a name for them, and print + // thier declarations + int i = 0; + while (i < mg->nMembers()) { + const ContentToken & token = mg->member( i); + const ModelGroup * subModel = token.asModelGroup(); + if (subModel) { + // ack -- its an un-named, compound type + PrintUnnamedClassDecl (token); + } + i++; + } + + // OK, now print the union + prtout ->PrintUnionProlog (currance, "abcd"); + + i = 0; + while (i < mg->nMembers()) { + const ContentToken & token = mg->member( i); + const ModelGroup * subModel = token.asModelGroup(); + if (subModel) { + // ack -- its an un-named, compound type + PrintUnnamedInstance (token); + } else { + // put the member elements into the class declaration + PrintMember (token); + } + i++; + } + + prtout ->PrintUnionEpilog (currance, "abcd"); +} + +void +pfxCompoundType :: PrintGroupMembers (const ModelGroup * mg) +{ + + int i = 0; + while (i < mg->nMembers()) { + const ContentToken & token = mg->member( i); + const ModelGroup * subModel = token.asModelGroup(); + + if ( subModel) { + if (ModelGroup::orConnector == subModel->connector()) { + PrintUnionDecl (token); + + } else { + if (ContentToken::none == token.occurrenceIndicator()) { + PrintGroupMembers (subModel); + } else { + // ack -- its an un-named, compound type + PrintUnnamedClassDecl (token); + } + } + } else { + + // put the member elements into the class declaration + PrintMember (token); + } + + i++; + } +} + + +void +pfxCompoundType :: PrintClass (const ElementType *type) +{ + + // its not a compound type unless we have a model group. + if (ElementDefinition::modelGroup != + type->definition()->declaredContent()) return; + + const ModelGroup * mg; + mg = type->definition()->compiledModelGroup()->modelGroup(); + + // open the class declaration + char * cname = pfxCharify (type->name()); + char * pname = pfxCapLower (cname); + + prtout->PrintClassProlog (pname); + + PrintGroupMembers (mg); + + prtout->PrintClassEpilog (pname); +} + +// =========================================================== + +#ifdef SP_NAMESPACE +} +#endif diff --git a/src/experimental/ofx/parser/pfxCompTypes.h b/src/experimental/ofx/parser/pfxCompTypes.h new file mode 100644 index 0000000000..988887dea7 --- /dev/null +++ b/src/experimental/ofx/parser/pfxCompTypes.h @@ -0,0 +1,57 @@ +// +// FILE: +// pfxCompTypes.h +// +// FUNCTION: +// Parses OFX dtd's +// +// HISTORY: +// Written by Linas Vepstas March 1998 + +#ifndef __PFX_COMP_TYPES_H__ +#define __PFX_COMP_TYPES_H__ + +#include "config.h" +#include "DtdParser.h" + +#include "pfxBaseTypes.h" +#include "pfxUtils.h" + + +// =========================================================== +// handles compund types +// IsUnion returns true if its pure-or + +class pfxCompoundType : + public pfxBaseType +{ + public: + pfxCompoundType (void); + char * AddCompoundType (const ElementType *); + + void PrintClass (const ElementType *); + + void PrintMember (const ContentToken &); + + int IsUnion (const ModelGroup *); + void PrintUnionDecl (const ContentToken &); + void PrintMacroDecl (const ContentToken &); + + char * GetUnnamedClassName (const ContentToken &); + void PrintUnnamedClassDecl (const ContentToken &); + void PrintUnnamedInstance (const ContentToken &); + + void PrintGroupMembers (const ModelGroup *); + + char * IsClass (char *); + + private: + char * classname[MAXVARS]; + int nclasses; +}; + +#ifdef SP_NAMESPACE +} +#endif + +#endif /* __PFX_COMP_TYPES_H__ */ diff --git a/src/experimental/ofx/parser/pfxLangOut.C b/src/experimental/ofx/parser/pfxLangOut.C new file mode 100644 index 0000000000..d6670bd72c --- /dev/null +++ b/src/experimental/ofx/parser/pfxLangOut.C @@ -0,0 +1,319 @@ +// +// FILE: +// pfxLangOut.C +// +// FUNCTION: +// Prints the C++ equivalents of the OFX dtd's +// The actual implementation of this stuff is very +// much of an ugly hack. Sorry. +// +// HISTORY: +// Written by Linas Vepstas April 1998 + +#include +#include +#include + +#include "config.h" + +#include "pfxLangOut.h" +#include "pfxUtils.h" + +pfxLangOutput :: pfxLangOutput (void) +{ + dent = 0; + prefix = 0x0; +} + +// ======================================================= +pfxOutDecl :: pfxOutDecl (void) +{ + nelts = 0; + doing_union = 0; + doing_class = 0; + nth_union = 0; + prefix = strdup("cfx"); +} + +void +pfxOutDecl :: PrintClassProlog (char * decl) +{ + if (0 == doing_class) nth_union = 0; + doing_class = 1; + + DENT (dent); printf ("\n\n"); + DENT (dent); printf ("class cfx%s \n", decl); + DENT (dent); printf ("{ \n"); + DENT (dent); printf (" public:\n"); + DENT (dent); printf (" cfx%s (void); // constructor \n", decl); + DENT (dent); printf (" virtual ~cfx%s (); // destructor \n", decl); + DENT (dent); printf ("\n"); + + dent +=2; +} + +void +pfxOutDecl :: PrintClassEpilog (char * decl) +{ + doing_class = 0; + dent -=2; + DENT (dent); printf ("};\n"); +} + +void +pfxOutDecl :: PrintUnionProlog (occ rance, char * decl) +{ + doing_union = 1; + nth_union ++; +} + +void +pfxOutDecl :: PrintUnionEpilog (occ rance, char * decl) +{ + // not an onion any more, so that PrintMember will revert to normal + doing_union = 0; + + // print enumerated type for the union members + DENT (dent); printf ("enum Enum%d{\n", nth_union); + for (int i=0; i scope, scope); + nest->dent = dent; + nest->PrintClassProlog (decl); + } else { + strcpy (classname, prefix); + strcat (classname, decl); + strcat (scope, classname); + strcat (scope, " :: "); + } + doing_class = 1; + +} + +void +pfxOutConstructor :: PrintClassEpilog (char * decl) +{ + // handle subclass nesting + if (nest) { + nest -> PrintClassEpilog (decl); + delete nest; + nest = 0x0; + } + + doing_class = 0; + DENT (dent); printf ("\n\n"); + DENT (dent); printf ("%s %s (void)\n", scope, classname); + DENT (dent); printf ("{\n"); + dent ++; + for (int i=0; i PrintMember (rance, decl, var); + return; + } + + if (doing_class) { + if (doing_union) { + if (done_union) return; + + char buff[1000]; + sprintf (buff, + "utype%d = T_%s;\n", nth_union, pfxToUpper (decl)); + override.insert (override.begin()+ nelts, strdup (buff)); + nelts ++; + + done_union = 1; + return; + } + declaration.insert (declaration.begin()+ nelts, strdup (decl)); + varname.insert (varname.begin()+ nelts, strdup (var)); + refix.insert (refix.begin()+ nelts, strdup (prefix)); + override.insert (override.begin()+ nelts, strdup ("")); + currance.insert (currance.begin()+ nelts, rance); + nelts ++; + return; + } + + switch (rance) { + case MUST: + printf ("\n"); + DENT (dent); + printf ("// %s *must* be present \n", decl); + + DENT (dent); + printf ("%s = new %s%s; \n", var, prefix, decl); + break; + + case OPT: + printf ("\n"); + DENT (dent); + printf ("// %s may be a null pointer \n", decl); + + DENT (dent); + printf ("%s = 0x0; \n", var); + break; + + case PLUS: + printf ("\n"); + DENT (dent); + printf ("// %s is a list of one or more items \n", decl); + + DENT (dent); + printf ("%s = 0x0; \n", var); + break; + + case REP: + printf ("\n"); + DENT (dent); + printf ("// %s is a list of zero or more items \n", decl); + + DENT (dent); + printf ("%s = 0x0; \n", var); + break; + } + +} + diff --git a/src/experimental/ofx/parser/pfxLangOut.h b/src/experimental/ofx/parser/pfxLangOut.h new file mode 100644 index 0000000000..6f310173be --- /dev/null +++ b/src/experimental/ofx/parser/pfxLangOut.h @@ -0,0 +1,107 @@ +// +// FILE: +// pfxLangOut.h +// +// FUNCTION: +// print language specific output +// In this case, this generates C++ output +// +// HISTORY: +// Written by Linas Vepstas April 1998 + +#ifndef __PFX_COMP_OUT_H__ +#define __PFX_COMP_OUT_H__ + +#include "config.h" +#include + +// virtual base class for output +// This is the base class that is used by the parser to +// generate output. +class pfxLangOutput +{ + public: + enum occ { + MUST, OPT, PLUS, REP }; + pfxLangOutput (void); + virtual void PrintClassProlog (char *hilo) = 0; + virtual void PrintClassEpilog (char *hilo) = 0; + virtual void PrintUnionProlog (occ, char *hilo) = 0; + virtual void PrintUnionEpilog (occ, char *hilo) = 0; + + virtual void PrintMember (occ, char *hilo, char * lo) = 0; + + char * prefix; + + protected: + int dent; + +}; + +// This class prints the class and union declarations +class pfxOutDecl : + public pfxLangOutput +{ + public: + pfxOutDecl (void); + virtual void PrintClassProlog (char *hilo); + virtual void PrintClassEpilog (char *hilo); + virtual void PrintUnionProlog (occ, char *hilo); + virtual void PrintUnionEpilog (occ, char *hilo); + + virtual void PrintMember (occ, char *hilo, char * lo); + + private: + short doing_union; + short doing_class; + int nth_union; + + // When a union has been declared, these are used to store + // the members of the union. This is needed because + // declaring a union requires several repeats of the data, + // each in slightly different form. + vector declaration; + vector varname; + vector refix; + vector currance; + int nelts; + +}; + +// This class prints the constructors +class pfxOutConstructor : + public pfxLangOutput +{ + public: + pfxOutConstructor (void); + virtual void PrintClassProlog (char *hilo); + virtual void PrintClassEpilog (char *hilo); + virtual void PrintUnionProlog (occ, char *hilo); + virtual void PrintUnionEpilog (occ, char *hilo); + + virtual void PrintMember (occ, char *hilo, char * lo); + + private: + short doing_union; + short doing_class; + int nth_union; + short done_union; + + pfxOutConstructor *nest; + char scope[450]; + char classname[450]; + + // when a class within a class has been dclared, we + // can't just create a constructor within the constructor. + // Thus, we need to defer the PrintMember() calls until the + // call to epilog has shown up. + int nelts; + vector declaration; + vector varname; + vector refix; + vector override; + vector currance; + +}; + +#endif /* __PFX_COMP_OUT_H__ */ diff --git a/src/experimental/ofx/parser/pfxUtils.C b/src/experimental/ofx/parser/pfxUtils.C new file mode 100644 index 0000000000..f9d81f03f1 --- /dev/null +++ b/src/experimental/ofx/parser/pfxUtils.C @@ -0,0 +1,92 @@ +// +// FILE: +// utils.C +// +// FUNCTION: +// Handles OFX base types +// +// HISTORY: +// Written by Linas Vepstas March 1998 + +#include +#include +#include + +#include "StringOf.h" + +#include "config.h" +#include "pfxUtils.h" + +#ifdef SP_NAMESPACE +namespace SP_NAMESPACE { +#endif + +// =========================================================== +// convert the string type to an ordinary char * + +char * +pfxCharify (const String &s) +{ + int len = s.size (); + + char * str = new char [len+1]; + + for (int i=0; i + +#include "StringOf.h" + +#include "config.h" + +#ifdef SP_NAMESPACE +namespace SP_NAMESPACE { +#endif + +// =========================================================== +// convert the string type to an ordinary char * + +char * pfxCharify (const String &s); +char * pfxToLower (char * str); +char * pfxToUpper (char * str); +char * pfxCapLower (char * str); + +#define DENT(dent) { for (int bonk=0; bonk<(dent); bonk++) printf (" "); } + + +#ifdef SP_NAMESPACE +} +#endif + +#endif /* __PFX_UTILS_H__ */ diff --git a/src/experimental/ofx/parser/simple.C b/src/experimental/ofx/parser/simple.C new file mode 100644 index 0000000000..09bd396d61 --- /dev/null +++ b/src/experimental/ofx/parser/simple.C @@ -0,0 +1,60 @@ +// +// simple.C +// +// a direct rip-off of James Clark's sample program +// for the generic SP parser. +// +// The next two lines are only to ensure bool gets defined +// appropriately. + +#include + +#include "config.h" +#include "Boolean.h" + +#include "ParserEventGeneratorKit.h" + + +class OutlineApplication : public SGMLApplication { +public: + OutlineApplication() : depth_(0) { } + + void PrtStr (const CharString &s) { + for (size_t i=0; irun(app); + delete egp; + return nErrors > 0; +}