Changed date parser to use lex/yacc.

This commit is contained in:
John Wiegley 2007-04-19 14:47:33 +00:00
parent 53c132ad98
commit c5214c8759
21 changed files with 4732 additions and 124 deletions

View file

@ -37,7 +37,7 @@ TAB_SIZE = 8
ALIASES = ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO OPTIMIZE_OUTPUT_JAVA = NO
BUILTIN_STL_SUPPORT = NO BUILTIN_STL_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES SUBGROUPING = YES
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -175,12 +175,12 @@ TREEVIEW_WIDTH = 250
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options related to the LaTeX output # configuration options related to the LaTeX output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
GENERATE_LATEX = NO GENERATE_LATEX = YES
LATEX_OUTPUT = latex LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO COMPACT_LATEX = NO
PAPER_TYPE = a4wide PAPER_TYPE = usletter
EXTRA_PACKAGES = EXTRA_PACKAGES =
LATEX_HEADER = LATEX_HEADER =
PDF_HYPERLINKS = YES PDF_HYPERLINKS = YES
@ -245,13 +245,13 @@ PERL_PATH = /usr/bin/perl
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the dot tool # Configuration options related to the dot tool
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
CLASS_DIAGRAMS = NO CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES HAVE_DOT = YES
CLASS_GRAPH = YES CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES GROUP_GRAPHS = YES
UML_LOOK = NO UML_LOOK = YES
TEMPLATE_RELATIONS = NO TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES INCLUDED_BY_GRAPH = YES

View file

@ -17,10 +17,15 @@ if HAVE_BOOST_PYTHON
lib_LTLIBRARIES += libpyledger.la lib_LTLIBRARIES += libpyledger.la
endif endif
AM_YFLAGS = -d
AM_LFLAGS = -o $(LEX_OUTPUT_ROOT).c
libledger_la_CXXFLAGS = $(WARNFLAGS) -I$(top_builddir)/gdtoa libledger_la_CXXFLAGS = $(WARNFLAGS) -I$(top_builddir)/gdtoa
libledger_la_SOURCES = \ libledger_la_SOURCES = \
amount.cc \ amount.cc \
times.cc \ times.cc \
parsetime.yy \
scantime.ll \
quotes.cc \ quotes.cc \
balance.cc \ balance.cc \
value.cc \ value.cc \
@ -84,6 +89,7 @@ libpyledger_la_LDFLAGS = -release 3.0
pkginclude_HEADERS = \ pkginclude_HEADERS = \
amount.h \ amount.h \
times.h \ times.h \
parsetime.h \
balance.h \ balance.h \
binary.h \ binary.h \
csv.h \ csv.h \
@ -124,7 +130,8 @@ bin_PROGRAMS = ledger
ledger_CXXFLAGS = ledger_CXXFLAGS =
ledger_SOURCES = option.cc main.cc ledger_SOURCES = option.cc main.cc
ledger_LDADD = $(LIBOBJS) libledger.la gdtoa/libgdtoa.la ledger_LDADD = $(LIBOBJS) libledger.la gdtoa/libgdtoa.la $(LEXLIB)
if HAVE_EXPAT if HAVE_EXPAT
ledger_CXXFLAGS += -DHAVE_EXPAT=1 ledger_CXXFLAGS += -DHAVE_EXPAT=1
endif endif
@ -206,6 +213,7 @@ UnitTests_SOURCES = tests/UnitTests.cc \
\ \
tests/corelib/numerics/BasicAmount.cc \ tests/corelib/numerics/BasicAmount.cc \
tests/corelib/numerics/CommodityAmount.cc \ tests/corelib/numerics/CommodityAmount.cc \
tests/corelib/numerics/DateTime.cc \
tests/corelib/numerics/Commodity.cc tests/corelib/numerics/Commodity.cc
UnitTests_LDADD = $(lib_LTLIBRARIES) gdtoa/libgdtoa.la -lcppunit UnitTests_LDADD = $(lib_LTLIBRARIES) gdtoa/libgdtoa.la -lcppunit

View file

