diff options
author | Joakim Sindholt <opensource@zhasha.com> | 2010-04-06 07:53:25 +0200 |
---|---|---|
committer | Joakim Sindholt <opensource@zhasha.com> | 2010-04-06 07:53:25 +0200 |
commit | e34bf063193950cd845802c2b65ed25b5b4f78e3 (patch) | |
tree | 46eea93827b17f9604692cf8f238ea4e9847137b | |
parent | 6edcb6a03aec76a99181cd77e8b38ea3e027ed23 (diff) |
rsim: Add the ability to export
This also means an epic ton of fixes for the register handling.
Basically nothing worked, but it gave off the illusion that it did.
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | src/cs.c | 12 | ||||
-rw-r--r-- | src/cs.vala | 2 | ||||
-rw-r--r-- | src/csimport.c | 1 | ||||
-rw-r--r-- | src/main.c | 653 | ||||
-rw-r--r-- | src/main.vala | 138 | ||||
-rw-r--r-- | src/registers.c | 242 | ||||
-rw-r--r-- | src/registers.vala | 40 |
8 files changed, 609 insertions, 480 deletions
diff --git a/Makefile.am b/Makefile.am index 6765924..6a1bfda 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,6 +16,7 @@ bin_PROGRAMS = rsim rsim_SOURCES = \ src/cs.vala \ src/csimport.vala \ + src/csexport.vala \ src/csview.vala \ src/main.vala \ src/registers.vala \ @@ -220,14 +220,14 @@ guint32 emulation_packet_iterator_get (EmulationPacketIterator* self); static void emulation_packet_iterator_finalize (EmulationPacketIterator* obj); enum { EMULATION_PACKET_BASE_DUMMY_PROPERTY, - EMULATION_PACKET_BASE_EXTRACT_TYPE, + EMULATION_PACKET_BASE_ELEMENT_TYPE, EMULATION_PACKET_BASE_TYPE_ID, EMULATION_PACKET_BASE_LENGTH }; EmulationPacketIterator* emulation_packet_base_iterator (EmulationPacketBase* self); guint32 emulation_packet_base_get (EmulationPacketBase* self, guint index); guint32 emulation_packet_base_extract_bits (EmulationPacketBase* self, guint high, guint low); -GType emulation_packet_base_get_extract_type (EmulationPacketBase* self); +GType emulation_packet_base_get_element_type (EmulationPacketBase* self); guint emulation_packet_base_get_type_id (EmulationPacketBase* self); static void emulation_packet_base_finalize (GObject* obj); static void emulation_packet_base_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); @@ -540,7 +540,7 @@ EmulationPacketBase* emulation_packet_base_new (void) { } -GType emulation_packet_base_get_extract_type (EmulationPacketBase* self) { +GType emulation_packet_base_get_element_type (EmulationPacketBase* self) { GType result; g_return_val_if_fail (self != NULL, 0UL); result = G_TYPE_UINT; @@ -565,7 +565,7 @@ static void emulation_packet_base_class_init (EmulationPacketBaseClass * klass) emulation_packet_base_parent_class = g_type_class_peek_parent (klass); G_OBJECT_CLASS (klass)->get_property = emulation_packet_base_get_property; G_OBJECT_CLASS (klass)->finalize = emulation_packet_base_finalize; - g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_PACKET_BASE_EXTRACT_TYPE, g_param_spec_gtype ("extract-type", "extract-type", "extract-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_PACKET_BASE_ELEMENT_TYPE, g_param_spec_gtype ("element-type", "element-type", "element-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_PACKET_BASE_TYPE_ID, g_param_spec_uint ("type-id", "type-id", "type-id", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_PACKET_BASE_LENGTH, g_param_spec_uint ("length", "length", "length", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); } @@ -596,8 +596,8 @@ static void emulation_packet_base_get_property (GObject * object, guint property EmulationPacketBase * self; self = EMULATION_PACKET_BASE (object); switch (property_id) { - case EMULATION_PACKET_BASE_EXTRACT_TYPE: - g_value_set_gtype (value, emulation_packet_base_get_extract_type (self)); + case EMULATION_PACKET_BASE_ELEMENT_TYPE: + g_value_set_gtype (value, emulation_packet_base_get_element_type (self)); break; case EMULATION_PACKET_BASE_TYPE_ID: g_value_set_uint (value, emulation_packet_base_get_type_id (self)); diff --git a/src/cs.vala b/src/cs.vala index cd73037..c7e57cf 100644 --- a/src/cs.vala +++ b/src/cs.vala @@ -37,7 +37,7 @@ namespace Emulation public class PacketBase : Object { public uint32 *dwords; - public Type extract_type { get { return typeof(uint32); } } + public Type element_type { get { return typeof(uint32); } } public PacketIterator iterator() { return new PacketIterator(this); } public uint32 header; diff --git a/src/csimport.c b/src/csimport.c index dd8b299..39a7f65 100644 --- a/src/csimport.c +++ b/src/csimport.c @@ -74,6 +74,7 @@ struct _GUICMain { GtkMenuBar* menubar; GtkToolbar* toolbar; GtkListStore* cs_store; + GtkTreeView* cs_list; }; struct _GUICMainClass { @@ -24,6 +24,16 @@ typedef struct _GUICActionsClass GUICActionsClass; typedef struct _GUICActionsPrivate GUICActionsPrivate; #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define GUI_TYPE_CMAIN (gui_cmain_get_type ()) +#define GUI_CMAIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GUI_TYPE_CMAIN, GUICMain)) +#define GUI_CMAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GUI_TYPE_CMAIN, GUICMainClass)) +#define GUI_IS_CMAIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GUI_TYPE_CMAIN)) +#define GUI_IS_CMAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GUI_TYPE_CMAIN)) +#define GUI_CMAIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GUI_TYPE_CMAIN, GUICMainClass)) + +typedef struct _GUICMain GUICMain; +typedef struct _GUICMainClass GUICMainClass; + #define GUI_TYPE_CS_IMPORT (gui_cs_import_get_type ()) #define GUI_CS_IMPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GUI_TYPE_CS_IMPORT, GUICSImport)) #define GUI_CS_IMPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GUI_TYPE_CS_IMPORT, GUICSImportClass)) @@ -45,16 +55,6 @@ typedef struct _GUICMenus GUICMenus; typedef struct _GUICMenusClass GUICMenusClass; typedef struct _GUICMenusPrivate GUICMenusPrivate; typedef struct _GUIParamSpecCMenus GUIParamSpecCMenus; - -#define GUI_TYPE_CMAIN (gui_cmain_get_type ()) -#define GUI_CMAIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GUI_TYPE_CMAIN, GUICMain)) -#define GUI_CMAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GUI_TYPE_CMAIN, GUICMainClass)) -#define GUI_IS_CMAIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GUI_TYPE_CMAIN)) -#define GUI_IS_CMAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GUI_TYPE_CMAIN)) -#define GUI_CMAIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GUI_TYPE_CMAIN, GUICMainClass)) - -typedef struct _GUICMain GUICMain; -typedef struct _GUICMainClass GUICMainClass; typedef struct _GUICMainPrivate GUICMainPrivate; #define _gui_cmenus_unref0(var) ((var == NULL) ? NULL : (var = (gui_cmenus_unref (var), NULL))) @@ -89,17 +89,28 @@ typedef struct _EmulationPacketBaseClass EmulationPacketBaseClass; typedef struct _GUICSView GUICSView; typedef struct _GUICSViewClass GUICSViewClass; + +#define GUI_TYPE_CS_EXPORT (gui_cs_export_get_type ()) +#define GUI_CS_EXPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GUI_TYPE_CS_EXPORT, GUICSExport)) +#define GUI_CS_EXPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GUI_TYPE_CS_EXPORT, GUICSExportClass)) +#define GUI_IS_CS_EXPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GUI_TYPE_CS_EXPORT)) +#define GUI_IS_CS_EXPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GUI_TYPE_CS_EXPORT)) +#define GUI_CS_EXPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GUI_TYPE_CS_EXPORT, GUICSExportClass)) + +typedef struct _GUICSExport GUICSExport; +typedef struct _GUICSExportClass GUICSExportClass; #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL))) -#define EMULATION_TYPE_SPEC_LOAD_DIALOG (emulation_spec_load_dialog_get_type ()) -#define EMULATION_SPEC_LOAD_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_SPEC_LOAD_DIALOG, EmulationSpecLoadDialog)) -#define EMULATION_SPEC_LOAD_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_TYPE_SPEC_LOAD_DIALOG, EmulationSpecLoadDialogClass)) -#define EMULATION_IS_SPEC_LOAD_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_TYPE_SPEC_LOAD_DIALOG)) -#define EMULATION_IS_SPEC_LOAD_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_TYPE_SPEC_LOAD_DIALOG)) -#define EMULATION_SPEC_LOAD_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_TYPE_SPEC_LOAD_DIALOG, EmulationSpecLoadDialogClass)) +#define GUI_TYPE_SPEC_LOAD_DIALOG (gui_spec_load_dialog_get_type ()) +#define GUI_SPEC_LOAD_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GUI_TYPE_SPEC_LOAD_DIALOG, GUISpecLoadDialog)) +#define GUI_SPEC_LOAD_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GUI_TYPE_SPEC_LOAD_DIALOG, GUISpecLoadDialogClass)) +#define GUI_IS_SPEC_LOAD_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GUI_TYPE_SPEC_LOAD_DIALOG)) +#define GUI_IS_SPEC_LOAD_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GUI_TYPE_SPEC_LOAD_DIALOG)) +#define GUI_SPEC_LOAD_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GUI_TYPE_SPEC_LOAD_DIALOG, GUISpecLoadDialogClass)) -typedef struct _EmulationSpecLoadDialog EmulationSpecLoadDialog; -typedef struct _EmulationSpecLoadDialogClass EmulationSpecLoadDialogClass; +typedef struct _GUISpecLoadDialog GUISpecLoadDialog; +typedef struct _GUISpecLoadDialogClass GUISpecLoadDialogClass; +typedef struct _GUISpecLoadDialogPrivate GUISpecLoadDialogPrivate; #define EMULATION_TYPE_SPEC_ENTRY (emulation_spec_entry_get_type ()) @@ -113,7 +124,6 @@ typedef struct _EmulationSpecLoadDialogClass EmulationSpecLoadDialogClass; typedef struct _EmulationSpec EmulationSpec; typedef struct _EmulationSpecClass EmulationSpecClass; typedef struct _EmulationSpecEntry EmulationSpecEntry; -typedef struct _EmulationSpecLoadDialogPrivate EmulationSpecLoadDialogPrivate; struct _GUICActions { GObject parent_instance; @@ -125,6 +135,7 @@ struct _GUICActions { GtkAction* RemoveCS; GtkAction* ImportCS; GtkAction* ExportCS; + GtkAction* OpenCS; GtkAction* Quit; }; @@ -138,6 +149,7 @@ struct _GUICMenus { GUICMenusPrivate * priv; GtkMenu* file; GtkMenu* edit; + GtkMenu* cs; }; struct _GUICMenusClass { @@ -156,6 +168,7 @@ struct _GUICMain { GtkMenuBar* menubar; GtkToolbar* toolbar; GtkListStore* cs_store; + GtkTreeView* cs_list; }; struct _GUICMainClass { @@ -175,53 +188,64 @@ struct _EmulationCSClass { GObjectClass parent_class; }; -struct _EmulationSpecEntry { - EmulationSpec* spec; - char* name; -}; - -struct _EmulationSpecLoadDialog { +struct _GUISpecLoadDialog { GtkWindow parent_instance; - EmulationSpecLoadDialogPrivate * priv; + GUISpecLoadDialogPrivate * priv; }; -struct _EmulationSpecLoadDialogClass { +struct _GUISpecLoadDialogClass { GtkWindowClass parent_class; }; -struct _EmulationSpecLoadDialogPrivate { +struct _GUISpecLoadDialogPrivate { GtkLabel* loading; GtkProgressBar* progress; gboolean done; }; +struct _EmulationSpecEntry { + EmulationSpec* spec; + char* name; +}; + +extern GUICMain* gui_main; static gpointer gui_cactions_parent_class = NULL; static gpointer gui_cmenus_parent_class = NULL; extern GUICActions* gui_actions; static gpointer gui_cmain_parent_class = NULL; -GUICActions* gui_actions = NULL; -extern GUICMain* gui_main; -GUICMain* gui_main = NULL; extern EmulationSpecEntry* emulation_specs; extern gint emulation_specs_length1; +static gpointer gui_spec_load_dialog_parent_class = NULL; +GUICActions* gui_actions = NULL; +GUICMain* gui_main = NULL; EmulationSpecEntry* emulation_specs = NULL; gint emulation_specs_length1 = 0; extern guint emulation_spec_default; guint emulation_spec_default = (guint) 1; -static gpointer emulation_spec_load_dialog_parent_class = NULL; GType gui_cactions_get_type (void); enum { GUI_CACTIONS_DUMMY_PROPERTY }; +void gui_cactions_pcsop_set_sensitive (GUICActions* self, gboolean setting); GUICActions* gui_cactions_new (void); GUICActions* gui_cactions_construct (GType object_type); +GType gui_cmain_get_type (void); +void gui_cmain_remove_cs (GUICMain* self); +static void _lambda10_ (GtkAction* source, GUICActions* self); +static void __lambda10__gtk_action_activate (GtkAction* _sender, gpointer self); GUICSImport* gui_cs_import_new (void); GUICSImport* gui_cs_import_construct (GType object_type); GType gui_cs_import_get_type (void); -static void _lambda9_ (GtkAction* source, GUICActions* self); -static void __lambda9__gtk_action_activate (GtkAction* _sender, gpointer self); +static void _lambda11_ (GtkAction* source, GUICActions* self); +static void __lambda11__gtk_action_activate (GtkAction* _sender, gpointer self); +void gui_cmain_open_csexport (GUICMain* self); +static void _lambda12_ (GtkAction* source, GUICActions* self); +static void __lambda12__gtk_action_activate (GtkAction* _sender, gpointer self); +void gui_cmain_open_csview (GUICMain* self); +static void _lambda13_ (GtkAction* source, GUICActions* self); +static void __lambda13__gtk_action_activate (GtkAction* _sender, gpointer self); static GObject * gui_cactions_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void gui_cactions_finalize (GObject* obj); gpointer gui_cmenus_ref (gpointer instance); @@ -236,7 +260,6 @@ enum { GUICMenus* gui_cmenus_new (void); GUICMenus* gui_cmenus_construct (GType object_type); static void gui_cmenus_finalize (GUICMenus* obj); -GType gui_cmain_get_type (void); enum { GUI_CMAIN_DUMMY_PROPERTY }; @@ -244,45 +267,61 @@ static void gui_cmain_add_toolitem (GUICMain* self, GtkAction* action); GType emulation_cs_get_type (void); GType emulation_packet_base_get_type (void); static void gui_cmain_dwords_cellrenderer (GUICMain* self, GtkTreeViewColumn* tree_column, GtkCellRenderer* cell, GtkTreeModel* model, GtkTreeIter* iter); +static EmulationCS* gui_cmain_get_selected_cs (GUICMain* self); GUICSView* gui_cs_view_new (EmulationCS* cs); GUICSView* gui_cs_view_construct (GType object_type, EmulationCS* cs); GType gui_cs_view_get_type (void); -static void gui_cmain_open_csview (GUICMain* self, GtkTreePath* path, GtkTreeViewColumn* column); +GUICSExport* gui_cs_export_new (EmulationCS* _cs); +GUICSExport* gui_cs_export_construct (GType object_type, EmulationCS* _cs); +GType gui_cs_export_get_type (void); GUICMain* gui_cmain_new (void); GUICMain* gui_cmain_construct (GType object_type); static void _gui_cmain_dwords_cellrenderer_gtk_tree_cell_data_func (GtkTreeViewColumn* tree_column, GtkCellRenderer* cell, GtkTreeModel* tree_model, GtkTreeIter* iter, gpointer self); -static void _gui_cmain_open_csview_gtk_tree_view_row_activated (GtkTreeView* _sender, GtkTreePath* path, GtkTreeViewColumn* column, gpointer self); +static void _lambda14_ (GtkTreePath* path, GtkTreeViewColumn* column, GUICMain* self); +static void __lambda14__gtk_tree_view_row_activated (GtkTreeView* _sender, GtkTreePath* path, GtkTreeViewColumn* column, gpointer self); +static gboolean _lambda15_ (GdkEventButton* event, GUICMain* self); +static gboolean __lambda15__gtk_widget_button_press_event (GtkWidget* _sender, GdkEventButton* event, gpointer self); +static void _lambda16_ (GtkTreeView* source, GUICMain* self); +static void __lambda16__gtk_tree_view_cursor_changed (GtkTreeView* _sender, gpointer self); static void _gtk_main_quit_gtk_object_destroy (GtkObject* _sender, gpointer self); static GObject * gui_cmain_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void gui_cmain_finalize (GObject* obj); -EmulationSpecLoadDialog* emulation_spec_load_dialog_new (GtkWindow* parent); -EmulationSpecLoadDialog* emulation_spec_load_dialog_construct (GType object_type, GtkWindow* parent); -GType emulation_spec_load_dialog_get_type (void); -void* emulation_spec_load_dialog_run (EmulationSpecLoadDialog* self); -static void* _emulation_spec_load_dialog_run_gthread_func (gpointer self); -void gui_init (char*** args, int* args_length1); +GType gui_spec_load_dialog_get_type (void); +#define GUI_SPEC_LOAD_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GUI_TYPE_SPEC_LOAD_DIALOG, GUISpecLoadDialogPrivate)) +enum { + GUI_SPEC_LOAD_DIALOG_DUMMY_PROPERTY +}; GType emulation_spec_entry_get_type (void); GType emulation_spec_get_type (void); EmulationSpecEntry* emulation_spec_entry_dup (const EmulationSpecEntry* self); void emulation_spec_entry_free (EmulationSpecEntry* self); void emulation_spec_entry_copy (const EmulationSpecEntry* self, EmulationSpecEntry* dest); void emulation_spec_entry_destroy (EmulationSpecEntry* self); -#define EMULATION_SPEC_LOAD_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EMULATION_TYPE_SPEC_LOAD_DIALOG, EmulationSpecLoadDialogPrivate)) -enum { - EMULATION_SPEC_LOAD_DIALOG_DUMMY_PROPERTY -}; static void _vala_EmulationSpecEntry_array_free (EmulationSpecEntry* array, gint array_length); -static void* emulation_spec_load_dialog_pulse_thread (EmulationSpecLoadDialog* self); -static void* _emulation_spec_load_dialog_pulse_thread_gthread_func (gpointer self); -static void* emulation_spec_load_dialog_specload_thread (EmulationSpecLoadDialog* self); -static void* _emulation_spec_load_dialog_specload_thread_gthread_func (gpointer self); +GUISpecLoadDialog* gui_spec_load_dialog_new (GtkWindow* parent); +GUISpecLoadDialog* gui_spec_load_dialog_construct (GType object_type, GtkWindow* parent); +static void* gui_spec_load_dialog_pulse_thread (GUISpecLoadDialog* self); +static void* _gui_spec_load_dialog_pulse_thread_gthread_func (gpointer self); +static void* gui_spec_load_dialog_specload_thread (GUISpecLoadDialog* self); +static void* _gui_spec_load_dialog_specload_thread_gthread_func (gpointer self); +void* gui_spec_load_dialog_run (GUISpecLoadDialog* self); EmulationSpec* emulation_spec_new (const char* filename, const char* variant); EmulationSpec* emulation_spec_construct (GType object_type, const char* filename, const char* variant); -static void emulation_spec_load_dialog_finalize (GObject* obj); +static void gui_spec_load_dialog_finalize (GObject* obj); +static void* _gui_spec_load_dialog_run_gthread_func (gpointer self); +void gui_init (char*** args, int* args_length1); gint _main (char** args, int args_length1); +void gui_cactions_pcsop_set_sensitive (GUICActions* self, gboolean setting) { + g_return_if_fail (self != NULL); + gtk_action_set_sensitive (self->RemoveCS, setting); + gtk_action_set_sensitive (self->ExportCS, setting); + gtk_action_set_sensitive (self->OpenCS, setting); +} + + GUICActions* gui_cactions_construct (GType object_type) { GUICActions * self; self = g_object_newv (object_type, 0, NULL); @@ -295,7 +334,18 @@ GUICActions* gui_cactions_new (void) { } -static void _lambda9_ (GtkAction* source, GUICActions* self) { +static void _lambda10_ (GtkAction* source, GUICActions* self) { + g_return_if_fail (source != NULL); + gui_cmain_remove_cs (gui_main); +} + + +static void __lambda10__gtk_action_activate (GtkAction* _sender, gpointer self) { + _lambda10_ (_sender, self); +} + + +static void _lambda11_ (GtkAction* source, GUICActions* self) { GUICSImport* d; g_return_if_fail (source != NULL); d = g_object_ref_sink (gui_cs_import_new ()); @@ -304,8 +354,30 @@ static void _lambda9_ (GtkAction* source, GUICActions* self) { } -static void __lambda9__gtk_action_activate (GtkAction* _sender, gpointer self) { - _lambda9_ (_sender, self); +static void __lambda11__gtk_action_activate (GtkAction* _sender, gpointer self) { + _lambda11_ (_sender, self); +} + + +static void _lambda12_ (GtkAction* source, GUICActions* self) { + g_return_if_fail (source != NULL); + gui_cmain_open_csexport (gui_main); +} + + +static void __lambda12__gtk_action_activate (GtkAction* _sender, gpointer self) { + _lambda12_ (_sender, self); +} + + +static void _lambda13_ (GtkAction* source, GUICActions* self) { + g_return_if_fail (source != NULL); + gui_cmain_open_csview (gui_main); +} + + +static void __lambda13__gtk_action_activate (GtkAction* _sender, gpointer self) { + _lambda13_ (_sender, self); } @@ -325,6 +397,7 @@ static GObject * gui_cactions_constructor (GType type, guint n_construct_propert GtkAction* _tmp5_; GtkAction* _tmp6_; GtkAction* _tmp7_; + GtkAction* _tmp8_; self->New = (_tmp0_ = gtk_action_new ("New", NULL, NULL, "gtk-new"), _g_object_unref0 (self->New), _tmp0_); self->Open = (_tmp1_ = gtk_action_new ("Open", NULL, NULL, "gtk-open"), _g_object_unref0 (self->Open), _tmp1_); self->Save = (_tmp2_ = gtk_action_new ("Save", NULL, NULL, "gtk-save"), _g_object_unref0 (self->Save), _tmp2_); @@ -332,8 +405,12 @@ static GObject * gui_cactions_constructor (GType type, guint n_construct_propert self->RemoveCS = (_tmp4_ = gtk_action_new ("RemoveCS", "Remove", "Remove selected CS' from the list", "gtk-remove"), _g_object_unref0 (self->RemoveCS), _tmp4_); self->ImportCS = (_tmp5_ = gtk_action_new ("ImportCS", "Import", "Import a command stream to the list", "gtk-add"), _g_object_unref0 (self->ImportCS), _tmp5_); self->ExportCS = (_tmp6_ = gtk_action_new ("ExportCS", "Export", "Export a CS to a file", "gtk-convert"), _g_object_unref0 (self->ExportCS), _tmp6_); - self->Quit = (_tmp7_ = gtk_action_new ("Quit", NULL, NULL, "gtk-quit"), _g_object_unref0 (self->Quit), _tmp7_); - g_signal_connect_object (self->ImportCS, "activate", (GCallback) __lambda9__gtk_action_activate, self, 0); + self->OpenCS = (_tmp7_ = gtk_action_new ("OpenCS", "Open", "Export a CS to a file", "gtk-open"), _g_object_unref0 (self->OpenCS), _tmp7_); + self->Quit = (_tmp8_ = gtk_action_new ("Quit", NULL, NULL, "gtk-quit"), _g_object_unref0 (self->Quit), _tmp8_); + g_signal_connect_object (self->RemoveCS, "activate", (GCallback) __lambda10__gtk_action_activate, self, 0); + g_signal_connect_object (self->ImportCS, "activate", (GCallback) __lambda11__gtk_action_activate, self, 0); + g_signal_connect_object (self->ExportCS, "activate", (GCallback) __lambda12__gtk_action_activate, self, 0); + g_signal_connect_object (self->OpenCS, "activate", (GCallback) __lambda13__gtk_action_activate, self, 0); } return obj; } @@ -360,6 +437,7 @@ static void gui_cactions_finalize (GObject* obj) { _g_object_unref0 (self->RemoveCS); _g_object_unref0 (self->ImportCS); _g_object_unref0 (self->ExportCS); + _g_object_unref0 (self->OpenCS); _g_object_unref0 (self->Quit); G_OBJECT_CLASS (gui_cactions_parent_class)->finalize (obj); } @@ -496,6 +574,7 @@ static void gui_cmenus_finalize (GUICMenus* obj) { self = GUI_CMENUS (obj); _g_object_unref0 (self->file); _g_object_unref0 (self->edit); + _g_object_unref0 (self->cs); } @@ -563,20 +642,66 @@ static void gui_cmain_dwords_cellrenderer (GUICMain* self, GtkTreeViewColumn* tr } -static void gui_cmain_open_csview (GUICMain* self, GtkTreePath* path, GtkTreeViewColumn* column) { +static EmulationCS* gui_cmain_get_selected_cs (GUICMain* self) { + EmulationCS* result; GtkTreeIter iter = {0}; EmulationCS* cs; - GUICSView* csv; - g_return_if_fail (self != NULL); - g_return_if_fail (path != NULL); - g_return_if_fail (column != NULL); + GtkTreeSelection* selection; + g_return_val_if_fail (self != NULL, NULL); cs = NULL; - gtk_tree_model_get_iter ((GtkTreeModel*) self->cs_store, &iter, path); + selection = _g_object_ref0 (gtk_tree_view_get_selection (self->cs_list)); + if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) { + result = NULL; + _g_object_unref0 (cs); + _g_object_unref0 (selection); + return result; + } gtk_tree_model_get ((GtkTreeModel*) self->cs_store, &iter, 1, &cs, -1, -1); - csv = g_object_ref_sink (gui_cs_view_new (cs)); - gtk_widget_show_all ((GtkWidget*) csv); + result = cs; + _g_object_unref0 (selection); + return result; +} + + +void gui_cmain_remove_cs (GUICMain* self) { + GtkTreeIter iter = {0}; + GtkTreeSelection* selection; + g_return_if_fail (self != NULL); + selection = _g_object_ref0 (gtk_tree_view_get_selection (self->cs_list)); + if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) { + _g_object_unref0 (selection); + return; + } + gtk_list_store_remove (self->cs_store, &iter); + _g_object_unref0 (selection); +} + + +void gui_cmain_open_csview (GUICMain* self) { + EmulationCS* cs; + g_return_if_fail (self != NULL); + cs = gui_cmain_get_selected_cs (self); + if (cs != NULL) { + GUICSView* csv; + csv = g_object_ref_sink (gui_cs_view_new (cs)); + gtk_widget_show_all ((GtkWidget*) csv); + _g_object_unref0 (csv); + } + _g_object_unref0 (cs); +} + + +void gui_cmain_open_csexport (GUICMain* self) { + EmulationCS* cs; + g_return_if_fail (self != NULL); + cs = gui_cmain_get_selected_cs (self); + if (cs != NULL) { + GUICSExport* d; + d = g_object_ref_sink (gui_cs_export_new (cs)); + gtk_dialog_run ((GtkDialog*) d); + _g_object_unref0 (d); + } _g_object_unref0 (cs); - _g_object_unref0 (csv); } @@ -597,8 +722,54 @@ static void _gui_cmain_dwords_cellrenderer_gtk_tree_cell_data_func (GtkTreeViewC } -static void _gui_cmain_open_csview_gtk_tree_view_row_activated (GtkTreeView* _sender, GtkTreePath* path, GtkTreeViewColumn* column, gpointer self) { - gui_cmain_open_csview (self, path, column); +static void _lambda14_ (GtkTreePath* path, GtkTreeViewColumn* column, GUICMain* self) { + g_return_if_fail (path != NULL); + g_return_if_fail (column != NULL); + gui_cmain_open_csview (self); +} + + +static void __lambda14__gtk_tree_view_row_activated (GtkTreeView* _sender, GtkTreePath* path, GtkTreeViewColumn* column, gpointer self) { + _lambda14_ (path, column, self); +} + + +static gboolean _lambda15_ (GdkEventButton* event, GUICMain* self) { + gboolean result; + EmulationCS* cs; + gboolean _tmp0_ = FALSE; + gboolean _tmp1_ = FALSE; + cs = gui_cmain_get_selected_cs (self); + if (cs != NULL) { + _tmp1_ = (*event).type == GDK_BUTTON_PRESS; + } else { + _tmp1_ = FALSE; + } + if (_tmp1_) { + _tmp0_ = (*event).button == 3; + } else { + _tmp0_ = FALSE; + } + if (_tmp0_) { + gtk_menu_popup (self->menu->cs, NULL, NULL, NULL, NULL, (*event).button, (*event).time); + } + _g_object_unref0 (cs); +} + + +static gboolean __lambda15__gtk_widget_button_press_event (GtkWidget* _sender, GdkEventButton* event, gpointer self) { + return _lambda15_ (event, self); +} + + +static void _lambda16_ (GtkTreeView* source, GUICMain* self) { + g_return_if_fail (source != NULL); + gui_cactions_pcsop_set_sensitive (gui_actions, gtk_tree_selection_get_selected (gtk_tree_view_get_selection (self->cs_list), NULL, NULL)); +} + + +static void __lambda16__gtk_tree_view_cursor_changed (GtkTreeView* _sender, gpointer self) { + _lambda16_ (_sender, self); } @@ -617,72 +788,87 @@ static GObject * gui_cmain_constructor (GType type, guint n_construct_properties self = GUI_CMAIN (obj); _inner_error_ = NULL; { - GUICMenus* _tmp8_; - GtkToolbar* _tmp9_; - GtkToolItem* _tmp11_; - GtkSeparatorToolItem* _tmp10_; - GtkMenu* _tmp12_; - GtkWidget* _tmp13_; + GUICMenus* _tmp9_; + GtkToolbar* _tmp10_; + GtkToolItem* _tmp12_; + GtkSeparatorToolItem* _tmp11_; + GtkMenu* _tmp13_; GtkWidget* _tmp14_; GtkWidget* _tmp15_; GtkWidget* _tmp16_; - GtkMenuItem* _tmp18_; - GtkSeparatorMenuItem* _tmp17_; - GtkWidget* _tmp19_; + GtkWidget* _tmp17_; + GtkMenuItem* _tmp19_; + GtkSeparatorMenuItem* _tmp18_; + GtkWidget* _tmp20_; GtkMenuItem* menu_file_item; - GtkMenu* _tmp20_; - GtkWidget* _tmp21_; + GtkMenu* _tmp21_; GtkWidget* _tmp22_; GtkWidget* _tmp23_; + GtkWidget* _tmp24_; GtkMenuItem* menu_edit_item; - GtkMenuBar* _tmp24_; - GtkListStore* _tmp25_; - GtkTreeView* cslist; - GtkCellRendererText* _tmp26_; - GtkCellRendererText* _tmp27_; + GtkMenuBar* _tmp25_; + GtkMenu* _tmp26_; + GtkWidget* _tmp27_; + GtkWidget* _tmp28_; + GtkMenuItem* _tmp30_; + GtkSeparatorMenuItem* _tmp29_; + GtkWidget* _tmp31_; + GtkListStore* _tmp32_; + GtkTreeView* _tmp33_; + GtkCellRendererText* _tmp34_; + GtkCellRendererText* _tmp35_; GtkScrolledWindow* sw; GtkVBox* mainbox; - self->menu = (_tmp8_ = gui_cmenus_new (), _gui_cmenus_unref0 (self->menu), _tmp8_); - self->toolbar = (_tmp9_ = g_object_ref_sink ((GtkToolbar*) gtk_toolbar_new ()), _g_object_unref0 (self->toolbar), _tmp9_); + self->menu = (_tmp9_ = gui_cmenus_new (), _gui_cmenus_unref0 (self->menu), _tmp9_); + self->toolbar = (_tmp10_ = g_object_ref_sink ((GtkToolbar*) gtk_toolbar_new ()), _g_object_unref0 (self->toolbar), _tmp10_); gui_cmain_add_toolitem (self, gui_actions->New); gui_cmain_add_toolitem (self, gui_actions->Open); gui_cmain_add_toolitem (self, gui_actions->Save); - gtk_toolbar_insert (self->toolbar, _tmp11_ = (_tmp10_ = g_object_ref_sink ((GtkSeparatorToolItem*) gtk_separator_tool_item_new ()), GTK_IS_TOOL_ITEM (_tmp10_) ? ((GtkToolItem*) _tmp10_) : NULL), -1); - _g_object_unref0 (_tmp11_); + gtk_toolbar_insert (self->toolbar, _tmp12_ = (_tmp11_ = g_object_ref_sink ((GtkSeparatorToolItem*) gtk_separator_tool_item_new ()), GTK_IS_TOOL_ITEM (_tmp11_) ? ((GtkToolItem*) _tmp11_) : NULL), -1); + _g_object_unref0 (_tmp12_); gui_cmain_add_toolitem (self, gui_actions->RemoveCS); gui_cmain_add_toolitem (self, gui_actions->ImportCS); gui_cmain_add_toolitem (self, gui_actions->ExportCS); - self->menu->file = (_tmp12_ = g_object_ref_sink ((GtkMenu*) gtk_menu_new ()), _g_object_unref0 (self->menu->file), _tmp12_); - gtk_menu_shell_append ((GtkMenuShell*) self->menu->file, (GtkWidget*) (_tmp13_ = gtk_action_create_menu_item (gui_actions->New), GTK_IS_MENU_ITEM (_tmp13_) ? ((GtkMenuItem*) _tmp13_) : NULL)); - gtk_menu_shell_append ((GtkMenuShell*) self->menu->file, (GtkWidget*) (_tmp14_ = gtk_action_create_menu_item (gui_actions->Open), GTK_IS_MENU_ITEM (_tmp14_) ? ((GtkMenuItem*) _tmp14_) : NULL)); - gtk_menu_shell_append ((GtkMenuShell*) self->menu->file, (GtkWidget*) (_tmp15_ = gtk_action_create_menu_item (gui_actions->Save), GTK_IS_MENU_ITEM (_tmp15_) ? ((GtkMenuItem*) _tmp15_) : NULL)); - gtk_menu_shell_append ((GtkMenuShell*) self->menu->file, (GtkWidget*) (_tmp16_ = gtk_action_create_menu_item (gui_actions->SaveAs), GTK_IS_MENU_ITEM (_tmp16_) ? ((GtkMenuItem*) _tmp16_) : NULL)); - gtk_menu_shell_append ((GtkMenuShell*) self->menu->file, (GtkWidget*) (_tmp18_ = (_tmp17_ = g_object_ref_sink ((GtkSeparatorMenuItem*) gtk_separator_menu_item_new ()), GTK_IS_MENU_ITEM (_tmp17_) ? ((GtkMenuItem*) _tmp17_) : NULL))); - _g_object_unref0 (_tmp18_); - gtk_menu_shell_append ((GtkMenuShell*) self->menu->file, (GtkWidget*) (_tmp19_ = gtk_action_create_menu_item (gui_actions->Quit), GTK_IS_MENU_ITEM (_tmp19_) ? ((GtkMenuItem*) _tmp19_) : NULL)); + self->menu->file = (_tmp13_ = g_object_ref_sink ((GtkMenu*) gtk_menu_new ()), _g_object_unref0 (self->menu->file), _tmp13_); + gtk_menu_shell_append ((GtkMenuShell*) self->menu->file, (GtkWidget*) (_tmp14_ = gtk_action_create_menu_item (gui_actions->New), GTK_IS_MENU_ITEM (_tmp14_) ? ((GtkMenuItem*) _tmp14_) : NULL)); + gtk_menu_shell_append ((GtkMenuShell*) self->menu->file, (GtkWidget*) (_tmp15_ = gtk_action_create_menu_item (gui_actions->Open), GTK_IS_MENU_ITEM (_tmp15_) ? ((GtkMenuItem*) _tmp15_) : NULL)); + gtk_menu_shell_append ((GtkMenuShell*) self->menu->file, (GtkWidget*) (_tmp16_ = gtk_action_create_menu_item (gui_actions->Save), GTK_IS_MENU_ITEM (_tmp16_) ? ((GtkMenuItem*) _tmp16_) : NULL)); + gtk_menu_shell_append ((GtkMenuShell*) self->menu->file, (GtkWidget*) (_tmp17_ = gtk_action_create_menu_item (gui_actions->SaveAs), GTK_IS_MENU_ITEM (_tmp17_) ? ((GtkMenuItem*) _tmp17_) : NULL)); + gtk_menu_shell_append ((GtkMenuShell*) self->menu->file, (GtkWidget*) (_tmp19_ = (_tmp18_ = g_object_ref_sink ((GtkSeparatorMenuItem*) gtk_separator_menu_item_new ()), GTK_IS_MENU_ITEM (_tmp18_) ? ((GtkMenuItem*) _tmp18_) : NULL))); + _g_object_unref0 (_tmp19_); + gtk_menu_shell_append ((GtkMenuShell*) self->menu->file, (GtkWidget*) (_tmp20_ = gtk_action_create_menu_item (gui_actions->Quit), GTK_IS_MENU_ITEM (_tmp20_) ? ((GtkMenuItem*) _tmp20_) : NULL)); menu_file_item = g_object_ref_sink ((GtkMenuItem*) gtk_menu_item_new_with_label ("File")); gtk_menu_item_set_submenu (menu_file_item, self->menu->file); - self->menu->edit = (_tmp20_ = g_object_ref_sink ((GtkMenu*) gtk_menu_new ()), _g_object_unref0 (self->menu->edit), _tmp20_); - gtk_menu_shell_append ((GtkMenuShell*) self->menu->edit, (GtkWidget*) (_tmp21_ = gtk_action_create_menu_item (gui_actions->RemoveCS), GTK_IS_MENU_ITEM (_tmp21_) ? ((GtkMenuItem*) _tmp21_) : NULL)); - gtk_menu_shell_append ((GtkMenuShell*) self->menu->edit, (GtkWidget*) (_tmp22_ = gtk_action_create_menu_item (gui_actions->ImportCS), GTK_IS_MENU_ITEM (_tmp22_) ? ((GtkMenuItem*) _tmp22_) : NULL)); - gtk_menu_shell_append ((GtkMenuShell*) self->menu->edit, (GtkWidget*) (_tmp23_ = gtk_action_create_menu_item (gui_actions->ExportCS), GTK_IS_MENU_ITEM (_tmp23_) ? ((GtkMenuItem*) _tmp23_) : NULL)); + self->menu->edit = (_tmp21_ = g_object_ref_sink ((GtkMenu*) gtk_menu_new ()), _g_object_unref0 (self->menu->edit), _tmp21_); + gtk_menu_shell_append ((GtkMenuShell*) self->menu->edit, (GtkWidget*) (_tmp22_ = gtk_action_create_menu_item (gui_actions->RemoveCS), GTK_IS_MENU_ITEM (_tmp22_) ? ((GtkMenuItem*) _tmp22_) : NULL)); + gtk_menu_shell_append ((GtkMenuShell*) self->menu->edit, (GtkWidget*) (_tmp23_ = gtk_action_create_menu_item (gui_actions->ImportCS), GTK_IS_MENU_ITEM (_tmp23_) ? ((GtkMenuItem*) _tmp23_) : NULL)); + gtk_menu_shell_append ((GtkMenuShell*) self->menu->edit, (GtkWidget*) (_tmp24_ = gtk_action_create_menu_item (gui_actions->ExportCS), GTK_IS_MENU_ITEM (_tmp24_) ? ((GtkMenuItem*) _tmp24_) : NULL)); menu_edit_item = g_object_ref_sink ((GtkMenuItem*) gtk_menu_item_new_with_label ("Edit")); gtk_menu_item_set_submenu (menu_edit_item, self->menu->edit); - self->menubar = (_tmp24_ = g_object_ref_sink ((GtkMenuBar*) gtk_menu_bar_new ()), _g_object_unref0 (self->menubar), _tmp24_); + self->menubar = (_tmp25_ = g_object_ref_sink ((GtkMenuBar*) gtk_menu_bar_new ()), _g_object_unref0 (self->menubar), _tmp25_); gtk_menu_shell_append ((GtkMenuShell*) self->menubar, (GtkWidget*) menu_file_item); gtk_menu_shell_append ((GtkMenuShell*) self->menubar, (GtkWidget*) menu_edit_item); - self->cs_store = (_tmp25_ = gtk_list_store_new (2, G_TYPE_STRING, EMULATION_TYPE_CS, NULL), _g_object_unref0 (self->cs_store), _tmp25_); - cslist = g_object_ref_sink ((GtkTreeView*) gtk_tree_view_new ()); - gtk_tree_view_insert_column_with_data_func (cslist, -1, "DWORDs", (GtkCellRenderer*) (_tmp26_ = g_object_ref_sink ((GtkCellRendererText*) gtk_cell_renderer_text_new ())), _gui_cmain_dwords_cellrenderer_gtk_tree_cell_data_func, g_object_ref (self), g_object_unref); - _g_object_unref0 (_tmp26_); - gtk_tree_view_insert_column_with_attributes (cslist, -1, "Name", (GtkCellRenderer*) (_tmp27_ = g_object_ref_sink ((GtkCellRendererText*) gtk_cell_renderer_text_new ())), "text", 0, NULL, NULL); - _g_object_unref0 (_tmp27_); - gtk_tree_view_set_model (cslist, (GtkTreeModel*) self->cs_store); - g_signal_connect_object (cslist, "row-activated", (GCallback) _gui_cmain_open_csview_gtk_tree_view_row_activated, self, 0); + self->menu->cs = (_tmp26_ = g_object_ref_sink ((GtkMenu*) gtk_menu_new ()), _g_object_unref0 (self->menu->cs), _tmp26_); + gtk_menu_shell_append ((GtkMenuShell*) self->menu->cs, (GtkWidget*) (_tmp27_ = gtk_action_create_menu_item (gui_actions->OpenCS), GTK_IS_MENU_ITEM (_tmp27_) ? ((GtkMenuItem*) _tmp27_) : NULL)); + gtk_menu_shell_append ((GtkMenuShell*) self->menu->cs, (GtkWidget*) (_tmp28_ = gtk_action_create_menu_item (gui_actions->ExportCS), GTK_IS_MENU_ITEM (_tmp28_) ? ((GtkMenuItem*) _tmp28_) : NULL)); + gtk_menu_shell_append ((GtkMenuShell*) self->menu->cs, (GtkWidget*) (_tmp30_ = (_tmp29_ = g_object_ref_sink ((GtkSeparatorMenuItem*) gtk_separator_menu_item_new ()), GTK_IS_MENU_ITEM (_tmp29_) ? ((GtkMenuItem*) _tmp29_) : NULL))); + _g_object_unref0 (_tmp30_); + gtk_menu_shell_append ((GtkMenuShell*) self->menu->cs, (GtkWidget*) (_tmp31_ = gtk_action_create_menu_item (gui_actions->RemoveCS), GTK_IS_MENU_ITEM (_tmp31_) ? ((GtkMenuItem*) _tmp31_) : NULL)); + self->cs_store = (_tmp32_ = gtk_list_store_new (2, G_TYPE_STRING, EMULATION_TYPE_CS, NULL), _g_object_unref0 (self->cs_store), _tmp32_); + self->cs_list = (_tmp33_ = g_object_ref_sink ((GtkTreeView*) gtk_tree_view_new ()), _g_object_unref0 (self->cs_list), _tmp33_); + gtk_tree_view_insert_column_with_data_func (self->cs_list, -1, "DWORDs", (GtkCellRenderer*) (_tmp34_ = g_object_ref_sink ((GtkCellRendererText*) gtk_cell_renderer_text_new ())), _gui_cmain_dwords_cellrenderer_gtk_tree_cell_data_func, g_object_ref (self), g_object_unref); + _g_object_unref0 (_tmp34_); + gtk_tree_view_insert_column_with_attributes (self->cs_list, -1, "Name", (GtkCellRenderer*) (_tmp35_ = g_object_ref_sink ((GtkCellRendererText*) gtk_cell_renderer_text_new ())), "text", 0, NULL, NULL); + _g_object_unref0 (_tmp35_); + gtk_tree_view_set_model (self->cs_list, (GtkTreeModel*) self->cs_store); + g_signal_connect_object (self->cs_list, "row-activated", (GCallback) __lambda14__gtk_tree_view_row_activated, self, 0); + g_signal_connect_object ((GtkWidget*) self->cs_list, "button-press-event", (GCallback) __lambda15__gtk_widget_button_press_event, self, 0); + g_signal_connect_object (self->cs_list, "cursor-changed", (GCallback) __lambda16__gtk_tree_view_cursor_changed, self, 0); + gui_cactions_pcsop_set_sensitive (gui_actions, FALSE); sw = g_object_ref_sink ((GtkScrolledWindow*) gtk_scrolled_window_new (NULL, NULL)); g_object_set (sw, "hscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL); g_object_set (sw, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL); - gtk_container_add ((GtkContainer*) sw, (GtkWidget*) cslist); + gtk_container_add ((GtkContainer*) sw, (GtkWidget*) self->cs_list); mainbox = g_object_ref_sink ((GtkVBox*) gtk_vbox_new (FALSE, 0)); gtk_box_pack_start ((GtkBox*) mainbox, (GtkWidget*) self->menubar, FALSE, TRUE, (guint) 0); gtk_box_pack_start ((GtkBox*) mainbox, (GtkWidget*) self->toolbar, FALSE, TRUE, (guint) 0); @@ -694,11 +880,11 @@ static GObject * gui_cmain_constructor (GType type, guint n_construct_properties { gtk_window_set_icon_from_file ((GtkWindow*) self, "/usr/share/pixmaps/rsim.png", &_inner_error_); if (_inner_error_ != NULL) { - goto __catch0_g_error; + goto __catch1_g_error; } } - goto __finally0; - __catch0_g_error: + goto __finally1; + __catch1_g_error: { GError * e; e = _inner_error_; @@ -707,11 +893,10 @@ static GObject * gui_cmain_constructor (GType type, guint n_construct_properties _g_error_free0 (e); } } - __finally0: + __finally1: if (_inner_error_ != NULL) { _g_object_unref0 (menu_file_item); _g_object_unref0 (menu_edit_item); - _g_object_unref0 (cslist); _g_object_unref0 (sw); _g_object_unref0 (mainbox); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); @@ -720,7 +905,6 @@ static GObject * gui_cmain_constructor (GType type, guint n_construct_properties gtk_widget_show_all ((GtkWidget*) self); _g_object_unref0 (menu_file_item); _g_object_unref0 (menu_edit_item); - _g_object_unref0 (cslist); _g_object_unref0 (sw); _g_object_unref0 (mainbox); } @@ -746,6 +930,7 @@ static void gui_cmain_finalize (GObject* obj) { _g_object_unref0 (self->menubar); _g_object_unref0 (self->toolbar); _g_object_unref0 (self->cs_store); + _g_object_unref0 (self->cs_list); G_OBJECT_CLASS (gui_cmain_parent_class)->finalize (obj); } @@ -760,95 +945,6 @@ GType gui_cmain_get_type (void) { } -static void* _emulation_spec_load_dialog_run_gthread_func (gpointer self) { - return emulation_spec_load_dialog_run (self); -} - - -void gui_init (char*** args, int* args_length1) { - GError * _inner_error_; - GUICActions* _tmp0_; - GUICMain* _tmp1_; - _inner_error_ = NULL; - gtk_init (args_length1, args); - gui_actions = (_tmp0_ = gui_cactions_new (), _g_object_unref0 (gui_actions), _tmp0_); - gui_main = (_tmp1_ = g_object_ref_sink (gui_cmain_new ()), _g_object_unref0 (gui_main), _tmp1_); - { - EmulationSpecLoadDialog* specload; - gdk_threads_init (); - specload = g_object_ref_sink (emulation_spec_load_dialog_new ((GtkWindow*) gui_main)); - { - g_thread_create (_emulation_spec_load_dialog_run_gthread_func, specload, FALSE, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_THREAD_ERROR) { - goto __catch1_g_thread_error; - } - _g_object_unref0 (specload); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - } - goto __finally1; - __catch1_g_thread_error: - { - GError * e; - e = _inner_error_; - _inner_error_ = NULL; - { - fprintf (stderr, "Unable to start loading thread.\n"); - g_assert (FALSE); - _g_error_free0 (e); - } - } - __finally1: - if (_inner_error_ != NULL) { - _g_object_unref0 (specload); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; - } - _g_object_unref0 (specload); - } - gtk_main (); -} - - -void emulation_spec_entry_copy (const EmulationSpecEntry* self, EmulationSpecEntry* dest) { - dest->spec = _g_object_ref0 (self->spec); - dest->name = g_strdup (self->name); -} - - -void emulation_spec_entry_destroy (EmulationSpecEntry* self) { - _g_object_unref0 (self->spec); - _g_free0 (self->name); -} - - -EmulationSpecEntry* emulation_spec_entry_dup (const EmulationSpecEntry* self) { - EmulationSpecEntry* dup; - dup = g_new0 (EmulationSpecEntry, 1); - emulation_spec_entry_copy (self, dup); - return dup; -} - - -void emulation_spec_entry_free (EmulationSpecEntry* self) { - emulation_spec_entry_destroy (self); - g_free (self); -} - - -GType emulation_spec_entry_get_type (void) { - static GType emulation_spec_entry_type_id = 0; - if (emulation_spec_entry_type_id == 0) { - emulation_spec_entry_type_id = g_boxed_type_register_static ("EmulationSpecEntry", (GBoxedCopyFunc) emulation_spec_entry_dup, (GBoxedFreeFunc) emulation_spec_entry_free); - } - return emulation_spec_entry_type_id; -} - - static void _vala_EmulationSpecEntry_array_free (EmulationSpecEntry* array, gint array_length) { if (array != NULL) { int i; @@ -860,8 +956,8 @@ static void _vala_EmulationSpecEntry_array_free (EmulationSpecEntry* array, gint } -EmulationSpecLoadDialog* emulation_spec_load_dialog_construct (GType object_type, GtkWindow* parent) { - EmulationSpecLoadDialog * self; +GUISpecLoadDialog* gui_spec_load_dialog_construct (GType object_type, GtkWindow* parent) { + GUISpecLoadDialog * self; EmulationSpecEntry* _tmp0_; GtkLabel* _tmp1_; GtkProgressBar* _tmp2_; @@ -888,22 +984,22 @@ EmulationSpecLoadDialog* emulation_spec_load_dialog_construct (GType object_type } -EmulationSpecLoadDialog* emulation_spec_load_dialog_new (GtkWindow* parent) { - return emulation_spec_load_dialog_construct (EMULATION_TYPE_SPEC_LOAD_DIALOG, parent); +GUISpecLoadDialog* gui_spec_load_dialog_new (GtkWindow* parent) { + return gui_spec_load_dialog_construct (GUI_TYPE_SPEC_LOAD_DIALOG, parent); } -static void* _emulation_spec_load_dialog_pulse_thread_gthread_func (gpointer self) { - return emulation_spec_load_dialog_pulse_thread (self); +static void* _gui_spec_load_dialog_pulse_thread_gthread_func (gpointer self) { + return gui_spec_load_dialog_pulse_thread (self); } -static void* _emulation_spec_load_dialog_specload_thread_gthread_func (gpointer self) { - return emulation_spec_load_dialog_specload_thread (self); +static void* _gui_spec_load_dialog_specload_thread_gthread_func (gpointer self) { + return gui_spec_load_dialog_specload_thread (self); } -void* emulation_spec_load_dialog_run (EmulationSpecLoadDialog* self) { +void* gui_spec_load_dialog_run (GUISpecLoadDialog* self) { void* result; GError * _inner_error_; GThread* load; @@ -920,7 +1016,7 @@ void* emulation_spec_load_dialog_run (EmulationSpecLoadDialog* self) { { GThread* _tmp0_; GThread* _tmp1_; - _tmp0_ = g_thread_create (_emulation_spec_load_dialog_pulse_thread_gthread_func, self, TRUE, &_inner_error_); + _tmp0_ = g_thread_create (_gui_spec_load_dialog_pulse_thread_gthread_func, self, TRUE, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == G_THREAD_ERROR) { goto __catch2_g_thread_error; @@ -930,7 +1026,7 @@ void* emulation_spec_load_dialog_run (EmulationSpecLoadDialog* self) { return NULL; } pulse = _tmp0_; - _tmp1_ = g_thread_create (_emulation_spec_load_dialog_specload_thread_gthread_func, self, TRUE, &_inner_error_); + _tmp1_ = g_thread_create (_gui_spec_load_dialog_specload_thread_gthread_func, self, TRUE, &_inner_error_); if (_inner_error_ != NULL) { if (_inner_error_->domain == G_THREAD_ERROR) { goto __catch2_g_thread_error; @@ -972,7 +1068,7 @@ void* emulation_spec_load_dialog_run (EmulationSpecLoadDialog* self) { } -static void* emulation_spec_load_dialog_pulse_thread (EmulationSpecLoadDialog* self) { +static void* gui_spec_load_dialog_pulse_thread (GUISpecLoadDialog* self) { void* result; g_return_val_if_fail (self != NULL, NULL); while (TRUE) { @@ -989,7 +1085,7 @@ static void* emulation_spec_load_dialog_pulse_thread (EmulationSpecLoadDialog* s } -static void* emulation_spec_load_dialog_specload_thread (EmulationSpecLoadDialog* self) { +static void* gui_spec_load_dialog_specload_thread (GUISpecLoadDialog* self) { void* result; EmulationSpec* r300_registers; EmulationSpec* r500_registers; @@ -1020,34 +1116,123 @@ static void* emulation_spec_load_dialog_specload_thread (EmulationSpecLoadDialog } -static void emulation_spec_load_dialog_class_init (EmulationSpecLoadDialogClass * klass) { - emulation_spec_load_dialog_parent_class = g_type_class_peek_parent (klass); - g_type_class_add_private (klass, sizeof (EmulationSpecLoadDialogPrivate)); - G_OBJECT_CLASS (klass)->finalize = emulation_spec_load_dialog_finalize; +static void gui_spec_load_dialog_class_init (GUISpecLoadDialogClass * klass) { + gui_spec_load_dialog_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GUISpecLoadDialogPrivate)); + G_OBJECT_CLASS (klass)->finalize = gui_spec_load_dialog_finalize; } -static void emulation_spec_load_dialog_instance_init (EmulationSpecLoadDialog * self) { - self->priv = EMULATION_SPEC_LOAD_DIALOG_GET_PRIVATE (self); +static void gui_spec_load_dialog_instance_init (GUISpecLoadDialog * self) { + self->priv = GUI_SPEC_LOAD_DIALOG_GET_PRIVATE (self); } -static void emulation_spec_load_dialog_finalize (GObject* obj) { - EmulationSpecLoadDialog * self; - self = EMULATION_SPEC_LOAD_DIALOG (obj); +static void gui_spec_load_dialog_finalize (GObject* obj) { + GUISpecLoadDialog * self; + self = GUI_SPEC_LOAD_DIALOG (obj); _g_object_unref0 (self->priv->loading); _g_object_unref0 (self->priv->progress); - G_OBJECT_CLASS (emulation_spec_load_dialog_parent_class)->finalize (obj); + G_OBJECT_CLASS (gui_spec_load_dialog_parent_class)->finalize (obj); } -GType emulation_spec_load_dialog_get_type (void) { - static GType emulation_spec_load_dialog_type_id = 0; - if (emulation_spec_load_dialog_type_id == 0) { - static const GTypeInfo g_define_type_info = { sizeof (EmulationSpecLoadDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) emulation_spec_load_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EmulationSpecLoadDialog), 0, (GInstanceInitFunc) emulation_spec_load_dialog_instance_init, NULL }; - emulation_spec_load_dialog_type_id = g_type_register_static (GTK_TYPE_WINDOW, "EmulationSpecLoadDialog", &g_define_type_info, 0); +GType gui_spec_load_dialog_get_type (void) { + static GType gui_spec_load_dialog_type_id = 0; + if (gui_spec_load_dialog_type_id == 0) { + static const GTypeInfo g_define_type_info = { sizeof (GUISpecLoadDialogClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gui_spec_load_dialog_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GUISpecLoadDialog), 0, (GInstanceInitFunc) gui_spec_load_dialog_instance_init, NULL }; + gui_spec_load_dialog_type_id = g_type_register_static (GTK_TYPE_WINDOW, "GUISpecLoadDialog", &g_define_type_info, 0); } - return emulation_spec_load_dialog_type_id; + return gui_spec_load_dialog_type_id; +} + + +static void* _gui_spec_load_dialog_run_gthread_func (gpointer self) { + return gui_spec_load_dialog_run (self); +} + + +void gui_init (char*** args, int* args_length1) { + GError * _inner_error_; + GUICActions* _tmp0_; + GUICMain* _tmp1_; + _inner_error_ = NULL; + gtk_init (args_length1, args); + gui_actions = (_tmp0_ = gui_cactions_new (), _g_object_unref0 (gui_actions), _tmp0_); + gui_main = (_tmp1_ = g_object_ref_sink (gui_cmain_new ()), _g_object_unref0 (gui_main), _tmp1_); + { + GUISpecLoadDialog* specload; + gdk_threads_init (); + specload = g_object_ref_sink (gui_spec_load_dialog_new ((GtkWindow*) gui_main)); + { + g_thread_create (_gui_spec_load_dialog_run_gthread_func, specload, FALSE, &_inner_error_); + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_THREAD_ERROR) { + goto __catch3_g_thread_error; + } + _g_object_unref0 (specload); + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); + return; + } + } + goto __finally3; + __catch3_g_thread_error: + { + GError * e; + e = _inner_error_; + _inner_error_ = NULL; + { + fprintf (stderr, "Unable to start loading thread.\n"); + g_assert (FALSE); + _g_error_free0 (e); + } + } + __finally3: + if (_inner_error_ != NULL) { + _g_object_unref0 (specload); + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); + return; + } + _g_object_unref0 (specload); + } + gtk_main (); +} + + +void emulation_spec_entry_copy (const EmulationSpecEntry* self, EmulationSpecEntry* dest) { + dest->spec = _g_object_ref0 (self->spec); + dest->name = g_strdup (self->name); +} + + +void emulation_spec_entry_destroy (EmulationSpecEntry* self) { + _g_object_unref0 (self->spec); + _g_free0 (self->name); +} + + +EmulationSpecEntry* emulation_spec_entry_dup (const EmulationSpecEntry* self) { + EmulationSpecEntry* dup; + dup = g_new0 (EmulationSpecEntry, 1); + emulation_spec_entry_copy (self, dup); + return dup; +} + + +void emulation_spec_entry_free (EmulationSpecEntry* self) { + emulation_spec_entry_destroy (self); + g_free (self); +} + + +GType emulation_spec_entry_get_type (void) { + static GType emulation_spec_entry_type_id = 0; + if (emulation_spec_entry_type_id == 0) { + emulation_spec_entry_type_id = g_boxed_type_register_static ("EmulationSpecEntry", (GBoxedCopyFunc) emulation_spec_entry_dup, (GBoxedFreeFunc) emulation_spec_entry_free); + } + return emulation_spec_entry_type_id; } diff --git a/src/main.vala b/src/main.vala index 177a198..40f1992 100644 --- a/src/main.vala +++ b/src/main.vala @@ -12,6 +12,7 @@ namespace GUI public Action RemoveCS; public Action ImportCS; public Action ExportCS; + public Action OpenCS; public Action Quit; construct { @@ -22,9 +23,20 @@ namespace GUI RemoveCS = new Action("RemoveCS", "Remove", "Remove selected CS' from the list", "gtk-remove"); ImportCS = new Action("ImportCS", "Import", "Import a command stream to the list", "gtk-add"); ExportCS = new Action("ExportCS", "Export", "Export a CS to a file", "gtk-convert"); + OpenCS = new Action("OpenCS", "Open", "Export a CS to a file", "gtk-open"); Quit = new Action("Quit", null, null, "gtk-quit"); + RemoveCS.activate.connect((source) => { main.remove_cs(); }); ImportCS.activate.connect((source) => { var d = new CSImport(); d.run(); }); + ExportCS.activate.connect((source) => { main.open_csexport(); }); + OpenCS.activate.connect((source) => { main.open_csview(); }); + } + + public void pcsop_set_sensitive(bool setting) + { + RemoveCS.set_sensitive(setting); + ExportCS.set_sensitive(setting); + OpenCS.set_sensitive(setting); } } @@ -32,6 +44,7 @@ namespace GUI { public Menu file; public Menu edit; + public Menu cs; } public class CMain : Window @@ -40,6 +53,7 @@ namespace GUI public MenuBar menubar; public Toolbar toolbar; public ListStore cs_store; + public TreeView cs_list; construct { menu = new CMenus(); @@ -74,17 +88,32 @@ namespace GUI menubar.append(menu_file_item); menubar.append(menu_edit_item); + /* used on right clicks */ + menu.cs = new Menu(); + menu.cs.append(actions.OpenCS.create_menu_item() as MenuItem); + menu.cs.append(actions.ExportCS.create_menu_item() as MenuItem); + menu.cs.append(new SeparatorMenuItem() as MenuItem); + menu.cs.append(actions.RemoveCS.create_menu_item() as MenuItem); + cs_store = new ListStore(2, typeof(string), typeof(CS)); - var cslist = new TreeView(); - cslist.insert_column_with_data_func(-1, "DWORDs", new CellRendererText(), dwords_cellrenderer); - cslist.insert_column_with_attributes(-1, "Name", new CellRendererText(), "text", 0, null); - cslist.set_model(cs_store); - cslist.row_activated.connect(open_csview); + cs_list = new TreeView(); + cs_list.insert_column_with_data_func(-1, "DWORDs", new CellRendererText(), dwords_cellrenderer); + cs_list.insert_column_with_attributes(-1, "Name", new CellRendererText(), "text", 0, null); + cs_list.set_model(cs_store); + cs_list.row_activated.connect((path, column) => { open_csview(); }); + cs_list.button_press_event.connect((event) => { + CS? cs = get_selected_cs(); + if (cs != null && event.type == Gdk.EventType.BUTTON_PRESS && event.button == 3) { + menu.cs.popup(null, null, null, event.button, event.time); + } + }); + cs_list.cursor_changed.connect((source) => { actions.pcsop_set_sensitive(cs_list.get_selection().get_selected(null, null)); }); + actions.pcsop_set_sensitive(false); var sw = new ScrolledWindow(null, null); sw.hscrollbar_policy = PolicyType.AUTOMATIC; sw.vscrollbar_policy = PolicyType.AUTOMATIC; - sw.add(cslist); + sw.add(cs_list); var mainbox = new VBox(false, 0); mainbox.pack_start(menubar, false, true, 0); @@ -119,54 +148,47 @@ namespace GUI (cell as CellRendererText).text = cs.dwords.length.to_string(); } - private void open_csview(TreePath path, TreeViewColumn column) + private CS? get_selected_cs() { TreeIter iter; CS cs; - cs_store.get_iter(out iter, path); - cs_store.get(iter, 1, out cs, -1); - var csv = new CSView(cs); - csv.show_all(); + var selection = cs_list.get_selection(); + if (!selection.get_selected(null, out iter)) { return null; } + + cs_store.get(iter, 1, out cs, -1); + return cs; } - } - public static CActions actions; - public static CMain main; + public void remove_cs() + { + TreeIter iter; - static void init(ref weak string[] args) - { - Gtk.init(ref args); - actions = new CActions(); - main = new CMain(); + var selection = cs_list.get_selection(); + if (!selection.get_selected(null, out iter)) { return; } - { - Gdk.threads_init(); + cs_store.remove(iter); + } - var specload = new SpecLoadDialog(main); - try { - Thread.create(specload.run, false); - } catch (ThreadError e) { - stderr.printf("Unable to start loading thread.\n"); - assert(false); + public void open_csview() + { + CS? cs = get_selected_cs(); + if (cs != null) { + var csv = new CSView(cs); + csv.show_all(); } } - Gtk.main(); - } -} - -namespace Emulation -{ - public struct SpecEntry - { - Spec spec; - string name; + public void open_csexport() + { + CS? cs = get_selected_cs(); + if (cs != null) { + var d = new CSExport(cs); + d.run(); + } + } } - public SpecEntry[] specs; - public uint spec_default = 1; - internal class SpecLoadDialog : Window { private Label loading; @@ -265,6 +287,42 @@ namespace Emulation return (void *)123; } } + + public static CActions actions; + public static CMain main; + + static void init(ref weak string[] args) + { + Gtk.init(ref args); + actions = new CActions(); + main = new CMain(); + + { + Gdk.threads_init(); + + var specload = new SpecLoadDialog(main); + try { + Thread.create(specload.run, false); + } catch (ThreadError e) { + stderr.printf("Unable to start loading thread.\n"); + assert(false); + } + } + + Gtk.main(); + } +} + +namespace Emulation +{ + public struct SpecEntry + { + Spec spec; + string name; + } + + public SpecEntry[] specs; + public uint spec_default = 1; } public static int main(string[] args) diff --git a/src/registers.c b/src/registers.c index 8ef89b6..a7dffbd 100644 --- a/src/registers.c +++ b/src/registers.c @@ -95,7 +95,6 @@ typedef struct _EmulationRegisterPrivate EmulationRegisterPrivate; typedef struct _EmulationRegisterIterator EmulationRegisterIterator; typedef struct _EmulationRegisterIteratorClass EmulationRegisterIteratorClass; typedef struct _EmulationRegisterIteratorPrivate EmulationRegisterIteratorPrivate; -typedef struct _EmulationParamSpecRegisterIterator EmulationParamSpecRegisterIterator; #define EMULATION_TYPE_REGISTER_LIST (emulation_register_list_get_type ()) #define EMULATION_REGISTER_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_REGISTER_LIST, EmulationRegisterList)) @@ -235,24 +234,18 @@ struct _EmulationRegisterPrivate { }; struct _EmulationRegisterIterator { - GTypeInstance parent_instance; - volatile int ref_count; + GObject parent_instance; EmulationRegisterIteratorPrivate * priv; }; struct _EmulationRegisterIteratorClass { - GTypeClass parent_class; - void (*finalize) (EmulationRegisterIterator *self); + GObjectClass parent_class; }; struct _EmulationRegisterIteratorPrivate { GList* m_list; }; -struct _EmulationParamSpecRegisterIterator { - GParamSpec parent_instance; -}; - struct _EmulationRegisterList { GObject parent_instance; EmulationRegisterListPrivate * priv; @@ -402,7 +395,7 @@ enum { EMULATION_REGISTER_INFO_COUNT, EMULATION_REGISTER_INFO_ACCESS, EMULATION_REGISTER_INFO_LENGTH, - EMULATION_REGISTER_INFO_EXTRACT_TYPE + EMULATION_REGISTER_INFO_ELEMENT_TYPE }; static void _g_list_free_g_object_unref (GList* self); EmulationBitfieldIterator* emulation_register_info_iterator (EmulationRegisterInfo* self); @@ -421,7 +414,7 @@ void emulation_register_info_set_count (EmulationRegisterInfo* self, guint value guint8 emulation_register_info_get_access (EmulationRegisterInfo* self); void emulation_register_info_set_access (EmulationRegisterInfo* self, guint8 value); guint emulation_register_info_get_length (EmulationRegisterInfo* self); -GType emulation_register_info_get_extract_type (EmulationRegisterInfo* self); +GType emulation_register_info_get_element_type (EmulationRegisterInfo* self); static GObject * emulation_register_info_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void emulation_register_info_finalize (GObject* obj); static void emulation_register_info_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); @@ -445,11 +438,6 @@ void emulation_register_set_info (EmulationRegister* self, EmulationRegisterInfo static void emulation_register_finalize (GObject* obj); static void emulation_register_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); static void emulation_register_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); -gpointer emulation_register_iterator_ref (gpointer instance); -void emulation_register_iterator_unref (gpointer instance); -GParamSpec* emulation_param_spec_register_iterator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); -void emulation_value_set_register_iterator (GValue* value, gpointer v_object); -gpointer emulation_value_get_register_iterator (const GValue* value); GType emulation_register_iterator_get_type (void); #define EMULATION_REGISTER_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EMULATION_TYPE_REGISTER_ITERATOR, EmulationRegisterIteratorPrivate)) enum { @@ -459,13 +447,13 @@ EmulationRegisterIterator* emulation_register_iterator_new (GList* l); EmulationRegisterIterator* emulation_register_iterator_construct (GType object_type, GList* l); gboolean emulation_register_iterator_next (EmulationRegisterIterator* self); EmulationRegister* emulation_register_iterator_get (EmulationRegisterIterator* self); -static void emulation_register_iterator_finalize (EmulationRegisterIterator* obj); +static void emulation_register_iterator_finalize (GObject* obj); GType emulation_register_list_get_type (void); #define EMULATION_REGISTER_LIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EMULATION_TYPE_REGISTER_LIST, EmulationRegisterListPrivate)) enum { EMULATION_REGISTER_LIST_DUMMY_PROPERTY, EMULATION_REGISTER_LIST_LENGTH, - EMULATION_REGISTER_LIST_EXTRACT_TYPE + EMULATION_REGISTER_LIST_ELEMENT_TYPE }; EmulationRegisterIterator* emulation_register_list_iterator (EmulationRegisterList* self); EmulationRegister* emulation_register_list_get (EmulationRegisterList* self, guint index); @@ -473,7 +461,7 @@ void emulation_register_list_append (EmulationRegisterList* self, EmulationRegis EmulationRegisterList* emulation_register_list_new (void); EmulationRegisterList* emulation_register_list_construct (GType object_type); guint emulation_register_list_get_length (EmulationRegisterList* self); -GType emulation_register_list_get_extract_type (EmulationRegisterList* self); +GType emulation_register_list_get_element_type (EmulationRegisterList* self); static GObject * emulation_register_list_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void emulation_register_list_finalize (GObject* obj); static void emulation_register_list_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); @@ -991,18 +979,18 @@ EmulationBitfieldIterator* emulation_bitfield_iterator_new (GList* l) { gboolean emulation_bitfield_iterator_next (EmulationBitfieldIterator* self) { gboolean result; g_return_val_if_fail (self != NULL, FALSE); - result = self->priv->m_list->next != NULL; + result = self->priv->m_list != NULL; return result; } EmulationBitfield* emulation_bitfield_iterator_get (EmulationBitfieldIterator* self) { EmulationBitfield* result; - EmulationBitfield* r; + GList* r; g_return_val_if_fail (self != NULL, NULL); - r = (EmulationBitfield*) self->priv->m_list->data; + r = self->priv->m_list; self->priv->m_list = self->priv->m_list->next; - result = r; + result = (EmulationBitfield*) r->data; return result; } @@ -1275,7 +1263,7 @@ guint emulation_register_info_get_length (EmulationRegisterInfo* self) { } -GType emulation_register_info_get_extract_type (EmulationRegisterInfo* self) { +GType emulation_register_info_get_element_type (EmulationRegisterInfo* self) { GType result; g_return_val_if_fail (self != NULL, 0UL); result = EMULATION_TYPE_BITFIELD; @@ -1311,7 +1299,7 @@ static void emulation_register_info_class_init (EmulationRegisterInfoClass * kla g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_REGISTER_INFO_COUNT, g_param_spec_uint ("count", "count", "count", 0, G_MAXUINT, (guint) 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_REGISTER_INFO_ACCESS, g_param_spec_uchar ("access", "access", "access", 0, G_MAXUINT8, (guint8) 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_REGISTER_INFO_LENGTH, g_param_spec_uint ("length", "length", "length", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_REGISTER_INFO_EXTRACT_TYPE, g_param_spec_gtype ("extract-type", "extract-type", "extract-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_REGISTER_INFO_ELEMENT_TYPE, g_param_spec_gtype ("element-type", "element-type", "element-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); } @@ -1367,8 +1355,8 @@ static void emulation_register_info_get_property (GObject * object, guint proper case EMULATION_REGISTER_INFO_LENGTH: g_value_set_uint (value, emulation_register_info_get_length (self)); break; - case EMULATION_REGISTER_INFO_EXTRACT_TYPE: - g_value_set_gtype (value, emulation_register_info_get_extract_type (self)); + case EMULATION_REGISTER_INFO_ELEMENT_TYPE: + g_value_set_gtype (value, emulation_register_info_get_element_type (self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -1535,8 +1523,8 @@ static void emulation_register_set_property (GObject * object, guint property_id EmulationRegisterIterator* emulation_register_iterator_construct (GType object_type, GList* l) { - EmulationRegisterIterator* self; - self = (EmulationRegisterIterator*) g_type_create_instance (object_type); + EmulationRegisterIterator * self; + self = (EmulationRegisterIterator*) g_object_new (object_type, NULL); self->priv->m_list = g_list_first (l); return self; } @@ -1550,164 +1538,51 @@ EmulationRegisterIterator* emulation_register_iterator_new (GList* l) { gboolean emulation_register_iterator_next (EmulationRegisterIterator* self) { gboolean result; g_return_val_if_fail (self != NULL, FALSE); - result = self->priv->m_list->next != NULL; + result = self->priv->m_list != NULL; return result; } EmulationRegister* emulation_register_iterator_get (EmulationRegisterIterator* self) { EmulationRegister* result; - EmulationRegister* r; + GList* r; g_return_val_if_fail (self != NULL, NULL); - r = (EmulationRegister*) self->priv->m_list->data; + r = self->priv->m_list; self->priv->m_list = self->priv->m_list->next; - result = r; + result = (EmulationRegister*) r->data; return result; } -static void emulation_value_register_iterator_init (GValue* value) { - value->data[0].v_pointer = NULL; -} - - -static void emulation_value_register_iterator_free_value (GValue* value) { - if (value->data[0].v_pointer) { - emulation_register_iterator_unref (value->data[0].v_pointer); - } -} - - -static void emulation_value_register_iterator_copy_value (const GValue* src_value, GValue* dest_value) { - if (src_value->data[0].v_pointer) { - dest_value->data[0].v_pointer = emulation_register_iterator_ref (src_value->data[0].v_pointer); - } else { - dest_value->data[0].v_pointer = NULL; - } -} - - -static gpointer emulation_value_register_iterator_peek_pointer (const GValue* value) { - return value->data[0].v_pointer; -} - - -static gchar* emulation_value_register_iterator_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { - if (collect_values[0].v_pointer) { - EmulationRegisterIterator* object; - object = collect_values[0].v_pointer; - if (object->parent_instance.g_class == NULL) { - return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); - } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { - return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); - } - value->data[0].v_pointer = emulation_register_iterator_ref (object); - } else { - value->data[0].v_pointer = NULL; - } - return NULL; -} - - -static gchar* emulation_value_register_iterator_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { - EmulationRegisterIterator** object_p; - object_p = collect_values[0].v_pointer; - if (!object_p) { - return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); - } - if (!value->data[0].v_pointer) { - *object_p = NULL; - } else if (collect_flags && G_VALUE_NOCOPY_CONTENTS) { - *object_p = value->data[0].v_pointer; - } else { - *object_p = emulation_register_iterator_ref (value->data[0].v_pointer); - } - return NULL; -} - - -GParamSpec* emulation_param_spec_register_iterator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { - EmulationParamSpecRegisterIterator* spec; - g_return_val_if_fail (g_type_is_a (object_type, EMULATION_TYPE_REGISTER_ITERATOR), NULL); - spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); - G_PARAM_SPEC (spec)->value_type = object_type; - return G_PARAM_SPEC (spec); -} - - -gpointer emulation_value_get_register_iterator (const GValue* value) { - g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, EMULATION_TYPE_REGISTER_ITERATOR), NULL); - return value->data[0].v_pointer; -} - - -void emulation_value_set_register_iterator (GValue* value, gpointer v_object) { - EmulationRegisterIterator* old; - g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, EMULATION_TYPE_REGISTER_ITERATOR)); - old = value->data[0].v_pointer; - if (v_object) { - g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, EMULATION_TYPE_REGISTER_ITERATOR)); - g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); - value->data[0].v_pointer = v_object; - emulation_register_iterator_ref (value->data[0].v_pointer); - } else { - value->data[0].v_pointer = NULL; - } - if (old) { - emulation_register_iterator_unref (old); - } -} - - static void emulation_register_iterator_class_init (EmulationRegisterIteratorClass * klass) { emulation_register_iterator_parent_class = g_type_class_peek_parent (klass); - EMULATION_REGISTER_ITERATOR_CLASS (klass)->finalize = emulation_register_iterator_finalize; g_type_class_add_private (klass, sizeof (EmulationRegisterIteratorPrivate)); + G_OBJECT_CLASS (klass)->finalize = emulation_register_iterator_finalize; } static void emulation_register_iterator_instance_init (EmulationRegisterIterator * self) { self->priv = EMULATION_REGISTER_ITERATOR_GET_PRIVATE (self); - self->ref_count = 1; } -static void emulation_register_iterator_finalize (EmulationRegisterIterator* obj) { +static void emulation_register_iterator_finalize (GObject* obj) { EmulationRegisterIterator * self; self = EMULATION_REGISTER_ITERATOR (obj); + G_OBJECT_CLASS (emulation_register_iterator_parent_class)->finalize (obj); } GType emulation_register_iterator_get_type (void) { static GType emulation_register_iterator_type_id = 0; if (emulation_register_iterator_type_id == 0) { - static const GTypeValueTable g_define_type_value_table = { emulation_value_register_iterator_init, emulation_value_register_iterator_free_value, emulation_value_register_iterator_copy_value, emulation_value_register_iterator_peek_pointer, "p", emulation_value_register_iterator_collect_value, "p", emulation_value_register_iterator_lcopy_value }; - static const GTypeInfo g_define_type_info = { sizeof (EmulationRegisterIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) emulation_register_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EmulationRegisterIterator), 0, (GInstanceInitFunc) emulation_register_iterator_instance_init, &g_define_type_value_table }; - static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; - emulation_register_iterator_type_id = g_type_register_fundamental (g_type_fundamental_next (), "EmulationRegisterIterator", &g_define_type_info, &g_define_type_fundamental_info, 0); + static const GTypeInfo g_define_type_info = { sizeof (EmulationRegisterIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) emulation_register_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EmulationRegisterIterator), 0, (GInstanceInitFunc) emulation_register_iterator_instance_init, NULL }; + emulation_register_iterator_type_id = g_type_register_static (G_TYPE_OBJECT, "EmulationRegisterIterator", &g_define_type_info, 0); } return emulation_register_iterator_type_id; } -gpointer emulation_register_iterator_ref (gpointer instance) { - EmulationRegisterIterator* self; - self = instance; - g_atomic_int_inc (&self->ref_count); - return instance; -} - - -void emulation_register_iterator_unref (gpointer instance) { - EmulationRegisterIterator* self; - self = instance; - if (g_atomic_int_dec_and_test (&self->ref_count)) { - EMULATION_REGISTER_ITERATOR_GET_CLASS (self)->finalize (self); - g_type_free_instance ((GTypeInstance *) self); - } -} - - EmulationRegisterIterator* emulation_register_list_iterator (EmulationRegisterList* self) { EmulationRegisterIterator* result; g_return_val_if_fail (self != NULL, NULL); @@ -1751,7 +1626,7 @@ guint emulation_register_list_get_length (EmulationRegisterList* self) { } -GType emulation_register_list_get_extract_type (EmulationRegisterList* self) { +GType emulation_register_list_get_element_type (EmulationRegisterList* self) { GType result; g_return_val_if_fail (self != NULL, 0UL); result = EMULATION_TYPE_REGISTER; @@ -1781,7 +1656,7 @@ static void emulation_register_list_class_init (EmulationRegisterListClass * kla G_OBJECT_CLASS (klass)->constructor = emulation_register_list_constructor; G_OBJECT_CLASS (klass)->finalize = emulation_register_list_finalize; g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_REGISTER_LIST_LENGTH, g_param_spec_uint ("length", "length", "length", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_REGISTER_LIST_EXTRACT_TYPE, g_param_spec_gtype ("extract-type", "extract-type", "extract-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_REGISTER_LIST_ELEMENT_TYPE, g_param_spec_gtype ("element-type", "element-type", "element-type", G_TYPE_NONE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); } @@ -1815,8 +1690,8 @@ static void emulation_register_list_get_property (GObject * object, guint proper case EMULATION_REGISTER_LIST_LENGTH: g_value_set_uint (value, emulation_register_list_get_length (self)); break; - case EMULATION_REGISTER_LIST_EXTRACT_TYPE: - g_value_set_gtype (value, emulation_register_list_get_extract_type (self)); + case EMULATION_REGISTER_LIST_ELEMENT_TYPE: + g_value_set_gtype (value, emulation_register_list_get_element_type (self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -2328,6 +2203,7 @@ static glong string_get_length (const char* self) { static void emulation_spec_parser_xmlparse_reg32 (EmulationSpecParser* self, xmlNode* node, guint offset, const char* _name) { char* name; EmulationRegisterList* regarr; + gboolean prefound; EmulationRegisterInfo* reginfo; EmulationRegister* reg; guint _tmp3_; @@ -2341,6 +2217,7 @@ static void emulation_spec_parser_xmlparse_reg32 (EmulationSpecParser* self, xml g_hash_table_insert (self->priv->regs, __uint_dup0 (&offset), emulation_register_list_new ()); regarr = (_tmp0_ = _g_object_ref0 ((EmulationRegisterList*) g_hash_table_lookup (self->priv->regs, &offset)), _g_object_unref0 (regarr), _tmp0_); } + prefound = TRUE; reginfo = _g_object_ref0 ((EmulationRegisterInfo*) g_hash_table_lookup (self->priv->info, name)); if (reginfo == NULL) { EmulationRegisterInfo* ri; @@ -2383,6 +2260,7 @@ static void emulation_spec_parser_xmlparse_reg32 (EmulationSpecParser* self, xml } g_hash_table_insert (self->priv->info, g_strdup (name), _g_object_ref0 (ri)); reginfo = (_tmp2_ = _g_object_ref0 ((EmulationRegisterInfo*) g_hash_table_lookup (self->priv->info, name)), _g_object_unref0 (reginfo), _tmp2_); + prefound = FALSE; _g_object_unref0 (ri); _g_free0 (access); } @@ -2391,34 +2269,36 @@ static void emulation_spec_parser_xmlparse_reg32 (EmulationSpecParser* self, xml emulation_register_set_num (reg, (_tmp3_ = emulation_register_info_get_count (reginfo), emulation_register_info_set_count (reginfo, _tmp3_ + 1), _tmp3_)); emulation_register_set_info (reg, reginfo); emulation_register_list_append (regarr, reg); - { - xmlNode* iter; - iter = node->children; + if (!prefound) { { - gboolean _tmp4_; - _tmp4_ = TRUE; - while (TRUE) { - if (!_tmp4_) { - iter = iter->next; - } - _tmp4_ = FALSE; - if (!(iter != NULL)) { - break; - } - if (iter->type != XML_ELEMENT_NODE) { - continue; - } - if (_vala_strcmp0 (iter->name, "bitfield") == 0) { - emulation_spec_parser_xmlparse_bitfield (self, iter, reginfo); - } else { - if (_vala_strcmp0 (iter->name, "doc") == 0) { - if (emulation_register_info_get_doc (reginfo) == NULL) { - char* _tmp5_; - emulation_register_info_set_doc (reginfo, _tmp5_ = xmlNodeGetContent (iter)); - _g_free0 (_tmp5_); - } + xmlNode* iter; + iter = node->children; + { + gboolean _tmp4_; + _tmp4_ = TRUE; + while (TRUE) { + if (!_tmp4_) { + iter = iter->next; + } + _tmp4_ = FALSE; + if (!(iter != NULL)) { + break; + } + if (iter->type != XML_ELEMENT_NODE) { + continue; + } + if (_vala_strcmp0 (iter->name, "bitfield") == 0) { + emulation_spec_parser_xmlparse_bitfield (self, iter, reginfo); } else { - fprintf (stdout, "Warning: Unknown rules-ng tag '%s' in reg32.\n", iter->name); + if (_vala_strcmp0 (iter->name, "doc") == 0) { + if (emulation_register_info_get_doc (reginfo) == NULL) { + char* _tmp5_; + emulation_register_info_set_doc (reginfo, _tmp5_ = xmlNodeGetContent (iter)); + _g_free0 (_tmp5_); + } + } else { + fprintf (stdout, "Warning: Unknown rules-ng tag '%s' in reg32.\n", iter->name); + } } } } diff --git a/src/registers.vala b/src/registers.vala index ff5c2c3..0c02b3b 100644 --- a/src/registers.vala +++ b/src/registers.vala @@ -42,12 +42,12 @@ namespace Emulation m_list = l.first(); } - public bool next() { return (m_list.next != null); } + public bool next() { return (m_list != null); } public new weak Bitfield get() { - weak Bitfield r = m_list.data; + weak List<Bitfield> r = m_list; m_list = m_list.next; - return r; + return r.data; } } @@ -61,7 +61,7 @@ namespace Emulation private List<Bitfield> bitfields; public uint length { get { return bitfields.length(); } } - public Type extract_type { get { return typeof(Bitfield); } } + public Type element_type { get { return typeof(Bitfield); } } public BitfieldIterator iterator() { return new BitfieldIterator(bitfields); } public new weak Bitfield get(uint index) { return bitfields.nth_data(index); } @@ -79,7 +79,7 @@ namespace Emulation public weak RegisterInfo info { get; internal set; } } - public class RegisterIterator + public class RegisterIterator : Object { private weak List<Register> m_list; @@ -88,12 +88,12 @@ namespace Emulation m_list = l.first(); } - public bool next() { return (m_list.next != null); } + public bool next() { return (m_list != null); } public new weak Register get() { - weak Register r = m_list.data; + weak List<Register> r = m_list; m_list = m_list.next; - return r; + return r.data; } } @@ -106,7 +106,7 @@ namespace Emulation } public uint length { get { return regs.length(); } } - public Type extract_type { get { return typeof(Register); } } + public Type element_type { get { return typeof(Register); } } public RegisterIterator iterator() { return new RegisterIterator(regs); } public new weak Register get(uint index) { return regs.nth_data(index); } @@ -315,6 +315,7 @@ namespace Emulation regarr = regs.lookup(offset); } + bool prefound = true; RegisterInfo reginfo = info.lookup(name); if (reginfo == null) { var ri = new RegisterInfo(); @@ -332,6 +333,7 @@ namespace Emulation info.insert(name, ri); reginfo = info.lookup(name); + prefound = false; } var reg = new Register(); @@ -340,15 +342,17 @@ namespace Emulation reg.info = reginfo; regarr.append(reg); - for (Xml.Node *iter = node->children; iter != null; iter = iter->next) { - if (iter->type != Xml.ElementType.ELEMENT_NODE) { continue; } + if (!prefound) { + for (Xml.Node *iter = node->children; iter != null; iter = iter->next) { + if (iter->type != Xml.ElementType.ELEMENT_NODE) { continue; } - if (iter->name == "bitfield") { - xmlparse_bitfield(iter, reginfo); - } else if (iter->name == "doc") { - if (reginfo.doc == null) { reginfo.doc = iter->get_content(); } - } else { - stdout.printf("Warning: Unknown rules-ng tag '%s' in reg32.\n", iter->name); + if (iter->name == "bitfield") { + xmlparse_bitfield(iter, reginfo); + } else if (iter->name == "doc") { + if (reginfo.doc == null) { reginfo.doc = iter->get_content(); } + } else { + stdout.printf("Warning: Unknown rules-ng tag '%s' in reg32.\n", iter->name); + } } } } @@ -426,7 +430,7 @@ namespace Emulation xml.parse(filename, variant); } - public RegisterList translate_addr(uint addr) + public RegisterList? translate_addr(uint addr) { return regs.lookup(addr); } |