Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Commit

Permalink
Merge pull request #15 from isage/master
Browse files Browse the repository at this point in the history
more cleanup and desktop/icon files
  • Loading branch information
nitram2342 committed Apr 1, 2014
2 parents 1a7a430 + c6fa43b commit 4f8672a
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 74 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ add_subdirectory(tools/export_module)
add_subdirectory(gui)


INSTALL(FILES degate.png DESTINATION share/pixmaps)
INSTALL(FILES degate.desktop DESTINATION share/applications)
11 changes: 11 additions & 0 deletions degate.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Name=Degate
Name[ru]=Degate
Comment=reverse engineering of digital logic
Comment[ru]=инжинерный анализ цифровой логики
Exec=degate_bin
Icon=degate
Terminal=false
Type=Application
Categories=Development;Electronics;
StartupNotify=true
Binary file added degate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions gui/ModuleWin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,6 @@ void ModuleWin::on_gate_selection_changed() {
if(refTreeSelection) {
Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
if(*iter) {
Gtk::TreeModel::Row row = *iter;

goto_button->set_sensitive(true);
move_button->set_sensitive(true);
}
Expand Down
1 change: 0 additions & 1 deletion gui/SplashWin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ bool SplashWin::on_expose_event(GdkEventExpose *event) {
Glib::RefPtr<Gdk::Window> window = get_window();

if(window) {
Gtk::Allocation allocation = get_allocation();
Cairo::RefPtr<Cairo::Context> m_cr = window->create_cairo_context();


Expand Down
52 changes: 0 additions & 52 deletions lib/DegateHelper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

#include <boost/foreach.hpp>

#include <sys/wait.h>

using namespace degate;
using namespace std;

Expand Down Expand Up @@ -53,56 +51,6 @@ void degate::write_string_to_file(std::string const& path,
file.close();
}

int degate::execute_command(std::string const& command, std::list<std::string> const& params) {

pid_t pid = fork();
if(pid == 0) {
// child
std::cout << "Execute command " << command << " ";
char const ** argv = new char const *[params.size()+2];
int i = 1;
BOOST_FOREACH(std::string const& s, params) {
argv[i] = s.c_str();
i++;
std::cout << s << " ";
}
argv[0] = command.c_str();
argv[i] = NULL;

std::cout << std::endl;

if(execvp(command.c_str(), const_cast<char* const*>(argv)) == -1) {
std::cout << "exec failed" << std::endl;
}
std::cout << "sth. failed" << std::endl;
exit(0);
}
else if(pid < 0) {
// fork failed
throw SystemException("fork() failed");
}
else {

// parent
int exit_code;
if(waitpid(pid, &exit_code, 0) != pid)
throw SystemException("waitpid() failed");
else {
if(WEXITSTATUS(exit_code) != 0) {
std::string errmsg("Failed to execute command: " + command);
BOOST_FOREACH(std::string const& s, params) {
errmsg += " ";
errmsg += s;
}
errmsg += ". Error: ";
errmsg += strerror(errno);
throw SystemException(errmsg);
}
return exit_code;
}
}
}

std::string degate::get_data_dir() {
Configuration const & conf = Configuration::get_instance();
return conf.get_data_dir();
Expand Down
9 changes: 0 additions & 9 deletions lib/DegateHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ namespace degate {
void write_string_to_file(std::string const& path,
std::string const& content);


/**
* Execute a command.
* @param command The command to execute.
* @param params list of parameters.
* @returns Returns the exit code.
*/
int execute_command(std::string const& command, std::list<std::string> const& params);

std::string get_data_dir();
}

Expand Down
5 changes: 0 additions & 5 deletions lib/ExternalMatching.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ void ExternalMatching::run() {
remove_directory(dir);
}

int ExternalMatching::get_exit_code() const {
return WEXITSTATUS(exit_code);
}


std::list<PlacedLogicModelObject_shptr> ExternalMatching::parse_file(std::string const& filename) const {

std::list<PlacedLogicModelObject_shptr> list;
Expand Down
1 change: 0 additions & 1 deletion lib/ExternalMatching.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ namespace degate {
void set_command(std::string const& cmd);
std::string get_command() const;

int get_exit_code() const;
};

typedef std::shared_ptr<ExternalMatching> ExternalMatching_shptr;
Expand Down
4 changes: 2 additions & 2 deletions libtest/ImageTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ void ImageTest::test_convert_pixel(void) {


rgba_pixel_t rb = convert_pixel<rgba_pixel_t, gs_byte_pixel_t>(0xa0);
CPPUNIT_ASSERT(MERGE_CHANNELS(0xa0, 0xa0, 0xa0, 255) == rb);
CPPUNIT_ASSERT((unsigned)MERGE_CHANNELS(0xa0, 0xa0, 0xa0, 255) == rb);

rgba_pixel_t rd = convert_pixel<rgba_pixel_t, gs_double_pixel_t>(4.0);
CPPUNIT_ASSERT(MERGE_CHANNELS(4, 4, 4, 255) == rd);
CPPUNIT_ASSERT((unsigned)MERGE_CHANNELS(4, 4, 4, 255) == rd);
}

void ImageTest::test_copy_pixel(void) {
Expand Down
2 changes: 1 addition & 1 deletion libtest/ProjectImporterTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void ProjectImporterTest::test_import_all_new_format(void) {
for(GateTemplate::image_iterator img_iter = gate_tmpl->images_begin();
img_iter != gate_tmpl->images_end(); ++img_iter, i++) {

Layer::LAYER_TYPE layer_type = (*img_iter).first;
// Layer::LAYER_TYPE layer_type = (*img_iter).first;
GateTemplateImage_shptr img = (*img_iter).second;
CPPUNIT_ASSERT(img != NULL);
}
Expand Down
2 changes: 1 addition & 1 deletion libtest/QuadTreeTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void QuadTreeTest::test_iterator(void) {
CPPUNIT_ASSERT(*it != NULL);

PlacedLogicModelObject_shptr gate = *it;
BoundingBox const& bb = gate->get_bounding_box();
// BoundingBox const& bb = gate->get_bounding_box();
//bb.print();
}
if(i != 2) {
Expand Down
50 changes: 50 additions & 0 deletions tools/gate_lib_documentation/gate_lib_doc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <string>
#include <iostream>
#include <fstream>
#include <sys/wait.h>

#include <boost/program_options.hpp>
#include <boost/algorithm/string/join.hpp>
Expand Down Expand Up @@ -93,6 +94,55 @@ int main(int argc, char ** argv) {
}


int execute_command(std::string const& command, std::list<std::string> const& params) {

pid_t pid = fork();
if(pid == 0) {
// child
std::cout << "Execute command " << command << " ";
char const ** argv = new char const *[params.size()+2];
int i = 1;
BOOST_FOREACH(std::string const& s, params) {
argv[i] = s.c_str();
i++;
std::cout << s << " ";
}
argv[0] = command.c_str();
argv[i] = NULL;

std::cout << std::endl;

if(execvp(command.c_str(), const_cast<char* const*>(argv)) == -1) {
std::cout << "exec failed" << std::endl;
}
std::cout << "sth. failed" << std::endl;
exit(0);
}
else if(pid < 0) {
// fork failed
throw SystemException("fork() failed");
}
else {

// parent
int exit_code;
if(waitpid(pid, &exit_code, 0) != pid)
throw SystemException("waitpid() failed");
else {
if(WEXITSTATUS(exit_code) != 0) {
std::string errmsg("Failed to execute command: " + command);
BOOST_FOREACH(std::string const& s, params) {
errmsg += " ";
errmsg += s;
}
errmsg += ". Error: ";
errmsg += strerror(errno);
throw SystemException(errmsg);
}
return exit_code;
}
}
}



Expand Down

0 comments on commit 4f8672a

Please sign in to comment.