@ -69,7 +69,8 @@ DIST_COMMON = README $(am__configure_deps) $(pkginclude_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/acconf.h.in $(top_srcdir)/configure AUTHORS COPYING \ $(srcdir)/acconf.h.in $(top_srcdir)/configure AUTHORS COPYING \
ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \ ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \
elisp-comp install-sh ltmain.sh missing texinfo.tex elisp-comp install-sh ltmain.sh missing parsetime.cc \
parsetime.h scantime.cc texinfo.tex ylwrap
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@ -91,17 +92,19 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
libLTLIBRARIES_INSTALL = $(INSTALL) libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES) LTLIBRARIES = $(lib_LTLIBRARIES)
libledger_la_LIBADD = libledger_la_LIBADD =
am__libledger_la_SOURCES_DIST = amount.cc times.cc quotes.cc \ am__libledger_la_SOURCES_DIST = amount.cc times.cc parsetime.yy \
balance.cc value.cc xml.cc xpath.cc mask.cc format.cc util.cc \ scantime.ll quotes.cc balance.cc value.cc xml.cc xpath.cc \
session.cc journal.cc parser.cc textual.cc binary.cc \ mask.cc format.cc util.cc session.cc journal.cc parser.cc \
xmlparse.cc qif.cc report.cc transform.cc csv.cc derive.cc \ textual.cc binary.cc xmlparse.cc qif.cc report.cc transform.cc \
emacs.cc reconcile.cc gnucash.cc ofx.cc debug.cc trace.cc csv.cc derive.cc emacs.cc reconcile.cc gnucash.cc ofx.cc \
debug.cc trace.cc
@HAVE_EXPAT_TRUE@am__objects_1 = libledger_la-gnucash.lo @HAVE_EXPAT_TRUE@am__objects_1 = libledger_la-gnucash.lo
@HAVE_XMLPARSE_TRUE@am__objects_2 = libledger_la-gnucash.lo @HAVE_XMLPARSE_TRUE@am__objects_2 = libledger_la-gnucash.lo
@HAVE_LIBOFX_TRUE@am__objects_3 = libledger_la-ofx.lo @HAVE_LIBOFX_TRUE@am__objects_3 = libledger_la-ofx.lo
@DEBUG_TRUE@am__objects_4 = libledger_la-debug.lo \ @DEBUG_TRUE@am__objects_4 = libledger_la-debug.lo \
@DEBUG_TRUE@ libledger_la-trace.lo @DEBUG_TRUE@ libledger_la-trace.lo
am_libledger_la_OBJECTS = libledger_la-amount.lo libledger_la-times.lo \ am_libledger_la_OBJECTS = libledger_la-amount.lo libledger_la-times.lo \
libledger_la-parsetime.lo libledger_la-scantime.lo \
libledger_la-quotes.lo libledger_la-balance.lo \ libledger_la-quotes.lo libledger_la-balance.lo \
libledger_la-value.lo libledger_la-xml.lo \ libledger_la-value.lo libledger_la-xml.lo \
libledger_la-xpath.lo libledger_la-mask.lo \ libledger_la-xpath.lo libledger_la-mask.lo \
@ -137,7 +140,7 @@ PyUnitTests_LDADD = $(LDADD)
am_UnitTests_OBJECTS = UnitTests-UnitTests.$(OBJEXT) \ am_UnitTests_OBJECTS = UnitTests-UnitTests.$(OBJEXT) \
UnitTests-BasicAmount.$(OBJEXT) \ UnitTests-BasicAmount.$(OBJEXT) \
UnitTests-CommodityAmount.$(OBJEXT) \ UnitTests-CommodityAmount.$(OBJEXT) \
UnitTests-Commodity.$(OBJEXT) UnitTests-DateTime.$(OBJEXT) UnitTests-Commodity.$(OBJEXT)
UnitTests_OBJECTS = $(am_UnitTests_OBJECTS) UnitTests_OBJECTS = $(am_UnitTests_OBJECTS)
UnitTests_DEPENDENCIES = $(lib_LTLIBRARIES) gdtoa/libgdtoa.la UnitTests_DEPENDENCIES = $(lib_LTLIBRARIES) gdtoa/libgdtoa.la
UnitTests_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ UnitTests_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
@ -145,8 +148,9 @@ UnitTests_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(CXXFLAGS) $(UnitTests_LDFLAGS) $(LDFLAGS) -o $@ $(CXXFLAGS) $(UnitTests_LDFLAGS) $(LDFLAGS) -o $@
am_ledger_OBJECTS = ledger-option.$(OBJEXT) ledger-main.$(OBJEXT) am_ledger_OBJECTS = ledger-option.$(OBJEXT) ledger-main.$(OBJEXT)
ledger_OBJECTS = $(am_ledger_OBJECTS) ledger_OBJECTS = $(am_ledger_OBJECTS)
am__DEPENDENCIES_1 =
ledger_DEPENDENCIES = $(LIBOBJS) libledger.la gdtoa/libgdtoa.la \ ledger_DEPENDENCIES = $(LIBOBJS) libledger.la gdtoa/libgdtoa.la \
$(am__append_16) $(am__DEPENDENCIES_1) $(am__append_16)
ledger_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ ledger_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(ledger_CXXFLAGS) $(CXXFLAGS) \ --mode=link $(CXXLD) $(ledger_CXXFLAGS) $(CXXFLAGS) \
$(ledger_LDFLAGS) $(LDFLAGS) -o $@ $(ledger_LDFLAGS) $(LDFLAGS) -o $@
@ -166,6 +170,13 @@ CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@ $(LDFLAGS) -o $@
LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
LTLEXCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS)
YLWRAP = $(top_srcdir)/ylwrap
YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
LTYACCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(YACC) $(YFLAGS) $(AM_YFLAGS)
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
@ -261,6 +272,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@
LIBS = @LIBS@ LIBS = @LIBS@
LIBTOOL = @LIBTOOL@ LIBTOOL = @LIBTOOL@
@ -286,6 +300,8 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@ SHELL = @SHELL@
STRIP = @STRIP@ STRIP = @STRIP@
VERSION = @VERSION@ VERSION = @VERSION@
YACC = @YACC@
YFLAGS = @YFLAGS@
abs_builddir = @abs_builddir@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@ abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@ abs_top_builddir = @abs_top_builddir@
@ -349,15 +365,17 @@ ESC_builddir = `echo "$(top_builddir)" | sed 's/\//\\\\\//g'`
ESC_distdir = `echo "$(distdir)" | sed 's/\//\\\\\//g'` ESC_distdir = `echo "$(distdir)" | sed 's/\//\\\\\//g'`
EXTRA_DIST = docs tests ledger.pdf ledger.info EXTRA_DIST = docs tests ledger.pdf ledger.info
lib_LTLIBRARIES = libledger.la $(am__append_1) lib_LTLIBRARIES = libledger.la $(am__append_1)
AM_YFLAGS = -d
AM_LFLAGS = -o $(LEX_OUTPUT_ROOT).c
libledger_la_CXXFLAGS = $(WARNFLAGS) -I$(top_builddir)/gdtoa \ libledger_la_CXXFLAGS = $(WARNFLAGS) -I$(top_builddir)/gdtoa \
$(am__append_2) $(am__append_4) $(am__append_6) \ $(am__append_2) $(am__append_4) $(am__append_6) \
$(am__append_8) $(am__append_10) $(am__append_8) $(am__append_10)
libledger_la_SOURCES = amount.cc times.cc quotes.cc balance.cc \ libledger_la_SOURCES = amount.cc times.cc parsetime.yy scantime.ll \
value.cc xml.cc xpath.cc mask.cc format.cc util.cc session.cc \ quotes.cc balance.cc value.cc xml.cc xpath.cc mask.cc \
journal.cc parser.cc textual.cc binary.cc xmlparse.cc qif.cc \ format.cc util.cc session.cc journal.cc parser.cc textual.cc \
report.cc transform.cc csv.cc derive.cc emacs.cc reconcile.cc \ binary.cc xmlparse.cc qif.cc report.cc transform.cc csv.cc \
$(am__append_3) $(am__append_5) $(am__append_7) \ derive.cc emacs.cc reconcile.cc $(am__append_3) \
$(am__append_9) $(am__append_5) $(am__append_7) $(am__append_9)
libledger_la_LDFLAGS = -release 3.0 libledger_la_LDFLAGS = -release 3.0
libpyledger_la_CXXFLAGS = -DUSE_BOOST_PYTHON=1 $(am__append_11) libpyledger_la_CXXFLAGS = -DUSE_BOOST_PYTHON=1 $(am__append_11)
libpyledger_la_SOURCES = \ libpyledger_la_SOURCES = \
@ -368,6 +386,7 @@ libpyledger_la_LDFLAGS = -release 3.0
pkginclude_HEADERS = \ pkginclude_HEADERS = \
amount.h \ amount.h \
times.h \ times.h \
parsetime.h \
balance.h \ balance.h \
binary.h \ binary.h \
csv.h \ csv.h \
@ -405,7 +424,7 @@ pkginclude_HEADERS = \
ledger_CXXFLAGS = $(am__append_12) $(am__append_13) $(am__append_14) \ ledger_CXXFLAGS = $(am__append_12) $(am__append_13) $(am__append_14) \
$(am__append_15) $(am__append_17) $(am__append_15) $(am__append_17)
ledger_SOURCES = option.cc main.cc ledger_SOURCES = option.cc main.cc
ledger_LDADD = $(LIBOBJS) libledger.la gdtoa/libgdtoa.la \ ledger_LDADD = $(LIBOBJS) libledger.la gdtoa/libgdtoa.la $(LEXLIB) \
$(am__append_16) $(am__append_16)
ledger_LDFLAGS = -static # for the sake of command-line speed ledger_LDFLAGS = -static # for the sake of command-line speed
info_TEXINFOS = ledger.texi info_TEXINFOS = ledger.texi
@ -422,6 +441,7 @@ UnitTests_SOURCES = tests/UnitTests.cc \
\ \
tests/corelib/numerics/BasicAmount.cc \ tests/corelib/numerics/BasicAmount.cc \
tests/corelib/numerics/CommodityAmount.cc \ tests/corelib/numerics/CommodityAmount.cc \
tests/corelib/numerics/DateTime.cc \
tests/corelib/numerics/Commodity.cc tests/corelib/numerics/Commodity.cc
UnitTests_LDADD = $(lib_LTLIBRARIES) gdtoa/libgdtoa.la -lcppunit UnitTests_LDADD = $(lib_LTLIBRARIES) gdtoa/libgdtoa.la -lcppunit
@ -433,7 +453,7 @@ all: acconf.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive $(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .cc .dvi .html .info .lo .o .obj .pdf .ps .texi .SUFFIXES: .cc .dvi .html .info .ll .lo .o .obj .pdf .ps .texi .yy
am--refresh: am--refresh:
@: @:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@ -511,6 +531,11 @@ clean-libLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \ echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \ rm -f "$${dir}/so_locations"; \
done done
parsetime.h: parsetime.cc
@if test ! -f $@; then \
rm -f parsetime.cc; \
$(MAKE) $(AM_MAKEFLAGS) parsetime.cc; \
else :; fi
libledger.la: $(libledger_la_OBJECTS) $(libledger_la_DEPENDENCIES) libledger.la: $(libledger_la_OBJECTS) $(libledger_la_DEPENDENCIES)
$(libledger_la_LINK) -rpath $(libdir) $(libledger_la_OBJECTS) $(libledger_la_LIBADD) $(LIBS) $(libledger_la_LINK) -rpath $(libdir) $(libledger_la_OBJECTS) $(libledger_la_LIBADD) $(LIBS)
libpyledger.la: $(libpyledger_la_OBJECTS) $(libpyledger_la_DEPENDENCIES) libpyledger.la: $(libpyledger_la_OBJECTS) $(libpyledger_la_DEPENDENCIES)
@ -576,6 +601,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnitTests-BasicAmount.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnitTests-BasicAmount.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnitTests-Commodity.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnitTests-Commodity.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnitTests-CommodityAmount.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnitTests-CommodityAmount.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnitTests-DateTime.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnitTests-UnitTests.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UnitTests-UnitTests.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ledger-main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ledger-main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ledger-option.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ledger-option.Po@am__quote@
@ -592,10 +618,12 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-mask.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-mask.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-ofx.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-ofx.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-parser.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-parser.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-parsetime.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-qif.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-qif.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-quotes.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-quotes.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-reconcile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-reconcile.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-report.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-report.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-scantime.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-session.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-session.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-textual.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-textual.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-times.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-times.Plo@am__quote@
@ -645,6 +673,20 @@ libledger_la-times.lo: times.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libledger_la_CXXFLAGS) $(CXXFLAGS) -c -o libledger_la-times.lo `test -f 'times.cc' || echo '$(srcdir)/'`times.cc @am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libledger_la_CXXFLAGS) $(CXXFLAGS) -c -o libledger_la-times.lo `test -f 'times.cc' || echo '$(srcdir)/'`times.cc
libledger_la-parsetime.lo: parsetime.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libledger_la_CXXFLAGS) $(CXXFLAGS) -MT libledger_la-parsetime.lo -MD -MP -MF $(DEPDIR)/libledger_la-parsetime.Tpo -c -o libledger_la-parsetime.lo `test -f 'parsetime.cc' || echo '$(srcdir)/'`parsetime.cc
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/libledger_la-parsetime.Tpo $(DEPDIR)/libledger_la-parsetime.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parsetime.cc' object='libledger_la-parsetime.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libledger_la_CXXFLAGS) $(CXXFLAGS) -c -o libledger_la-parsetime.lo `test -f 'parsetime.cc' || echo '$(srcdir)/'`parsetime.cc
libledger_la-scantime.lo: scantime.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libledger_la_CXXFLAGS) $(CXXFLAGS) -MT libledger_la-scantime.lo -MD -MP -MF $(DEPDIR)/libledger_la-scantime.Tpo -c -o libledger_la-scantime.lo `test -f 'scantime.cc' || echo '$(srcdir)/'`scantime.cc
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/libledger_la-scantime.Tpo $(DEPDIR)/libledger_la-scantime.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scantime.cc' object='libledger_la-scantime.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libledger_la_CXXFLAGS) $(CXXFLAGS) -c -o libledger_la-scantime.lo `test -f 'scantime.cc' || echo '$(srcdir)/'`scantime.cc
libledger_la-quotes.lo: quotes.cc libledger_la-quotes.lo: quotes.cc
@am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libledger_la_CXXFLAGS) $(CXXFLAGS) -MT libledger_la-quotes.lo -MD -MP -MF $(DEPDIR)/libledger_la-quotes.Tpo -c -o libledger_la-quotes.lo `test -f 'quotes.cc' || echo '$(srcdir)/'`quotes.cc @am__fastdepCXX_TRUE@ $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libledger_la_CXXFLAGS) $(CXXFLAGS) -MT libledger_la-quotes.lo -MD -MP -MF $(DEPDIR)/libledger_la-quotes.Tpo -c -o libledger_la-quotes.lo `test -f 'quotes.cc' || echo '$(srcdir)/'`quotes.cc
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/libledger_la-quotes.Tpo $(DEPDIR)/libledger_la-quotes.Plo @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/libledger_la-quotes.Tpo $(DEPDIR)/libledger_la-quotes.Plo
@ -876,6 +918,20 @@ UnitTests-CommodityAmount.obj: tests/corelib/numerics/CommodityAmount.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(UnitTests_CXXFLAGS) $(CXXFLAGS) -c -o UnitTests-CommodityAmount.obj `if test -f 'tests/corelib/numerics/CommodityAmount.cc'; then $(CYGPATH_W) 'tests/corelib/numerics/CommodityAmount.cc'; else $(CYGPATH_W) '$(srcdir)/tests/corelib/numerics/CommodityAmount.cc'; fi` @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(UnitTests_CXXFLAGS) $(CXXFLAGS) -c -o UnitTests-CommodityAmount.obj `if test -f 'tests/corelib/numerics/CommodityAmount.cc'; then $(CYGPATH_W) 'tests/corelib/numerics/CommodityAmount.cc'; else $(CYGPATH_W) '$(srcdir)/tests/corelib/numerics/CommodityAmount.cc'; fi`
UnitTests-DateTime.o: tests/corelib/numerics/DateTime.cc
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(UnitTests_CXXFLAGS) $(CXXFLAGS) -MT UnitTests-DateTime.o -MD -MP -MF $(DEPDIR)/UnitTests-DateTime.Tpo -c -o UnitTests-DateTime.o `test -f 'tests/corelib/numerics/DateTime.cc' || echo '$(srcdir)/'`tests/corelib/numerics/DateTime.cc
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/UnitTests-DateTime.Tpo $(DEPDIR)/UnitTests-DateTime.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tests/corelib/numerics/DateTime.cc' object='UnitTests-DateTime.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(UnitTests_CXXFLAGS) $(CXXFLAGS) -c -o UnitTests-DateTime.o `test -f 'tests/corelib/numerics/DateTime.cc' || echo '$(srcdir)/'`tests/corelib/numerics/DateTime.cc
UnitTests-DateTime.obj: tests/corelib/numerics/DateTime.cc
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(UnitTests_CXXFLAGS) $(CXXFLAGS) -MT UnitTests-DateTime.obj -MD -MP -MF $(DEPDIR)/UnitTests-DateTime.Tpo -c -o UnitTests-DateTime.obj `if test -f 'tests/corelib/numerics/DateTime.cc'; then $(CYGPATH_W) 'tests/corelib/numerics/DateTime.cc'; else $(CYGPATH_W) '$(srcdir)/tests/corelib/numerics/DateTime.cc'; fi`
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/UnitTests-DateTime.Tpo $(DEPDIR)/UnitTests-DateTime.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tests/corelib/numerics/DateTime.cc' object='UnitTests-DateTime.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(UnitTests_CXXFLAGS) $(CXXFLAGS) -c -o UnitTests-DateTime.obj `if test -f 'tests/corelib/numerics/DateTime.cc'; then $(CYGPATH_W) 'tests/corelib/numerics/DateTime.cc'; else $(CYGPATH_W) '$(srcdir)/tests/corelib/numerics/DateTime.cc'; fi`
UnitTests-Commodity.o: tests/corelib/numerics/Commodity.cc UnitTests-Commodity.o: tests/corelib/numerics/Commodity.cc
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(UnitTests_CXXFLAGS) $(CXXFLAGS) -MT UnitTests-Commodity.o -MD -MP -MF $(DEPDIR)/UnitTests-Commodity.Tpo -c -o UnitTests-Commodity.o `test -f 'tests/corelib/numerics/Commodity.cc' || echo '$(srcdir)/'`tests/corelib/numerics/Commodity.cc @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(UnitTests_CXXFLAGS) $(CXXFLAGS) -MT UnitTests-Commodity.o -MD -MP -MF $(DEPDIR)/UnitTests-Commodity.Tpo -c -o UnitTests-Commodity.o `test -f 'tests/corelib/numerics/Commodity.cc' || echo '$(srcdir)/'`tests/corelib/numerics/Commodity.cc
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/UnitTests-Commodity.Tpo $(DEPDIR)/UnitTests-Commodity.Po @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/UnitTests-Commodity.Tpo $(DEPDIR)/UnitTests-Commodity.Po
@ -918,6 +974,12 @@ ledger-main.obj: main.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ledger_CXXFLAGS) $(CXXFLAGS) -c -o ledger-main.obj `if test -f 'main.cc'; then $(CYGPATH_W) 'main.cc'; else $(CYGPATH_W) '$(srcdir)/main.cc'; fi` @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ledger_CXXFLAGS) $(CXXFLAGS) -c -o ledger-main.obj `if test -f 'main.cc'; then $(CYGPATH_W) 'main.cc'; else $(CYGPATH_W) '$(srcdir)/main.cc'; fi`
.ll.cc:
$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE)
.yy.cc:
$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE)
mostlyclean-libtool: mostlyclean-libtool:
-rm -f *.lo -rm -f *.lo
@ -1523,6 +1585,9 @@ distclean-generic:
maintainer-clean-generic: maintainer-clean-generic:
@echo "This command is intended for maintainers to use" @echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild." @echo "it deletes files that may require special tools to rebuild."
-rm -f parsetime.cc
-rm -f parsetime.h
-rm -f scantime.cc
@HAVE_BOOST_PYTHON_FALSE@install-exec-hook: @HAVE_BOOST_PYTHON_FALSE@install-exec-hook:
clean: clean-recursive clean: clean-recursive

