refactor(library/simple_formatter): rename simple_formatter to print

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-08-22 10:32:01 -07:00
parent 7d987df429
commit b746492ac8
13 changed files with 24 additions and 21 deletions

View file

@ -16,7 +16,7 @@ Author: Leonardo de Moura
#include "library/private.h"
#include "library/explicit.h"
#include "library/num.h"
#include "library/simple_formatter.h"
#include "library/print.h"
#include "frontends/lean/pp.h"
#include "frontends/lean/pp_options.h"
#include "frontends/lean/token_table.h"

View file

@ -8,6 +8,6 @@ add_library(library deep_copy.cpp expr_lt.cpp io_state.cpp occurs.cpp
unifier.cpp unifier_plugin.cpp inductive_unifier_plugin.cpp
explicit.cpp num.cpp string.cpp opaque_hints.cpp head_map.cpp
match.cpp definition_cache.cpp declaration_index.cpp
simple_formatter.cpp)
print.cpp)
target_link_libraries(library ${LEAN_LIBS})

View file

@ -5,11 +5,11 @@ Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
*/
#include "kernel/kernel_exception.h"
#include "library/simple_formatter.h"
#include "library/print.h"
#include "library/io_state.h"
namespace lean {
static io_state g_dummy_ios(mk_simple_formatter_factory());
static io_state g_dummy_ios(mk_print_formatter_factory());
io_state const & get_dummy_ios() {
return g_dummy_ios;
}

View file

@ -31,7 +31,7 @@ Author: Leonardo de Moura
#include "library/normalize.h"
#include "library/module.h"
#include "library/opaque_hints.h"
#include "library/simple_formatter.h"
#include "library/print.h"
// Lua Bindings for the Kernel classes. We do not include the Lua
// bindings in the kernel because we do not want to inflate the Kernel.
@ -878,7 +878,7 @@ static const struct luaL_Reg formatter_m[] = {
};
static char g_formatter_factory_key;
static formatter_factory g_simple_formatter_factory = mk_simple_formatter_factory();
static formatter_factory g_print_formatter_factory = mk_print_formatter_factory();
optional<formatter_factory> get_global_formatter_factory_core(lua_State * L) {
io_state * io = get_io_state_ptr(L);
@ -903,7 +903,7 @@ formatter_factory get_global_formatter_factory(lua_State * L) {
if (r)
return *r;
else
return g_simple_formatter_factory;
return g_print_formatter_factory;
}
void set_global_formatter_factory(lua_State * L, formatter_factory const & fmtf) {
@ -1223,7 +1223,7 @@ io_state to_io_state_ext(lua_State * L, int idx) {
int mk_io_state(lua_State * L) {
int nargs = lua_gettop(L);
if (nargs == 0)
return push_io_state(L, io_state(mk_simple_formatter_factory()));
return push_io_state(L, io_state(mk_print_formatter_factory()));
else if (nargs == 1)
return push_io_state(L, io_state(to_io_state(L, 1)));
else

View file

@ -11,7 +11,7 @@ Author: Leonardo de Moura
#include "kernel/instantiate.h"
#include "kernel/free_vars.h"
#include "kernel/annotation.h"
#include "library/simple_formatter.h"
#include "library/print.h"
namespace lean {
bool is_used_name(expr const & t, name const & n) {
@ -249,7 +249,7 @@ struct print_expr_fn {
}
};
formatter_factory mk_simple_formatter_factory() {
formatter_factory mk_print_formatter_factory() {
return [](environment const & env, options const & o) { // NOLINT
return formatter(o, [=](expr const & e, options const &) {
std::ostringstream s;

View file

@ -22,8 +22,11 @@ pair<expr, expr> binding_body_fresh(expr const & b, bool preserve_type = false);
/** \brief Return the body of the let-expression \c l, where variable #0 is replaced by a local constant with a "fresh" name. */
pair<expr, expr> let_body_fresh(expr const & l, bool preserve_type = false);
/** \brief Create a simple formatter object based on operator */
formatter_factory mk_simple_formatter_factory();
/** \brief Create a simple formatter object based on operator for "print" procedure.
\remark The print procedure is only used for debugging purposes.
*/
formatter_factory mk_print_formatter_factory();
/** \brief Use simple formatter as the default print function */
void init_default_print_fn();

View file

@ -26,7 +26,7 @@ Author: Leonardo de Moura
#include "library/opaque_hints.h"
#include "library/unifier_plugin.h"
#include "library/kernel_bindings.h"
#include "library/simple_formatter.h"
#include "library/print.h"
#ifndef LEAN_DEFAULT_UNIFIER_MAX_STEPS
#define LEAN_DEFAULT_UNIFIER_MAX_STEPS 20000
@ -993,7 +993,7 @@ struct unifier_fn {
void display(std::ostream & out, justification const & j, unsigned indent = 0) {
for (unsigned i = 0; i < indent; i++)
out << " ";
out << j.pp(mk_simple_formatter_factory()(m_env, options()), nullptr, m_subst) << "\n";
out << j.pp(mk_print_formatter_factory()(m_env, options()), nullptr, m_subst) << "\n";
if (j.is_composite()) {
display(out, composite_child1(j), indent+2);
display(out, composite_child2(j), indent+2);

View file

@ -26,7 +26,7 @@ Author: Leonardo de Moura
#include "library/io_state_stream.h"
#include "library/definition_cache.h"
#include "library/declaration_index.h"
#include "library/simple_formatter.h"
#include "library/print.h"
#include "library/error_handling/error_handling.h"
#include "frontends/lean/parser.h"
#include "frontends/lean/pp.h"

View file

@ -12,7 +12,7 @@ Author: Leonardo de Moura
#include "kernel/type_checker.h"
#include "kernel/abstract.h"
#include "kernel/kernel_exception.h"
#include "library/simple_formatter.cpp"
#include "library/print.h"
using namespace lean;
static environment add_decl(environment const & env, declaration const & d) {
@ -21,7 +21,7 @@ static environment add_decl(environment const & env, declaration const & d) {
}
formatter mk_formatter(environment const & env) {
return mk_simple_formatter_factory()(env, options());
return mk_print_formatter_factory()(env, options());
}
static void tst1() {

View file

@ -16,7 +16,7 @@ Author: Leonardo de Moura
#include "kernel/abstract.h"
#include "kernel/instantiate.h"
#include "library/max_sharing.h"
#include "library/simple_formatter.h"
#include "library/print.h"
#include "library/deep_copy.h"
#include "library/kernel_serializer.h"
using namespace lean;

View file

@ -8,7 +8,7 @@ Author: Leonardo de Moura
#include "util/test.h"
#include "kernel/abstract.h"
#include "library/max_sharing.h"
#include "library/simple_formatter.h"
#include "library/print.h"
using namespace lean;
static void tst1() {

View file

@ -14,7 +14,7 @@ Author: Leonardo de Moura
#include "kernel/metavar.h"
#include "kernel/instantiate.h"
#include "kernel/abstract.h"
#include "library/simple_formatter.h"
#include "library/print.h"
using namespace lean;
void collect_assumptions(justification const & j, buffer<unsigned> & r) {

View file

@ -11,7 +11,7 @@ Author: Leonardo de Moura
#include "kernel/instantiate.h"
#include "kernel/expr_maps.h"
#include "kernel/replace_fn.h"
#include "library/simple_formatter.h"
#include "library/print.h"
using namespace lean;
expr mk_big(expr f, unsigned depth, unsigned val) {