{
char *str = g_key_file_get_value(kf, grp, key, NULL);
-#ifdef EMU8051_DEBUG
- printf("key: %s\n", key);
-#endif
+ log_debug("key: %s", key);
if (G_LIKELY(str)) {
*value = atoi(str);
-
-#ifdef EMU8051_DEBUG
- printf(" value = %d\n", *value);
-#endif
-
+ log_debug(" value = %d", *value);
g_free(str);
}
file_path = g_build_filename(dir_path, file, NULL);
-#ifdef EMU8051_DEBUG
- printf("app. config file = %s\n", file_path);
-#endif
+ log_info("app. config file = %s", file_path);
g_free(dir_path);
#ifndef COMMON_H
#define COMMON_H 1
-/* Define this to have debugging output. */
-/* #define EMU8051_DEBUG 1 */
-
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
console_main();
-#ifdef EMU8051_DEBUG
- printf("End of program.\n");
-#endif
+ log_info("Terminate");
return 0;
}
emugtk_stop_running()
{
if (running) {
-#ifdef EMU8051_DEBUG
- printf("emugtk_StopRunning()\n");
-#endif
+ log_info("StopRunning()");
g_source_remove(running_function_tag);
running = 0;
regwin_Show();
{
cpu8051_Exec();
if (IsBreakpoint(cpu8051.pc)) {
-#ifdef EMU8051_DEBUG
- g_print("Breakpoint Hit, stopping!\n");
-#endif
+ log_info("Breakpoint Hit");
emugtk_stop_running();
}
emugtk_start_running(void)
{
if (!running) {
-#ifdef EMU8051_DEBUG
- printf("emugtk_StartRunning()\n");
-#endif
+ log_info("StartRunning()");
running_function_tag = g_idle_add(emugtk_running, 0);
running = 1;
}
static void
emugtk_ResetEvent(GtkWidget *widget, GdkEvent *event, gpointer data)
{
-#ifdef EMU8051_DEBUG
- g_print("emugtk_ResetEvent(...)\n");
-#endif
+ log_info("ResetEvent()");
emugtk_stop_running();
emugtk_Reset();
}
static void
emugtk_RunEvent(GtkWidget *widget, GdkEvent *event, gpointer data)
{
-#ifdef EMU8051_DEBUG
- g_print("emugtk_RunEvent(...)\n");
-#endif
+ log_info("RunEvent()");
+
if (running)
emugtk_stop_running();
else
static void
emugtk_StopEvent(GtkWidget *widget, GdkEvent *event, gpointer data)
{
-#ifdef EMU8051_DEBUG
- g_print("emugtk_StopEvent(...)\n");
-#endif
+ log_info("StopEvent()");
emugtk_stop_running();
}
static void
emugtk_StepEvent(GtkWidget *widget, GdkEvent *event, gpointer data)
{
-#ifdef EMU8051_DEBUG
- g_print("emugtk_StepEvent(...)\n");
-#endif
+ log_info("StepEvent()");
emugtk_stop_running();
emugtk_Step();
}
static void
emugtk_UpdateDisplay(void)
{
-#ifdef EMU8051_DEBUG
- g_print("emugtk_UpdateDisplay()\n");
-#endif
-
+ log_debug("UpdateDisplay()");
regwin_Show();
pgmwin_Disasm();
memwin_DumpD("00");
gtk_main();
-#ifdef EMU8051_DEBUG
- printf("End of program.\n");
-#endif
+ log_info("Terminate");
app_config_save();
if (folder != NULL) {
if (strlen(folder) >= MAX_FILENAME_LENGTH) {
/* Non-critical error */
- g_print("current folder name too long for buffer\n");
+ log_warn("current folder name too long for buffer");
} else {
-#if defined(DEBUG)
- g_print("current folder = %s\n", folder);
-#endif
-
+ log_info("current folder = %s", folder);
strncpy(previous_folder, folder, MAX_FILENAME_LENGTH);
}
char *dir;
char *cwd = NULL;
-#if defined(DEBUG)
- g_print("FileOpenEvent()\n");
-#endif
+ log_info("FileOpenEvent()");
/* Create a new file selection widget. */
file_dialog = gtk_file_chooser_dialog_new(
GTK_FILE_CHOOSER(file_dialog));
if (selected_file != NULL) {
-#if defined(DEBUG)
- g_print("emugtk_File = %s\n", selected_file);
-#endif
+ log_info("emugtk_File = %s", selected_file);
remember_current_folder(GTK_FILE_CHOOSER(file_dialog));
static void
FileQuitEvent(gchar *string)
{
-#if defined(DEBUG)
- g_print("%s\n", string);
-#endif
-
gtk_main_quit();
}
unsigned int Address;
GtkListStore *store;
-#ifdef EMU8051_DEBUG
- printf("memwin_DumpD, address = %s\n", MemAddress);
-#endif
+ log_info("memwin_DumpD, address = %s", MemAddress);
if (strlen(MemAddress) != 0) {
if (STREQ(MemAddress, "PC"))
GtkTreeModel *model;
GtkTreeIter iter;
-#ifdef EMU8051_DEBUG
- printf("pgmwin_sel_changed_event()\n");
-#endif
+ log_debug("pgmwin_sel_changed_event()");
/* This will only work in single or browse selection mode! */
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pgmlist));
/* Convert hex address in ASCII to integer. */
sscanf(str_addr, "%x", &val);
-#ifdef EMU8051_DEBUG
- printf(" row address is: $%04X\n", val);
-#endif
+ log_debug(" row address is: $%04X", val);
ToggleBreakpoint(val);
pgmwin_Disasm();
g_free(str_addr);
} else {
-#ifdef EMU8051_DEBUG
- printf(" no row selected.\n");
-#endif
+ log_debug(" no row selected");
}
return FALSE;