From: Hugo Villeneuve Date: Tue, 14 Jan 2014 04:43:46 +0000 (-0500) Subject: Change confusing variable name bits_per_row to bytes_per_row X-Git-Tag: v2.0.0~9 X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=877e908e7bcca4f1402edf212f1aea0462c9d4e7;p=emu8051.git Change confusing variable name bits_per_row to bytes_per_row --- diff --git a/src/gtk/app-config.c b/src/gtk/app-config.c index 90022f2..bbbd6f4 100644 --- a/src/gtk/app-config.c +++ b/src/gtk/app-config.c @@ -62,7 +62,7 @@ app_config_init(void) cfg->view_int_memory = 1; cfg->view_sfr_memory = 1; cfg->view_ext_memory = 1; - cfg->bits_per_row = 16; /* 8 or 16 */ + cfg->bytes_per_row = 16; /* 8 or 16 */ } static int @@ -108,8 +108,8 @@ app_config_load_from_key_file(GKeyFile *kf) &cfg->view_sfr_memory); app_config_key_file_get_int(kf, "view", "ext_memory", &cfg->view_ext_memory); - app_config_key_file_get_int(kf, "view", "bits_per_row", - &cfg->bits_per_row); + app_config_key_file_get_int(kf, "view", "bytes_per_row", + &cfg->bytes_per_row); } static char * @@ -201,8 +201,8 @@ app_config_save(void) cfg->view_sfr_memory); g_string_append_printf(buf, "ext_memory=%d\n", cfg->view_ext_memory); - g_string_append_printf(buf, "bits_per_row=%d\n", - cfg->bits_per_row); + g_string_append_printf(buf, "bytes_per_row=%d\n", + cfg->bytes_per_row); file_path = app_config_get_file_path(); diff --git a/src/gtk/app-config.h b/src/gtk/app-config.h index 1c418b5..b7fc617 100644 --- a/src/gtk/app-config.h +++ b/src/gtk/app-config.h @@ -52,7 +52,7 @@ struct app_config_t int view_int_memory; int view_sfr_memory; int view_ext_memory; - int bits_per_row; /* 8 or 16 */ + int bytes_per_row; /* 8 or 16 */ }; int diff --git a/src/gtk/memwin.c b/src/gtk/memwin.c index b31551f..c78758d 100644 --- a/src/gtk/memwin.c +++ b/src/gtk/memwin.c @@ -162,7 +162,7 @@ memwin_init_columns(GtkWidget *listview, int memory_id) gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column); - for (i = COL_DATA0; i < (COL_DATA0 + cfg->bits_per_row); i++) { + for (i = COL_DATA0; i < (COL_DATA0 + cfg->bytes_per_row); i++) { char col_name[8]; /* Create new renderer for each editable cell. */ @@ -183,7 +183,7 @@ memwin_init_columns(GtkWidget *listview, int memory_id) GUINT_TO_POINTER(memory_id)); /* Use two digits only if DATA_ROWS > 10 */ - if (cfg->bits_per_row < 10) + if (cfg->bytes_per_row < 10) sprintf(col_name, "B%1d", i - COL_DATA0); else sprintf(col_name, "B%02d", i - COL_DATA0); @@ -211,10 +211,10 @@ compute_data_rows(int memory_id) u_int32_t *crc; if (memory_id == INT_MEM_ID) { - data_rows = options.iram_size / cfg->bits_per_row; + data_rows = options.iram_size / cfg->bytes_per_row; crc = crc_internal; } else if (memory_id == EXT_MEM_ID) { - data_rows = options.xram_size / cfg->bits_per_row; + data_rows = options.xram_size / cfg->bytes_per_row; crc = crc_external; } else { log_fail("Invalid memory type"); @@ -246,7 +246,7 @@ memwin_init(char *title, int memory_id) GtkWidget *memlist; int data_rows; - COL_ASCII = cfg->bits_per_row + 1; + COL_ASCII = cfg->bytes_per_row + 1; N_COLUMNS = COL_ASCII + 1; frame = gtk_frame_new(title); @@ -320,7 +320,7 @@ memwin_refresh(int memory_id) store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(memlist))); - for (row = 0; row < data_rows; row++, Address += cfg->bits_per_row) { + for (row = 0; row < data_rows; row++, Address += cfg->bytes_per_row) { int valid; GtkTreeIter iter; char str[4+1]; /* Maximum str len is for address column (4 digits) */ @@ -358,7 +358,7 @@ memwin_refresh(int memory_id) */ buf8 = memory_getbuf(memory_id, Address); crc_new = crc32(0L, Z_NULL, 0); - crc_new = crc32(crc_new, buf8, cfg->bits_per_row); + crc_new = crc32(crc_new, buf8, cfg->bytes_per_row); if (crc_new == crc_old[row]) { continue; @@ -372,7 +372,7 @@ memwin_refresh(int memory_id) gtk_list_store_set(store, &iter, COL_ADDRESS, str, -1); - for (col = 0; col < cfg->bits_per_row; col++) { + for (col = 0; col < cfg->bytes_per_row; col++) { u_int8_t data; data = memory_read8(memory_id, Address + col); diff --git a/src/gtk/viewmenu.c b/src/gtk/viewmenu.c index 166ab88..8f38438 100644 --- a/src/gtk/viewmenu.c +++ b/src/gtk/viewmenu.c @@ -46,15 +46,15 @@ void toggle_layout(GtkWidget *widget, gpointer data) } } -void toggle_bits_per_row(GtkWidget *widget, gpointer data) +void toggle_bytes_per_row(GtkWidget *widget, gpointer data) { - int bits_per_row; + int bytes_per_row; - bits_per_row = GPOINTER_TO_UINT(data); + bytes_per_row = GPOINTER_TO_UINT(data); if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) { - log_info(" Bits per row = %d", bits_per_row); - cfg->bits_per_row = bits_per_row; + log_info(" Bytes per row = %d", bytes_per_row); + cfg->bytes_per_row = bytes_per_row; emugtk_restart_gui(); } } @@ -135,7 +135,7 @@ view_add_layout_submenu(GtkWidget *parent) } void -view_add_bits_per_row_submenu(GtkWidget *parent) +view_add_bytes_per_row_submenu(GtkWidget *parent) { GtkWidget *submenu; GtkWidget *item; @@ -145,21 +145,21 @@ view_add_bits_per_row_submenu(GtkWidget *parent) submenu = gtk_menu_new(); - item = gtk_menu_item_new_with_label("Bits per row"); + item = gtk_menu_item_new_with_label("Bytes per row"); item1 = gtk_radio_menu_item_new_with_label(group, "8"); group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(item1)); item2 = gtk_radio_menu_item_new_with_label(group, "16"); - if (cfg->bits_per_row == 8) + if (cfg->bytes_per_row == 8) gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item1), TRUE); else gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item2), TRUE); g_signal_connect(G_OBJECT(item1), "activate", - G_CALLBACK(toggle_bits_per_row), (gpointer) 8); + G_CALLBACK(toggle_bytes_per_row), (gpointer) 8); g_signal_connect(G_OBJECT(item2), "activate", - G_CALLBACK(toggle_bits_per_row), (gpointer) 16); + G_CALLBACK(toggle_bytes_per_row), (gpointer) 16); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item1); @@ -206,8 +206,8 @@ ViewAddMenu(GtkWidget *menu_bar) AddMenuSeparator(menu); - /* Add bits per row submenu */ - view_add_bits_per_row_submenu(menu); + /* Add bytes per row submenu */ + view_add_bytes_per_row_submenu(menu); gtk_menu_item_set_submenu(GTK_MENU_ITEM(view), menu); gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), view);