summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2019-03-15 16:30:28 -0700
committerJohn Wiegley <johnw@newartisans.com>2019-03-15 17:30:46 -0700
commitf0dacdb22f2888be104711d9092ca43d770965f2 (patch)
treef2ae7a8926ee581d39a558d6c4c83d3e7c1de9cd /src
parentd511d671fcbb517ec474d4355a4c1568ee2fbb09 (diff)
downloadfork-ledger-f0dacdb22f2888be104711d9092ca43d770965f2.tar.gz
fork-ledger-f0dacdb22f2888be104711d9092ca43d770965f2.tar.bz2
fork-ledger-f0dacdb22f2888be104711d9092ca43d770965f2.zip
Remove the 'org' command, which was always a hack to begin with
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/org.cc201
-rw-r--r--src/org.h94
-rw-r--r--src/report.cc6
-rw-r--r--src/select.cc2
5 files changed, 0 insertions, 305 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9b39ea94..756df376 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,7 +9,6 @@ set(LEDGER_SOURCES
convert.cc
draft.cc
emacs.cc
- org.cc
ptree.cc
print.cc
output.cc
@@ -103,7 +102,6 @@ set(LEDGER_INCLUDES
mask.h
op.h
option.h
- org.h
output.h
parser.h
pool.h
diff --git a/src/org.cc b/src/org.cc
deleted file mode 100644
index c5a1aac3..00000000
--- a/src/org.cc
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (c) 2003-2018, 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>
-
-#include "org.h"
-#include "xact.h"
-#include "post.h"
-#include "account.h"
-#include "journal.h"
-#include "pool.h"
-#include "report.h"
-
-namespace ledger {
-
-posts_to_org_table::posts_to_org_table(report_t& _report,
- const optional<string>& _prepend_format)
- : report(_report), last_xact(NULL), last_post(NULL),
- header_printed(false), first_report_title(true)
-{
- first_line_format.parse_format
- ("|%(format_date(date))"
- "|%(code)"
- "|%(payee)"
- "|%(cleared ? \"*\" : (pending ? \"!\" : \"\"))"
- "|%(display_account)"
- "|%(scrub(top_amount(display_amount)))"
- "|%(scrub(top_amount(display_total)))"
- "|%(join(note | xact.note))\n");
-
- next_lines_format.parse_format
- ("|"
- "|"
- "|%(has_tag(\"Payee\") ? payee : \"\")"
- "|%(cleared ? \"*\" : (pending ? \"!\" : \"\"))"
- "|%(display_account)"
- "|%(scrub(top_amount(display_amount)))"
- "|%(scrub(top_amount(display_total)))"
- "|%(join(note | xact.note))\n");
-
- amount_lines_format.parse_format
- ("|"
- "|"
- "|"
- "|"
- "|"
- "|%(scrub(next_amount))"
- "|%(scrub(next_total))"
- "|\n");
-
- if (_prepend_format)
- prepend_format.parse_format(*_prepend_format);
-
- TRACE_CTOR(posts_to_org_table, "report&, optional<string>");
-}
-
-void posts_to_org_table::flush()
-{
- report.output_stream.flush();
-}
-
-void posts_to_org_table::operator()(post_t& post)
-{
- if (! post.has_xdata() ||
- ! post.xdata().has_flags(POST_EXT_DISPLAYED)) {
- std::ostream& out(report.output_stream);
-
- bind_scope_t bound_scope(report, post);
-
- if (! header_printed) {
- out << "|Date|Code|Payee|X|Account|Amount|Total|Note|\n"
- << "|-|\n"
- << "|||<20>|||<r>|<r>|<20>|\n";
- header_printed = true;
- }
-
- if (! report_title.empty()) {
- if (first_report_title)
- first_report_title = false;
- else
- out << '\n';
-
- value_scope_t val_scope(bound_scope, string_value(report_title));
- format_t group_title_format(report.HANDLER(group_title_format_).str());
-
- out << "|-|\n";
- out << '|' << group_title_format(val_scope);
- out << "|-|\n";
-
- report_title = "";
- }
-
- if (prepend_format)
- out << '|' << prepend_format(bound_scope);
-
- if (last_xact != post.xact) {
- out << first_line_format(bound_scope);
- last_xact = post.xact;
- }
- else if (last_post && last_post->date() != post.date()) {
- out << first_line_format(bound_scope);
- }
- else {
- out << next_lines_format(bound_scope);
- }
-
- value_t amt = expr_t("display_amount").calc(bound_scope).simplified();
- value_t tot = expr_t("display_total").calc(bound_scope).simplified();
-
- if (amt.type() == value_t::BALANCE || tot.type() == value_t::BALANCE) {
- balance_t amt_bal(amt.to_balance());
- balance_t tot_bal(tot.to_balance());
- balance_t::amounts_map::const_iterator i = amt_bal.amounts.begin();
- balance_t::amounts_map::const_iterator j = tot_bal.amounts.begin();
- bool first = true;
- while (i != amt_bal.amounts.end() || j != tot_bal.amounts.end()) {
- if (first) {
- first = false;
- if (i != amt_bal.amounts.end()) ++i;
- if (j != tot_bal.amounts.end()) ++j;
- } else {
- symbol_scope_t call_scope(bound_scope);
- bool assigned = false;
-
- if (i != amt_bal.amounts.end()) {
- if ((*i).second) {
- DEBUG("org.next_amount", "next_amount = " << (*i).second);
- call_scope.define(symbol_t::FUNCTION, "next_amount",
- expr_t::op_t::wrap_value((*i++).second));
- assigned = true;
- } else {
- call_scope.define(symbol_t::FUNCTION, "next_amount",
- expr_t::op_t::wrap_value(string_value("")));
- ++i;
- }
- } else {
- call_scope.define(symbol_t::FUNCTION, "next_amount",
- expr_t::op_t::wrap_value(string_value("")));
- }
-
- if (j != tot_bal.amounts.end()) {
- if ((*j).second) {
- DEBUG("org.next_total", "next_total = " << (*j).second);
- call_scope.define(symbol_t::FUNCTION, "next_total",
- expr_t::op_t::wrap_value((*j++).second));
- DEBUG("org.next_total", "2.next_total = " <<
- call_scope.lookup(symbol_t::FUNCTION,
- "next_total")->as_value());
- assigned = true;
- } else {
- call_scope.define(symbol_t::FUNCTION, "next_total",
- expr_t::op_t::wrap_value(string_value("")));
- ++j;
- }
- } else {
- call_scope.define(symbol_t::FUNCTION, "next_total",
- expr_t::op_t::wrap_value(string_value("")));
- }
-
- if (assigned) {
- amount_lines_format.mark_uncompiled();
- out << amount_lines_format(call_scope);
- }
- }
- }
- }
-
- post.xdata().add_flags(POST_EXT_DISPLAYED);
- last_post = &post;
- }
-}
-
-} // namespace ledger
diff --git a/src/org.h b/src/org.h
deleted file mode 100644
index 9702297c..00000000
--- a/src/org.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2003-2018, 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.
- */
-
-/**
- * @addtogroup data
- */
-
-/**
- * @file org.h
- * @author John Wiegley
- *
- * @ingroup data
- */
-#ifndef _ORG_H
-#define _ORG_H
-
-#include "chain.h"
-#include "format.h"
-
-namespace ledger {
-
-class xact_t;
-class post_t;
-class report_t;
-
-class posts_to_org_table : public item_handler<post_t>
-{
-protected:
- typedef std::list<xact_t *> xacts_list;
- typedef std::map<xact_t *, bool> xacts_present_map;
-
- report_t& report;
- format_t first_line_format;
- format_t next_lines_format;
- format_t amount_lines_format;
- format_t prepend_format;
- xact_t * last_xact;
- post_t * last_post;
- bool header_printed;
- bool first_report_title;
- string report_title;
-
-public:
- posts_to_org_table(report_t& _report,
- const optional<string>& _prepend_format = none);
- virtual ~posts_to_org_table() {
- TRACE_DTOR(posts_to_org_table);
- }
-
- virtual void flush();
- virtual void operator()(post_t& post);
-
- virtual void clear() {
- last_xact = NULL;
- last_post = NULL;
- header_printed = false;
- first_report_title = true;
- report_title = "";
-
- item_handler<post_t>::clear();
- }
-};
-
-} // namespace ledger
-
-#endif // _ORG_H
diff --git a/src/report.cc b/src/report.cc
index 13e6a61f..cc165184 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -48,7 +48,6 @@
#include "convert.h"
#include "ptree.h"
#include "emacs.h"
-#include "org.h"
namespace ledger {
@@ -1672,11 +1671,6 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind,
if (is_eq(p, "lisp"))
return POSTS_REPORTER(new format_emacs_posts(output_stream));
break;
- case 'o':
- if (is_eq(p, "org"))
- return POSTS_REPORTER(new posts_to_org_table
- (*this, maybe_format(HANDLER(prepend_format_))));
- break;
case 'p':
if (*(p + 1) == '\0' || is_eq(p, "print")) {
diff --git a/src/select.cc b/src/select.cc
index 187387d8..a6eeee09 100644
--- a/src/select.cc
+++ b/src/select.cc
@@ -421,8 +421,6 @@ value_t select_command(call_scope_t& args)
}
else if (arg == "emacs") {
}
- else if (arg == "org") {
- }
}
++m1;