Browse Source

Merge branch 'master' of bitbucket.org:cppit/juci into terminalmergedir

master
oyvang 11 years ago
parent
commit
e2b2729558
  1. 7
      juci/CMakeLists.txt
  2. 2
      juci/api.cc
  3. 11
      juci/juci.cc
  4. 18
      juci/logging.h
  5. 2
      juci/plugins.py
  6. 4
      juci/source.cc

7
juci/CMakeLists.txt

@ -111,6 +111,9 @@ add_executable(${project_name}
terminal.cc
)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
add_library(${module} SHARED
api
api_ext
@ -132,8 +135,8 @@ link_directories(
${LIBCLANG_LIBRARY_DIRS}
)
#module:
set_target_properties(${module} PROPERTIES PREFIX "")
# LIBRARY_OUTPUT_DIRECTORY "/usr/lib/python2.7/dist-packages/")
set_target_properties(${module} PROPERTIES PREFIX ""
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib/")
target_link_libraries(${module} ${PYTHON_LIBRARIES} ${Boost_LIBRARIES})
#executable:
target_link_libraries(${project_name} ${LIVCLANG_LIBRARIES} ${LCL_LIBRARIES} ${GTKMM_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})

2
juci/api.cc

@ -38,7 +38,7 @@ void PluginApi::ReplaceWord(std::string word) {
}
void PluginApi::ReplaceLine(std::string line) {
std::cout << "unimplemented: " << __func__ << std::endl;
WARNING("use of unimplemented method");
}
std::string PluginApi::GetWord() {

11
juci/juci.cc

@ -1,14 +1,19 @@
#include "window.h"
#include "logging.h"
void init_logging() {
add_common_attributes();
add_file_log(keywords::file_name = "juci.log",
keywords::auto_flush = true);
INFO("Logging initalized");
}
int main(int argc, char *argv[]) {
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(
argc,
argv,
"no.sout.juci");
add_file_log("juci.log");
INFO("Logging initalized");
init_logging();
Window window;
return app->run(window);
}

18
juci/logging.h

@ -12,11 +12,17 @@
using namespace boost::log;
#define TRACE(x) BOOST_LOG_TRIVIAL(trace) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">";
#define DEBUG(x) BOOST_LOG_TRIVIAL(debug) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">";
#define INFO(x) BOOST_LOG_TRIVIAL(info) << __func__ << "(" << __LINE__ << "): \"" x << "\"";
#define WARNING(x) BOOST_LOG_TRIVIAL(warning) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">";
#define ERROR(x) BOOST_LOG_TRIVIAL(error) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">";
#define FATAL(x) BOOST_LOG_TRIVIAL(fatal) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">";
#define TRACE_VAR(x) BOOST_LOG_TRIVIAL(trace) << "** Trace: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">";
#define DEBUG_VAR(x) BOOST_LOG_TRIVIAL(debug) << "** Debug: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">";
#define INFO_VAR(x) BOOST_LOG_TRIVIAL(info) << "** Info: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">";
#define WARNING_VAR(x) BOOST_LOG_TRIVIAL(warning) << "** Warning: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">";
#define FATAL_VAR(x) BOOST_LOG_TRIVIAL(fatal) << "** Fatal: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">";
#define ERROR_VAR(x) BOOST_LOG_TRIVIAL(error) << "** Error: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">";
#define TRACE(x) BOOST_LOG_TRIVIAL(trace) << "** Trace: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\"";
#define DEBUG(x) BOOST_LOG_TRIVIAL(debug) << "** Debug: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\"";
#define INFO(x) BOOST_LOG_TRIVIAL(info) << "** Info: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\"";
#define WARNING(x) BOOST_LOG_TRIVIAL(warning) << "** Warning: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\"";
#define FATAL(x) BOOST_LOG_TRIVIAL(fatal) << "** Fatal: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\"";
#define ERROR(x) BOOST_LOG_TRIVIAL(error) << "** Error: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\"";
#endif // JUCI_LOGGING_H_

2
juci/plugins.py

@ -2,7 +2,7 @@
#plugin handler
import sys, os, glob
cwd = os.getcwd()
sys.path.append(cwd)
sys.path.append(cwd+"/lib")
import juci_to_python_api as juci
def loadplugins():

4
juci/source.cc

@ -362,6 +362,7 @@ void Source::Controller::OnOpenFile(const string &filepath) {
if (!go) {
std::thread parse([this]() {
if (parsing.try_lock()) {
INFO("Starting parsing");
while (true) {
const std::string raw = buffer()->get_text().raw();
std::map<std::string, std::string> buffers;
@ -376,6 +377,7 @@ void Source::Controller::OnOpenFile(const string &filepath) {
}
}
parsing.unlock();
INFO("Parsing completed");
}
});
parse.detach();
@ -385,10 +387,12 @@ void Source::Controller::OnOpenFile(const string &filepath) {
buffer()->signal_begin_user_action().connect([this]() {
if (go) {
syntax.lock();
INFO("Updating syntax");
view().
OnUpdateSyntax(model().ExtractTokens(0, buffer()->get_text().size()),
model().config());
go = false;
INFO("Syntax updated");
syntax.unlock();
}
});

Loading…
Cancel
Save