View file

@ -81,5 +81,9 @@
/* Version number of package */ /* Version number of package */
#undef VERSION #undef VERSION
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */
#undef YYTEXT_POINTER
/* Define to `unsigned int' if <sys/types.h> does not define. */ /* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t #undef size_t

View file

@ -1172,7 +1172,7 @@ bool parse_annotations(std::istream& in, amount_t& price,
else else
throw new amount_error("Commodity date lacks closing bracket"); throw new amount_error("Commodity date lacks closing bracket");
date = ptime_from_local_date_string(buf); date = parse_datetime(buf);
has_date = true; has_date = true;
} }
else if (c == '(') { else if (c == '(') {

321
configure vendored
View file

@ -872,6 +872,11 @@ F77
FFLAGS FFLAGS
ac_ct_F77 ac_ct_F77
LIBTOOL LIBTOOL
YACC
YFLAGS
LEX
LEX_OUTPUT_ROOT
LEXLIB
EMACS EMACS
EMACSLOADPATH EMACSLOADPATH
lispdir lispdir
@ -918,6 +923,8 @@ CPP
CXXCPP CXXCPP
F77 F77
FFLAGS FFLAGS
YACC
YFLAGS
EMACS EMACS
EMACSLOADPATH' EMACSLOADPATH'
ac_subdirs_all='gdtoa' ac_subdirs_all='gdtoa'
@ -1534,6 +1541,11 @@ Some influential environment variables:
CXXCPP C++ preprocessor CXXCPP C++ preprocessor
F77 Fortran 77 compiler command F77 Fortran 77 compiler command
FFLAGS Fortran 77 compiler flags FFLAGS Fortran 77 compiler flags
YACC The `Yet Another C Compiler' implementation to use. Defaults to
the first program found out of: `bison -y', `byacc', `yacc'.
YFLAGS The list of arguments that will be passed by default to $YACC.
This script will default YFLAGS to the empty string to avoid a
default value of `-d' given by some make applications.
EMACS the Emacs editor command EMACS the Emacs editor command
EMACSLOADPATH EMACSLOADPATH
the Emacs library search path the Emacs library search path
@ -4848,7 +4860,7 @@ ia64-*-hpux*)
;; ;;
*-*-irix6*) *-*-irix6*)
# Find out which ABI we are using. # Find out which ABI we are using.
echo '#line 4851 "configure"' > conftest.$ac_ext echo '#line 4863 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5 (eval $ac_compile) 2>&5
ac_status=$? ac_status=$?
@ -7107,11 +7119,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7110: $lt_compile\"" >&5) (eval echo "\"\$as_me:7122: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:7114: \$? = $ac_status" >&5 echo "$as_me:7126: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output. # So say no if there are warnings other than the usual output.
@ -7375,11 +7387,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7378: $lt_compile\"" >&5) (eval echo "\"\$as_me:7390: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:7382: \$? = $ac_status" >&5 echo "$as_me:7394: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output. # So say no if there are warnings other than the usual output.
@ -7479,11 +7491,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7482: $lt_compile\"" >&5) (eval echo "\"\$as_me:7494: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err) (eval "$lt_compile" 2>out/conftest.err)
ac_status=$? ac_status=$?
cat out/conftest.err >&5 cat out/conftest.err >&5
echo "$as_me:7486: \$? = $ac_status" >&5 echo "$as_me:7498: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext if (exit $ac_status) && test -s out/conftest2.$ac_objext
then then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
@ -9787,7 +9799,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 9790 "configure" #line 9802 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@ -9887,7 +9899,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 9890 "configure" #line 9902 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@ -12223,11 +12235,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:12226: $lt_compile\"" >&5) (eval echo "\"\$as_me:12238: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:12230: \$? = $ac_status" >&5 echo "$as_me:12242: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output. # So say no if there are warnings other than the usual output.
@ -12327,11 +12339,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:12330: $lt_compile\"" >&5) (eval echo "\"\$as_me:12342: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err) (eval "$lt_compile" 2>out/conftest.err)
ac_status=$? ac_status=$?
cat out/conftest.err >&5 cat out/conftest.err >&5
echo "$as_me:12334: \$? = $ac_status" >&5 echo "$as_me:12346: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext if (exit $ac_status) && test -s out/conftest2.$ac_objext
then then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
@ -13897,11 +13909,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:13900: $lt_compile\"" >&5) (eval echo "\"\$as_me:13912: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:13904: \$? = $ac_status" >&5 echo "$as_me:13916: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output. # So say no if there are warnings other than the usual output.
@ -14001,11 +14013,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:14004: $lt_compile\"" >&5) (eval echo "\"\$as_me:14016: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err) (eval "$lt_compile" 2>out/conftest.err)
ac_status=$? ac_status=$?
cat out/conftest.err >&5 cat out/conftest.err >&5
echo "$as_me:14008: \$? = $ac_status" >&5 echo "$as_me:14020: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext if (exit $ac_status) && test -s out/conftest2.$ac_objext
then then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
@ -16199,11 +16211,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:16202: $lt_compile\"" >&5) (eval echo "\"\$as_me:16214: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:16206: \$? = $ac_status" >&5 echo "$as_me:16218: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output. # So say no if there are warnings other than the usual output.
@ -16467,11 +16479,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:16470: $lt_compile\"" >&5) (eval echo "\"\$as_me:16482: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err) (eval "$lt_compile" 2>conftest.err)
ac_status=$? ac_status=$?
cat conftest.err >&5 cat conftest.err >&5
echo "$as_me:16474: \$? = $ac_status" >&5 echo "$as_me:16486: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output. # So say no if there are warnings other than the usual output.
@ -16571,11 +16583,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'` -e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:16574: $lt_compile\"" >&5) (eval echo "\"\$as_me:16586: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err) (eval "$lt_compile" 2>out/conftest.err)
ac_status=$? ac_status=$?
cat out/conftest.err >&5 cat out/conftest.err >&5
echo "$as_me:16578: \$? = $ac_status" >&5 echo "$as_me:16590: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext if (exit $ac_status) && test -s out/conftest2.$ac_objext
then then
# The compiler can only warn and ignore the option if not recognized # The compiler can only warn and ignore the option if not recognized
@ -19234,6 +19246,262 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
for ac_prog in 'bison -y' byacc
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_YACC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$YACC"; then
ac_cv_prog_YACC="$YACC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_YACC="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
YACC=$ac_cv_prog_YACC
if test -n "$YACC"; then
{ echo "$as_me:$LINENO: result: $YACC" >&5
echo "${ECHO_T}$YACC" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
test -n "$YACC" && break
done
test -n "$YACC" || YACC="yacc"
for ac_prog in flex lex
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_LEX+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$LEX"; then
ac_cv_prog_LEX="$LEX" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_LEX="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
LEX=$ac_cv_prog_LEX
if test -n "$LEX"; then
{ echo "$as_me:$LINENO: result: $LEX" >&5
echo "${ECHO_T}$LEX" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
test -n "$LEX" && break
done
test -n "$LEX" || LEX=":"
if test "x$LEX" != "x:"; then
cat >conftest.l <<_ACEOF
%%
a { ECHO; }
b { REJECT; }
c { yymore (); }
d { yyless (1); }
e { yyless (input () != 0); }
f { unput (yytext[0]); }
. { BEGIN INITIAL; }
%%
#ifdef YYTEXT_POINTER
extern char *yytext;
#endif
int
main (void)
{
return ! yylex () + ! yywrap ();
}
_ACEOF
{ (ac_try="$LEX conftest.l"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$LEX conftest.l") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
{ echo "$as_me:$LINENO: checking lex output file root" >&5
echo $ECHO_N "checking lex output file root... $ECHO_C" >&6; }
if test "${ac_cv_prog_lex_root+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -f lex.yy.c; then
ac_cv_prog_lex_root=lex.yy
elif test -f lexyy.c; then
ac_cv_prog_lex_root=lexyy
else
{ { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5
echo "$as_me: error: cannot find output from $LEX; giving up" >&2;}
{ (exit 1); exit 1; }; }
fi
fi
{ echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5
echo "${ECHO_T}$ac_cv_prog_lex_root" >&6; }
LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
if test -z "${LEXLIB+set}"; then
{ echo "$as_me:$LINENO: checking lex library" >&5
echo $ECHO_N "checking lex library... $ECHO_C" >&6; }
if test "${ac_cv_lib_lex+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_save_LIBS=$LIBS
ac_cv_lib_lex='none needed'
for ac_lib in '' -lfl -ll; do
LIBS="$ac_lib $ac_save_LIBS"
cat >conftest.$ac_ext <<_ACEOF
`cat $LEX_OUTPUT_ROOT.c`
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
ac_cv_lib_lex=$ac_lib
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
test "$ac_cv_lib_lex" != 'none needed' && break
done
LIBS=$ac_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_lex" >&5
echo "${ECHO_T}$ac_cv_lib_lex" >&6; }
test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
fi
{ echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5
echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6; }
if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
# POSIX says lex can declare yytext either as a pointer or an array; the
# default is implementation-dependent. Figure out which it is, since
# not all implementations provide the %pointer and %array declarations.
ac_cv_prog_lex_yytext_pointer=no
ac_save_LIBS=$LIBS
LIBS="$LEXLIB $ac_save_LIBS"
cat >conftest.$ac_ext <<_ACEOF
#define YYTEXT_POINTER 1
`cat $LEX_OUTPUT_ROOT.c`
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
ac_cv_prog_lex_yytext_pointer=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5
echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6; }
if test $ac_cv_prog_lex_yytext_pointer = yes; then
cat >>confdefs.h <<\_ACEOF
#define YYTEXT_POINTER 1
_ACEOF
fi
rm -f conftest.l $LEX_OUTPUT_ROOT.c
fi
if test "$LEX" != flex; then
LEX="$SHELL $missing_dir/missing flex"
LEX_OUTPUT_ROOT=lex.yy
LEXLIB=''
fi
# Checks for emacs lisp path # Checks for emacs lisp path
# If set to t, that means we are running in a shell under Emacs. # If set to t, that means we are running in a shell under Emacs.
@ -22221,6 +22489,11 @@ F77!$F77$ac_delim
FFLAGS!$FFLAGS$ac_delim FFLAGS!$FFLAGS$ac_delim
ac_ct_F77!$ac_ct_F77$ac_delim ac_ct_F77!$ac_ct_F77$ac_delim
LIBTOOL!$LIBTOOL$ac_delim LIBTOOL!$LIBTOOL$ac_delim
YACC!$YACC$ac_delim
YFLAGS!$YFLAGS$ac_delim
LEX!$LEX$ac_delim
LEX_OUTPUT_ROOT!$LEX_OUTPUT_ROOT$ac_delim
LEXLIB!$LEXLIB$ac_delim
EMACS!$EMACS$ac_delim EMACS!$EMACS$ac_delim
EMACSLOADPATH!$EMACSLOADPATH$ac_delim EMACSLOADPATH!$EMACSLOADPATH$ac_delim
lispdir!$lispdir$ac_delim lispdir!$lispdir$ac_delim
@ -22253,7 +22526,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF _ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 35; then if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 40; then
break break
elif $ac_last_try; then elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

View file

@ -17,6 +17,15 @@ AC_PROG_MAKE_SET
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
AM_PROG_LIBTOOL AM_PROG_LIBTOOL
AC_PROG_YACC
AC_PROG_LEX
if test "$LEX" != flex; then
LEX="$SHELL $missing_dir/missing flex"
AC_SUBST(LEX_OUTPUT_ROOT, lex.yy)
AC_SUBST(LEXLIB, '')
fi
# Checks for emacs lisp path # Checks for emacs lisp path
AM_PATH_LISPDIR AM_PATH_LISPDIR

36
docs/date-examples.txt Normal file
View file

@ -0,0 +1,36 @@
2002-02-02
2002/02/02
2002.02.02
02-02-2002
02/02/2002
02.02.2002
02-02-02
02/02/02
02.02.02
02-02
02/02
02.02
20020202
20020202T023318
20020202T023318-0700
20020202T023318-0100
02-Feb-2002
2002-Feb-02
02 Feb 2002
02-Feb-2002
02 February 2002
02-February-2002
2002 Feb 02
2002-Feb-02
2002 February 02
2002-February-02
02 Feb
02-Feb
02 February
02-February
Feb 02
Feb-02
February 02
February-02
Feb 02, 2002
February 02, 2002

View file

@ -219,7 +219,7 @@ void dataHandler(void *userData, const char *s, int len)
break; break;
case gnucash_parser_t::ENTRY_DATE: case gnucash_parser_t::ENTRY_DATE:
parser->curr_entry->_date = ptime_from_local_date_string(std::string(s, len)); parser->curr_entry->_date = parse_datetime(std::string(s, len));
break; break;
case gnucash_parser_t::ENTRY_DESC: case gnucash_parser_t::ENTRY_DESC:

1914
parsetime.cc Normal file

File diff suppressed because it is too large Load diff

67
parsetime.h Normal file
View file

@ -0,0 +1,67 @@
/* A Bison parser, made by GNU Bison 2.3. */
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
TOK_FOURNUM = 258,
TOK_TWONUM = 259,
TOK_ONENUM = 260,
TOK_MONTH = 261,
TOK_SPACE = 262
};
#endif
/* Tokens. */
#define TOK_FOURNUM 258
#define TOK_TWONUM 259
#define TOK_ONENUM 260
#define TOK_MONTH 261
#define TOK_SPACE 262
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
extern YYSTYPE yylval;

