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 terminal.cc
) )
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
add_library(${module} SHARED add_library(${module} SHARED
api api
api_ext api_ext
@ -132,8 +135,8 @@ link_directories(
${LIBCLANG_LIBRARY_DIRS} ${LIBCLANG_LIBRARY_DIRS}
) )
#module: #module:
set_target_properties(${module} PROPERTIES PREFIX "") set_target_properties(${module} PROPERTIES PREFIX ""
# LIBRARY_OUTPUT_DIRECTORY "/usr/lib/python2.7/dist-packages/") LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib/")
target_link_libraries(${module} ${PYTHON_LIBRARIES} ${Boost_LIBRARIES}) target_link_libraries(${module} ${PYTHON_LIBRARIES} ${Boost_LIBRARIES})
#executable: #executable:
target_link_libraries(${project_name} ${LIVCLANG_LIBRARIES} ${LCL_LIBRARIES} ${GTKMM_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}) 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) { void PluginApi::ReplaceLine(std::string line) {
std::cout << "unimplemented: " << __func__ << std::endl; WARNING("use of unimplemented method");
} }
std::string PluginApi::GetWord() { std::string PluginApi::GetWord() {

11
juci/juci.cc

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

18
juci/logging.h

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

2
juci/plugins.py

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

4
juci/source.cc

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

Loading…
Cancel
Save