summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt13
-rw-r--r--src/account.h26
-rw-r--r--src/amount.cc79
-rw-r--r--src/amount.h10
-rw-r--r--src/annotate.h48
-rw-r--r--src/archive.cc295
-rw-r--r--src/archive.h92
-rw-r--r--src/balance.h12
-rw-r--r--src/commodity.h61
-rw-r--r--src/expr.h13
-rw-r--r--src/exprbase.h15
-rw-r--r--src/filters.cc2
-rw-r--r--src/flags.h22
-rw-r--r--src/global.cc21
-rw-r--r--src/global.h6
-rw-r--r--src/item.h42
-rw-r--r--src/iterators.cc2
-rw-r--r--src/journal.h35
-rw-r--r--src/lookup.cc2
-rw-r--r--src/mask.h19
-rw-r--r--src/op.h27
-rw-r--r--src/output.cc6
-rw-r--r--src/output.h10
-rw-r--r--src/parser.h2
-rw-r--r--src/pool.h20
-rw-r--r--src/post.h24
-rw-r--r--src/predicate.h13
-rw-r--r--src/py_item.cc14
-rw-r--r--src/report.cc5
-rw-r--r--src/report.h6
-rw-r--r--src/scope.h99
-rw-r--r--src/session.cc99
-rw-r--r--src/session.h2
-rw-r--r--src/system.hh.in80
-rw-r--r--src/times.h92
-rw-r--r--src/value.h28
-rw-r--r--src/xact.h72
37 files changed, 99 insertions, 1315 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7b10061f..8ed6e51a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,3 +1,7 @@
+set(LEDGER_CLI_SOURCES
+ global.cc
+ main.cc)
+
set(LEDGER_SOURCES
stats.cc
generate.cc
@@ -24,7 +28,6 @@ set(LEDGER_SOURCES
textual.cc
temps.cc
journal.cc
- archive.cc
account.cc
xact.cc
post.cc
@@ -76,7 +79,6 @@ set(LEDGER_INCLUDES
account.h
amount.h
annotate.h
- archive.h
balance.h
chain.h
commodity.h
@@ -255,7 +257,7 @@ else()
endmacro(ADD_PCH_RULE _header_filename _src_list _other_srcs)
endif()
-add_pch_rule(${PROJECT_BINARY_DIR}/system.hh LEDGER_SOURCES main.cc global.cc)
+add_pch_rule(${PROJECT_BINARY_DIR}/system.hh LEDGER_SOURCES LEDGER_CLI_SOURCES)
include(GNUInstallDirs)
@@ -271,6 +273,9 @@ if (BUILD_LIBRARY)
add_executable(ledger main.cc global.cc)
target_link_libraries(ledger libledger)
+ if (CMAKE_SYSTEM_NAME STREQUAL Darwin AND HAVE_BOOST_PYTHON)
+ target_link_libraries(ledger ${PYTHON_LIBRARIES})
+ endif()
install(TARGETS libledger DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES ${LEDGER_INCLUDES}
@@ -292,7 +297,7 @@ print(s.get_python_lib(True, prefix=''))"
if (PYTHON_SITE_PACKAGES)
if (WIN32 AND NOT CYGWIN)
set(_ledger_python_module_name "ledger.pyd")
- elseif(CMAKE_HOST_APPLE)
+ elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(_ledger_python_module_name "ledger.so")
else()
set(_ledger_python_module_name "ledger${CMAKE_SHARED_LIBRARY_SUFFIX}")
diff --git a/src/account.h b/src/account.h
index 76e839eb..7de4e560 100644
--- a/src/account.h
+++ b/src/account.h
@@ -261,11 +261,7 @@ public:
mutable optional<xdata_t> xdata_;
bool has_xdata() const {
-#if BOOST_VERSION >= 105600
- return xdata_ != NULL;
-#else
- return xdata_;
-#endif
+ return static_cast<bool>(xdata_);
}
void clear_xdata();
xdata_t& xdata() {
@@ -289,26 +285,6 @@ public:
}
bool children_with_xdata() const;
std::size_t children_with_flags(xdata_t::flags_t flags) const;
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<supports_flags<> >(*this);
- ar & boost::serialization::base_object<scope_t>(*this);
- ar & parent;
- ar & name;
- ar & note;
- ar & depth;
- ar & accounts;
- ar & posts;
- ar & _fullname;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
std::ostream& operator<<(std::ostream& out, const account_t& account);
diff --git a/src/amount.cc b/src/amount.cc
index 6ddcdb4f..b0898bfb 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -93,20 +93,6 @@ struct amount_t::bigint_t : public supports_flags<>
}
return true;
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */)
- {
- ar & boost::serialization::base_object<supports_flags<> >(*this);
- ar & val;
- ar & prec;
- ar & refc;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
bool amount_t::is_initialized = false;
@@ -1331,69 +1317,4 @@ void put_amount(property_tree::ptree& st, const amount_t& amt,
st.put("quantity", amt.quantity_string());
}
-#if HAVE_BOOST_SERIALIZATION
-
-template<class Archive>
-void amount_t::serialize(Archive& ar, const unsigned int /* version */)
-{
- ar & is_initialized;
- ar & quantity;
- ar & commodity_;
-}
-
-#endif // HAVE_BOOST_SERIALIZATION
-
} // namespace ledger
-
-#if HAVE_BOOST_SERIALIZATION
-namespace boost {
-namespace serialization {
-
-template <class Archive>
-void serialize(Archive& ar, MP_INT& mpz, const unsigned int /* version */)
-{
- ar & mpz._mp_alloc;
- ar & mpz._mp_size;
- ar & mpz._mp_d;
-}
-
-template <class Archive>
-void serialize(Archive& ar, MP_RAT& mpq, const unsigned int /* version */)
-{
- ar & mpq._mp_num;
- ar & mpq._mp_den;
-}
-
-template <class Archive>
-void serialize(Archive& ar, long unsigned int& integer,
- const unsigned int /* version */)
-{
- ar & make_binary_object(&integer, sizeof(long unsigned int));
-}
-
-} // namespace serialization
-} // namespace boost
-
-BOOST_CLASS_EXPORT(ledger::annotated_commodity_t)
-
-template void boost::serialization::serialize(boost::archive::binary_iarchive&,
- MP_INT&, const unsigned int);
-template void boost::serialization::serialize(boost::archive::binary_oarchive&,
- MP_INT&, const unsigned int);
-template void boost::serialization::serialize(boost::archive::binary_iarchive&,
- MP_RAT&, const unsigned int);
-template void boost::serialization::serialize(boost::archive::binary_oarchive&,
- MP_RAT&, const unsigned int);
-template void boost::serialization::serialize(boost::archive::binary_iarchive&,
- long unsigned int&,
- const unsigned int);
-template void boost::serialization::serialize(boost::archive::binary_oarchive&,
- long unsigned int&,
- const unsigned int);
-
-template void ledger::amount_t::serialize(boost::archive::binary_iarchive&,
- const unsigned int);
-template void ledger::amount_t::serialize(boost::archive::binary_oarchive&,
- const unsigned int);
-
-#endif // HAVE_BOOST_SERIALIZATION
diff --git a/src/amount.h b/src/amount.h
index ea5cadd6..4c959177 100644
--- a/src/amount.h
+++ b/src/amount.h
@@ -743,16 +743,6 @@ public:
bool valid() const;
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */);
-#endif // HAVE_BOOST_SERIALIZATION
-
/*@}*/
};
diff --git a/src/annotate.h b/src/annotate.h
index c0fbcd3d..c2b2ec9d 100644
--- a/src/annotate.h
+++ b/src/annotate.h
@@ -107,21 +107,6 @@ struct annotation_t : public supports_flags<>,
assert(*this);
return true;
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<supports_flags<> >(*this);
- ar & price;
- ar & date;
- ar & tag;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
void put_annotation(property_tree::ptree& pt, const annotation_t& details);
@@ -162,21 +147,6 @@ struct keep_details_t
return keep_price || keep_date || keep_tag;
}
bool keep_any(const commodity_t& comm) const;
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & keep_price;
- ar & keep_date;
- ar & keep_tag;
- ar & only_actuals;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
inline std::ostream& operator<<(std::ostream& out,
@@ -250,24 +220,6 @@ public:
virtual void write_annotations(std::ostream& out,
bool no_computed_annotations = false) const;
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- explicit annotated_commodity_t() : ptr(NULL) {
- TRACE_CTOR(annotated_commodity_t, "");
- }
-
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<commodity_t>(*this);
- ar & ptr;
- ar & details;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
inline annotated_commodity_t&
diff --git a/src/archive.cc b/src/archive.cc
deleted file mode 100644
index 9ae04e85..00000000
--- a/src/archive.cc
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Copyright (c) 2003-2015, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <system.hh>
-
-#if HAVE_BOOST_SERIALIZATION
-
-#include "archive.h"
-#include "amount.h"
-#include "commodity.h"
-#include "pool.h"
-#include "scope.h"
-#include "account.h"
-#include "post.h"
-#include "xact.h"
-
-#define LEDGER_MAGIC 0x4c454447
-#define ARCHIVE_VERSION 0x03000006
-
-//BOOST_IS_ABSTRACT(ledger::scope_t)
-BOOST_CLASS_EXPORT(ledger::scope_t)
-BOOST_CLASS_EXPORT(ledger::child_scope_t)
-BOOST_CLASS_EXPORT(ledger::symbol_scope_t)
-BOOST_CLASS_EXPORT(ledger::call_scope_t)
-BOOST_CLASS_EXPORT(ledger::account_t)
-BOOST_CLASS_EXPORT(ledger::item_t)
-BOOST_CLASS_EXPORT(ledger::post_t)
-BOOST_CLASS_EXPORT(ledger::xact_base_t)
-BOOST_CLASS_EXPORT(ledger::xact_t)
-BOOST_CLASS_EXPORT(ledger::auto_xact_t)
-BOOST_CLASS_EXPORT(ledger::period_xact_t)
-
-template void ledger::journal_t::serialize(boost::archive::binary_oarchive&,
- const unsigned int);
-template void ledger::journal_t::serialize(boost::archive::binary_iarchive&,
- const unsigned int);
-namespace ledger {
-
-namespace {
- bool read_header_bits(std::istream& in) {
- uint32_t bytes;
-
- assert(sizeof(uint32_t) == 4);
- in.read(reinterpret_cast<char *>(&bytes), sizeof(uint32_t));
- if (bytes != LEDGER_MAGIC) {
- DEBUG("archive.journal", "Magic bytes not present");
- return false;
- }
-
- in.read(reinterpret_cast<char *>(&bytes), sizeof(uint32_t));
- if (bytes != ARCHIVE_VERSION) {
- DEBUG("archive.journal", "Archive version mismatch");
- return false;
- }
-
- return true;
- }
-
- void write_header_bits(std::ostream& out) {
- uint32_t bytes;
-
- assert(sizeof(uint32_t) == 4);
- bytes = LEDGER_MAGIC;
- out.write(reinterpret_cast<char *>(&bytes), sizeof(uint32_t));
-
- bytes = ARCHIVE_VERSION;
- out.write(reinterpret_cast<char *>(&bytes), sizeof(uint32_t));
- }
-}
-
-bool archive_t::read_header()
-{
- uintmax_t size = file_size(file);
- if (size < 8)
- return false;
-
- // Open the stream, read the version number and the list of sources
- ifstream stream(file, std::ios::binary);
- if (! read_header_bits(stream))
- return false;
-
- boost::archive::binary_iarchive iarchive(stream);
-
- DEBUG("archive.journal", "Reading header from archive");
- iarchive >> *this;
-
- DEBUG("archive.journal",
- "Version number: " << std::hex << ARCHIVE_VERSION << std::dec);
- DEBUG("archive.journal", "Number of sources: " << sources.size());
-
-#if DEBUG_ON
- foreach (const journal_t::fileinfo_t& i, sources)
- DEBUG("archive.journal", "Loaded source: " << *i.filename);
-#endif
-
- return true;
-}
-
-bool archive_t::should_load(const std::list<path>& data_files)
-{
- std::size_t found = 0;
-
- DEBUG("archive.journal", "Should the archive be loaded?");
-
- if (! exists(file)) {
- DEBUG("archive.journal", "No, it does not exist");
- return false;
- }
-
- if (! read_header()) {
- DEBUG("archive.journal", "No, header failed to read");
- return false;
- }
-
- if (data_files.empty()) {
- DEBUG("archive.journal", "No, there were no data files!");
- return false;
- }
-
- if (sources.empty()) {
- DEBUG("archive.journal", "No, there were no sources!");
- return false;
- }
-
- if (data_files.size() != sources.size()) {
- DEBUG("archive.journal", "No, number of sources doesn't match: "
- << data_files.size() << " != " << sources.size());
- return false;
- }
-
- foreach (const path& p, data_files) {
- DEBUG("archive.journal", "Scanning for data file: " << p);
-
- if (! exists(p)) {
- DEBUG("archive.journal", "No, an input source no longer exists: " << p);
- return false;
- }
-
- foreach (const journal_t::fileinfo_t& i, sources) {
- assert(! i.from_stream);
- assert(i.filename);
-
- DEBUG("archive.journal", "Comparing against source file: " << *i.filename);
-
- if (*i.filename == p) {
- if (! exists(*i.filename)) {
- DEBUG("archive.journal",
- "No, a referent source no longer exists: " << *i.filename);
- return false;
- }
-
- if (i.modtime != posix_time::from_time_t(last_write_time(p))) {
- DEBUG("archive.journal", "No, a source's modtime has changed: " << p);
- return false;
- }
-
- if (i.size != file_size(p)) {
- DEBUG("archive.journal", "No, a source's size has changed: " << p);
- return false;
- }
-
- found++;
- }
- }
- }
-
- if (found != data_files.size()) {
- DEBUG("archive.journal", "No, not every source's name matched");
- return false;
- }
-
- DEBUG("archive.journal", "Yes, it should be loaded!");
- return true;
-}
-
-bool archive_t::should_save(journal_t& journal)
-{
- std::list<path> data_files;
-
- DEBUG("archive.journal", "Should the archive be saved?");
-
- if (journal.was_loaded) {
- DEBUG("archive.journal", "No, it's one we loaded before");
- return false;
- }
-
- if (journal.sources.empty()) {
- DEBUG("archive.journal", "No, there were no sources!");
- return false;
- }
-
- foreach (const journal_t::fileinfo_t& i, journal.sources) {
- if (i.from_stream) {
- DEBUG("archive.journal", "No, one source was from a stream");
- return false;
- }
-
- if (! exists(*i.filename)) {
- DEBUG("archive.journal",
- "No, a source no longer exists: " << *i.filename);
- return false;
- }
-
- data_files.push_back(*i.filename);
- }
-
- if (should_load(data_files)) {
- DEBUG("archive.journal", "No, because it's still loadable");
- return false;
- }
-
- DEBUG("archive.journal", "Yes, it should be saved!");
- return true;
-}
-
-void archive_t::save(journal_t& journal)
-{
- INFO_START(archive, "Saved journal file cache");
-
- ofstream stream(file, std::ios::binary);
-
- write_header_bits(stream);
- sources = journal.sources;
-
-#if DEBUG_ON
- foreach (const journal_t::fileinfo_t& i, sources)
- DEBUG("archive.journal", "Saving source: " << *i.filename);
-#endif
-
- boost::archive::binary_oarchive oa(stream);
-
- DEBUG("archive.journal", "Creating archive with version "
- << std::hex << ARCHIVE_VERSION << std::dec);
- oa << *this;
-
- DEBUG("archive.journal",
- "Archiving journal with " << sources.size() << " sources");
- oa << journal;
-
- INFO_FINISH(archive);
-}
-
-bool archive_t::load(journal_t& journal)
-{
- INFO_START(archive, "Read cached journal file");
-
- ifstream stream(file, std::ios::binary);
- if (! read_header_bits(stream))
- return false;
-
- boost::archive::binary_iarchive iarchive(stream);
-
- // Skip past the archive header, it was already read in before
- archive_t temp;
- iarchive >> temp;
-
- iarchive >> journal;
- journal.was_loaded = true;
-
- INFO_FINISH(archive);
-
- return true;
-}
-
-} // namespace ledger
-
-#endif // HAVE_BOOST_SERIALIZATION
diff --git a/src/archive.h b/src/archive.h
deleted file mode 100644
index 485f9606..00000000
--- a/src/archive.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2003-2015, John Wiegley. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * - Neither the name of New Artisans LLC nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @defgroup report Reporting
- */
-
-/**
- * @file archive.h
- * @author John Wiegley
- *
- * @ingroup report
- */
-#ifndef _ARCHIVE_H
-#define _ARCHIVE_H
-
-#include "journal.h"
-
-namespace ledger {
-
-class archive_t
-{
- path file;
-
- std::list<journal_t::fileinfo_t> sources;
-
-public:
- archive_t() {
- TRACE_CTOR(archive_t, "");
- }
- archive_t(const path& _file) : file(_file) {
- TRACE_CTOR(archive_t, "const path&");
- }
- archive_t(const archive_t& ar) : file(ar.file) {
- TRACE_CTOR(archive_t, "copy");
- }
- ~archive_t() {
- TRACE_DTOR(archive_t);
- }
-
- bool read_header();
-
- bool should_load(const std::list<path>& data_files);
- bool should_save(journal_t& journal);
-
- void save(journal_t& journal);
- bool load(journal_t& journal);
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & sources;
- }
-#endif // HAVE_BOOST_SERIALIZATION
-};
-
-} // namespace ledger
-
-#endif // _ARCHIVE_H
diff --git a/src/balance.h b/src/balance.h
index 752bb4d6..c9ef9658 100644
--- a/src/balance.h
+++ b/src/balance.h
@@ -594,18 +594,6 @@ public:
}
return true;
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & amounts;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
inline std::ostream& operator<<(std::ostream& out, const balance_t& bal) {
diff --git a/src/commodity.h b/src/commodity.h
index 3d1ddf04..53ed3a9f 100644
--- a/src/commodity.h
+++ b/src/commodity.h
@@ -68,19 +68,6 @@ struct price_point_t
bool operator==(const price_point_t& other) const {
return when == other.when && price == other.price;
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & when;
- ar & price;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
class commodity_t
@@ -138,28 +125,6 @@ protected:
virtual ~base_t() {
TRACE_DTOR(commodity_t::base_t);
}
-
-#if HAVE_BOOST_SERIALIZATION
- private:
- base_t() {
- TRACE_CTOR(base_t, "");
- }
-
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<supports_flags<uint_least16_t> >(*this);
- ar & symbol;
- ar & precision;
- ar & name;
- ar & note;
- ar & smaller;
- ar & larger;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
shared_ptr<base_t> base;
@@ -315,32 +280,6 @@ public:
struct compare_by_commodity {
bool operator()(const amount_t * left, const amount_t * right) const;
};
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- supports_flags<uint_least16_t> temp_flags;
-
-protected:
- explicit commodity_t()
- : delegates_flags<uint_least16_t>(temp_flags), parent_(NULL),
- annotated(false) {
- TRACE_CTOR(commodity_t, "");
- }
-
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<delegates_flags<uint_least16_t> >(*this);
- ar & base;
- ar & parent_;
- ar & qualified_symbol;
- ar & annotated;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
inline std::ostream& operator<<(std::ostream& out, const commodity_t& comm) {
diff --git a/src/expr.h b/src/expr.h
index 384cc661..041a5297 100644
--- a/src/expr.h
+++ b/src/expr.h
@@ -106,19 +106,6 @@ public:
virtual string context_to_str() const;
virtual void print(std::ostream& out) const;
virtual void dump(std::ostream& out) const;
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<base_type>(*this);
- ar & ptr;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
/**
diff --git a/src/exprbase.h b/src/exprbase.h
index b88fcd7d..dcaa69ca 100644
--- a/src/exprbase.h
+++ b/src/exprbase.h
@@ -231,21 +231,6 @@ public:
out << std::endl << _("--- Result value ---") << std::endl;
return calc();
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & context;
- ar & str;
- if (Archive::is_loading::value)
- compiled = false;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
template <typename ResultType>
diff --git a/src/filters.cc b/src/filters.cc
index fd30c966..d9fb64b0 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -726,7 +726,7 @@ namespace {
insert_prices_in_map(price_map_t& _all_prices)
: all_prices(_all_prices) {}
- void operator()(datetime_t& date, const amount_t& price) {
+ void operator()(const datetime_t& date, const amount_t& price) {
all_prices.insert(price_map_t::value_type(date, price));
}
};
diff --git a/src/flags.h b/src/flags.h
index f3593517..82ebaac1 100644
--- a/src/flags.h
+++ b/src/flags.h
@@ -90,17 +90,6 @@ public:
void drop_flags(const flags_t arg) {
_flags = static_cast<T>(static_cast<U>(_flags) & static_cast<U>(~arg));
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */)
- {
- ar & _flags;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
template <typename T = boost::uint_least8_t, typename U = T>
@@ -193,17 +182,6 @@ public:
void drop_flags(const flags_t arg) {
_flags.drop_flags(arg);
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */)
- {
- ar & _flags;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
#endif // _FLAGS_H
diff --git a/src/global.cc b/src/global.cc
index 602e216c..e4ebe6f5 100644
--- a/src/global.cc
+++ b/src/global.cc
@@ -110,7 +110,7 @@ global_scope_t::~global_scope_t()
void global_scope_t::parse_init(path init_file)
{
TRACE_START(init, 1, "Read initialization file");
-
+
parse_context_stack_t parsing_context;
parsing_context.push(init_file);
parsing_context.get_current().journal = session().journal.get();
@@ -122,15 +122,15 @@ void global_scope_t::parse_init(path init_file)
throw_(parse_error, _f("Transactions found in initialization file '%1%'")
% init_file);
}
-
+
TRACE_FINISH(init, 1);
}
void global_scope_t::read_init()
{
- // if specified on the command line init_file_ is filled in
+ // if specified on the command line init_file_ is filled in
// global_scope_t::handle_debug_options. If it was specified on the command line
- // fail is the file doesn't exist. If no init file was specified
+ // fail if the file doesn't exist. If no init file was specified
// on the command-line then try the default values, but don't fail if there
// isn't one.
path init_file;
@@ -144,6 +144,9 @@ void global_scope_t::read_init()
} else {
if (const char * home_var = std::getenv("HOME")) {
init_file = (path(home_var) / ".ledgerrc");
+ if (! exists(init_file)) {
+ init_file = ("./.ledgerrc");
+ }
} else {
init_file = ("./.ledgerrc");
}
@@ -316,17 +319,11 @@ option_t<global_scope_t> * global_scope_t::lookup_option(const char * p)
case 'd':
OPT(debug_);
break;
- case 'f':
- OPT(full_help);
- break;
case 'h':
OPT_(help);
- else OPT(help_calc);
- else OPT(help_comm);
- else OPT(help_disp);
break;
case 'i':
- OPT(init_file_);
+ OPT_(init_file_);
break;
case 'o':
OPT(options);
@@ -505,7 +502,7 @@ void handle_debug_options(int argc, char * argv[])
}
else if (i + 1 < argc && std::strcmp(argv[i], "--debug") == 0) {
#if DEBUG_ON
- _log_level = LOG_DEBUG;
+ _log_level = LOG_DEBUG;
_log_category = argv[i + 1];
i++;
#endif
diff --git a/src/global.h b/src/global.h
index f36dbe3d..5d849777 100644
--- a/src/global.h
+++ b/src/global.h
@@ -123,6 +123,8 @@ public:
out <<
"Ledger " << Ledger_VERSION_MAJOR << '.' << Ledger_VERSION_MINOR << '.'
<< Ledger_VERSION_PATCH;
+ if (Ledger_VERSION_PRERELEASE != 0)
+ out << Ledger_VERSION_PRERELEASE;
if (Ledger_VERSION_DATE != 0)
out << '-' << Ledger_VERSION_DATE;
out << _(", the command-line accounting tool");
@@ -145,11 +147,7 @@ See LICENSE file included with the distribution for details and disclaimer.");
void visit_man_page() const;
- OPTION_(global_scope_t, full_help, DO() { parent->visit_man_page(); }); // -H
OPTION_(global_scope_t, help, DO() { parent->visit_man_page(); }); // -h
- OPTION_(global_scope_t, help_calc, DO() { parent->visit_man_page(); });
- OPTION_(global_scope_t, help_comm, DO() { parent->visit_man_page(); });
- OPTION_(global_scope_t, help_disp, DO() { parent->visit_man_page(); });
OPTION__
(global_scope_t, init_file_, // -i
diff --git a/src/item.h b/src/item.h
index 458cb378..dbba53a8 100644
--- a/src/item.h
+++ b/src/item.h
@@ -78,23 +78,6 @@ struct position_t
}
return *this;
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & pathname;
- ar & beg_pos;
- ar & beg_line;
- ar & end_pos;
- ar & end_line;
- ar & sequence;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
class item_t : public supports_flags<uint_least16_t>, public scope_t
@@ -191,11 +174,7 @@ public:
static bool use_aux_date;
virtual bool has_date() const {
-#if BOOST_VERSION >= 105600
- return _date != NULL;
-#else
- return _date;
-#endif
+ return static_cast<bool>(_date);
}
virtual date_t date() const {
@@ -226,25 +205,6 @@ public:
const string& name);
bool valid() const;
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<supports_flags<uint_least16_t> >(*this);
- ar & boost::serialization::base_object<scope_t>(*this);
- ar & _state;
- ar & _date;
- ar & _date_aux;
- ar & note;
- ar & pos;
- ar & metadata;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
value_t get_comment(item_t& item);
diff --git a/src/iterators.cc b/src/iterators.cc
index 21bec5d9..0225e210 100644
--- a/src/iterators.cc
+++ b/src/iterators.cc
@@ -96,7 +96,7 @@ namespace {
TRACE_DTOR(create_price_xact);
}
- void operator()(datetime_t& date, const amount_t& price) {
+ void operator()(const datetime_t& date, const amount_t& price) {
xact_t * xact;
string symbol = price.commodity().symbol();
diff --git a/src/journal.h b/src/journal.h
index 613b2b96..324315b1 100644
--- a/src/journal.h
+++ b/src/journal.h
@@ -100,21 +100,6 @@ public:
~fileinfo_t() throw() {
TRACE_DTOR(journal_t::fileinfo_t);
}
-
-#if HAVE_BOOST_SERIALIZATION
- private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & filename;
- ar & size;
- ar & modtime;
- ar & from_stream;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
account_t * master;
@@ -215,26 +200,6 @@ public:
private:
std::size_t read_textual(parse_context_stack_t& context);
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & master;
- ar & bucket;
- ar & xacts;
- ar & auto_xacts;
- ar & period_xacts;
- ar & sources;
- ar & payee_mappings;
- ar & account_mappings;
- ar & checksum_map;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
} // namespace ledger
diff --git a/src/lookup.cc b/src/lookup.cc
index 6dbeb502..3b6707e5 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -54,7 +54,7 @@ namespace {
struct usage_sorter {
bool operator()(const account_use_pair& left,
const account_use_pair& right) const {
- return left.second > right.second;
+ return left.second < right.second;
}
};
}
diff --git a/src/mask.h b/src/mask.h
index 2b579768..dce23440 100644
--- a/src/mask.h
+++ b/src/mask.h
@@ -124,25 +124,6 @@ public:
}
return true;
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- string temp;
- if (Archive::is_loading::value) {
- ar & temp;
- *this = temp;
- } else {
- temp = str();
- ar & temp;
- }
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
inline std::ostream& operator<<(std::ostream& out, const mask_t& mask) {
diff --git a/src/op.h b/src/op.h
index c45ffb08..d94c2534 100644
--- a/src/op.h
+++ b/src/op.h
@@ -314,33 +314,6 @@ private:
value_t calc_call(scope_t& scope, ptr_op_t * locus, const int depth);
value_t calc_cons(scope_t& scope, ptr_op_t * locus, const int depth);
value_t calc_seq(scope_t& scope, ptr_op_t * locus, const int depth);
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & refc;
- ar & kind;
- if (Archive::is_loading::value || ! left_ || ! left_->is_function()) {
- ar & left_;
- } else {
- ptr_op_t temp_op;
- ar & temp_op;
- }
- if (Archive::is_loading::value || is_value() || is_ident() ||
- (kind > UNARY_OPERATORS &&
- (! has_right() || ! right()->is_function()))) {
- ar & data;
- } else {
- variant<ptr_op_t, value_t, string, expr_t::func_t> temp_data;
- ar & temp_data;
- }
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
inline expr_t::ptr_op_t
diff --git a/src/output.cc b/src/output.cc
index ffd144e1..92b71387 100644
--- a/src/output.cc
+++ b/src/output.cc
@@ -291,7 +291,7 @@ void report_accounts::flush()
void report_accounts::operator()(post_t& post)
{
- std::map<account_t *, std::size_t>::iterator i = accounts.find(post.account);
+ accounts_report_map::iterator i = accounts.find(post.account);
if (i == accounts.end())
accounts.insert(accounts_pair(post.account, 1));
else
@@ -362,7 +362,7 @@ void report_commodities::operator()(post_t& post)
amount_t temp(post.amount.strip_annotations(report.what_to_keep()));
commodity_t& comm(temp.commodity());
- std::map<commodity_t *, std::size_t>::iterator i = commodities.find(&comm);
+ commodities_report_map::iterator i = commodities.find(&comm);
if (i == commodities.end())
commodities.insert(commodities_pair(&comm, 1));
else
@@ -371,7 +371,7 @@ void report_commodities::operator()(post_t& post)
if (comm.has_annotation()) {
annotated_commodity_t& ann_comm(as_annotated_commodity(comm));
if (ann_comm.details.price) {
- std::map<commodity_t *, std::size_t>::iterator ii =
+ commodities_report_map::iterator ii =
commodities.find(&ann_comm.details.price->commodity());
if (ii == commodities.end())
commodities.insert
diff --git a/src/output.h b/src/output.h
index ec7ec6c2..1305fa77 100644
--- a/src/output.h
+++ b/src/output.h
@@ -142,9 +142,10 @@ class report_accounts : public item_handler<post_t>
protected:
report_t& report;
- std::map<account_t *, std::size_t, account_compare> accounts;
-
typedef std::map<account_t *, std::size_t>::value_type accounts_pair;
+ typedef std::map<account_t *, std::size_t, account_compare> accounts_report_map;
+
+ accounts_report_map accounts;
public:
report_accounts(report_t& _report) : report(_report) {
@@ -221,9 +222,10 @@ class report_commodities : public item_handler<post_t>
protected:
report_t& report;
- std::map<commodity_t *, std::size_t, commodity_compare> commodities;
-
typedef std::map<commodity_t *, std::size_t>::value_type commodities_pair;
+ typedef std::map<commodity_t *, std::size_t, commodity_compare> commodities_report_map;
+
+ commodities_report_map commodities;
public:
report_commodities(report_t& _report) : report(_report) {
diff --git a/src/parser.h b/src/parser.h
index e46fc719..25c4a7e3 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -118,7 +118,7 @@ public:
ptr_op_t parse(std::istream& in,
const parse_flags_t& flags = PARSE_DEFAULT,
- const optional<string>& original_string = NULL);
+ const optional<string>& original_string = boost::none);
};
} // namespace ledger
diff --git a/src/pool.h b/src/pool.h
index d24df78c..2e9d93f1 100644
--- a/src/pool.h
+++ b/src/pool.h
@@ -132,26 +132,6 @@ public:
parse_price_expression(const std::string& str,
const bool add_prices = true,
const optional<datetime_t>& moment = none);
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & current_pool;
- ar & commodities;
- ar & annotated_commodities;
- ar & null_commodity;
- ar & default_commodity;
- ar & keep_base;
- ar & price_db;
- ar & quote_leeway;
- ar & get_quotes;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
} // namespace ledger
diff --git a/src/post.h b/src/post.h
index 1e5fc569..5f22fa3c 100644
--- a/src/post.h
+++ b/src/post.h
@@ -205,11 +205,7 @@ public:
mutable optional<xdata_t> xdata_;
bool has_xdata() const {
-#if BOOST_VERSION >= 105600
- return xdata_ != NULL;
-#else
- return xdata_;
-#endif
+ return static_cast<bool>(xdata_);
}
void clear_xdata() {
xdata_ = none;
@@ -255,24 +251,6 @@ public:
}
}
};
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<item_t>(*this);
- ar & xact;
- ar & account;
- ar & amount;
- ar & amount_expr;
- ar & cost;
- ar & assigned_amount;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
class journal_t;
diff --git a/src/predicate.h b/src/predicate.h
index 30d07223..e8c5b31c 100644
--- a/src/predicate.h
+++ b/src/predicate.h
@@ -90,19 +90,6 @@ public:
.to_boolean() :
true);
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<expr_t>(*this);
- ar & what_to_keep;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
} // namespace ledger
diff --git a/src/py_item.cc b/src/py_item.cc
index 473bbef8..4dd104c9 100644
--- a/src/py_item.cc
+++ b/src/py_item.cc
@@ -32,6 +32,7 @@
#include <system.hh>
#include "pyinterp.h"
+#include "pyutils.h"
#include "scope.h"
#include "mask.h"
#include "item.h"
@@ -64,6 +65,13 @@ namespace {
return item.get_tag(tag_mask, value_mask);
}
+ std::string py_position_pathname(position_t const& pos) {
+ return pos.pathname.native();
+ }
+ void py_position_set_pathname(position_t& pos, string const& s) {
+ pos.pathname = s;
+ }
+
} // unnamed namespace
#if 0
@@ -79,8 +87,8 @@ void export_item()
{
class_< position_t > ("Position")
.add_property("pathname",
- make_getter(&position_t::pathname),
- make_setter(&position_t::pathname))
+ make_function(py_position_pathname),
+ make_function(py_position_set_pathname))
.add_property("beg_pos",
make_getter(&position_t::beg_pos),
make_setter(&position_t::beg_pos))
@@ -169,6 +177,8 @@ void export_item()
.def("valid", &item_t::valid)
;
+
+ register_optional_to_python<position_t>();
}
} // namespace ledger
diff --git a/src/report.cc b/src/report.cc
index 4b240611..ac08c247 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -631,7 +631,7 @@ value_t report_t::fn_trim(call_scope_t& args)
while (*p && std::isspace(*p))
p++;
- const char * e = buf.get() + temp.length();
+ const char * e = buf.get() + temp.length() - 1;
while (e > p && std::isspace(*e))
e--;
@@ -643,7 +643,7 @@ value_t report_t::fn_trim(call_scope_t& args)
return string_value(empty_string);
}
else {
- return string_value(string(p, static_cast<std::string::size_type>(e - p)));
+ return string_value(string(p, static_cast<std::string::size_type>(e - p + 1)));
}
}
@@ -1198,6 +1198,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
OPT_CH(collapse);
else OPT(no_color);
else OPT(no_pager);
+ else OPT(no_revalued);
else OPT(no_rounding);
else OPT(no_titles);
else OPT(no_total);
diff --git a/src/report.h b/src/report.h
index 67e95884..10afbe6f 100644
--- a/src/report.h
+++ b/src/report.h
@@ -496,7 +496,7 @@ public:
"%-(ansify_if(partial_account(options.flat), blue if color))\n%/"
"%$1 %$2 %$3\n%/"
"%(prepend_width ? \" \" * int(prepend_width) : \"\")"
- "---------------- ---------------- ---------\n");
+ "---------------- ---------------- ---------\n");
});
OPTION(report_t, color);
@@ -764,6 +764,10 @@ public:
OTHER(color).off();
});
+ OPTION_(report_t, no_revalued, DO() {
+ OTHER(revalued).off();
+ });
+
OPTION(report_t, no_rounding);
OPTION(report_t, no_titles);
OPTION(report_t, no_total);
diff --git a/src/scope.h b/src/scope.h
index 8ad3afac..ba1144b2 100644
--- a/src/scope.h
+++ b/src/scope.h
@@ -83,20 +83,6 @@ struct symbol_t
bool operator==(const symbol_t& sym) const {
return kind == sym.kind || name == sym.name;
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & kind;
- ar & name;
- ar & definition;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
class empty_scope_t;
@@ -127,16 +113,6 @@ public:
virtual bool type_required() const {
return false;
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive&, const unsigned int /* version */) {}
-#endif // HAVE_BOOST_SERIALIZATION
};
class empty_scope_t : public scope_t
@@ -184,19 +160,6 @@ public:
return parent->lookup(kind, name);
return NULL;
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<scope_t>(*this);
- ar & parent;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
class bind_scope_t : public child_scope_t
@@ -233,19 +196,6 @@ public:
return def;
return child_scope_t::lookup(kind, name);
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<child_scope_t>(*this);
- ar & grandchild;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
template <typename T>
@@ -323,19 +273,6 @@ public:
virtual expr_t::ptr_op_t lookup(const symbol_t::kind_t kind,
const string& name);
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<child_scope_t>(*this);
- ar & symbols;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
class context_scope_t : public child_scope_t
@@ -365,24 +302,6 @@ public:
virtual bool type_required() const {
return required;
}
-
-#if HAVE_BOOST_SERIALIZATION
-protected:
- explicit context_scope_t() {
- TRACE_CTOR(context_scope_t, "");
- }
-
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<child_scope_t>(*this);
- ar & value_type_context;
- ar & required;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
class call_scope_t : public context_scope_t
@@ -480,24 +399,6 @@ public:
bool empty() const {
return args.size() == 0;
}
-
-#if HAVE_BOOST_SERIALIZATION
-protected:
- explicit call_scope_t() : depth(0) {
- TRACE_CTOR(call_scope_t, "");
- }
-
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<context_scope_t>(*this);
- ar & args;
- //ar & ptr;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
template <>
diff --git a/src/session.cc b/src/session.cc
index b0d31be9..b4fb4eb8 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -37,7 +37,6 @@
#include "journal.h"
#include "iterators.h"
#include "filters.h"
-#include "archive.h"
namespace ledger {
@@ -129,56 +128,13 @@ std::size_t session_t::read_data(const string& master_account)
if (HANDLED(value_expr_))
journal->value_expr = HANDLER(value_expr_).str();
-#if HAVE_BOOST_SERIALIZATION
- optional<archive_t> cache;
- if (HANDLED(cache_) && master_account.empty())
- cache = archive_t(HANDLED(cache_).str());
-
- if (! (cache &&
- cache->should_load(HANDLER(file_).data_files) &&
- cache->load(*journal.get()))) {
-#endif // HAVE_BOOST_SERIALIZATION
- if (price_db_path) {
- if (exists(*price_db_path)) {
- parsing_context.push(*price_db_path);
- parsing_context.get_current().journal = journal.get();
- try {
- if (journal->read(parsing_context) > 0)
- throw_(parse_error, _("Transactions not allowed in price history file"));
- }
- catch (...) {
- parsing_context.pop();
- throw;
- }
- parsing_context.pop();
- }
- }
-
- foreach (const path& pathname, HANDLER(file_).data_files) {
- if (pathname == "-" || pathname == "/dev/stdin") {
- // To avoid problems with stdin and pipes, etc., we read the entire
- // file in beforehand into a memory buffer, and then parcel it out
- // from there.
- std::ostringstream buffer;
-
- while (std::cin.good() && ! std::cin.eof()) {
- char line[8192];
- std::cin.read(line, 8192);
- std::streamsize count = std::cin.gcount();
- buffer.write(line, count);
- }
- buffer.flush();
-
- shared_ptr<std::istream> stream(new std::istringstream(buffer.str()));
- parsing_context.push(stream);
- } else {
- parsing_context.push(pathname);
- }
-
+ if (price_db_path) {
+ if (exists(*price_db_path)) {
+ parsing_context.push(*price_db_path);
parsing_context.get_current().journal = journal.get();
- parsing_context.get_current().master = acct;
try {
- xact_count += journal->read(parsing_context);
+ if (journal->read(parsing_context) > 0)
+ throw_(parse_error, _("Transactions not allowed in price history file"));
}
catch (...) {
parsing_context.pop();
@@ -186,16 +142,44 @@ std::size_t session_t::read_data(const string& master_account)
}
parsing_context.pop();
}
+ }
+
+ foreach (const path& pathname, HANDLER(file_).data_files) {
+ if (pathname == "-" || pathname == "/dev/stdin") {
+ // To avoid problems with stdin and pipes, etc., we read the entire
+ // file in beforehand into a memory buffer, and then parcel it out
+ // from there.
+ std::ostringstream buffer;
+
+ while (std::cin.good() && ! std::cin.eof()) {
+ char line[8192];
+ std::cin.read(line, 8192);
+ std::streamsize count = std::cin.gcount();
+ buffer.write(line, count);
+ }
+ buffer.flush();
- DEBUG("ledger.read", "xact_count [" << xact_count
- << "] == journal->xacts.size() [" << journal->xacts.size() << "]");
- assert(xact_count == journal->xacts.size());
+ shared_ptr<std::istream> stream(new std::istringstream(buffer.str()));
+ parsing_context.push(stream);
+ } else {
+ parsing_context.push(pathname);
+ }
-#if HAVE_BOOST_SERIALIZATION
- if (cache && cache->should_save(*journal.get()))
- cache->save(*journal.get());
+ parsing_context.get_current().journal = journal.get();
+ parsing_context.get_current().master = acct;
+ try {
+ xact_count += journal->read(parsing_context);
+ }
+ catch (...) {
+ parsing_context.pop();
+ throw;
+ }
+ parsing_context.pop();
}
-#endif // HAVE_BOOST_SERIALIZATION
+
+ DEBUG("ledger.read", "xact_count [" << xact_count
+ << "] == journal->xacts.size() [" << journal->xacts.size() << "]");
+ assert(xact_count == journal->xacts.size());
if (populated_data_files)
HANDLER(file_).data_files.clear();
@@ -333,8 +317,7 @@ option_t<session_t> * session_t::lookup_option(const char * p)
OPT_CH(price_exp_);
break;
case 'c':
- OPT(cache_);
- else OPT(check_payees);
+ OPT(check_payees);
break;
case 'd':
OPT(download); // -Q
diff --git a/src/session.h b/src/session.h
index b287b19e..f9aee389 100644
--- a/src/session.h
+++ b/src/session.h
@@ -97,7 +97,6 @@ public:
void report_options(std::ostream& out)
{
- HANDLER(cache_).report(out);
HANDLER(check_payees).report(out);
HANDLER(day_break).report(out);
HANDLER(download).report(out);
@@ -126,7 +125,6 @@ public:
* Option handlers
*/
- OPTION(session_t, cache_);
OPTION(session_t, check_payees);
OPTION(session_t, day_break);
OPTION(session_t, download); // -Q
diff --git a/src/system.hh.in b/src/system.hh.in
index 21417e09..8de27ad6 100644
--- a/src/system.hh.in
+++ b/src/system.hh.in
@@ -54,6 +54,7 @@
#define Ledger_VERSION_MAJOR @Ledger_VERSION_MAJOR@
#define Ledger_VERSION_MINOR @Ledger_VERSION_MINOR@
#define Ledger_VERSION_PATCH @Ledger_VERSION_PATCH@
+#define Ledger_VERSION_PRERELEASE "@Ledger_VERSION_PRERELEASE@"
#define Ledger_VERSION_DATE @Ledger_VERSION_DATE@
#define HAVE_EDIT @HAVE_EDIT@
@@ -70,7 +71,6 @@
#define HAVE_BOOST_PYTHON @HAVE_BOOST_PYTHON@
#define HAVE_BOOST_REGEX_UNICODE @HAVE_BOOST_REGEX_UNICODE@
-#define HAVE_BOOST_SERIALIZATION 0
#define DEBUG_MODE @DEBUG_MODE@
#define NO_ASSERTS @NO_ASSERTS@
@@ -238,86 +238,8 @@ typedef std::ostream::pos_type ostream_pos_type;
#endif
#define _f(str) boost::format(_(str))
-#if HAVE_BOOST_SERIALIZATION
-
-#include <boost/archive/binary_iarchive.hpp>
-#include <boost/archive/binary_oarchive.hpp>
-
-#include <boost/serialization/base_object.hpp>
-#include <boost/serialization/binary_object.hpp>
-#include <boost/serialization/optional.hpp>
-#include <boost/serialization/shared_ptr.hpp>
-#include <boost/serialization/variant.hpp>
-#include <boost/serialization/utility.hpp>
-#include <boost/serialization/export.hpp>
-#include <boost/serialization/level.hpp>
-#include <boost/serialization/string.hpp>
-#include <boost/serialization/vector.hpp>
-#include <boost/serialization/deque.hpp>
-#include <boost/serialization/list.hpp>
-#include <boost/serialization/map.hpp>
-
-#include <boost/date_time/posix_time/time_serialize.hpp>
-#include <boost/date_time/gregorian/greg_serialize.hpp>
-#include <boost/ptr_container/serialize_ptr_deque.hpp>
-
-namespace boost {
-namespace serialization {
-
-template <class Archive>
-void serialize(Archive& ar, boost::filesystem::path& p, const unsigned int)
-{
- std::string s;
- if (Archive::is_saving::value)
- s = p.string();
-
- ar & s;
-
- if (Archive::is_loading::value)
- p = s;
-}
-
-template <class Archive, class T>
-void serialize(Archive& ar, boost::intrusive_ptr<T>& ptr, const unsigned int)
-{
- if (Archive::is_saving::value) {
- T * p = ptr.get();
- ar & p;
- }
- else if (Archive::is_loading::value) {
- T * p;
- ar & p;
- ptr.reset(p);
- }
-}
-
-template <class Archive>
-void serialize(Archive&, boost::any&, const unsigned int) {
- // jww (2012-03-29): Should we really ignore any fields entirely?
- // These occur inside value_t::storage_t::data's variant.
-}
-
-template <class Archive>
-void serialize(Archive&, boost::blank&, const unsigned int) {}
-
-template <class Archive, class T>
-void serialize(Archive&, boost::function<T>&, const unsigned int) {}
-
-template <class Archive>
-void serialize(Archive& ar, istream_pos_type& pos, const unsigned int)
-{
- ar & make_binary_object(&pos, sizeof(istream_pos_type));
-}
-
-} // namespace serialization
-} // namespace boost
-
-#else // HAVE_BOOST_SERIALIZATION
-
#include <boost/ptr_container/ptr_deque.hpp>
-#endif // HAVE_BOOST_SERIALIZATION
-
#if HAVE_BOOST_PYTHON
#include <boost/python.hpp>
diff --git a/src/times.h b/src/times.h
index c1bfb1cc..e1a9e847 100644
--- a/src/times.h
+++ b/src/times.h
@@ -153,20 +153,6 @@ struct date_traits_t
has_month == traits.has_month &&
has_day == traits.has_day);
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & has_year;
- ar & has_month;
- ar & has_day;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
struct date_duration_t
@@ -247,19 +233,6 @@ struct date_duration_t
}
static date_t find_nearest(const date_t& date, skip_quantum_t skip);
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & quantum;
- ar & length;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
class date_specifier_t
@@ -343,21 +316,6 @@ public:
return out.str();
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & year;
- ar & month;
- ar & day;
- ar & wday;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
class date_range_t
@@ -420,20 +378,6 @@ public:
return out.str();
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & range_begin;
- ar & range_end;
- ar & end_inclusive;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
class date_specifier_or_range_t
@@ -490,18 +434,6 @@ public:
return out.str();
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & specifier_or_range;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
class date_interval_t : public equality_comparable<date_interval_t>
@@ -568,11 +500,7 @@ public:
void stabilize(const optional<date_t>& date = none);
bool is_valid() const {
-#if BOOST_VERSION >= 105600
- return start != NULL;
-#else
- return start;
-#endif
+ return static_cast<bool>(start);
}
/** Find the current or next period containing date. Returns false if
@@ -594,24 +522,6 @@ public:
date_interval_t& operator++();
void dump(std::ostream& out);
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & range;
- ar & start;
- ar & finish;
- ar & aligned;
- ar & next;
- ar & duration;
- ar & end_of_duration;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
void times_initialize();
diff --git a/src/value.h b/src/value.h
index c224ce04..810d34f9 100644
--- a/src/value.h
+++ b/src/value.h
@@ -227,20 +227,6 @@ public:
data = false;
type = VOID;
}
-
-#if HAVE_BOOST_SERIALIZATION
- private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & data;
- ar & type;
- ar & refc;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
private:
@@ -965,20 +951,6 @@ public:
* Debugging methods.
*/
bool valid() const;
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & true_value;
- ar & false_value;
- ar & storage;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
#define NULL_VALUE (value_t())
diff --git a/src/xact.h b/src/xact.h
index 3ca57953..37a20972 100644
--- a/src/xact.h
+++ b/src/xact.h
@@ -87,20 +87,6 @@ public:
virtual bool valid() const {
return true;
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<item_t>(*this);
- ar & journal;
- ar & posts;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
class xact_t : public xact_base_t
@@ -142,20 +128,6 @@ public:
const string& name);
virtual bool valid() const;
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<xact_base_t>(*this);
- ar & code;
- ar & payee;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
class auto_xact_t : public xact_base_t
@@ -176,21 +148,6 @@ public:
bool _overwrite_existing)
: tag_data(_tag_data), overwrite_existing(_overwrite_existing),
apply_to_post(NULL) {}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
- deferred_tag_data_t() : apply_to_post(NULL) {}
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & tag_data;
- ar & overwrite_existing;
- ar & apply_to_post;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
typedef std::list<deferred_tag_data_t> deferred_notes_list;
@@ -236,21 +193,6 @@ private:
}
virtual void extend_xact(xact_base_t& xact, parse_context_t& context);
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<xact_base_t>(*this);
- ar & predicate;
- ar & check_exprs;
- ar & deferred_notes;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
class period_xact_t : public xact_base_t
@@ -284,20 +226,6 @@ class period_xact_t : public xact_base_t
return string(_("generated periodic transaction"));
}
}
-
-#if HAVE_BOOST_SERIALIZATION
-private:
- /** Serialization. */
-
- friend class boost::serialization::access;
-
- template<class Archive>
- void serialize(Archive& ar, const unsigned int /* version */) {
- ar & boost::serialization::base_object<xact_base_t>(*this);
- ar & period;
- ar & period_string;
- }
-#endif // HAVE_BOOST_SERIALIZATION
};
typedef std::list<xact_t *> xacts_list;