272
parsetime.yy Normal file
View file

@ -0,0 +1,272 @@
%{
#define YYSTYPE struct ledger::intorchar
#include "times.h"
#include "FlexLexer.h"
static struct std::tm * timeval;
namespace {
boost::posix_time::ptime moment;
yyFlexLexer * lexer;
inline void yyerror(const char *str) {
throw new ledger::datetime_error(str);
}
inline int yylex(void) {
return lexer->yylex();
}
int month_to_int(char * name)
{
switch (std::toupper(name[0])) {
case 'J':
if (name[1] == std::tolower('a'))
return 1;
else if (name[2] == std::tolower('n'))
return 6;
else
return 7;
case 'F':
return 2;
case 'M':
if (name[2] == std::tolower('r'))
return 3;
else
return 5;
case 'A':
if (name[1] == std::tolower('p'))
return 4;
else
return 8;
case 'S':
return 9;
case 'O':
return 10;
case 'N':
return 11;
case 'D':
return 12;
default:
std::cerr << "What?? (" << name << ")" << std::endl;
assert(0);
return -1;
}
}
void set_mdy(const ledger::intorchar& month,
const ledger::intorchar& day,
const ledger::intorchar& year = ledger::intorchar(),
bool shortyear = false)
{
if (ledger::day_before_month) {
timeval->tm_mon = (day.ival == -1 ?
month_to_int(day.sval) : day.ival) - 1;
timeval->tm_mday = month.ival;
} else {
timeval->tm_mon = (month.ival == -1 ?
month_to_int(month.sval) : month.ival) - 1;
timeval->tm_mday = day.ival;
}
if (year.ival != -1)
timeval->tm_year = (shortyear ?
(year.ival < 70 ? year.ival + 100 : year.ival) :
year.ival - 1900);
}
}
%}
%token TOK_FOURNUM
%token TOK_TWONUM
%token TOK_ONENUM
%token TOK_MONTH
%token TOK_SPACE
%left '/' '-' '.' 'T'
%%
input: date optspace ;
optspace: /* epsilon */ | TOK_SPACE ;
date: absdate {
if (timeval->tm_gmtoff != -1) {
boost::posix_time::ptime::time_duration_type offset;
offset = boost::posix_time::seconds(timeval->tm_gmtoff);
moment = boost::posix_time::from_time_t(timegm(timeval)) - offset;
} else {
moment = boost::posix_time::ptime_from_tm(*timeval);
}
};
absdate:
year '/' morday '/' morday {
set_mdy($3, $5, $1);
}
|
year '-' morday '-' morday {
set_mdy($3, $5, $1);
}
|
year '.' morday '.' morday {
set_mdy($3, $5, $1);
}
|
morday '/' morday '/' year {
set_mdy($1, $3, $5);
}
|
morday '-' morday '-' year {
set_mdy($1, $3, $5);
}
|
morday '.' morday '.' year {
set_mdy($1, $3, $5);
}
|
morday '.' morday {
set_mdy($1, $3);
}
|
morday '/' morday {
set_mdy($1, $3);
}
|
morday '-' morday {
set_mdy($1, $3);
}
|
morday '/' morday '/' TOK_TWONUM {
set_mdy($1, $3, $5, true);
}
|
morday '-' morday '-' TOK_TWONUM {
set_mdy($1, $3, $5, true);
}
|
morday '.' morday '.' TOK_TWONUM {
set_mdy($1, $3, $5, true);
}
|
isodate
|
year TOK_SPACE TOK_MONTH TOK_SPACE morday {
set_mdy($3, $5, $1);
}
|
morday TOK_SPACE TOK_MONTH TOK_SPACE year {
set_mdy($3, $1, $5);
}
|
TOK_MONTH TOK_SPACE morday {
set_mdy($1, $3);
}
|
morday TOK_SPACE TOK_MONTH {
set_mdy($3, $1);
}
|
year '-' TOK_MONTH '-' morday {
set_mdy($3, $5, $1);
}
|
morday '-' TOK_MONTH '-' year {
set_mdy($3, $1, $5);
}
|
TOK_MONTH '-' morday {
set_mdy($1, $3);
}
|
morday '-' TOK_MONTH {
set_mdy($3, $1);
}
|
TOK_MONTH TOK_SPACE morday ',' TOK_SPACE year {
set_mdy($1, $3, $6);
}
;
isodate:
year TOK_FOURNUM opttime
{
timeval->tm_year = $1.ival - 1900;
timeval->tm_mon = $2.ival / 100 - 1;
timeval->tm_mday = $3.ival % 100;
};
opttime: /* epsilon */ |
'T' TOK_FOURNUM TOK_TWONUM optzone
{
timeval->tm_hour = $2.ival / 100;
timeval->tm_min = $2.ival % 100;
timeval->tm_sec = $3.ival;
};
optzone: /* epsilon */ |
'-' TOK_FOURNUM {
timeval->tm_gmtoff = - (($2.ival / 100) * 3600 + ($2.ival % 100) * 60);
}
| '+' TOK_FOURNUM {
timeval->tm_gmtoff = (($2.ival / 100) * 3600 + ($2.ival % 100) * 60);
};
year: TOK_FOURNUM { $$ = $1; };
morday:
TOK_TWONUM { $$ = $1; }
| TOK_ONENUM { $$ = $1; };
%%
int yywrap()
{
return 1;
}
boost::posix_time::ptime parse_abs_datetime(std::istream& input)
{
lexer = new yyFlexLexer(&input);
struct std::tm temp;
std::memset(&temp, 0, sizeof(struct std::tm));
temp.tm_year = 2002 - 1900;
temp.tm_gmtoff = -1;
timeval = &temp;
//yydebug = 1;
// jww (2007-04-19): Catch any boost errors thrown from here and
// push them onto the new error stack scheme.
try {
if (yyparse() == 0)
return moment;
}
catch (ledger::datetime_error *) {
throw;
}
catch (...) {
throw new ledger::datetime_error("Failed to parse date/time");
}
throw new ledger::datetime_error("Failed to parse date/time");
}
#ifdef MAIN
namespace ledger {
bool day_before_month = false;
}
int main()
{
std::cout << parse_abs_datetime(std::cin) << std::endl;
return 0;
}
#endif // MAIN

