fix(util/sexpr/option_declarations): default value in help message, fixes #212
This commit is contained in:
parent
8e7aac1eb4
commit
e40f8ffe57
4 changed files with 15 additions and 14 deletions
|
@ -11,6 +11,7 @@ Author: Leonardo de Moura
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "util/stackinfo.h"
|
#include "util/stackinfo.h"
|
||||||
|
#include "util/macros.h"
|
||||||
#include "util/debug.h"
|
#include "util/debug.h"
|
||||||
#include "util/sstream.h"
|
#include "util/sstream.h"
|
||||||
#include "util/interrupt.h"
|
#include "util/interrupt.h"
|
||||||
|
@ -60,13 +61,10 @@ static void on_ctrl_c(int ) {
|
||||||
lean::request_interrupt();
|
lean::request_interrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define XSTR(x) #x
|
|
||||||
#define STR(x) XSTR(x)
|
|
||||||
|
|
||||||
static void display_header(std::ostream & out) {
|
static void display_header(std::ostream & out) {
|
||||||
out << "Lean (version " << LEAN_VERSION_MAJOR << "." << LEAN_VERSION_MINOR
|
out << "Lean (version " << LEAN_VERSION_MAJOR << "." << LEAN_VERSION_MINOR
|
||||||
<< ", commit " << std::string(g_githash).substr(0, 12)
|
<< ", commit " << std::string(g_githash).substr(0, 12)
|
||||||
<< ", " << STR(LEAN_BUILD_TYPE) << ")\n";
|
<< ", " << LEAN_STR(LEAN_BUILD_TYPE) << ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
static void display_help(std::ostream & out) {
|
static void display_help(std::ostream & out) {
|
||||||
|
|
10
src/util/macros.h
Normal file
10
src/util/macros.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
||||||
|
Released under Apache 2.0 license as described in the file LICENSE.
|
||||||
|
|
||||||
|
Author: Leonardo de Moura
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define LEAN_XSTR(x) #x
|
||||||
|
#define LEAN_STR(x) LEAN_XSTR(x)
|
|
@ -7,6 +7,7 @@ Author: Leonardo de Moura
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "util/macros.h"
|
||||||
#include "util/sexpr/options.h"
|
#include "util/sexpr/options.h"
|
||||||
|
|
||||||
namespace lean {
|
namespace lean {
|
||||||
|
@ -36,6 +37,6 @@ void initialize_option_declarations();
|
||||||
void finalize_option_declarations();
|
void finalize_option_declarations();
|
||||||
option_declarations const & get_option_declarations();
|
option_declarations const & get_option_declarations();
|
||||||
void register_option(name const & n, option_kind k, char const * default_value, char const * description);
|
void register_option(name const & n, option_kind k, char const * default_value, char const * description);
|
||||||
#define register_bool_option(n, v, d) register_option(n, BoolOption, #v, d)
|
#define register_bool_option(n, v, d) register_option(n, BoolOption, LEAN_STR(v), d)
|
||||||
#define register_unsigned_option(n, v, d) register_option(n, UnsignedOption, #v, d)
|
#define register_unsigned_option(n, v, d) register_option(n, UnsignedOption, LEAN_STR(v), d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,14 +90,6 @@ struct mk_option_declaration {
|
||||||
|
|
||||||
int mk_options(name const & prefix, lua_State * L);
|
int mk_options(name const & prefix, lua_State * L);
|
||||||
|
|
||||||
#define LEAN_MAKE_OPTION_NAME_CORE(LINE) LEAN_OPTION_ ## LINE
|
|
||||||
#define LEAN_MAKE_OPTION_NAME(LINE) LEAN_MAKE_OPTION_NAME_CORE(LINE)
|
|
||||||
#define LEAN_OPTION_UNIQUE_NAME LEAN_MAKE_OPTION_NAME(__LINE__)
|
|
||||||
#define RegisterOption(N, K, D, DESC) static ::lean::mk_option_declaration LEAN_OPTION_UNIQUE_NAME(N, K, D, DESC)
|
|
||||||
#define RegisterOptionCore(N, K, D, DESC) RegisterOption(N, K, #D, DESC)
|
|
||||||
#define RegisterBoolOption(N, D, DESC) RegisterOptionCore(N, BoolOption, D, DESC);
|
|
||||||
#define RegisterUnsignedOption(N, D, DESC) RegisterOptionCore(N, UnsignedOption, D, DESC);
|
|
||||||
|
|
||||||
UDATA_DEFS(options)
|
UDATA_DEFS(options)
|
||||||
int options_update(lua_State * L);
|
int options_update(lua_State * L);
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue