Permalink
Browse files

initial commit for multi-lingual rdis

  • Loading branch information...
endeav0r committed Dec 29, 2012
1 parent 8be1fde commit e0e84d43858c29d8e46e09b4b0178d86be7b9d53
Showing with 74 additions and 33 deletions.
  1. +0 −1 Makefile
  2. +10 −10 src/gui/funcwindow.c
  3. +6 −0 src/gui/gui.h
  4. +1 −1 src/gui/hexwindow.c
  5. +4 −4 src/gui/inswindow.c
  6. +1 −1 src/gui/rdgwindow.c
  7. +10 −10 src/gui/rdiswindow.c
  8. +2 −2 src/gui/refwindow.c
  9. +36 −0 src/lang/en.h
  10. +4 −4 src/rdis.c
View
@@ -1,7 +1,6 @@
all :
make -C src/
-
install :
cp src/rdis /usr/bin/rdis
View
@@ -40,28 +40,28 @@ struct _funcwindow * funcwindow_create (struct _gui * gui)
funcwindow->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(funcwindow->comboBoxText),
- "all");
+ LANG_ALL);
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(funcwindow->comboBoxText),
- "reachable");
+ LANG_REACHABLE);
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(funcwindow->comboBoxText),
- "unreachable");
+ LANG_UNREACHABLE);
// popup menu stuff
- GtkWidget * menuItem = gtk_menu_item_new_with_label("Call Graph");
+ GtkWidget * menuItem = gtk_menu_item_new_with_label(LANG_CALLGRAPH);
g_signal_connect(menuItem,
"activate",
G_CALLBACK(funcwindow_call_graph),
funcwindow);
gtk_menu_shell_append(GTK_MENU_SHELL(funcwindow->menu_popup), menuItem);
- menuItem = gtk_menu_item_new_with_label("Mark Reachable");
+ menuItem = gtk_menu_item_new_with_label(LANG_MARKREACHABLE);
g_signal_connect(menuItem,
"activate",
G_CALLBACK(funcwindow_mark_reachable),
funcwindow);
gtk_menu_shell_append(GTK_MENU_SHELL(funcwindow->menu_popup), menuItem);
- menuItem = gtk_menu_item_new_with_label("Remove Function");
+ menuItem = gtk_menu_item_new_with_label(LANG_REMOVEFUNC);
g_signal_connect(menuItem,
"activate",
G_CALLBACK(funcwindow_remove_function),
@@ -81,7 +81,7 @@ struct _funcwindow * funcwindow_create (struct _gui * gui)
GtkCellRenderer * renderer;
GtkTreeViewColumn * column;
renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes("address",
+ column = gtk_tree_view_column_new_with_attributes(LANG_ADDRESS,
renderer,
"text", COL_ADDR,
NULL);
@@ -90,7 +90,7 @@ struct _funcwindow * funcwindow_create (struct _gui * gui)
gtk_tree_view_append_column(GTK_TREE_VIEW(funcwindow->treeView), column);
renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes("name",
+ column = gtk_tree_view_column_new_with_attributes(LANG_NAME,
renderer,
"text", COL_LABEL,
NULL);
@@ -185,11 +185,11 @@ void funcwindow_redraw (struct _funcwindow * funcwindow)
int bits = 0;
int mask = 0;
- if (strcmp(type, "reachable") == 0) {
+ if (strcmp(type, LANG_REACHABLE) == 0) {
bits = FUNCTION_REACHABLE;
mask = FUNCTION_REACHABLE;
}
- else if (strcmp(type, "unreachable") == 0) {
+ else if (strcmp(type, LANG_UNREACHABLE) == 0) {
bits = 0;
mask = FUNCTION_REACHABLE;
}
View
@@ -5,6 +5,12 @@
#include "rdis.h"
+#ifndef LANG
+ #include "lang/en.h"
+#else
+ #include "lang/"LANG".h"
+#endif
+
struct _gui_window {
const struct _object * object;
GtkWidget * window;
View
@@ -241,7 +241,7 @@ void hexwindow_populate_popup (GtkTextView * text_view,
{
printf("populate popup\n");
// popup menu stuff
- GtkWidget * menuItem = gtk_menu_item_new_with_label("User Function");
+ GtkWidget * menuItem = gtk_menu_item_new_with_label(LANG_USERFUNCTION);
g_signal_connect(menuItem,
"activate",
G_CALLBACK(hexwindow_user_function),
View
@@ -93,7 +93,7 @@ struct _inswindow * inswindow_create (struct _gui * gui)
GtkCellRenderer * renderer;
GtkTreeViewColumn * column;
renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes("address",
+ column = gtk_tree_view_column_new_with_attributes(LANG_ADDRESS,
renderer,
"text", COL_ADDR,
NULL);
@@ -102,7 +102,7 @@ struct _inswindow * inswindow_create (struct _gui * gui)
gtk_tree_view_append_column(GTK_TREE_VIEW(inswindow->treeView), column);
renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes("bytes",
+ column = gtk_tree_view_column_new_with_attributes(LANG_BYTES,
renderer,
"text", COL_BYTES,
NULL);
@@ -111,7 +111,7 @@ struct _inswindow * inswindow_create (struct _gui * gui)
gtk_tree_view_append_column(GTK_TREE_VIEW(inswindow->treeView), column);
renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes("description",
+ column = gtk_tree_view_column_new_with_attributes(LANG_DESCRIPTION,
renderer,
"text", COL_DESCRIPTION,
NULL);
@@ -120,7 +120,7 @@ struct _inswindow * inswindow_create (struct _gui * gui)
gtk_tree_view_append_column(GTK_TREE_VIEW(inswindow->treeView), column);
renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes("comment",
+ column = gtk_tree_view_column_new_with_attributes(LANG_COMMENT,
renderer,
"text", COL_COMMENT,
NULL);
View
@@ -81,7 +81,7 @@ struct _rdgwindow * rdgwindow_create (struct _gui * gui,
rdgwindow->gui->rdis->labels);
// popup menu stuff
- GtkWidget * menuItem = gtk_menu_item_new_with_label("User Function");
+ GtkWidget * menuItem = gtk_menu_item_new_with_label(LANG_USERFUNCTION);
g_signal_connect(menuItem,
"activate",
G_CALLBACK(rdgwindow_user_function),
View
@@ -13,9 +13,9 @@ struct _rdiswindow * rdiswindow_create (struct _gui * gui)
rdiswindow->buttonsBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
rdiswindow->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
- rdiswindow->hexButton = gtk_button_new_with_label("Hex View");
- rdiswindow->functionsButton = gtk_button_new_with_label("Functions");
- rdiswindow->refButton = gtk_button_new_with_label("References");
+ rdiswindow->hexButton = gtk_button_new_with_label(LANG_HEXVIEW);
+ rdiswindow->functionsButton = gtk_button_new_with_label(LANG_FUNCTIONS);
+ rdiswindow->refButton = gtk_button_new_with_label(LANG_REFERENCES);
rdiswindow->scrolledWindow = gtk_scrolled_window_new(NULL, NULL);
rdiswindow->consoleTagTable = gtk_text_tag_table_new();
rdiswindow->consoleBuffer =
@@ -33,10 +33,10 @@ struct _rdiswindow * rdiswindow_create (struct _gui * gui)
NULL);
- GtkWidget * menuItemFile = gtk_menu_item_new_with_label("File");
- GtkWidget * menuItemOpen = gtk_menu_item_new_with_label("Open .rdis");
- GtkWidget * menuItemSave = gtk_menu_item_new_with_label("Save .rdis");
- GtkWidget * menuItemLoad = gtk_menu_item_new_with_label("Load Executable");
+ GtkWidget * menuItemFile = gtk_menu_item_new_with_label(LANG_MENUFILE);
+ GtkWidget * menuItemOpen = gtk_menu_item_new_with_label(LANG_OPENRDIS);
+ GtkWidget * menuItemSave = gtk_menu_item_new_with_label(LANG_SAVERDIS);
+ GtkWidget * menuItemLoad = gtk_menu_item_new_with_label(LANG_LOADEXEC);
GtkWidget * menuFile = gtk_menu_new();
gtk_container_add(GTK_CONTAINER(menuFile), menuItemOpen);
@@ -210,7 +210,7 @@ void rdiswindow_open (GtkMenuItem * menuItem, struct _rdiswindow * rdiswindow)
{
GtkWidget * dialog;
- dialog = gtk_file_chooser_dialog_new("Open Rdis File",
+ dialog = gtk_file_chooser_dialog_new(LANG_OPENRDISFILE,
GTK_WINDOW(rdiswindow->window),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL,
@@ -261,7 +261,7 @@ void rdiswindow_save (GtkMenuItem * menuItem, struct _rdiswindow * rdiswindow)
return;
}
- dialog = gtk_file_chooser_dialog_new("Save Rdis File",
+ dialog = gtk_file_chooser_dialog_new(LANG_SAVERDISFILE,
GTK_WINDOW(rdiswindow->window),
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL,
@@ -295,7 +295,7 @@ void rdiswindow_load (GtkMenuItem * menuItem, struct _rdiswindow * rdiswindow)
{
GtkWidget * dialog;
- dialog = gtk_file_chooser_dialog_new("Load Executable File",
+ dialog = gtk_file_chooser_dialog_new(LANG_LOADEXECFILE,
GTK_WINDOW(rdiswindow->window),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL,
View
@@ -45,7 +45,7 @@ struct _refwindow * refwindow_create (struct _gui * gui)
GtkTreeViewColumn * column;
renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes("address",
+ column = gtk_tree_view_column_new_with_attributes(LANG_ADDRESS,
renderer,
"text", COL_ADDRESS,
NULL);
@@ -54,7 +54,7 @@ struct _refwindow * refwindow_create (struct _gui * gui)
gtk_tree_view_append_column(GTK_TREE_VIEW(refwindow->treeView), column);
renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes("referencers",
+ column = gtk_tree_view_column_new_with_attributes(LANG_REFERENCERS,
renderer,
"text", COL_REFERENCERS,
NULL);
View
@@ -0,0 +1,36 @@
+#ifndef lang_HEADER
+#define lang_HEADER
+
+// GUI
+#define LANG_ACTIVATE "Activate"
+#define LANG_ADDRESS "Address"
+#define LANG_ALL "All"
+#define LANG_BYTES "Bytes"
+#define LANG_CALLGRAPH "Call Graph"
+#define LANG_COMMENT "Comment"
+#define LANG_DESCRIPTION "Description"
+#define LANG_FUNCTIONS "Functions"
+#define LANG_HEXVIEW "Hex View"
+#define LANG_LOADEXEC "Load Executable"
+#define LANG_LOADEXECFILE "Load Executable File"
+#define LANG_MARKREACHABLE "Mark Reachable"
+#define LANG_MENUFILE "File"
+#define LANG_NAME "Name"
+#define LANG_OPENRDIS "Open .rdis"
+#define LANG_OPENRDISFILE "Open Rdis File"
+#define LANG_REACHABLE "Reachable"
+#define LANG_REFERENCES "References"
+#define LANG_REFERENCERS "Referencers"
+#define LANG_REMOVEFUNC "Remove Function"
+#define LANG_SAVERDIS "Save .rdis"
+#define LANG_SAVERDISFILE "Safe Rdis File"
+#define LANG_UNREACHABLE "Unreachable"
+#define LANG_USERFUNCTION "User Function"
+
+// RDIS
+#define LANG_MEMORYLOADED "Memory Loaded"
+#define LANG_FUNCSLOADED "Functions Loaded"
+#define LANG_GRAPHLOADED "Graph Loaded"
+#define LANG_LABELSLOADED "Labels Loaded"
+
+#endif
View
@@ -55,19 +55,19 @@ struct _rdis * rdis_create_with_console (_loader * loader,
rdis->memory = loader_memory_map(loader);
printf("memory loaded\n");fflush(stdout);
- rdis_console(rdis, "memory loaded");
+ rdis_console(rdis, LANG_MEMORYLOADED);
rdis->functions = loader_functions(loader, rdis->memory);
printf("functions loaded\n");fflush(stdout);
- rdis_console(rdis, "functions loaded");
+ rdis_console(rdis, LANG_FUNCSLOADED);
rdis->graph = loader_graph_functions(loader, rdis->memory, rdis->functions);
printf("graph loaded\n");fflush(stdout);
- rdis_console(rdis, "graph loaded");
+ rdis_console(rdis, LANG_GRAPHLOADED);
rdis->labels = loader_labels_functions(loader, rdis->memory, rdis->functions);
printf("labels loaded\n");fflush(stdout);
- rdis_console(rdis, "labels loaded");
+ rdis_console(rdis, LANG_LABELSLOADED);
rdis_check_references(rdis);
rdis_functions_bounds(rdis);

0 comments on commit e0e84d4

Please sign in to comment.