2
qif.cc
View file

@ -102,7 +102,7 @@ unsigned int qif_parser_t::parse(std::istream& in,
case 'D': case 'D':
SET_BEG_POS_AND_LINE(); SET_BEG_POS_AND_LINE();
get_line(in); get_line(in);
entry->_date = ptime_from_local_date_string(line); entry->_date = parse_datetime(line);
break; break;
case 'T': case 'T':

1577
scantime.cc Normal file

File diff suppressed because it is too large Load diff

29
scantime.ll Normal file
View file

@ -0,0 +1,29 @@
%option c++ 8bit
%{
#define YYSTYPE struct ledger::intorchar
extern int yywrap();
#include "times.h"
#include "parsetime.h"
extern YYSTYPE yylval;
%}
shortmon (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
longmon (January|February|March|April|May|June|July|August|September|October|November|December)
%%
[ \t] return TOK_SPACE;
[\r\n] ;
[0-9]{4} yylval = ledger::intorchar(std::atoi(yytext)); return TOK_FOURNUM;
[0-9]{2} yylval = ledger::intorchar(std::atoi(yytext)); return TOK_TWONUM;
[0-9]{1} yylval = ledger::intorchar(std::atoi(yytext)); return TOK_ONENUM;
{shortmon} yylval = ledger::intorchar(yytext); return TOK_MONTH;
{longmon} yylval = ledger::intorchar(yytext); return TOK_MONTH;
. return (int) yytext[0];

View file

@ -13,89 +13,71 @@ void DateTimeTestCase::tearDown() {}
void DateTimeTestCase::testConstructors() void DateTimeTestCase::testConstructors()
{ {
struct tm moment; std::time_t time_t_now = std::time(NULL);
std::memset(&moment, INT_MAX, sizeof(struct tm)); struct tm * moment = std::localtime(&time_t_now);
#ifdef HAVE_STRPTIME std::time_t localMoment = std::mktime(moment);
strptime("2006/12/25 00:00:00", "%Y/%m/%d %H:%M:%S", &moment);
ptime d0;
ptime d1(parse_datetime("1990/01/01"));
ptime d3(boost::posix_time::from_time_t(localMoment));
ptime d4(parse_datetime("2006/12/25"));
ptime d5(parse_datetime("12/25"));
ptime d6(parse_datetime("2006.12.25"));
ptime d7(parse_datetime("12.25"));
ptime d8(parse_datetime("2006-12-25"));
ptime d9(parse_datetime("12-25"));
#if 0
ptime d10(parse_datetime("tue"));
ptime d11(parse_datetime("tuesday"));
ptime d12(parse_datetime("feb"));
ptime d13(parse_datetime("february"));
ptime d14(parse_datetime("2006"));
#endif #endif
ptime d15(d3);
#ifdef HAVE_TIMEGM assertTrue(d0.is_not_a_date_time());
std::time_t gmtMoment = timegm(&moment); assertFalse(d1.is_not_a_date_time());
#endif assertFalse(d4.is_not_a_date_time());
std::time_t localMoment = std::mktime(&moment);
date_t d1; assertTrue(now > d1);
#ifdef HAVE_TIMEGM assertTrue(now <= d3);
date_t d2(gmtMoment); assertTrue(now > d4);
#endif
date_t d3(localMoment);
date_t d4("2006/12/25");
date_t d5("12/25");
date_t d6("2006.12.25");
date_t d7("12.25");
date_t d8("2006-12-25");
date_t d9("12-25");
date_t d10("tue");
date_t d11("tuesday");
date_t d12("feb");
date_t d13("february");
date_t d14("2006");
date_t d15(d3);
#ifdef HAVE_TIMEGM
if (std::memcmp(&gmtMoment, &localMoment, sizeof(std::time_t)) == 0)
assertEqual(d2, d3);
else
assertNotEqual(d2, d3);
#endif
assertFalse(d1);
assertTrue(d4);
assertTrue(date_t::now > d1);
assertTrue(date_t::now > d3);
assertTrue(date_t::now > d4);
assertEqual(d3, d4);
assertEqual(d3, d15); assertEqual(d3, d15);
assertEqual(d4, d6); assertEqual(d4, d6);
assertEqual(d4, d8); assertEqual(d4, d8);
assertEqual(d5, d7); assertEqual(d5, d7);
assertEqual(d5, d9); assertEqual(d5, d9);
#if 0
assertEqual(d10, d11); assertEqual(d10, d11);
assertEqual(d12, d13); assertEqual(d12, d13);
#endif
assertThrow(date_t("2007/02/29"), date_error *); assertThrow(parse_datetime("2007/02/29"), datetime_error *);
assertThrow(date_t("2007/13/01"), date_error *); assertThrow(parse_datetime("2007/13/01"), datetime_error *);
assertThrow(date_t("2007/00/01"), date_error *); assertThrow(parse_datetime("2007/00/01"), datetime_error *);
assertThrow(date_t("2007/01/00"), date_error *); assertThrow(parse_datetime("2007/01/00"), datetime_error *);
assertThrow(date_t("2007/00/00"), date_error *); assertThrow(parse_datetime("2007/00/00"), datetime_error *);
assertThrow(date_t("2007/05/32"), date_error *); assertThrow(parse_datetime("2007/05/32"), datetime_error *);
assertThrow(date_t("2006x/12/25"), date_error *); assertThrow(parse_datetime("2006x/12/25"), datetime_error *);
assertThrow(date_t("2006/12x/25"), date_error *); assertThrow(parse_datetime("2006/12x/25"), datetime_error *);
assertThrow(date_t("2006/12/25x"), date_error *); assertThrow(parse_datetime("2006/12/25x"), datetime_error *);
assertThrow(date_t("feb/12/25"), date_error *); assertThrow(parse_datetime("feb/12/25"), datetime_error *);
assertThrow(date_t("2006/mon/25"), date_error *); assertThrow(parse_datetime("2006/mon/25"), datetime_error *);
assertThrow(date_t("2006/12/web"), date_error *); assertThrow(parse_datetime("2006/12/web"), datetime_error *);
assertThrow(date_t("12*25"), date_error *); assertThrow(parse_datetime("12*25"), datetime_error *);
assertThrow(date_t("tuf"), date_error *); assertThrow(parse_datetime("tuf"), datetime_error *);
assertThrow(date_t("tufsday"), date_error *); assertThrow(parse_datetime("tufsday"), datetime_error *);
assertThrow(date_t("fec"), date_error *); assertThrow(parse_datetime("fec"), datetime_error *);
assertThrow(date_t("fecruary"), date_error *); assertThrow(parse_datetime("fecruary"), datetime_error *);
assertThrow(date_t("207x"), date_error *); assertThrow(parse_datetime("207x"), datetime_error *);
assertThrow(date_t("hello"), date_error *); assertThrow(parse_datetime("hello"), datetime_error *);
datetime_t dt1;
datetime_t dt2;
datetime_t dt3;
datetime_t dt4;
datetime_t dt5;
interval_t i1; interval_t i1;
interval_t i2; interval_t i2;
} }

View file

@ -276,10 +276,10 @@ transaction_t * parse_transaction(char * line,
if (char * p = std::strchr(buf, '=')) { if (char * p = std::strchr(buf, '=')) {
*p++ = '\0'; *p++ = '\0';
xact->_date_eff = ptime_from_local_date_string(p); xact->_date_eff = parse_datetime(p);
} }
if (buf[0]) if (buf[0])
xact->_date = ptime_from_local_date_string(buf); xact->_date = parse_datetime(buf);
} }
} }
} }
@ -623,7 +623,7 @@ unsigned int textual_parser_t::parse(std::istream& in,
time_entry_t event; time_entry_t event;
event.desc = n ? n : ""; event.desc = n ? n : "";
event.checkin = ptime_from_local_time_string(date); event.checkin = parse_datetime(date);
event.account = account_stack.front()->find_account(p); event.account = account_stack.front()->find_account(p);
if (! time_entries.empty()) if (! time_entries.empty())
@ -649,7 +649,7 @@ unsigned int textual_parser_t::parse(std::istream& in,
char * n = next_element(p, true); char * n = next_element(p, true);
clock_out_from_timelog clock_out_from_timelog
(ptime_from_local_time_string(date), (parse_datetime(date),
p ? account_stack.front()->find_account(p) : NULL, n, journal); p ? account_stack.front()->find_account(p) : NULL, n, journal);
count++; count++;
} }
@ -686,11 +686,10 @@ unsigned int textual_parser_t::parse(std::istream& in,
if (std::isdigit(time_field_ptr[0])) { if (std::isdigit(time_field_ptr[0])) {
symbol_and_price = next_element(time_field_ptr); symbol_and_price = next_element(time_field_ptr);
if (! symbol_and_price) break; if (! symbol_and_price) break;
datetime = ptime_from_local_time_string(date_field + " " + datetime = parse_datetime(date_field + " " + time_field_ptr);
time_field_ptr);
} else { } else {
symbol_and_price = time_field_ptr; symbol_and_price = time_field_ptr;
datetime = ptime_from_local_date_string(date_field); datetime = parse_datetime(date_field);
} }
std::string symbol; std::string symbol;

View file

@ -2,6 +2,92 @@
namespace ledger { namespace ledger {
ptime now = boost::posix_time::second_clock::universal_time(); ptime now = boost::posix_time::second_clock::universal_time();
bool day_before_month = false;
ptime parse_datetime(std::istream& in)
{
#if 1
return parse_abs_datetime(in);
#else
std::string word;
if (! in.good() || in.eof())
return ptime();
in >> word;
// Grammar
//
// datetime: absdate [time]
// | reldate
// | datetime preposition
//
// reldate: NOW | TODAY | YESTERDAY | TOMORROW
// | skip_or_quantity specifier
//
// skip_or_quantity: skip | quantity
//
// skip: LAST | NEXT
//
// quantity: INTEGER | CARDINAL
//
// specifier: DAY | WEEK | MONTH | QUARTER | YEAR | DECADE
//
// preposition: AGO | BACK
// | BEFORE reldate
// | SINCE/FROM reldate
// | UNTIL reldate
// | AFTER reldate
if (std::isdigit(word[0])) {
// This could be any of a variety of formats:
//
// 20070702 [TIME]
// 22072007T171940
// 22072007T171940-0700
// 2007-07-02 [TIME]
// 2007/07/02 [TIME]
// 2007.07.02 [TIME]
// 2007-Jul-22 [TIME]
// 07-22-2007 [TIME]
// 07-22-07 [TIME]
// 07/22/2007 [TIME]
// 07/22/2007 [TIME]
// 07.22.2007 [TIME]
// 07.22.07 [TIME]
// 22-07-2007 [TIME]
// 22-07-07 [TIME]
// 22/07/2007 [TIME]
// 22/07/07 [TIME]
// 22.07.2007 [TIME]
// 22.07.07 [TIME]
// 22 Jul 2007 [TIME]
// 22 July 2007 [TIME]
//
// (NUMBER) (SPECIFIER)
} else {
// If there is no starting digit, then it could be any of these:
//
// now
// today
// yesterday
// tomorrow
// (last|next) (week|month|quarter|year|decade)
// (one|two|three|four|five|six|seven|eight|nine|ten) SPECIFIER
// PREPOSITION DATE
//
// PREPOSITION = (from|after|before|since|until)
// SPECIFIER = (weeks?|months?|quarters?|years?|decades?) (ago|back)
//
//
}
#endif
}
ptime datetime_range_from_stream(std::istream& in)
{
}
} }

64
times.h
View file

@ -8,6 +8,9 @@
#include <ctime> #include <ctime>
#include <string> #include <string>
#include <iostream>
#include "error.h"
namespace ledger { namespace ledger {
@ -15,6 +18,12 @@ typedef boost::posix_time::ptime ptime;
typedef boost::posix_time::seconds seconds; typedef boost::posix_time::seconds seconds;
typedef ptime::time_duration_type time_duration; typedef ptime::time_duration_type time_duration;
class datetime_error : public error {
public:
datetime_error(const std::string& _reason) throw() : error(_reason) {}
virtual ~datetime_error() throw() {}
};
class interval_t class interval_t
{ {
public: public:
@ -31,6 +40,7 @@ public:
void parse(std::istream& in) {} void parse(std::istream& in) {}
}; };
#if 0
inline ptime ptime_local_to_utc(const ptime& when) { inline ptime ptime_local_to_utc(const ptime& when) {
struct std::tm tm_gmt = to_tm(when); struct std::tm tm_gmt = to_tm(when);
return boost::posix_time::from_time_t(std::mktime(&tm_gmt)); return boost::posix_time::from_time_t(std::mktime(&tm_gmt));
@ -46,9 +56,63 @@ inline ptime ptime_from_local_date_string(const std::string& date_string) {
inline ptime ptime_from_local_time_string(const std::string& time_string) { inline ptime ptime_from_local_time_string(const std::string& time_string) {
return ptime_local_to_utc(boost::posix_time::time_from_string(time_string)); return ptime_local_to_utc(boost::posix_time::time_from_string(time_string));
} }
#endif
ptime parse_datetime(std::istream& in);
inline ptime parse_datetime(const std::string& str) {
std::istringstream instr(str);
return parse_datetime(instr);
}
extern ptime now; extern ptime now;
extern bool day_before_month;
struct intorchar
{
int ival;
char * sval;
intorchar() : ival(-1), sval(NULL) {}
intorchar(int val) : ival(val), sval(NULL) {}
intorchar(char * val) : ival(-1), sval(NULL) {
set_sval(val);
}
intorchar(const intorchar& o) : ival(o.ival), sval(NULL) {
set_sval(o.sval);
}
~intorchar() {
clear_sval();
}
intorchar& operator=(const intorchar& o) {
if (&o == this)
return *this;
ival = o.ival;
set_sval(o.sval);
}
private:
void clear_sval() {
if (sval) {
delete[] sval;
sval = NULL;
}
}
void set_sval(char * val) {
clear_sval();
if (val) {
sval = new char[std::strlen(val) + 1];
std::strcpy(sval, val);
}
}
};
} }
boost::posix_time::ptime parse_abs_datetime(std::istream& input);
#endif /* _TIMES_H */ #endif /* _TIMES_H */

View file

@ -79,10 +79,10 @@ static void endElement(void *userData, const char *name)
curr_entry = NULL; curr_entry = NULL;
} }
else if (std::strcmp(name, "en:date") == 0) { else if (std::strcmp(name, "en:date") == 0) {
curr_entry->_date = ptime_from_local_date_string(data); curr_entry->_date = parse_datetime(data);
} }
else if (std::strcmp(name, "en:date_eff") == 0) { else if (std::strcmp(name, "en:date_eff") == 0) {
curr_entry->_date_eff = ptime_from_local_date_string(data); curr_entry->_date_eff = parse_datetime(data);
} }
else if (std::strcmp(name, "en:code") == 0) { else if (std::strcmp(name, "en:code") == 0) {
curr_entry->code = data; curr_entry->code = data;

223
ylwrap Executable file
View file

@ -0,0 +1,223 @@
#! /bin/sh
# ylwrap - wrapper for lex/yacc invocations.
scriptversion=2005-05-14.22
# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
case "$1" in
'')
echo "$0: No files given. Try \`$0 --help' for more information." 1>&2
exit 1
;;
--basedir)
basedir=$2
shift 2
;;
-h|--h*)
cat <<\EOF
Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
Wrapper for lex/yacc invocations, renaming files as desired.
INPUT is the input file
OUTPUT is one file PROG generates
DESIRED is the file we actually want instead of OUTPUT
PROGRAM is program to run
ARGS are passed to PROG
Any number of OUTPUT,DESIRED pairs may be used.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v|--v*)
echo "ylwrap $scriptversion"
exit $?
;;
esac
# The input.
input="$1"
shift
case "$input" in
[\\/]* | ?:[\\/]*)
# Absolute path; do nothing.
;;
*)
# Relative path. Make it absolute.
input="`pwd`/$input"
;;
esac
pairlist=
while test "$#" -ne 0; do
if test "$1" = "--"; then
shift
break
fi
pairlist="$pairlist $1"
shift
done
# The program to run.
prog="$1"
shift
# Make any relative path in $prog absolute.
case "$prog" in
[\\/]* | ?:[\\/]*) ;;
*[\\/]*) prog="`pwd`/$prog" ;;
esac
# FIXME: add hostname here for parallel makes that run commands on
# other machines. But that might take us over the 14-char limit.
dirname=ylwrap$$
trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
mkdir $dirname || exit 1
cd $dirname
case $# in
0) $prog "$input" ;;
*) $prog "$@" "$input" ;;
esac
ret=$?
if test $ret -eq 0; then
set X $pairlist
shift
first=yes
# Since DOS filename conventions don't allow two dots,
# the DOS version of Bison writes out y_tab.c instead of y.tab.c
# and y_tab.h instead of y.tab.h. Test to see if this is the case.
y_tab_nodot="no"
if test -f y_tab.c || test -f y_tab.h; then
y_tab_nodot="yes"
fi
# The directory holding the input.
input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
# Quote $INPUT_DIR so we can use it in a regexp.
# FIXME: really we should care about more than `.' and `\'.
input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'`
while test "$#" -ne 0; do
from="$1"
# Handle y_tab.c and y_tab.h output by DOS
if test $y_tab_nodot = "yes"; then
if test $from = "y.tab.c"; then
from="y_tab.c"
else
if test $from = "y.tab.h"; then
from="y_tab.h"
fi
fi
fi
if test -f "$from"; then
# If $2 is an absolute path name, then just use that,
# otherwise prepend `../'.
case "$2" in
[\\/]* | ?:[\\/]*) target="$2";;
*) target="../$2";;
esac
# We do not want to overwrite a header file if it hasn't
# changed. This avoid useless recompilations. However the
# parser itself (the first file) should always be updated,
# because it is the destination of the .y.c rule in the
# Makefile. Divert the output of all other files to a temporary
# file so we can compare them to existing versions.
if test $first = no; then
realtarget="$target"
target="tmp-`echo $target | sed s/.*[\\/]//g`"
fi
# Edit out `#line' or `#' directives.
#
# We don't want the resulting debug information to point at
# an absolute srcdir; it is better for it to just mention the
# .y file with no path.
#
# We want to use the real output file name, not yy.lex.c for
# instance.
#
# We want the include guards to be adjusted too.
FROM=`echo "$from" | sed \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
TARGET=`echo "$2" | sed \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \
-e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?
# Check whether header files must be updated.
if test $first = no; then
if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
echo "$2" is unchanged
rm -f "$target"
else
echo updating "$2"
mv -f "$target" "$realtarget"
fi
fi
else
# A missing file is only an error for the first file. This
# is a blatant hack to let us support using "yacc -d". If -d
# is not specified, we don't want an error when the header
# file is "missing".
if test $first = yes; then
ret=1
fi
fi
shift
shift
first=no
done
else
ret=$?
fi
# Remove the directory.
cd ..
rm -rf $dirname
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End: