[build] some refactoring of files

pull/672/head
Timothy Stack 5 years ago
parent 63e53377c3
commit fb7d6eafaf

@ -246,6 +246,11 @@ AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([TESTS_ENVIRONMENT])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([src/base/Makefile])
AC_CONFIG_FILES([src/fmtlib/Makefile])
AC_CONFIG_FILES([src/pcrepp/Makefile])
AC_CONFIG_FILES([src/yajl/Makefile])
AC_CONFIG_FILES([src/yajlpp/Makefile])
AC_CONFIG_FILES([test/Makefile])
AC_OUTPUT

@ -1,190 +1,191 @@
set(diag_STAT_SRCS
ansi_scrubber.cc
bookmarks.cc
bottom_status_source.cc
collation-functions.cc
command_executor.cc
curl_looper.cc
db_sub_source.cc
elem_to_json.cc
environ_vtab.cc
extension-functions.cc
field_overlay_source.cc
file_vtab.cc
filter_observer.cc
filter_status_source.cc
filter_sub_source.cc
fs-extension-functions.cc
fstat_vtab.cc
fts_fuzzy_match.cc
grep_proc.cc
help_text_formatter.cc
hist_source.cc
hotkeys.cc
input_dispatcher.cc
intern_string.cc
is_utf8.cc
json-extension-functions.cc
json_op.cc
json_ptr.cc
line_buffer.cc
listview_curses.cc
lnav_commands.cc
lnav_config.cc
lnav_log.cc
lnav_util.cc
log_accel.cc
log_actions.cc
log_format.cc
log_format_loader.cc
log_level.cc
logfile.cc
logfile_sub_source.cc
network-extension-functions.cc
data_scanner.cc
data_parser.cc
papertrail_proc.cc
ptimec_rt.cc
pretty_printer.cc
readline_callbacks.cc
readline_curses.cc
readline_highlighters.cc
readline_possibilities.cc
regexp_vtab.cc
relative_time.cc
session_data.cc
sequence_matcher.cc
shared_buffer.cc
shlex.cc
sqlite-extension-func.cc
statusview_curses.cc
string-extension-functions.cc
sysclip.cc
pcrepp.cc
piper_proc.cc
ptimec.cc
sql_util.cc
state-extension-functions.cc
strnatcmp.c
text_format.cc
textfile_highlighters.cc
textview_curses.cc
time-extension-functions.cc
timer.cc
unique_path.hh
view_curses.cc
view_helpers.cc
views_vtab.cc
vt52_curses.cc
vtab_module.cc
log_vtab_impl.cc
xterm_mouse.cc
yajlpp.cc
yajl/yajl.c
yajl/yajl_alloc.c
yajl/yajl_alloc.h
yajl/yajl_buf.c
yajl/yajl_buf.h
yajl/yajl_bytestack.h
yajl/yajl_encode.c
yajl/yajl_encode.h
yajl/yajl_gen.c
yajl/yajl_lex.c
yajl/yajl_lex.h
yajl/yajl_parser.c
yajl/yajl_parser.h
yajl/yajl_tree.c
yajl/yajl_version.c
spookyhash/SpookyV2.cpp
ansi_scrubber.cc
bookmarks.cc
bottom_status_source.cc
collation-functions.cc
command_executor.cc
curl_looper.cc
db_sub_source.cc
elem_to_json.cc
environ_vtab.cc
extension-functions.cc
field_overlay_source.cc
file_vtab.cc
filter_observer.cc
filter_status_source.cc
filter_sub_source.cc
fs-extension-functions.cc
fstat_vtab.cc
fts_fuzzy_match.cc
grep_proc.cc
help_text_formatter.cc
hist_source.cc
hotkeys.cc
input_dispatcher.cc
intern_string.cc
is_utf8.cc
json-extension-functions.cc
yajlpp/json_op.cc
yajlpp/json_ptr.cc
line_buffer.cc
listview_curses.cc
lnav_commands.cc
lnav_config.cc
base/lnav_log.cc
lnav_util.cc
log_accel.cc
log_actions.cc
log_format.cc
log_format_loader.cc
log_level.cc
logfile.cc
logfile_sub_source.cc
network-extension-functions.cc
data_scanner.cc
data_parser.cc
papertrail_proc.cc
ptimec_rt.cc
pretty_printer.cc
readline_callbacks.cc
readline_curses.cc
readline_highlighters.cc
readline_possibilities.cc
regexp_vtab.cc
relative_time.cc
session_data.cc
sequence_matcher.cc
shared_buffer.cc
shlex.cc
sqlite-extension-func.cc
statusview_curses.cc
string-extension-functions.cc
sysclip.cc
pcrepp/pcrepp.cc
piper_proc.cc
ptimec.cc
sql_util.cc
state-extension-functions.cc
strnatcmp.c
text_format.cc
textfile_highlighters.cc
textview_curses.cc
time-extension-functions.cc
timer.cc
unique_path.hh
view_curses.cc
view_helpers.cc
views_vtab.cc
vt52_curses.cc
vtab_module.cc
log_vtab_impl.cc
xterm_mouse.cc
yajlpp/yajlpp.cc
yajl/yajl.c
yajl/yajl_alloc.c
yajl/yajl_alloc.h
yajl/yajl_buf.c
yajl/yajl_buf.h
yajl/yajl_bytestack.h
yajl/yajl_encode.c
yajl/yajl_encode.h
yajl/yajl_gen.c
yajl/yajl_lex.c
yajl/yajl_lex.h
yajl/yajl_parser.c
yajl/yajl_parser.h
yajl/yajl_tree.c
yajl/yajl_version.c
spookyhash/SpookyV2.cpp
all_logs_vtab.hh
attr_line.hh
auto_fd.hh
auto_mem.hh
auto_pid.hh
big_array.hh
bottom_status_source.hh
byte_array.hh
command_executor.hh
column_namer.hh
curl_looper.hh
default-log-formats-json.hh
doc_status_source.hh
elem_to_json.hh
field_overlay_source.hh
file_vtab.hh
filter_observer.hh
filter_status_source.hh
filter_sub_source.hh
format-text-files.hh
fstat_vtab.hh
fts_fuzzy_match.hh
grep_highlighter.hh
help.hh
help_text_formatter.hh
highlighter.hh
hotkeys.hh
init-sql.hh
input_dispatcher.hh
intern_string.hh
is_utf8.hh
k_merge_tree.h
log_actions.hh
log_data_helper.hh
log_data_table.hh
log_format_impls.cc
log_gutter_source.hh
log_level.hh
log_search_table.hh
logfile_stats.hh
optional.hpp
papertrail_proc.hh
plain_text_source.hh
pretty_printer.hh
preview_status_source.hh
ptimec.hh
pthreadpp.hh
readline_callbacks.hh
readline_possibilities.hh
regexp_vtab.hh
relative_time.hh
all_logs_vtab.hh
attr_line.hh
auto_fd.hh
auto_mem.hh
auto_pid.hh
big_array.hh
bottom_status_source.hh
byte_array.hh
command_executor.hh
column_namer.hh
curl_looper.hh
default-log-formats-json.hh
doc_status_source.hh
elem_to_json.hh
field_overlay_source.hh
file_vtab.hh
filter_observer.hh
filter_status_source.hh
filter_sub_source.hh
format-text-files.hh
fstat_vtab.hh
fts_fuzzy_match.hh
grep_highlighter.hh
help.hh
help_text.hh
help_text_formatter.hh
highlighter.hh
hotkeys.hh
init-sql.hh
input_dispatcher.hh
intern_string.hh
is_utf8.hh
k_merge_tree.h
log_actions.hh
log_data_helper.hh
log_data_table.hh
log_format_impls.cc
log_gutter_source.hh
log_level.hh
log_search_table.hh
logfile_stats.hh
optional.hpp
papertrail_proc.hh
plain_text_source.hh
pretty_printer.hh
preview_status_source.hh
ptimec.hh
base/pthreadpp.hh
readline_callbacks.hh
readline_possibilities.hh
regexp_vtab.hh
relative_time.hh
styling.hh
ring_span.hh
sequence_sink.hh
shlex.hh
simdutf8check.h
spectro_source.hh
strong_int.hh
sysclip.hh
term_extra.hh
termios_guard.hh
text_format.hh
textfile_highlighters.hh
textfile_sub_source.hh
time_T.hh
timer.hh
top_status_source.hh
url_loader.hh
views_vtab.hh
vtab_module.hh
xterm-palette.hh
yajlpp.hh
yajlpp_def.hh
ring_span.hh
sequence_sink.hh
shlex.hh
simdutf8check.h
spectro_source.hh
strong_int.hh
sysclip.hh
term_extra.hh
termios_guard.hh
text_format.hh
textfile_highlighters.hh
textfile_sub_source.hh
time_T.hh
timer.hh
top_status_source.hh
url_loader.hh
views_vtab.hh
vtab_module.hh
xterm-palette.hh
yajlpp/yajlpp.hh
yajlpp/yajlpp_def.hh
mapbox/recursive_wrapper.hpp
mapbox/variant.hpp
mapbox/variant_io.hpp
mapbox/variant_visitor.hpp
mapbox/recursive_wrapper.hpp
mapbox/variant.hpp
mapbox/variant_io.hpp
mapbox/variant_visitor.hpp
yajl/api/yajl_common.h
yajl/api/yajl_gen.h
yajl/api/yajl_parse.h
yajl/api/yajl_tree.h
yajl/api/yajl_common.h
yajl/api/yajl_gen.h
yajl/api/yajl_parse.h
yajl/api/yajl_tree.h
filesystem/fwd.h
filesystem/path.h
filesystem/resolver.h
filesystem/fwd.h
filesystem/path.h
filesystem/resolver.h
fmtlib/posix.cc
fmtlib/fmt/time.h
@ -201,7 +202,7 @@ set(diag_STAT_SRCS
fmtlib/format.cc
../../lbuild-debug/src/config.h
)
)
set(lnav_SRCS lnav.cc)

@ -1,4 +1,6 @@
SUBDIRS = base fmtlib pcrepp yajl yajlpp .
bin_PROGRAMS = lnav
noinst_PROGRAMS = bin2c ptimec lnav-test
@ -129,6 +131,11 @@ AM_CPPFLAGS = \
LDADD = \
libdiag.a \
base/libbase.a \
fmtlib/libcppfmt.a \
pcrepp/libpcrepp.a \
yajl/libyajl.a \
yajlpp/libyajlpp.a \
$(READLINE_LIBS) \
$(CURSES_LIB) \
$(SQLITE3_LIBS) \
@ -186,6 +193,7 @@ noinst_HEADERS = \
grep_proc.hh \
help.hh \
help.txt \
help_text.hh \
help_text_formatter.hh \
highlighter.hh \
hist_source.hh \
@ -195,15 +203,12 @@ noinst_HEADERS = \
input_dispatcher.hh \
intern_string.hh \
is_utf8.hh \
json_op.hh \
json_ptr.hh \
k_merge_tree.h \
line_buffer.hh \
listview_curses.hh \
lnav.hh \
lnav_commands.hh \
lnav_config.hh \
lnav_log.hh \
lnav_util.hh \
log_accel.hh \
log_actions.hh \
@ -223,12 +228,10 @@ noinst_HEADERS = \
mapbox/variant_visitor.hpp \
optional.hpp \
papertrail_proc.hh \
pcrepp.hh \
piper_proc.hh \
plain_text_source.hh \
pretty_printer.hh \
preview_status_source.hh \
pthreadpp.hh \
ptimec.hh \
readline_callbacks.hh \
readline_curses.hh \
@ -270,8 +273,6 @@ noinst_HEADERS = \
log_format_impls.cc \
xterm_mouse.hh \
xterm-palette.hh \
yajlpp.hh \
yajlpp_def.hh \
spookyhash/SpookyV2.h \
filesystem/fwd.h \
filesystem/path.h \
@ -288,22 +289,6 @@ noinst_HEADERS = \
fmtlib/fmt/posix.h \
fmtlib/fmt/format.h
if USE_INCLUDED_YAJL
noinst_HEADERS += yajl/api/yajl_common.h \
yajl/api/yajl_gen.h \
yajl/api/yajl_parse.h \
yajl/api/yajl_tree.h \
yajl/yajl_alloc.h \
yajl/yajl_buf.h \
yajl/yajl_bytestack.h \
yajl/yajl_common.h \
yajl/yajl_encode.h \
yajl/yajl_lex.h \
yajl/yajl_parser.h \
yajl/yajl_version.h
endif
libdiag_a_SOURCES = \
ansi-palette.c \
ansi_scrubber.cc \
@ -332,13 +317,10 @@ libdiag_a_SOURCES = \
intern_string.cc \
is_utf8.cc \
json-extension-functions.cc \
json_op.cc \
json_ptr.cc \
line_buffer.cc \
listview_curses.cc \
lnav_commands.cc \
lnav_config.cc \
lnav_log.cc \
lnav_util.cc \
log_accel.cc \
log_actions.cc \
@ -370,7 +352,6 @@ libdiag_a_SOURCES = \
string-extension-functions.cc \
text_format.cc \
timer.cc \
pcrepp.cc \
piper_proc.cc \
sql_util.cc \
state-extension-functions.cc \
@ -388,28 +369,7 @@ libdiag_a_SOURCES = \
log_vtab_impl.cc \
xterm_mouse.cc \
xterm-palette.c \
yajlpp.cc \
spookyhash/SpookyV2.cpp \
fmtlib/posix.cc \
fmtlib/format.cc
if USE_INCLUDED_YAJL
libdiag_a_SOURCES += yajl/yajl.c \
yajl/yajl_alloc.c \
yajl/yajl_alloc.h \
yajl/yajl_buf.c \
yajl/yajl_buf.h \
yajl/yajl_bytestack.h \
yajl/yajl_encode.c \
yajl/yajl_encode.h \
yajl/yajl_gen.c \
yajl/yajl_lex.c \
yajl/yajl_lex.h \
yajl/yajl_parser.c \
yajl/yajl_parser.h \
yajl/yajl_tree.c \
yajl/yajl_version.c
endif
spookyhash/SpookyV2.cpp
TEXT2C_FILES = \
ansi-palette.o \

@ -34,7 +34,7 @@
#include <vector>
#include "view_curses.hh"
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
#include "ansi_scrubber.hh"
using namespace std;

@ -39,7 +39,7 @@
#include <new>
#include <exception>
#include "lnav_log.hh"
#include "base/lnav_log.hh"
/**
* Resource management class for file descriptors.

@ -1,5 +1,5 @@
/**
* Copyright (c) 2007-2012, Timothy Stack
* Copyright (c) 2007-2019, Timothy Stack
*
* All rights reserved.
*
@ -29,8 +29,8 @@
* @file auto_mem.hh
*/
#ifndef __auto_mem_hh
#define __auto_mem_hh
#ifndef lnav_auto_mem_hh
#define lnav_auto_mem_hh
#include <string.h>
#include <unistd.h>
@ -49,23 +49,24 @@ typedef void (*free_func_t)(void *);
template<class T, free_func_t default_free = free>
class auto_mem {
public:
auto_mem(T *ptr = NULL) : am_ptr(ptr), am_free_func(default_free) { };
explicit auto_mem(T *ptr = nullptr)
: am_ptr(ptr), am_free_func(default_free) {
};
auto_mem(auto_mem & am)
auto_mem(auto_mem &am)
: am_ptr(am.release()), am_free_func(am.am_free_func)
{};
template<typename F>
auto_mem(F free_func)
: am_ptr(NULL), am_free_func((free_func_t)free_func) { };
explicit auto_mem(F free_func)
: am_ptr(nullptr), am_free_func((free_func_t)free_func) { };
auto_mem(auto_mem &&other) : am_ptr(nullptr) {
this->reset(other.release());
this->am_free_func = other.am_free_func;
auto_mem(auto_mem &&other) noexcept
: am_ptr(other.release()),
am_free_func(other.am_free_func) {
};
~auto_mem()
{
~auto_mem() {
this->reset();
};
@ -88,7 +89,7 @@ public:
{
T *retval = this->am_ptr;
this->am_ptr = NULL;
this->am_ptr = nullptr;
return retval;
};
@ -103,10 +104,10 @@ public:
return &this->am_ptr;
};
void reset(T *ptr = NULL)
void reset(T *ptr = nullptr)
{
if (this->am_ptr != ptr) {
if (this->am_ptr != NULL) {
if (this->am_ptr != nullptr) {
this->am_free_func((void *)this->am_ptr);
}
this->am_ptr = ptr;
@ -121,18 +122,17 @@ private:
template<typename T, void(*free_func) (T *)>
class static_root_mem {
public:
static_root_mem()
{
static_root_mem() {
memset(&this->srm_value, 0, sizeof(T));
};
~static_root_mem() { free_func(&this->srm_value); };
const T *operator->(void) const { return &this->srm_value; };
const T *operator->() const { return &this->srm_value; };
const T &in(void) const { return this->srm_value; };
const T &in() const { return this->srm_value; };
T *inout(void) {
T *inout() {
free_func(&this->srm_value);
memset(&this->srm_value, 0, sizeof(T));
return &this->srm_value;
@ -145,4 +145,5 @@ private:
T srm_value;
};
#endif

@ -0,0 +1,9 @@
noinst_LIBRARIES = libbase.a
noinst_HEADERS = \
lnav_log.hh \
pthreadpp.hh
libbase_a_SOURCES = \
lnav_log.cc

@ -40,7 +40,7 @@
#include <vector>
#include <algorithm>
#include "lnav_log.hh"
#include "base/lnav_log.hh"
struct bookmark_metadata {
static std::set<std::string> KNOWN_TAGS;

@ -35,7 +35,7 @@
#include <string>
#include "lnav_log.hh"
#include "base/lnav_log.hh"
template<size_t COUNT, typename T = unsigned char>
struct byte_array {

@ -31,7 +31,7 @@
#include <vector>
#include "json_ptr.hh"
#include "yajlpp/json_ptr.hh"
#include "pcrecpp.h"
#include "lnav.hh"
#include "log_format_loader.hh"

@ -59,9 +59,9 @@ public:
#include <curl/curl.h>
#include "auto_mem.hh"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "lnav_util.hh"
#include "pthreadpp.hh"
#include "base/pthreadpp.hh"
class curl_request {
public:

@ -40,9 +40,9 @@
#include <iterator>
#include <algorithm>
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "lnav_util.hh"
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
#include "byte_array.hh"
#include "data_scanner.hh"

@ -33,7 +33,7 @@
#include <netinet/in.h>
#include <sys/socket.h>
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
#include "data_scanner.hh"
using namespace std;

@ -32,7 +32,7 @@
#include <string>
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
#include "shared_buffer.hh"
enum data_token_t {

@ -29,7 +29,7 @@
#include "config.h"
#include "json_ptr.hh"
#include "yajlpp/json_ptr.hh"
#include "db_sub_source.hh"
const char *db_label_source::NULL_STR = "<NULL>";

@ -30,7 +30,7 @@
#include "config.h"
#include "elem_to_json.hh"
#include "yajlpp.hh"
#include "yajlpp/yajlpp.hh"
using namespace std;

@ -35,7 +35,7 @@
#include <string.h>
#include "auto_mem.hh"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "sql_util.hh"
#include "environ_vtab.hh"

@ -35,7 +35,7 @@
#include "lnav.hh"
#include "auto_mem.hh"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "sql_util.hh"
#include "file_vtab.hh"
#include "vtab_module.hh"

@ -0,0 +1,6 @@
noinst_LIBRARIES = libcppfmt.a
libcppfmt_a_SOURCES = \
format.cc \
posix.cc

@ -38,7 +38,7 @@
#include <pwd.h>
#include "auto_mem.hh"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "sql_util.hh"
#include "vtab_module.hh"
#include "fstat_vtab.hh"

@ -40,7 +40,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "lnav_util.hh"
#include "grep_proc.hh"
#include "listview_curses.hh"

@ -50,10 +50,10 @@
#include <vector>
#include <exception>
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
#include "auto_fd.hh"
#include "auto_mem.hh"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "strong_int.hh"
#include "line_buffer.hh"

@ -0,0 +1,206 @@
/**
* Copyright (c) 2019, Timothy Stack
*
* 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 Timothy Stack 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 REGENTS 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 REGENTS 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.
*/
#ifndef LNAV_HELP_TEXT_HH
#define LNAV_HELP_TEXT_HH
#include <map>
#include <string>
#include <vector>
enum class help_context_t {
HC_NONE,
HC_PARAMETER,
HC_RESULT,
HC_COMMAND,
HC_SQL_KEYWORD,
HC_SQL_FUNCTION,
HC_SQL_TABLE_VALUED_FUNCTION,
};
enum class help_nargs_t {
HN_REQUIRED,
HN_OPTIONAL,
HN_ZERO_OR_MORE,
HN_ONE_OR_MORE,
};
enum class help_parameter_format_t {
HPF_STRING,
HPF_REGEX,
HPF_INTEGER,
HPF_NUMBER,
HPF_DATETIME,
HPF_ENUM,
};
struct help_example {
const char *he_cmd{nullptr};
const char *he_result{nullptr};
};
struct help_text {
help_context_t ht_context{help_context_t::HC_NONE};
const char *ht_name{nullptr};
const char *ht_summary{nullptr};
const char *ht_flag_name{nullptr};
const char *ht_group_start{nullptr};
const char *ht_group_end{nullptr};
const char *ht_description{nullptr};
std::vector<struct help_text> ht_parameters;
std::vector<struct help_text> ht_results;
std::vector<struct help_example> ht_example;
help_nargs_t ht_nargs{help_nargs_t::HN_REQUIRED};
help_parameter_format_t ht_format{help_parameter_format_t::HPF_STRING};
std::vector<const char *> ht_enum_values;
std::vector<const char *> ht_tags;
std::vector<const char *> ht_opposites;
help_text() = default;
help_text(const char *name, const char *summary = nullptr)
: ht_name(name),
ht_summary(summary) {
if (name[0] == ':') {
this->ht_context = help_context_t::HC_COMMAND;
this->ht_name = &name[1];
}
};
help_text &command() {
this->ht_context = help_context_t::HC_COMMAND;
return *this;
};
help_text &sql_function() {
this->ht_context = help_context_t::HC_SQL_FUNCTION;
return *this;
};
help_text &sql_table_valued_function() {
this->ht_context = help_context_t::HC_SQL_TABLE_VALUED_FUNCTION;
return *this;
};
help_text &sql_keyword() {
this->ht_context = help_context_t::HC_SQL_KEYWORD;
return *this;
};
help_text &with_summary(const char *summary) {
this->ht_summary = summary;
return *this;
};
help_text &with_flag_name(const char *flag) {
this->ht_flag_name = flag;
return *this;
}
help_text &with_grouping(const char *group_start, const char *group_end) {
this->ht_group_start = group_start;
this->ht_group_end = group_end;
return *this;
}
help_text &with_parameters(const std::initializer_list<help_text> &params) {
this->ht_parameters = params;
for (auto &param : this->ht_parameters) {
param.ht_context = help_context_t::HC_PARAMETER;
}
return *this;
}
help_text &with_parameter(const help_text &ht) {
this->ht_parameters.emplace_back(ht);
this->ht_parameters.back().ht_context = help_context_t::HC_PARAMETER;
return *this;
};
help_text &with_result(const help_text &ht) {
this->ht_results.emplace_back(ht);
this->ht_results.back().ht_context = help_context_t::HC_RESULT;
return *this;
};
help_text &with_examples(const std::initializer_list<help_example> &examples) {
this->ht_example = examples;
return *this;
}
help_text &with_example(const help_example &example) {
this->ht_example.emplace_back(example);
return *this;
}
help_text &optional() {
this->ht_nargs = help_nargs_t::HN_OPTIONAL;
return *this;
};
help_text &zero_or_more() {
this->ht_nargs = help_nargs_t::HN_ZERO_OR_MORE;
return *this;
};
help_text &one_or_more() {
this->ht_nargs = help_nargs_t::HN_ONE_OR_MORE;
return *this;
};
help_text &with_format(help_parameter_format_t format) {
this->ht_format = format;
return *this;
}
help_text &with_enum_values(const std::initializer_list<const char*> &enum_values) {
this->ht_enum_values = enum_values;
return *this;
};
help_text &with_tags(const std::initializer_list<const char*> &tags) {
this->ht_tags = tags;
return *this;
};
help_text &with_opposites(const std::initializer_list<const char*> &opps) {
this->ht_opposites = opps;
return *this;
};
void index_tags() {
for (const auto &tag: this->ht_tags) {
TAGGED.insert(std::make_pair(tag, this));
}
};
static std::multimap<std::string, help_text *> TAGGED;
};
#endif

@ -43,7 +43,7 @@ std::multimap<std::string, help_text *> help_text::TAGGED;
void format_help_text_for_term(const help_text &ht, int width, attr_line_t &out, bool synopsis_only)
{
static size_t body_indent = 2;
static const size_t body_indent = 2;
view_colors &vc = view_colors::singleton();
text_wrap_settings tws;
@ -52,7 +52,7 @@ void format_help_text_for_term(const help_text &ht, int width, attr_line_t &out,
tws.with_width(width);
switch (ht.ht_context) {
case HC_COMMAND: {
case help_context_t::HC_COMMAND: {
out.append("Synopsis", &view_curses::VC_STYLE, A_UNDERLINE)
.append("\n")
.append(body_indent, ' ')
@ -60,14 +60,14 @@ void format_help_text_for_term(const help_text &ht, int width, attr_line_t &out,
.append(ht.ht_name, &view_curses::VC_STYLE, A_BOLD);
for (auto &param : ht.ht_parameters) {
out.append(" ");
if (param.ht_nargs == HN_OPTIONAL) {
if (param.ht_nargs == help_nargs_t::HN_OPTIONAL) {
out.append("[");
}
out.append(param.ht_name, &view_curses::VC_STYLE, A_UNDERLINE);
if (param.ht_nargs == HN_OPTIONAL) {
if (param.ht_nargs == help_nargs_t::HN_OPTIONAL) {
out.append("]");
}
if (param.ht_nargs == HN_ONE_OR_MORE) {
if (param.ht_nargs == help_nargs_t::HN_ONE_OR_MORE) {
out.append("1", &view_curses::VC_STYLE, A_UNDERLINE);
out.append(" [");
out.append("...", &view_curses::VC_STYLE, A_UNDERLINE);
@ -84,8 +84,8 @@ void format_help_text_for_term(const help_text &ht, int width, attr_line_t &out,
.append("\n");
break;
}
case HC_SQL_FUNCTION:
case HC_SQL_TABLE_VALUED_FUNCTION: {
case help_context_t::HC_SQL_FUNCTION:
case help_context_t::HC_SQL_TABLE_VALUED_FUNCTION: {
bool needs_comma = false;
out.append("Synopsis", &view_curses::VC_STYLE, A_UNDERLINE)
@ -102,8 +102,8 @@ void format_help_text_for_term(const help_text &ht, int width, attr_line_t &out,
out.append(", ");
}
out.append(param.ht_name, &view_curses::VC_STYLE, A_UNDERLINE);
if (param.ht_nargs == HN_ZERO_OR_MORE ||
param.ht_nargs == HN_ONE_OR_MORE) {
if (param.ht_nargs == help_nargs_t::HN_ZERO_OR_MORE ||
param.ht_nargs == help_nargs_t::HN_ONE_OR_MORE) {
out.append(", ...");
}
needs_comma = true;
@ -114,7 +114,7 @@ void format_help_text_for_term(const help_text &ht, int width, attr_line_t &out,
.append("\n");
break;
}
case HC_SQL_KEYWORD: {
case help_context_t::HC_SQL_KEYWORD: {
size_t line_start = body_indent;
bool break_all = false;
@ -133,8 +133,8 @@ void format_help_text_for_term(const help_text &ht, int width, attr_line_t &out,
out.append(body_indent + strlen(ht.ht_name) + 1, ' ');
break_all = true;
}
if (param.ht_nargs == HN_ZERO_OR_MORE ||
param.ht_nargs == HN_OPTIONAL) {
if (param.ht_nargs == help_nargs_t::HN_ZERO_OR_MORE ||
param.ht_nargs == help_nargs_t::HN_OPTIONAL) {
if (!break_all) {
out.append(" ");
}
@ -155,8 +155,8 @@ void format_help_text_for_term(const help_text &ht, int width, attr_line_t &out,
.append(param.ht_name, &view_curses::VC_STYLE,
A_UNDERLINE);
if (!param.ht_parameters.empty()) {
if (param.ht_nargs == HN_ZERO_OR_MORE ||
param.ht_nargs == HN_ONE_OR_MORE) {
if (param.ht_nargs == help_nargs_t::HN_ZERO_OR_MORE ||
param.ht_nargs == help_nargs_t::HN_ONE_OR_MORE) {
out.append("1", &view_curses::VC_STYLE, A_UNDERLINE);
}
if (param.ht_parameters[0].ht_flag_name) {
@ -171,8 +171,8 @@ void format_help_text_for_term(const help_text &ht, int width, attr_line_t &out,
A_UNDERLINE);
}
}
if (param.ht_nargs == HN_ZERO_OR_MORE ||
param.ht_nargs == HN_ONE_OR_MORE) {
if (param.ht_nargs == help_nargs_t::HN_ZERO_OR_MORE ||
param.ht_nargs == help_nargs_t::HN_ONE_OR_MORE) {
bool needs_comma = param.ht_parameters.empty() ||
!param.ht_flag_name;
@ -209,8 +209,8 @@ void format_help_text_for_term(const help_text &ht, int width, attr_line_t &out,
.append(param.ht_group_end, &view_curses::VC_STYLE,
A_BOLD);
}
if (param.ht_nargs == HN_ZERO_OR_MORE ||
param.ht_nargs == HN_OPTIONAL) {
if (param.ht_nargs == help_nargs_t::HN_ZERO_OR_MORE ||
param.ht_nargs == help_nargs_t::HN_OPTIONAL) {
out.append("]");
}
}
@ -312,11 +312,11 @@ void format_help_text_for_term(const help_text &ht, int width, attr_line_t &out,
string name = related.ht_name;
switch (related.ht_context) {
case HC_COMMAND:
case help_context_t::HC_COMMAND:
name = ":" + name;
break;
case HC_SQL_FUNCTION:
case HC_SQL_TABLE_VALUED_FUNCTION:
case help_context_t::HC_SQL_FUNCTION:
case help_context_t::HC_SQL_TABLE_VALUED_FUNCTION:
name = name + "()";
break;
default:
@ -349,19 +349,17 @@ void format_help_text_for_term(const help_text &ht, int width, attr_line_t &out,
}
}
void format_example_text_for_term(const help_text &ht, int width, attr_line_t &out)
void format_example_text_for_term(const help_text &ht,
const help_example_to_attr_line_fun_t eval,
int width, attr_line_t &out)
{
text_wrap_settings tws;
tws.with_width(width);
if (!ht.ht_example.empty()) {
map<string, string> vars;
int count = 1;
vars["name"] = ht.ht_name;
add_ansi_vars(vars);
out.append(ht.ht_example.size() == 1 ? "Example" : "Examples",
&view_curses::VC_STYLE,
A_UNDERLINE)
@ -379,15 +377,15 @@ void format_example_text_for_term(const help_text &ht, int width, attr_line_t &o
out.append("\n");
}
switch (ht.ht_context) {
case HC_COMMAND:
case help_context_t::HC_COMMAND:
ex_line.insert(0, 1, ' ');
ex_line.insert(0, 1, ':');
ex_line.insert(1, ht.ht_name);
readline_command_highlighter(ex_line, 0);
break;
case HC_SQL_KEYWORD:
case HC_SQL_FUNCTION:
case HC_SQL_TABLE_VALUED_FUNCTION:
case help_context_t::HC_SQL_KEYWORD:
case help_context_t::HC_SQL_FUNCTION:
case help_context_t::HC_SQL_TABLE_VALUED_FUNCTION:
readline_sqlite_highlighter(ex_line, 0);
prompt = ";";
break;
@ -402,7 +400,7 @@ void format_example_text_for_term(const help_text &ht, int width, attr_line_t &o
.append(ex_line, &tws.with_indent(3 + keyword_offset + 1))
.append("\n")
.append(3, ' ')
.append(ex.he_result, &tws.with_indent(3))
.append(eval(ht, ex), &tws.with_indent(3))
.append("\n");
count += 1;

@ -30,184 +30,18 @@
#ifndef LNAV_HELP_TEXT_FORMATTER_HH
#define LNAV_HELP_TEXT_FORMATTER_HH
#include <map>
#include <string>
#include <vector>
#include <functional>
#include "help_text.hh"
#include "attr_line.hh"
enum help_context_t {
HC_NONE,
HC_PARAMETER,
HC_RESULT,
HC_COMMAND,
HC_SQL_KEYWORD,
HC_SQL_FUNCTION,
HC_SQL_TABLE_VALUED_FUNCTION,
};
enum help_nargs_t {
HN_REQUIRED,
HN_OPTIONAL,
HN_ZERO_OR_MORE,
HN_ONE_OR_MORE,
};
enum help_parameter_format_t {
HPF_STRING,
HPF_REGEX,
HPF_INTEGER,
HPF_NUMBER,
HPF_DATETIME,
HPF_ENUM,
};
struct help_example {
const char *he_cmd;
attr_line_t he_result;
};
struct help_text {
help_context_t ht_context{HC_NONE};
const char *ht_name;
const char *ht_summary;
const char *ht_flag_name{nullptr};
const char *ht_group_start{nullptr};
const char *ht_group_end{nullptr};
const char *ht_description{nullptr};
std::vector<struct help_text> ht_parameters;
std::vector<struct help_text> ht_results;
std::vector<struct help_example> ht_example;
help_nargs_t ht_nargs{HN_REQUIRED};
help_parameter_format_t ht_format{HPF_STRING};
std::vector<const char *> ht_enum_values;
std::vector<const char *> ht_tags;
std::vector<const char *> ht_opposites;
help_text() {
};
help_text(const char *name, const char *summary = nullptr)
: ht_name(name),
ht_summary(summary) {
if (name[0] == ':') {
this->ht_context = HC_COMMAND;
this->ht_name = &name[1];
}
};
help_text &command() {
this->ht_context = HC_COMMAND;
return *this;
};
help_text &sql_function() {
this->ht_context = HC_SQL_FUNCTION;
return *this;
};
help_text &sql_table_valued_function() {
this->ht_context = HC_SQL_TABLE_VALUED_FUNCTION;
return *this;
};
help_text &sql_keyword() {
this->ht_context = HC_SQL_KEYWORD;
return *this;
};
help_text &with_summary(const char *summary) {
this->ht_summary = summary;
return *this;
};
help_text &with_flag_name(const char *flag) {
this->ht_flag_name = flag;
return *this;
}
help_text &with_grouping(const char *group_start, const char *group_end) {
this->ht_group_start = group_start;
this->ht_group_end = group_end;
return *this;
}
help_text &with_parameters(const std::initializer_list<help_text> &params) {
this->ht_parameters = params;
for (auto &param : this->ht_parameters) {
param.ht_context = HC_PARAMETER;
}
return *this;
}
help_text &with_parameter(const help_text &ht) {
this->ht_parameters.emplace_back(ht);
this->ht_parameters.back().ht_context = HC_PARAMETER;
return *this;
};
help_text &with_result(const help_text &ht) {
this->ht_results.emplace_back(ht);
this->ht_results.back().ht_context = HC_RESULT;
return *this;
};
help_text &with_examples(const std::initializer_list<help_example> &examples) {
this->ht_example = examples;
return *this;
}
help_text &with_example(const help_example &example) {
this->ht_example.emplace_back(example);
return *this;
}
help_text &optional() {
this->ht_nargs = HN_OPTIONAL;
return *this;
};
help_text &zero_or_more() {
this->ht_nargs = HN_ZERO_OR_MORE;
return *this;
};
help_text &one_or_more() {
this->ht_nargs = HN_ONE_OR_MORE;
return *this;
};
help_text &with_format(help_parameter_format_t format) {
this->ht_format = format;
return *this;
}
help_text &with_enum_values(const std::initializer_list<const char*> &enum_values) {
this->ht_enum_values = enum_values;
return *this;
};
help_text &with_tags(const std::initializer_list<const char*> &tags) {
this->ht_tags = tags;
return *this;
};
help_text &with_opposites(const std::initializer_list<const char*> &opps) {
this->ht_opposites = opps;
return *this;
};
void index_tags() {
for (const auto &tag: this->ht_tags) {
TAGGED.insert(std::make_pair(tag, this));
}
};
static std::multimap<std::string, help_text *> TAGGED;
};
using help_example_to_attr_line_fun_t =
std::function<attr_line_t(const help_text &, const help_example &)>;
void format_help_text_for_term(const help_text &ht, int width, attr_line_t &out, bool synopsis_only = false);
void format_example_text_for_term(const help_text &ht, int width, attr_line_t &out);
void format_example_text_for_term(
const help_text &ht,
const help_example_to_attr_line_fun_t eval,
int width, attr_line_t &out);
#endif //LNAV_HELP_TEXT_FORMATTER_HH

@ -33,7 +33,7 @@
#define __highlighter_hh
#include "optional.hpp"
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
#include "text_format.hh"
#include "view_curses.hh"

@ -40,7 +40,7 @@
#include "mapbox/variant.hpp"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "strong_int.hh"
#include "textview_curses.hh"

@ -48,6 +48,7 @@
# error "SysV or X/Open-compatible Curses header file required"
#endif
#include "base/lnav_log.hh"
#include "input_dispatcher.hh"
void input_dispatcher::new_input(const struct timeval &current_time, int ch)
@ -63,12 +64,12 @@ void input_dispatcher::new_input(const struct timeval &current_time, int ch)
break;
default:
if (this->id_escape_index > 0) {
this->append_to_escape_buffer(ch);
if (strcmp("\x1b[", this->id_escape_buffer) == 0) {
this->id_mouse_handler();
this->id_escape_index = 0;
} else {
this->append_to_escape_buffer(ch);
switch (this->id_escape_matcher(this->id_escape_buffer)) {
case escape_match_t::NONE:
for (int lpc = 0; this->id_escape_buffer[lpc]; lpc++) {

@ -40,8 +40,8 @@
#include "sqlite3.h"
#include "yajlpp.hh"
#include "json_op.hh"
#include "yajlpp/yajlpp.hh"
#include "yajlpp/json_op.hh"
#include "mapbox/variant.hpp"
#include "vtab_module.hh"
@ -197,18 +197,17 @@ static void sql_jget(sqlite3_context *context,
const char *ptr_in = (const char *)sqlite3_value_text(argv[1]);
json_ptr jp(ptr_in);
sql_json_op jo(jp);
auto_mem<yajl_gen_t> gen(yajl_gen_free);
auto_mem<yajl_handle_t> handle(yajl_free);
const unsigned char *err;
yajlpp_gen gen;
gen = yajl_gen_alloc(nullptr);
yajl_gen_config(gen.in(), yajl_gen_beautify, false);
yajl_gen_config(gen, yajl_gen_beautify, false);
jo.jo_ptr_callbacks = json_op::gen_callbacks;
jo.jo_ptr_callbacks.yajl_null = gen_handle_null;
jo.jo_ptr_callbacks.yajl_boolean = gen_handle_boolean;
jo.jo_ptr_callbacks.yajl_string = gen_handle_string;
jo.jo_ptr_data = gen.in();
jo.jo_ptr_data = gen.get_handle();
handle.reset(yajl_alloc(&json_op::ptr_callbacks, nullptr, &jo));
switch (yajl_parse(handle.in(), (const unsigned char *)json_in, strlen(json_in))) {
@ -257,17 +256,14 @@ static void sql_jget(sqlite3_context *context,
return;
}
const unsigned char *buf;
size_t len;
string_fragment result = gen.to_string_fragment();
yajl_gen_get_buf(gen, &buf, &len);
if (len == 0) {
if (result.empty()) {
null_or_default(context, argc, argv);
return;
}
sqlite3_result_text(context, (const char *) buf, len, SQLITE_TRANSIENT);
sqlite3_result_text(context, result.data(), result.length(), SQLITE_TRANSIENT);
}
struct json_agg_context {

@ -39,7 +39,7 @@
#include <exception>
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "auto_fd.hh"
#include "auto_mem.hh"
#include "shared_buffer.hh"

@ -36,7 +36,7 @@
#include <cmath>
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "listview_curses.hh"
using namespace std;

@ -83,7 +83,7 @@
#include "help.hh"
#include "init-sql.hh"
#include "logfile.hh"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "log_accel.hh"
#include "lnav_util.hh"
#include "ansi_scrubber.hh"
@ -133,7 +133,7 @@
#endif
#include "papertrail_proc.hh"
#include "yajlpp.hh"
#include "yajlpp/yajlpp.hh"
#include "readline_callbacks.hh"
#include "command_executor.hh"
#include "plain_text_source.hh"
@ -338,8 +338,8 @@ bool setup_logline_table(exec_context &ec)
for (const auto &pair : sqlite_function_help) {
switch (pair.second->ht_context) {
case HC_SQL_FUNCTION:
case HC_SQL_TABLE_VALUED_FUNCTION: {
case help_context_t::HC_SQL_FUNCTION:
case help_context_t::HC_SQL_TABLE_VALUED_FUNCTION: {
string poss = pair.first +
(pair.second->ht_parameters.empty() ? "()" : ("("));

@ -332,6 +332,7 @@ extern const ssize_t ZOOM_COUNT;
void rebuild_hist();
void rebuild_indexes();
void execute_examples();
attr_line_t eval_example(const help_text &ht, const help_example &ex);
bool ensure_view(textview_curses *expected_tc);
bool toggle_view(textview_curses *toggle_tc);

@ -58,7 +58,7 @@
#include "yajl/api/yajl_parse.h"
#include "db_sub_source.hh"
#include "papertrail_proc.hh"
#include "json_op.hh"
#include "yajlpp/json_op.hh"
using namespace std;
@ -767,30 +767,22 @@ static string com_save_to(exec_context &ec, string cmdline, vector<string> &args
}
}
else if (args[0] == "write-json-to") {
yajl_gen handle = NULL;
yajlpp_gen gen;
if ((handle = yajl_gen_alloc(NULL)) == NULL) {
if (outfile != stdout) {
closer(outfile);
}
return "error: unable to allocate memory";
}
else {
yajl_gen_config(handle, yajl_gen_beautify, 1);
yajl_gen_config(handle,
yajl_gen_print_callback, yajl_writer, outfile);
yajl_gen_config(gen, yajl_gen_beautify, 1);
yajl_gen_config(gen,
yajl_gen_print_callback, yajl_writer, outfile);
{
yajlpp_array root_array(handle);
for (size_t row = 0; row < dls.dls_rows.size(); row++) {
if (ec.ec_dry_run && row > 10) {
break;
}
{
yajlpp_array root_array(gen);
json_write_row(handle, row);
line_count += 1;
for (size_t row = 0; row < dls.dls_rows.size(); row++) {
if (ec.ec_dry_run && row > 10) {
break;
}
json_write_row(gen, row);
line_count += 1;
}
}
}
@ -3222,26 +3214,18 @@ static string com_config(exec_context &ec, string cmdline, vector<string> &args)
}
if (jph != nullptr) {
auto_mem<yajl_gen_t> handle(yajl_gen_free);
handle = yajl_gen_alloc(nullptr);
yajlpp_gen_context ygc(handle, lnav_config_handlers);
yajl_gen_config(handle, yajl_gen_beautify, 1);
yajlpp_gen gen;
yajlpp_gen_context ygc(gen, lnav_config_handlers);
yajl_gen_config(gen, yajl_gen_beautify, 1);
ygc.with_context(ypc);
if (ypc.ypc_current_handler == nullptr) {
ygc.gen();
} else {
jph->gen(ygc, handle);
jph->gen(ygc, gen);
}
const unsigned char *buffer;
size_t len;
yajl_gen_get_buf(handle, &buffer, &len);
string old_value((char *) buffer, len);
string old_value = gen.to_string_fragment().to_string();
if (args.size() == 2 || ypc.ypc_current_handler == nullptr) {
vector<string> errors;
@ -3760,7 +3744,7 @@ readline_context::command_t STD_COMMANDS[] = {
help_text(":adjust-log-time")
.with_summary("Change the timestamps of the top file to be relative to the given date")
.with_parameter(help_text("timestamp", "The new timestamp for the top line in the view")
.with_format(HPF_DATETIME))
.with_format(help_parameter_format_t::HPF_DATETIME))
.with_example({"2017-01-02T05:33:00", ""})
.with_example({"-1h"})
},
@ -3772,7 +3756,7 @@ readline_context::command_t STD_COMMANDS[] = {
help_text(":unix-time")
.with_summary("Convert epoch time to a human-readable form")
.with_parameter(help_text("seconds", "The epoch timestamp to convert")
.with_format(HPF_INTEGER))
.with_format(help_parameter_format_t::HPF_INTEGER))
.with_example({"1490191111", "Wed Mar 22 06:58:31 2017 -0700 PDT -- 1490191111"})
},
{

@ -42,17 +42,18 @@
#include <iostream>
#include <stdexcept>
#include <fmt/format.h>
#include "pcrecpp.h"
#include "auto_fd.hh"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "lnav_util.hh"
#include "auto_mem.hh"
#include "auto_pid.hh"
#include "lnav_config.hh"
#include "yajlpp.hh"
#include "yajlpp_def.hh"
#include "yajlpp/yajlpp.hh"
#include "yajlpp/yajlpp_def.hh"
#include "shlex.hh"
#include "styling.hh"
@ -830,49 +831,35 @@ void reset_config(const std::string &path)
string save_config()
{
auto_mem<yajl_gen_t> handle(yajl_gen_free);
if ((handle = yajl_gen_alloc(NULL)) == NULL) {
return "error: Unable to create yajl_gen_object";
}
else {
char filename[128];
snprintf(filename, sizeof(filename), "config.json.%d.tmp", getpid());
string user_config_tmp = dotlnav_path(filename);
string user_config = dotlnav_path("config.json");
yajl_gen_config(handle, yajl_gen_beautify, true);
yajlpp_gen_context ygc(handle, lnav_config_handlers);
vector<string> errors;
yajlpp_gen gen;
string filename = fmt::format("config.json.{}.tmp", getpid());
string user_config_tmp = dotlnav_path(filename.c_str());
string user_config = dotlnav_path("config.json");
ygc.with_default_obj(lnav_default_config)
.with_obj(lnav_config);
ygc.gen();
yajl_gen_config(gen, yajl_gen_beautify, true);
yajlpp_gen_context ygc(gen, lnav_config_handlers);
vector<string> errors;
const unsigned char *buffer;
size_t len;
ygc.with_default_obj(lnav_default_config)
.with_obj(lnav_config);
ygc.gen();
yajl_gen_get_buf(handle, &buffer, &len);
{
auto_fd fd;
{
auto_fd fd;
if ((fd = open(user_config_tmp.c_str(),
O_WRONLY | O_CREAT | O_TRUNC, 0600)) == -1) {
return "error: unable to save configuration -- " +
string(strerror(errno));
} else {
string_fragment bits = gen.to_string_fragment();
if ((fd = open(user_config_tmp.c_str(),
O_WRONLY | O_CREAT | O_TRUNC, 0600)) == -1) {
return "error: unable to save configuration -- " +
string(strerror(errno));
}
else {
log_perror(write(fd, buffer, len));
}
log_perror(write(fd, bits.data(), bits.length()));
}
rename(user_config_tmp.c_str(), user_config.c_str());
}
rename(user_config_tmp.c_str(), user_config.c_str());
return "info: configuration saved";
}

@ -40,7 +40,7 @@
#include <functional>
#include <unordered_map>
#include "yajlpp.hh"
#include "yajlpp/yajlpp.hh"
#include "log_level.hh"
#include "styling.hh"

@ -42,7 +42,7 @@
#include "auto_fd.hh"
#include "lnav_util.hh"
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
#include "lnav_config.hh"
using namespace std;

@ -37,7 +37,7 @@
#include <cmath>
#include <algorithm>
#include "lnav_log.hh"
#include "base/lnav_log.hh"
/**
* Helper class for figuring out changes in the log message rate.

@ -41,8 +41,8 @@
#include "logfile_sub_source.hh"
#include "data_parser.hh"
#include "column_namer.hh"
#include "json_ptr.hh"
#include "lnav_log.hh"
#include "yajlpp/json_ptr.hh"
#include "base/lnav_log.hh"
#include "sql_util.hh"
class log_data_helper

@ -34,8 +34,8 @@
#include <string.h>
#include <strings.h>
#include "yajlpp.hh"
#include "yajlpp_def.hh"
#include "yajlpp/yajlpp.hh"
#include "yajlpp/yajlpp_def.hh"
#include "sql_util.hh"
#include "log_format.hh"
#include "log_vtab_impl.hh"

@ -48,9 +48,9 @@
#include <sstream>
#include "optional.hpp"
#include "pcrepp.hh"
#include "yajlpp.hh"
#include "lnav_log.hh"
#include "pcrepp/pcrepp.hh"
#include "yajlpp/yajlpp.hh"
#include "base/lnav_log.hh"
#include "lnav_util.hh"
#include "byte_array.hh"
#include "view_curses.hh"

@ -33,7 +33,7 @@
#include <stdio.h>
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
#include "sql_util.hh"
#include "log_format.hh"
#include "log_vtab_impl.hh"

@ -41,8 +41,8 @@
#include <string>
#include <fstream>
#include "yajlpp.hh"
#include "yajlpp_def.hh"
#include "yajlpp/yajlpp.hh"
#include "yajlpp/yajlpp_def.hh"
#include "lnav_config.hh"
#include "log_format.hh"
#include "auto_fd.hh"

@ -29,7 +29,7 @@
#include "config.h"
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
#include "log_level.hh"
const char *level_names[LEVEL__MAX + 1] = {

@ -29,10 +29,10 @@
#include "config.h"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "sql_util.hh"
#include "log_vtab_impl.hh"
#include "yajlpp_def.hh"
#include "yajlpp/yajlpp_def.hh"
#include "vtab_module.hh"
#include "logfile_sub_source.hh"

@ -44,7 +44,7 @@
#include <vector>
#include <algorithm>
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "byte_array.hh"
#include "line_buffer.hh"
#include "log_format.hh"

@ -41,7 +41,7 @@
#include <vector>
#include <algorithm>
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "log_accel.hh"
#include "strong_int.hh"
#include "logfile.hh"

@ -35,7 +35,7 @@
#include <curl/curl.h>
#include "papertrail_proc.hh"
#include "yajlpp_def.hh"
#include "yajlpp/yajlpp_def.hh"
#include "yajl/api/yajl_parse.h"
const char *papertrail_proc::PT_SEARCH_URL =

@ -45,7 +45,7 @@
#include "auto_fd.hh"
#include "auto_mem.hh"
#include "yajlpp.hh"
#include "yajlpp/yajlpp.hh"
#include "curl_looper.hh"
#include "line_buffer.hh"

@ -0,0 +1,12 @@
AM_CPPFLAGS = \
-Wall \
-I$(top_srcdir)/src
noinst_LIBRARIES = libpcrepp.a
noinst_HEADERS = \
pcrepp.hh
libpcrepp_a_SOURCES = \
pcrepp.cc

@ -55,7 +55,7 @@
#include <vector>
#include <exception>
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "auto_mem.hh"
#include "intern_string.hh"

@ -45,7 +45,7 @@
#include <stdlib.h>
#include <poll.h>
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "piper_proc.hh"
#include "line_buffer.hh"

@ -448,7 +448,7 @@ inline void ftime_i(char *dst, off_t &off_inout, ssize_t len, const struct exttm
off_inout = strlen(dst);
}
#include "lnav_log.hh"
#include "base/lnav_log.hh"
inline bool ptime_6(struct exttm *dst, const char *str, off_t &off_inout, ssize_t len)
{

@ -221,7 +221,7 @@ void rl_change(void *dummy, readline_curses *rc)
al.clear();
etc.get_dimensions(height, width);
format_example_text_for_term(ht, width, al);
format_example_text_for_term(ht, eval_example, width, al);
lnav_data.ld_example_source.replace_with(al);
}
@ -418,7 +418,7 @@ static void rl_search_internal(void *dummy, readline_curses *rc, bool complete =
format_help_text_for_term(ht, min(70UL, doc_width), doc_al,
help_count > 1);
if (help_count == 1) {
format_example_text_for_term(ht, ex_width, ex_al);
format_example_text_for_term(ht, eval_example, ex_width, ex_al);
}
}

@ -55,10 +55,10 @@
#include <string>
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
#include "shlex.hh"
#include "auto_mem.hh"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "lnav_util.hh"
#include "ansi_scrubber.hh"
#include "readline_curses.hh"

@ -31,7 +31,7 @@
#include "config.h"
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
#include "sql_util.hh"
#include "shlex.hh"
#include "lnav_util.hh"

@ -37,7 +37,7 @@
#include "sql_util.hh"
#include "data_parser.hh"
#include "sysclip.hh"
#include "yajlpp_def.hh"
#include "yajlpp/yajlpp_def.hh"
#include "lnav_config.hh"
#include "sqlite-extension-func.hh"

@ -35,7 +35,7 @@
#include "logfile.hh"
#include "auto_mem.hh"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "sql_util.hh"
#include "file_vtab.hh"
#include "vtab_module.hh"

@ -33,7 +33,7 @@
#include <cstdlib>
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
#include "lnav_util.hh"
#include "relative_time.hh"

@ -43,8 +43,8 @@
#include <utility>
#include <yajl/api/yajl_tree.h>
#include "yajlpp.hh"
#include "yajlpp_def.hh"
#include "yajlpp/yajlpp.hh"
#include "yajlpp/yajlpp_def.hh"
#include "lnav.hh"
#include "logfile.hh"
#include "sql_util.hh"

@ -38,7 +38,7 @@
#include <sys/queue.h>
#include "auto_mem.hh"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
class shared_buffer;

@ -36,7 +36,7 @@
#include <vector>
#include <string>
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
enum shlex_token_t {
ST_ERROR,

@ -9,7 +9,7 @@
#include <stdint.h>
#include <x86intrin.h>
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#ifdef __cplusplus
extern "C" {

@ -40,9 +40,9 @@
#include "auto_mem.hh"
#include "sql_util.hh"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "lnav_util.hh"
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
using namespace std;

@ -35,7 +35,7 @@
#include <assert.h>
#include "lnav_util.hh"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "sqlite-extension-func.hh"
@ -83,7 +83,7 @@ int register_sqlite_funcs(sqlite3 *db, sqlite_registration_func_t *reg_funcs)
nullptr,
nullptr);
if (fd.fd_help.ht_context != HC_NONE) {
if (fd.fd_help.ht_context != help_context_t::HC_NONE) {
help_text &ht = fd.fd_help;
sqlite_function_help.insert(make_pair(ht.ht_name, &ht));
@ -104,7 +104,7 @@ int register_sqlite_funcs(sqlite3 *db, sqlite_registration_func_t *reg_funcs)
agg_funcs[i].xStep,
agg_funcs[i].xFinalize);
if (fda.fda_help.ht_context != HC_NONE) {
if (fda.fda_help.ht_context != help_context_t::HC_NONE) {
help_text &ht = fda.fda_help;
sqlite_function_help.insert(make_pair(ht.ht_name, &ht));

@ -17,9 +17,9 @@
#include <unordered_map>
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
#include "yajlpp.hh"
#include "yajlpp/yajlpp.hh"
#include "column_namer.hh"
#include "yajl/api/yajl_gen.h"
#include "sqlite-extension-func.hh"
@ -89,10 +89,8 @@ regexp_match(const char *re, const char *str)
return static_cast<const char *>(nullptr);
}
auto_mem<yajl_gen_t> gen(yajl_gen_free);
gen = yajl_gen_alloc(nullptr);
yajl_gen_config(gen.in(), yajl_gen_beautify, false);
yajlpp_gen gen;
yajl_gen_config(gen, yajl_gen_beautify, false);
if (extractor.get_capture_count() == 1) {
pcre_context::capture_t *cap = pc[0];
@ -178,10 +176,8 @@ json_string extract(const char *str)
dp.parse();
// dp.print(stderr, dp.dp_pairs);
auto_mem<yajl_gen_t> gen(yajl_gen_free);
gen = yajl_gen_alloc(NULL);
yajl_gen_config(gen.in(), yajl_gen_beautify, false);
yajlpp_gen gen;
yajl_gen_config(gen, yajl_gen_beautify, false);
elements_to_json(gen, dp, &dp.dp_pairs);

@ -33,7 +33,7 @@
#include <stdio.h>
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "sysclip.hh"
struct clip_command {

@ -31,7 +31,7 @@
#include "config.h"
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
#include "text_format.hh"

@ -34,7 +34,7 @@
#include <pcrecpp.h>
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
#include "lnav_util.hh"
#include "data_parser.hh"
#include "ansi_scrubber.hh"

@ -39,7 +39,7 @@
#include "grep_proc.hh"
#include "bookmarks.hh"
#include "listview_curses.hh"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "text_format.hh"
#include "logfile.hh"
#include "highlighter.hh"

@ -30,7 +30,7 @@
#include "config.h"
#include "timer.hh"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
static const struct itimerval DISABLE_TV = {
{ 0, 0 },

@ -35,12 +35,12 @@
#include <string>
#include "auto_mem.hh"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "view_curses.hh"
#include "ansi_scrubber.hh"
#include "lnav_config.hh"
#include "yajlpp.hh"
#include "yajlpp_def.hh"
#include "yajlpp/yajlpp.hh"
#include "yajlpp/yajlpp_def.hh"
#include "xterm-palette.hh"
#include "attr_line.hh"
#include "shlex.hh"

@ -60,7 +60,7 @@
#include <functional>
#include <algorithm>
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "attr_line.hh"
#include "optional.hpp"
#include "lnav_util.hh"

@ -175,11 +175,11 @@ static void build_all_help_text()
for (const auto &iter : sqlite_function_help) {
switch (iter.second->ht_context) {
case HC_SQL_FUNCTION:
case HC_SQL_TABLE_VALUED_FUNCTION:
case help_context_t::HC_SQL_FUNCTION:
case help_context_t::HC_SQL_TABLE_VALUED_FUNCTION:
sql_funcs[iter.second->ht_name] = iter.second;
break;
case HC_SQL_KEYWORD:
case help_context_t::HC_SQL_KEYWORD:
sql_keywords[iter.second->ht_name] = iter.second;
break;
default:
@ -192,7 +192,7 @@ static void build_all_help_text()
format_help_text_for_term(*iter.second, 79, all_help_text);
if (!iter.second->ht_example.empty()) {
all_help_text.append(1, '\n');
format_example_text_for_term(*iter.second, 90, all_help_text);
format_example_text_for_term(*iter.second, eval_example, 90, all_help_text);
}
}
@ -201,7 +201,7 @@ static void build_all_help_text()
format_help_text_for_term(*iter.second, 79, all_help_text);
if (!iter.second->ht_example.empty()) {
all_help_text.append(1, '\n');
format_example_text_for_term(*iter.second, 79, all_help_text);
format_example_text_for_term(*iter.second, eval_example, 79, all_help_text);
}
}
@ -325,6 +325,8 @@ void layout_views()
lnav_data.ld_rl_view->set_width(width);
}
static unordered_map<string, attr_line_t> EXAMPLE_RESULTS;
void execute_examples()
{
exec_context &ec = lnav_data.ld_exec_context;
@ -337,22 +339,23 @@ void execute_examples()
for (auto &ex : ht.ht_example) {
string alt_msg;
attr_line_t result;
switch (ht.ht_context) {
case HC_SQL_FUNCTION:
case HC_SQL_TABLE_VALUED_FUNCTION: {
case help_context_t::HC_SQL_FUNCTION:
case help_context_t::HC_SQL_TABLE_VALUED_FUNCTION: {
execute_sql(ec, ex.he_cmd, alt_msg);
if (dls.dls_rows.size() == 1 &&
dls.dls_rows[0].size() == 1) {
ex.he_result.append(dls.dls_rows[0][0]);
result.append(dls.dls_rows[0][0]);
} else {
attr_line_t al;
dos.list_value_for_overlay(db_tc,
0, 1,
vis_line_t(0),
al);
ex.he_result.append(al);
result.append(al);
for (int lpc = 0;
lpc < (int)dls.text_line_count(); lpc++) {
al.clear();
@ -361,14 +364,16 @@ void execute_examples()
false);
dls.text_attrs_for_line(db_tc, lpc,
al.get_attrs());
ex.he_result.append("\n")
result.append("\n")
.append(al);
}
}
EXAMPLE_RESULTS[ex.he_cmd] = result;
log_debug("example: %s", ex.he_cmd);
log_debug("example result: %s",
ex.he_result.get_string().c_str());
result.get_string().c_str());
break;
}
default:
@ -381,6 +386,17 @@ void execute_examples()
dls.clear();
}
attr_line_t eval_example(const help_text &ht, const help_example &ex)
{
auto iter = EXAMPLE_RESULTS.find(ex.he_cmd);
if (iter != EXAMPLE_RESULTS.end()) {
return iter->second;
}
return "";
}
bool toggle_view(textview_curses *toggle_tc)
{
textview_curses *tc = lnav_data.ld_view_stack.top().value_or(nullptr);

@ -40,7 +40,7 @@
#include <utility>
#include "lnav.hh"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "sql_util.hh"
#include "views_vtab.hh"
#include "view_curses.hh"

@ -36,7 +36,7 @@
#include <map>
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "vt52_curses.hh"
#if defined HAVE_NCURSESW_CURSES_H

@ -37,7 +37,7 @@
#include <utility>
#include "optional.hpp"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
#include "lnav_util.hh"
#include "auto_mem.hh"
#include "yajl/api/yajl_gen.h"

@ -34,3 +34,66 @@
const char *xterm_mouse::XT_TERMCAP = "\033[?1000%?%p1%{1}%=%th%el%;";
const char *xterm_mouse::XT_TERMCAP_TRACKING = "\033[?1002%?%p1%{1}%=%th%el%;";
const char *xterm_mouse::XT_TERMCAP_SGR = "\033[?1006%?%p1%{1}%=%th%el%;";
void xterm_mouse::handle_mouse()
{
bool release = false;
int ch;
size_t index = 0;
int bstate, x, y;
char buffer[64];
bool done = false;
while (!done) {
if (index >= sizeof(buffer) - 1) {
break;
}
ch = getch();
switch (ch) {
case 'm':
release = true;
done = true;
break;
case 'M':
done = true;
break;
default:
buffer[index++] = (char)ch;
break;
}
}
buffer[index] = '\0';
if (sscanf(buffer, "<%d;%d;%d", &bstate, &x, &y) == 3) {
if (this->xm_behavior) {
this->xm_behavior->mouse_event(bstate, release, x, y);
}
}
else {
log_error("bad mouse escape sequence: %s", buffer);
}
}
void xterm_mouse::set_enabled(bool enabled)
{
if (is_available()) {
putp(tparm((char *)XT_TERMCAP, enabled ? 1 : 0));
putp(tparm((char *)XT_TERMCAP_TRACKING, enabled ? 1 : 0));
putp(tparm((char *)XT_TERMCAP_SGR, enabled ? 1 : 0));
fflush(stdout);
this->xm_enabled = enabled;
} else {
log_warning("mouse support is not available");
}
}
bool xterm_mouse::is_available()
{
const char *termname = getenv("TERM");
bool retval = false;
if (termname and strstr(termname, "xterm") != NULL) {
retval = isatty(STDOUT_FILENO);
}
return retval;
}

@ -52,7 +52,7 @@
# error "SysV or X/Open-compatible Curses header file required"
#endif
#include "lnav_log.hh"
#include "base/lnav_log.hh"
/**
* Base class for delegates of the xterm_mouse class.
@ -102,39 +102,20 @@ public:
/**
* @return True if the user's terminal supports xterm-mouse events.
*/
static bool is_available()
{
const char *termname = getenv("TERM");
bool retval = false;
if (termname and strstr(termname, "xterm") != NULL) {
retval = isatty(STDOUT_FILENO);
}
return retval;
};
xterm_mouse() : xm_enabled(false), xm_behavior(NULL) {};
static bool is_available();
~xterm_mouse()
{
if (this->is_enabled())
if (this->is_enabled()) {
set_enabled(false);
}
};
/**
* @param enabled True if xterm mouse support should be enabled in the
* terminal.
*/
void set_enabled(bool enabled)
{
if (is_available()) {
putp(tparm((char *)XT_TERMCAP, enabled ? 1 : 0));
putp(tparm((char *)XT_TERMCAP_TRACKING, enabled ? 1 : 0));
putp(tparm((char *)XT_TERMCAP_SGR, enabled ? 1 : 0));
fflush(stdout);
this->xm_enabled = enabled;
}
};
void set_enabled(bool enabled);
/**
* @return True if xterm mouse support is enabled, false otherwise.
@ -158,47 +139,10 @@ public:
* Handle a KEY_MOUSE character from ncurses.
* @param ch unused
*/
void handle_mouse()
{
bool release = false;
int ch;
size_t index = 0;
int bstate, x, y;
char buffer[64];
bool done = false;
while (!done) {
if (index >= sizeof(buffer) - 1) {
break;
}
ch = getch();
switch (ch) {
case 'm':
release = true;
done = true;
break;
case 'M':
done = true;
break;
default:
buffer[index++] = (char)ch;
break;
}
}
buffer[index] = '\0';
if (sscanf(buffer, "<%d;%d;%d", &bstate, &x, &y) == 3) {
if (this->xm_behavior) {
this->xm_behavior->mouse_event(bstate, release, x, y);
}
}
else {
log_error("bad mouse escape sequence: %s", buffer);
}
};
void handle_mouse();
private:
bool xm_enabled;
mouse_behavior *xm_behavior;
bool xm_enabled{false};
mouse_behavior *xm_behavior{nullptr};
};
#endif

@ -0,0 +1,37 @@
AM_CPPFLAGS = -I$(top_srcdir)/src
noinst_LIBRARIES = libyajl.a
noinst_HEADERS = \
api/yajl_common.h \
api/yajl_gen.h \
api/yajl_parse.h \
api/yajl_tree.h \
yajl_alloc.h \
yajl_buf.h \
yajl_bytestack.h \
yajl_common.h \
yajl_encode.h \
yajl_lex.h \
yajl_parser.h \
yajl_version.h
if USE_INCLUDED_YAJL
libyajl_a_SOURCES = \
yajl.c \
yajl_alloc.c \
yajl_alloc.h \
yajl_buf.c \
yajl_buf.h \
yajl_bytestack.h \
yajl_encode.c \
yajl_encode.h \
yajl_gen.c \
yajl_lex.c \
yajl_lex.h \
yajl_parser.c \
yajl_parser.h \
yajl_tree.c \
yajl_version.c
endif

@ -0,0 +1,52 @@
TESTS_ENVIRONMENT = $(SHELL) $(top_builddir)/TESTS_ENVIRONMENT
LOG_COMPILER = $(SHELL) $(top_builddir)/TESTS_ENVIRONMENT
AM_CPPFLAGS = \
-Wall \
-I$(top_srcdir)/src/ \
-I$(top_srcdir)/src/fmtlib
noinst_LIBRARIES = libyajlpp.a
noinst_HEADERS = \
json_op.hh \
json_ptr.hh \
yajlpp.hh \
yajlpp_def.hh
libyajlpp_a_SOURCES = \
json_op.cc \
json_ptr.cc \
yajlpp.cc
check_PROGRAMS = \
drive_json_op \
drive_json_ptr_walk \
test_json_ptr \
test_yajlpp
drive_json_op_SOURCES = drive_json_op.cc
drive_json_ptr_walk_SOURCES = drive_json_ptr_walk.cc
test_json_ptr_SOURCES = test_json_ptr.cc
test_yajlpp_SOURCES = test_yajlpp.cc
LDADD = \
$(top_builddir)/src/base/libbase.a \
$(top_builddir)/src/fmtlib/libcppfmt.a \
$(top_builddir)/src/pcrepp/libpcrepp.a \
$(top_builddir)/src/yajl/libyajl.a \
libyajlpp.a
dist_noinst_SCRIPTS = \
test_json_op.sh \
test_json_ptr_walk.sh
TESTS = \
test_json_op.sh \
test_json_ptr \
test_json_ptr_walk.sh \
test_yajlpp

@ -35,8 +35,8 @@
#include "yajl/api/yajl_gen.h"
#include "json_op.hh"
#include "lnav_log.hh"
#include "yajlpp/json_op.hh"
#include "base/lnav_log.hh"
static void printer(void *ctx, const char *numberVal, size_t numberLen)
{

@ -31,40 +31,43 @@
#include "config.h"
#include <iostream>
#include <stdlib.h>
#include "yajlpp.hh"
#include "json_op.hh"
#include "json_ptr.hh"
#include "lnav_log.hh"
#include "yajl/api/yajl_gen.h"
#include "base/lnav_log.hh"
using namespace std;
int main(int argc, char *argv[])
{
int retval = EXIT_SUCCESS;
char buffer[1024];
yajl_status status;
json_ptr_walk jpw;
ssize_t rc;
log_argv(argc, argv);
while ((rc = read(STDIN_FILENO, buffer, sizeof(buffer))) > 0) {
status = jpw.parse(buffer, rc);
if (status == yajl_status_error) {
fprintf(stderr, "error:cannot parse JSON input -- %s\n",
std::string json_input(std::istreambuf_iterator<char>(cin), {});
status = jpw.parse(json_input.c_str(), json_input.size());
if (status == yajl_status_error) {
fprintf(stderr, "error:cannot parse JSON input -- %s\n",
jpw.jpw_error_msg.c_str());
retval = EXIT_FAILURE;
break;
}
else if (status == yajl_status_client_canceled) {
fprintf(stderr, "client cancel\n");
break;
}
return EXIT_FAILURE;
}
if (status == yajl_status_client_canceled) {
fprintf(stderr, "client cancel\n");
}
status = jpw.complete_parse();
if (status == yajl_status_error) {
fprintf(stderr, "error:cannot parse JSON input -- %s\n",
jpw.jpw_error_msg.c_str());
retval = EXIT_FAILURE;
return EXIT_FAILURE;
}
else if (status == yajl_status_client_canceled) {
fprintf(stderr, "client cancel\n");
@ -74,6 +77,24 @@ int main(int argc, char *argv[])
iter != jpw.jpw_values.end();
++iter) {
printf("%s = %s\n", iter->wt_ptr.c_str(), iter->wt_value.c_str());
{
auto_mem<yajl_handle_t> parse_handle(yajl_free);
json_ptr jp(iter->wt_ptr.c_str());
json_op jo(jp);
yajlpp_gen gen;
jo.jo_ptr_callbacks = json_op::gen_callbacks;
jo.jo_ptr_data = gen.get_handle();
parse_handle.reset(yajl_alloc(&json_op::ptr_callbacks, nullptr, &jo));
yajl_parse(parse_handle.in(),
(const unsigned char *) json_input.c_str(),
json_input.size());
yajl_complete_parse(parse_handle.in());
assert(iter->wt_value == gen.to_string_fragment().to_string());
}
}
return retval;

@ -34,7 +34,7 @@
#include "yajl/api/yajl_gen.h"
#include "json_op.hh"
#include "lnav_log.hh"
#include "base/lnav_log.hh"
static int gen_handle_start_map(void *ctx)
{
@ -129,8 +129,8 @@ static int gen_handle_end_array(void *ctx)
const yajl_callbacks json_op::gen_callbacks = {
gen_handle_null,
gen_handle_boolean,
NULL,
NULL,
nullptr,
nullptr,
gen_handle_number,
gen_handle_string,
gen_handle_start_map,
@ -143,8 +143,8 @@ const yajl_callbacks json_op::gen_callbacks = {
const yajl_callbacks json_op::ptr_callbacks = {
handle_null,
handle_boolean,
NULL,
NULL,
nullptr,
nullptr,
handle_number,
handle_string,
handle_start_map,
@ -160,7 +160,7 @@ int json_op::handle_null(void *ctx)
int retval = 1;
if (jo->check_index()) {
if (jo->jo_ptr_callbacks.yajl_null != NULL) {
if (jo->jo_ptr_callbacks.yajl_null != nullptr) {
retval = jo->jo_ptr_callbacks.yajl_null(ctx);
}
}
@ -174,7 +174,7 @@ int json_op::handle_boolean(void *ctx, int boolVal)
int retval = 1;
if (jo->check_index()) {
if (jo->jo_ptr_callbacks.yajl_boolean != NULL) {
if (jo->jo_ptr_callbacks.yajl_boolean != nullptr) {
retval = jo->jo_ptr_callbacks.yajl_boolean(ctx, boolVal);
}
}
@ -188,7 +188,7 @@ int json_op::handle_number(void *ctx, const char *numberVal, size_t numberLen)
int retval = 1;
if (jo->check_index()) {
if (jo->jo_ptr_callbacks.yajl_number != NULL) {
if (jo->jo_ptr_callbacks.yajl_number != nullptr) {
retval = jo->jo_ptr_callbacks.yajl_number(ctx, numberVal, numberLen);
}
}
@ -202,7 +202,7 @@ int json_op::handle_string(void *ctx, const unsigned char *stringVal, size_t str
int retval = 1;
if (jo->check_index()) {
if (jo->jo_ptr_callbacks.yajl_string != NULL) {
if (jo->jo_ptr_callbacks.yajl_string != nullptr) {
retval = jo->jo_ptr_callbacks.yajl_string(ctx, stringVal, stringLen);
}
}
@ -216,7 +216,7 @@ int json_op::handle_start_map(void *ctx)
int retval = 1;
if (jo->check_index(false)) {
if (jo->jo_ptr_callbacks.yajl_start_map != NULL) {
if (jo->jo_ptr_callbacks.yajl_start_map != nullptr) {
retval = jo->jo_ptr_callbacks.yajl_start_map(ctx);
}
}
@ -234,7 +234,7 @@ int json_op::handle_map_key(void *ctx, const unsigned char * key, size_t len)
int retval = 1;
if (jo->check_index(false)) {
if (jo->jo_ptr_callbacks.yajl_map_key != NULL) {
if (jo->jo_ptr_callbacks.yajl_map_key != nullptr) {
retval = jo->jo_ptr_callbacks.yajl_map_key(ctx, key, len);
}
}
@ -252,7 +252,7 @@ int json_op::handle_end_map(void *ctx)
int retval = 1;
if (jo->check_index()) {
if (jo->jo_ptr_callbacks.yajl_end_map != NULL) {
if (jo->jo_ptr_callbacks.yajl_end_map != nullptr) {
retval = jo->jo_ptr_callbacks.yajl_end_map(ctx);
}
}
@ -268,7 +268,7 @@ int json_op::handle_start_array(void *ctx)
int retval = 1;
if (jo->check_index(false)) {
if (jo->jo_ptr_callbacks.yajl_start_array != NULL) {
if (jo->jo_ptr_callbacks.yajl_start_array != nullptr) {
retval = jo->jo_ptr_callbacks.yajl_start_array(ctx);
}
}
@ -284,7 +284,7 @@ int json_op::handle_end_array(void *ctx)
int retval = 1;
if (jo->check_index()) {
if (jo->jo_ptr_callbacks.yajl_end_array != NULL) {
if (jo->jo_ptr_callbacks.yajl_end_array != nullptr) {
retval = jo->jo_ptr_callbacks.yajl_end_array(ctx);
}
}

@ -36,7 +36,7 @@
#include <string>
#include "json_ptr.hh"
#include "yajlpp/json_ptr.hh"
#include "yajl/api/yajl_parse.h"
class json_op {
@ -55,27 +55,23 @@ public:
const static yajl_callbacks gen_callbacks;
const static yajl_callbacks ptr_callbacks;
json_op(json_ptr &ptr)
: jo_depth(0),
jo_array_index(-1),
jo_ptr(ptr),
jo_ptr_data(NULL),
jo_ptr_error_code(0) {
memset(&this->jo_ptr_callbacks, 0, sizeof(this->jo_ptr_callbacks));
explicit json_op(const json_ptr &ptr)
: jo_ptr(ptr),
jo_ptr_callbacks(gen_callbacks) {
};
bool check_index(bool primitive = true) {
return this->jo_ptr.at_index(this->jo_depth, this->jo_array_index, primitive);
};
int jo_depth;
int jo_array_index;
int jo_depth{0};
int jo_array_index{-1};
json_ptr jo_ptr;
yajl_callbacks jo_ptr_callbacks;
void *jo_ptr_data;
void *jo_ptr_data{nullptr};
std::string jo_ptr_error;
int jo_ptr_error_code;
int jo_ptr_error_code{0};
};
#endif

@ -33,7 +33,7 @@
#include "yajl/api/yajl_gen.h"
#include "json_ptr.hh"
#include "yajlpp/json_ptr.hh"
using namespace std;
@ -114,14 +114,14 @@ static int handle_map_key(void *ctx, const unsigned char * key, size_t len)
required_len = json_ptr::encode(partially_encoded_key, sizeof(partially_encoded_key),
(const char *)key, len);
if (required_len < sizeof(partially_encoded_key)) {
jpw->jpw_keys.push_back(string(partially_encoded_key, required_len));
jpw->jpw_keys.emplace_back(&partially_encoded_key[0], required_len);
}
else {
char fully_encoded_key[required_len];
json_ptr::encode(fully_encoded_key, sizeof(fully_encoded_key),
(const char *)key, len);
jpw->jpw_keys.push_back(string(fully_encoded_key, required_len));
jpw->jpw_keys.emplace_back(&fully_encoded_key[0], required_len);
}
return 1;
@ -163,8 +163,8 @@ static int handle_end_array(void *ctx)
const yajl_callbacks json_ptr_walk::callbacks = {
handle_null,
handle_boolean,
NULL,
NULL,
nullptr,
nullptr,
handle_number,
handle_string,
handle_start_map,
@ -362,7 +362,7 @@ bool json_ptr::expect_array(int32_t &depth, int32_t &index)
else if (this->reached_end()) {
retval = true;
}
else if (this->jp_pos[0] == '/') {
else if (this->jp_pos[0] == '/' && index == this->jp_array_index) {
int offset;
this->jp_depth += 1;
@ -436,3 +436,25 @@ bool json_ptr::at_index(int32_t &depth, int32_t &index, bool primitive)
return retval;
}
std::string json_ptr_walk::current_ptr()
{
std::string retval;
for (size_t lpc = 0; lpc < this->jpw_array_indexes.size(); lpc++) {
retval.append("/");
if (this->jpw_array_indexes[lpc] == -1) {
retval.append(this->jpw_keys[lpc]);
}
else {
char num[64];
snprintf(num, sizeof(num), "%d", this->jpw_array_indexes[lpc]);
retval.append(num);
}
}
this->jpw_max_ptr_len = std::max(this->jpw_max_ptr_len, retval.size());
return retval;
}

@ -1,7 +1,5 @@
#include <utility>
/**
* Copyright (c) 2014, Timothy Stack
* Copyright (c) 2014-2019, Timothy Stack
*
* All rights reserved.
*
@ -95,26 +93,7 @@ public:
}
};
std::string current_ptr() {
std::string retval;
for (size_t lpc = 0; lpc < this->jpw_array_indexes.size(); lpc++) {
retval.append("/");
if (this->jpw_array_indexes[lpc] == -1) {
retval.append(this->jpw_keys[lpc]);
}
else {
char num[64];
snprintf(num, sizeof(num), "%d", this->jpw_array_indexes[lpc]);
retval.append(num);
}
}
this->jpw_max_ptr_len = std::max(this->jpw_max_ptr_len, retval.size());
return retval;
};
std::string current_ptr();
struct walk_triple {
walk_triple(std::string ptr, yajl_type type, std::string value)

@ -35,7 +35,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "json_ptr.hh"
#include "yajlpp/json_ptr.hh"
int main(int argc, const char *argv[])
{

@ -35,7 +35,7 @@ check_output "array" <<EOF
EOF
run_test ./drive_json_ptr_walk <<EOF
[1, 2, 3, [4, 5, 6]]
[1, 2, 3, [4, 5, 6], 7, 8, 9, [10, 11, [12, 13, 14], 15], 16]
EOF
check_output "nested array" <<EOF
@ -45,6 +45,16 @@ check_output "nested array" <<EOF
/3/0 = 4
/3/1 = 5
/3/2 = 6
/4 = 7
/5 = 8
/6 = 9
/7/0 = 10
/7/1 = 11
/7/2/0 = 12
/7/2/1 = 13
/7/2/2 = 14
/7/3 = 15
/8 = 16
EOF
run_test ./drive_json_ptr_walk <<EOF

@ -34,8 +34,8 @@
#include <stdio.h>
#include <assert.h>
#include "yajlpp.hh"
#include "yajlpp_def.hh"
#include "yajlpp/yajlpp.hh"
#include "yajlpp/yajlpp_def.hh"
const char *TEST_DATA =
"[{ \"foo\": 0 }, { \"foo\": 1 }]";

@ -556,7 +556,6 @@ void yajlpp_gen_context::gen()
yajlpp_gen_context &yajlpp_gen_context::with_context(yajlpp_parse_context &ypc)
{
this->ygc_obj_stack = ypc.ypc_obj_stack;
this->ygc_base_name = ypc.get_path_fragment(-1);
if (ypc.ypc_current_handler == nullptr &&
!ypc.ypc_handler_stack.empty() &&
ypc.ypc_handler_stack.back() != nullptr) {

@ -1,5 +1,5 @@
/**
* Copyright (c) 2013, Timothy Stack
* Copyright (c) 2013-2019, Timothy Stack
*
* All rights reserved.
*
@ -47,7 +47,7 @@
#include <functional>
#include "optional.hpp"
#include "pcrepp.hh"
#include "pcrepp/pcrepp.hh"
#include "json_ptr.hh"
#include "intern_string.hh"
@ -135,17 +135,16 @@ struct json_path_handler_base {
json_path_handler_base(const char *path)
: jph_path(path),
jph_regex(path, PCRE_ANCHORED),
jph_gen_callback(NULL),
jph_gen_callback(nullptr),
jph_field_getter(nullptr),
jph_obj_provider(NULL),
jph_path_provider(NULL),
jph_obj_provider(nullptr),
jph_path_provider(nullptr),
jph_synopsis(""),
jph_description(""),
jph_children(NULL),
jph_kv_pair(false),
jph_children(nullptr),
jph_min_length(0),
jph_max_length(INT_MAX),
jph_enum_values(NULL),
jph_enum_values(nullptr),
jph_min_value(LLONG_MIN),
jph_optional_wrapper(false)
{
@ -184,7 +183,6 @@ struct json_path_handler_base {
const char * jph_synopsis;
const char * jph_description;
json_path_handler_base *jph_children;
bool jph_kv_pair;
std::shared_ptr<pcrepp> jph_pattern;
const char * jph_pattern_re{nullptr};
std::function<void(const string_fragment &)> jph_string_validator;
@ -368,7 +366,7 @@ public:
}
};
yajl_status complete_parse();;
yajl_status complete_parse();
void report_error(lnav_log_level_t level, const char *format, ...) {
va_list args;
@ -587,17 +585,20 @@ public:
int ygc_depth;
std::stack<void *> ygc_default_stack;
std::stack<void *> ygc_obj_stack;
std::string ygc_base_name;
json_path_handler *ygc_handlers;
};
class yajlpp_gen {
public:
yajlpp_gen() : yg_handle(yajl_gen_free) {
this->yg_handle = yajl_gen_alloc(NULL);
this->yg_handle = yajl_gen_alloc(nullptr);
};
operator yajl_gen_t *() {
yajl_gen get_handle() const {
return this->yg_handle.in();
};
operator yajl_gen () {
return this->yg_handle.in();
};

@ -6,42 +6,28 @@ add_executable(lnav_doctests
../src/relative_time.cc
../../lbuild-debug/src/time_fmts.cc
../src/ptimec_rt.cc
../src/pcrepp.cc
../src/lnav_log.cc)
add_executable(test_pcrepp test_pcrepp.cc ../src/lnav_log.cc ../src/pcrepp.cc)
../src/pcrepp/pcrepp.cc
../src/base/lnav_log.cc)
add_executable(test_pcrepp test_pcrepp.cc ../src/base/lnav_log.cc ../src/pcrepp/pcrepp.cc)
add_executable(test_reltime test_reltime.cc
../src/relative_time.cc
../src/pcrepp.cc
../src/lnav_log.cc)
../src/pcrepp/pcrepp.cc
../src/base/lnav_log.cc)
add_executable(test_date_time_scanner test_date_time_scanner.cc
../src/lnav_util.cc
../../lbuild-debug/src/time_fmts.cc
../src/ptimec_rt.cc
../src/pcrepp.cc
../src/lnav_log.cc
../src/pcrepp/pcrepp.cc
../src/base/lnav_log.cc
../src/spookyhash/SpookyV2.cpp)
add_executable(test_abbrev test_abbrev.cc
../src/lnav_util.cc
../../lbuild-debug/src/time_fmts.cc
../src/ptimec_rt.cc
../src/pcrepp.cc
../src/lnav_log.cc
../src/pcrepp/pcrepp.cc
../src/base/lnav_log.cc
../src/spookyhash/SpookyV2.cpp)
add_executable(test_json_ptr test_json_ptr.cc
../src/lnav_util.cc
../../lbuild-debug/src/time_fmts.cc
../src/ptimec_rt.cc
../src/pcrepp.cc
../src/lnav_log.cc
../src/spookyhash/SpookyV2.cpp)
add_executable(drive_json_op drive_json_op.cc
../src/lnav_util.cc
../../lbuild-debug/src/time_fmts.cc
../src/ptimec_rt.cc
../src/pcrepp.cc
../src/lnav_log.cc
../src/spookyhash/SpookyV2.cpp)
add_executable(drive_sql_anno drive_sql_anno.cc ../src/lnav_log.cc ../src/pcrepp.cc)
add_executable(drive_sql_anno drive_sql_anno.cc ../src/base/lnav_log.cc ../src/pcrepp/pcrepp.cc)
link_directories(/opt/local/lib)
target_link_libraries(test_pcrepp /usr/local/lib/libpcre.a)
target_link_libraries(test_reltime /usr/local/lib/libpcre.a)
@ -49,4 +35,3 @@ target_link_libraries(lnav_doctests /usr/local/lib/libpcre.a)
target_link_libraries(test_date_time_scanner /usr/local/lib/libpcre.a)
target_link_libraries(test_abbrev /usr/local/lib/libpcre.a)
target_link_libraries(drive_sql_anno /usr/local/lib/libpcre.a)
target_link_libraries(test_json_ptr /usr/local/lib/libpcre.a)

@ -19,8 +19,6 @@ check_PROGRAMS = \
drive_data_scanner \
drive_line_buffer \
drive_grep_proc \
drive_json_op \
drive_json_ptr_walk \
drive_listview \
drive_logfile \
drive_mvwattrline \
@ -41,14 +39,12 @@ check_PROGRAMS = \
test_bookmarks \
test_date_time_scanner \
test_grep_proc2 \
test_json_ptr \
test_line_buffer2 \
test_log_accel \
test_ncurses_unicode \
test_pcrepp \
test_reltime \
test_top_status \
test_yajlpp
test_top_status
AM_LDFLAGS = \
$(STATIC_LDFLAGS) \
@ -62,159 +58,88 @@ CONFIG_OBJS = \
../src/keymap-default.o
TEXT2C_OBJS = \
../src/default-log-formats-json.o \
../src/dhclient-summary.o \
../src/dump-pid-sh.o \
../src/lnav-pop-view.o \
../src/partition-by-boot.o \
../src/search-for.o
LDADD = -lz $(CURSES_LIB)
LDADD = \
-lz \
$(CURSES_LIB) \
$(CONFIG_OBJS) \
$(TEXT2C_OBJS) \
$(top_builddir)/src/base/libbase.a \
$(top_builddir)/src/fmtlib/libcppfmt.a \
$(top_builddir)/src/pcrepp/libpcrepp.a \
$(top_builddir)/src/yajl/libyajl.a \
$(top_builddir)/src/yajlpp/libyajlpp.a \
$(top_builddir)/src/libdiag.a \
$(SQLITE3_LIBS) \
$(PCRE_LIBS) \
$(READLINE_LIBS) \
$(LIBCURL) \
-lpcrecpp
test_ansi_scrubber_SOURCES = test_ansi_scrubber.cc
test_ansi_scrubber_LDADD = ../src/libdiag.a $(CURSES_LIB) \
$(CONFIG_OBJS)
test_auto_fd_SOURCES = test_auto_fd.cc
test_auto_fd_LDADD = ../src/libdiag.a
test_auto_mem_SOURCES = test_auto_mem.cc
test_bookmarks_SOURCES = test_bookmarks.cc
test_bookmarks_LDADD = ../src/libdiag.a
test_date_time_scanner_SOURCES = test_date_time_scanner.cc
test_date_time_scanner_LDADD = ../src/libdiag.a $(SQLITE3_LIBS)
test_grep_proc2_SOURCES = test_grep_proc2.cc
test_grep_proc2_LDADD = ../src/libdiag.a $(PCRE_LIBS) -lz
test_line_buffer2_SOURCES = test_line_buffer2.cc
test_line_buffer2_LDADD = ../src/libdiag.a
test_log_accel_SOURCES = test_log_accel.cc
test_log_accel_LDADD = ../src/libdiag.a
test_pcrepp_SOURCES = test_pcrepp.cc
test_pcrepp_LDADD = ../src/libdiag.a $(PCRE_LIBS) -lz
test_top_status_SOURCES = test_top_status.cc
test_top_status_LDADD = \
../src/libdiag.a \
$(CONFIG_OBJS) \
$(CURSES_LIB) \
$(PCRE_LIBS) \
$(SQLITE3_LIBS) \
$(LIBCURL) \
-lz
test_yajlpp_SOURCES = test_yajlpp.cc
test_yajlpp_LDADD = ../src/libdiag.a
test_abbrev_SOURCES = test_abbrev.cc
test_abbrev_LDADD = ../src/libdiag.a
test_json_ptr_SOURCES = test_json_ptr.cc
test_json_ptr_LDADD = ../src/libdiag.a
test_reltime_SOURCES = test_reltime.cc
test_reltime_LDADD = ../src/libdiag.a
test_ncurses_unicode_SOURCES = test_ncurses_unicode.cc
lnav_doctests_SOURCES = lnav_doctests.cc
lnav_doctests_LDADD = ../src/libdiag.a $(CONFIG_OBJS) $(CURSES_LIB)
drive_line_buffer_SOURCES = drive_line_buffer.cc
drive_line_buffer_LDADD = ../src/libdiag.a $(CURSES_LIB) -lz $(CURSES_LIB)
drive_grep_proc_SOURCES = drive_grep_proc.cc
drive_grep_proc_LDADD = ../src/libdiag.a $(PCRE_LIBS) -lz $(CURSES_LIB)
drive_json_op_SOURCES = drive_json_op.cc
drive_json_op_LDADD = ../src/libdiag.a $(PCRE_LIBS) -lz $(CURSES_LIB)
drive_json_ptr_walk_SOURCES = drive_json_ptr_walk.cc
drive_json_ptr_walk_LDADD = ../src/libdiag.a $(PCRE_LIBS) -lz $(CURSES_LIB)
drive_listview_SOURCES = drive_listview.cc
drive_listview_LDADD = ../src/libdiag.a $(CURSES_LIB) -lz $(CURSES_LIB) \
$(CONFIG_OBJS)
drive_logfile_SOURCES = drive_logfile.cc
drive_logfile_LDADD = \
../src/libdiag.a \
../src/default-log-formats-json.o \
$(CONFIG_OBJS) \
$(TEXT2C_OBJS) \
$(CURSES_LIB) \
$(SQLITE3_LIBS) \
$(PCRE_LIBS) \
-lpcrecpp
drive_sequencer_SOURCES = drive_sequencer.cc
drive_sequencer_LDADD = ../src/libdiag.a $(CURSES_LIB) $(SQLITE3_LIBS)
drive_shlexer_SOURCES = drive_shlexer.cc
drive_shlexer_LDADD = ../src/libdiag.a
drive_data_scanner_SOURCES = \
drive_data_scanner.cc
drive_data_scanner_LDADD = \
../src/libdiag.a \
../src/default-log-formats-json.o \
$(CONFIG_OBJS) \
$(TEXT2C_OBJS) \
$(LIBCURL) \
$(PCRE_LIBS) \
$(SQLITE3_LIBS) \
-lpcrecpp \
$(CURSES_LIB)
drive_mvwattrline_SOURCES = drive_mvwattrline.cc
drive_mvwattrline_LDADD = ../src/libdiag.a $(CURSES_LIB) \
$(CONFIG_OBJS)
drive_view_colors_SOURCES = drive_view_colors.cc
drive_view_colors_LDADD = ../src/libdiag.a $(CURSES_LIB) \
$(CONFIG_OBJS)
drive_vt52_curses_SOURCES = drive_vt52_curses.cc
drive_vt52_curses_LDADD = ../src/libdiag.a $(CURSES_LIB) $(CONFIG_OBJS)
drive_readline_curses_SOURCES = drive_readline_curses.cc
drive_readline_curses_LDADD = ../src/libdiag.a $(READLINE_LIBS) $(CURSES_LIB) \
$(CONFIG_OBJS)
drive_sql_SOURCES = \
drive_sql.cc
drive_sql_LDADD = \
../src/libdiag.a \
$(CONFIG_OBJS) \
$(SQLITE3_LIBS) \
$(PCRE_LIBS) \
$(CURSES_LIB) \
$(READLINE_LIBS) \
$(LIBCURL) \
$(TEXT2C_OBJS) \
-lpcrecpp
drive_sql_anno_SOURCES = \
drive_sql_anno.cc
drive_sql_anno_LDADD = \
../src/libdiag.a \
$(CONFIG_OBJS) \
$(SQLITE3_LIBS) \
$(PCRE_LIBS) \
$(CURSES_LIB) \
$(READLINE_LIBS) \
$(LIBCURL) \
-lpcrecpp
drive_sql_SOURCES = drive_sql.cc
drive_sql_anno_SOURCES = drive_sql_anno.cc
slicer_SOURCES = slicer.cc
slicer_LDADD = ../src/libdiag.a $(CURSES_LIB)
scripty_SOURCES = scripty.cc
scripty_LDADD = ../src/libdiag.a $(CURSES_LIB)
dist_noinst_SCRIPTS = \
parser_debugger.py \
@ -227,8 +152,6 @@ dist_noinst_SCRIPTS = \
test_format_loader.sh \
test_grep_proc.sh \
test_json_format.sh \
test_json_op.sh \
test_json_ptr_walk.sh \
test_line_buffer.sh \
test_listview.sh \
test_logfile.sh \
@ -384,8 +307,6 @@ TESTS = \
test_grep_proc.sh \
test_grep_proc2 \
test_json_format.sh \
test_json_op.sh \
test_json_ptr_walk.sh \
test_log_accel \
test_logfile.sh \
test_pcrepp \
@ -400,7 +321,6 @@ TESTS = \
test_sql_str_func.sh \
test_sql_time_func.sh \
test_data_parser.sh \
test_yajlpp \
test_pretty_print.sh
DISABLED_TESTS = \

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save