summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xacprep2
-rw-r--r--lib/Makefile2
-rw-r--r--src/main.cc2
-rw-r--r--src/pyinterp.cc8
-rw-r--r--src/session.cc3
-rw-r--r--src/textual.cc16
-rw-r--r--src/timelog.cc11
-rw-r--r--src/timelog.h14
-rw-r--r--src/utils.h6
9 files changed, 50 insertions, 14 deletions
diff --git a/acprep b/acprep
index 9f72f975..00999256 100755
--- a/acprep
+++ b/acprep
@@ -244,7 +244,7 @@ class CommandLineApp(object):
force_exit = True # If true, always ends run() with sys.exit()
log_handler = None
darwin_gcc = False
- boost_version = "1_45"
+ boost_version = "1_46"
options = {
'debug': False,
diff --git a/lib/Makefile b/lib/Makefile
index 12859439..0e3d1da1 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -6,7 +6,7 @@ STOW_ROOT = /usr/local/stow
PRODUCTS = $(HOME)/Products
GCC_VERSION = 4.6
-BOOST_VERSION = 1_45_0
+BOOST_VERSION = 1_46_0
CC = gcc-mp-$(GCC_VERSION)
ifeq ($(CC),clang)
diff --git a/src/main.cc b/src/main.cc
index ef611f51..820f920d 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -67,7 +67,9 @@ int main(int argc, char * argv[], char * envp[])
// Initialize global Boost/C++ environment
std::ios::sync_with_stdio(false);
+#if BOOST_VERSION < 104600
filesystem::path::default_name_check(filesystem::portable_posix_name);
+#endif
std::signal(SIGINT, sigint_handler);
#ifndef WIN32
diff --git a/src/pyinterp.cc b/src/pyinterp.cc
index 8052f6a4..e0801604 100644
--- a/src/pyinterp.cc
+++ b/src/pyinterp.cc
@@ -137,7 +137,7 @@ void python_interpreter_t::hack_system_paths()
int n = python::extract<int>(paths.attr("__len__")());
for (int i = 0; i < n; i++) {
python::extract<std::string> str(paths[i]);
- path pathname(str);
+ path pathname(str());
DEBUG("python.interp", "sys.path = " << pathname);
if (exists(pathname / "ledger" / "__init__.py")) {
@@ -202,9 +202,15 @@ object python_interpreter_t::import_option(const string& str)
paths.insert(0, file.parent_path().string());
sys_dict["path"] = paths;
+#if BOOST_VERSION >= 104600
+ string name = file.filename().string();
+ if (contains(name, ".py"))
+ name = file.stem().string();
+#else
string name = file.filename();
if (contains(name, ".py"))
name = file.stem();
+#endif
#else // BOOST_VERSION >= 103700
paths.insert(0, file.branch_path().string());
sys_dict["path"] = paths;
diff --git a/src/session.cc b/src/session.cc
index 96aa98d4..fdb0ad1d 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -129,7 +129,6 @@ std::size_t session_t::read_data(const string& master_account)
buffer.flush();
std::istringstream buf_in(buffer.str());
-
xact_count += journal->read(buf_in, "/dev/stdin", acct);
journal->sources.push_back(journal_t::fileinfo_t());
} else {
@@ -137,6 +136,8 @@ std::size_t session_t::read_data(const string& master_account)
}
}
+ DEBUG("ledger.read", "xact_count [" << xact_count
+ << "] == journal->xacts.size() [" << journal->xacts.size() << "]");
assert(xact_count == journal->xacts.size());
#if defined(HAVE_BOOST_SERIALIZATION)
diff --git a/src/textual.cc b/src/textual.cc
index 5bcbf86b..a1e5d50b 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -68,7 +68,9 @@ namespace {
parse_context_t(journal_t& _journal, scope_t& _scope)
: journal(_journal), scope(_scope), timelog(journal, scope),
- strict(false), count(0), errors(0), sequence(1) {}
+ strict(false), count(0), errors(0), sequence(1) {
+ timelog.context_count = &count;
+ }
bool front_is_account() {
return state_stack.front().type() == typeid(account_t *);
@@ -86,6 +88,10 @@ namespace {
return boost::get<account_t *>(state);
return NULL;
}
+
+ void close() {
+ timelog.close();
+ }
};
class instance_t : public noncopyable, public scope_t
@@ -723,7 +729,11 @@ void instance_t::include_directive(char * line)
mask_t glob;
#if BOOST_VERSION >= 103700
path parent_path = filename.parent_path();
+#if BOOST_VERSION >= 104600
+ glob.assign_glob('^' + filename.filename().string() + '$');
+#else
glob.assign_glob('^' + filename.filename() + '$');
+#endif
#else // BOOST_VERSION >= 103700
path parent_path = filename.branch_path();
glob.assign_glob('^' + filename.leaf() + '$');
@@ -742,7 +752,11 @@ void instance_t::include_directive(char * line)
#endif
{
#if BOOST_VERSION >= 103700
+#if BOOST_VERSION >= 104600
+ string base = (*iter).path().string();
+#else
string base = (*iter).filename();
+#endif
#else // BOOST_VERSION >= 103700
string base = (*iter).leaf();
#endif // BOOST_VERSION >= 103700
diff --git a/src/timelog.cc b/src/timelog.cc
index 698e2420..ee9a0b6c 100644
--- a/src/timelog.cc
+++ b/src/timelog.cc
@@ -117,21 +117,22 @@ namespace {
}
} // unnamed namespace
-time_log_t::~time_log_t()
+void time_log_t::close()
{
- TRACE_DTOR(time_log_t);
-
if (! time_xacts.empty()) {
std::list<account_t *> accounts;
foreach (time_xact_t& time_xact, time_xacts)
accounts.push_back(time_xact.account);
- foreach (account_t * account, accounts)
+ foreach (account_t * account, accounts) {
+ DEBUG("timelog", "Clocking out from account " << account->fullname());
clock_out_from_timelog(time_xacts,
time_xact_t(none, CURRENT_TIME(), account),
journal, scope);
-
+ if (context_count)
+ (*context_count)++;
+ }
assert(time_xacts.empty());
}
}
diff --git a/src/timelog.h b/src/timelog.h
index 92b80edc..020ae4f2 100644
--- a/src/timelog.h
+++ b/src/timelog.h
@@ -83,21 +83,27 @@ public:
}
};
-class time_log_t
+class time_log_t : public boost::noncopyable
{
std::list<time_xact_t> time_xacts;
journal_t& journal;
scope_t& scope;
public:
+ std::size_t * context_count;
+
time_log_t(journal_t& _journal, scope_t& _scope)
- : journal(_journal), scope(_scope) {
- TRACE_CTOR(time_log_t, "journal_t&, scope_t&");
+ : journal(_journal), scope(_scope), context_count(NULL) {
+ TRACE_CTOR(time_log_t, "journal_t&, scope_t&, std::size&");
+ }
+ ~time_log_t() {
+ TRACE_DTOR(time_log_t);
}
- ~time_log_t();
void clock_in(time_xact_t event);
void clock_out(time_xact_t event);
+
+ void close();
};
} // namespace ledger
diff --git a/src/utils.h b/src/utils.h
index af75514c..ad9b0562 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -92,6 +92,12 @@ namespace ledger {
typedef boost::filesystem::filesystem_error filesystem_error;
}
+#if BOOST_FILESYSTEM_VERSION == 3
+namespace boost { namespace filesystem3 { namespace path_traits {
+template<> struct is_pathable<ledger::string> { static const bool value = true; };
+}}}
+#endif
+
/*@}*/
/**