summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoakim Sindholt <opensource@zhasha.com>2010-04-07 22:13:09 +0200
committerJoakim Sindholt <opensource@zhasha.com>2010-04-07 22:13:09 +0200
commitb6d169ee79f4a2717e5c83449be5166311329aa2 (patch)
tree3208d077754374eb1b4e5d642924e33c015e777c
parent98d18bcdd6b1911f2d7cf8a4fd88af1a50f78364 (diff)
cs: use a more logical layout
-rw-r--r--src/cs.c1018
-rw-r--r--src/cs.vala162
-rw-r--r--src/csexport.c506
-rw-r--r--src/csexport.vala44
-rw-r--r--src/csimport.c36
-rw-r--r--src/csimport.vala2
-rw-r--r--src/csview.c196
-rw-r--r--src/csview.vala44
-rw-r--r--src/main.c86
-rw-r--r--src/main.vala16
10 files changed, 1232 insertions, 878 deletions
diff --git a/src/cs.c b/src/cs.c
index 031d2af..e6dd19d 100644
--- a/src/cs.c
+++ b/src/cs.c
@@ -25,21 +25,31 @@
#include <glib.h>
#include <glib-object.h>
+#include <stdlib.h>
#include <string.h>
#include <gobject/gvaluecollector.h>
-#define EMULATION_TYPE_CHIP (emulation_chip_get_type ())
+#define EMULATION_TYPE_PACKET (emulation_packet_get_type ())
+#define EMULATION_PACKET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_PACKET, EmulationPacket))
+#define EMULATION_PACKET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_TYPE_PACKET, EmulationPacketClass))
+#define EMULATION_IS_PACKET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_TYPE_PACKET))
+#define EMULATION_IS_PACKET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_TYPE_PACKET))
+#define EMULATION_PACKET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_TYPE_PACKET, EmulationPacketClass))
-#define EMULATION_TYPE_PACKET_BASE (emulation_packet_base_get_type ())
-#define EMULATION_PACKET_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_PACKET_BASE, EmulationPacketBase))
-#define EMULATION_PACKET_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_TYPE_PACKET_BASE, EmulationPacketBaseClass))
-#define EMULATION_IS_PACKET_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_TYPE_PACKET_BASE))
-#define EMULATION_IS_PACKET_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_TYPE_PACKET_BASE))
-#define EMULATION_PACKET_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_TYPE_PACKET_BASE, EmulationPacketBaseClass))
+typedef struct _EmulationPacket EmulationPacket;
+typedef struct _EmulationPacketClass EmulationPacketClass;
+typedef struct _EmulationPacketPrivate EmulationPacketPrivate;
-typedef struct _EmulationPacketBase EmulationPacketBase;
-typedef struct _EmulationPacketBaseClass EmulationPacketBaseClass;
+#define EMULATION_PACKET_TYPE_ITERATOR (emulation_packet_iterator_get_type ())
+#define EMULATION_PACKET_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_PACKET_TYPE_ITERATOR, EmulationPacketIterator))
+#define EMULATION_PACKET_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_PACKET_TYPE_ITERATOR, EmulationPacketIteratorClass))
+#define EMULATION_PACKET_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_PACKET_TYPE_ITERATOR))
+#define EMULATION_PACKET_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_PACKET_TYPE_ITERATOR))
+#define EMULATION_PACKET_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_PACKET_TYPE_ITERATOR, EmulationPacketIteratorClass))
+
+typedef struct _EmulationPacketIterator EmulationPacketIterator;
+typedef struct _EmulationPacketIteratorClass EmulationPacketIteratorClass;
#define EMULATION_TYPE_PACKET0 (emulation_packet0_get_type ())
#define EMULATION_PACKET0(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_PACKET0, EmulationPacket0))
@@ -80,19 +90,8 @@ typedef struct _EmulationPacket2Class EmulationPacket2Class;
typedef struct _EmulationPacket3 EmulationPacket3;
typedef struct _EmulationPacket3Class EmulationPacket3Class;
-
-#define EMULATION_TYPE_PACKET_ITERATOR (emulation_packet_iterator_get_type ())
-#define EMULATION_PACKET_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_PACKET_ITERATOR, EmulationPacketIterator))
-#define EMULATION_PACKET_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_TYPE_PACKET_ITERATOR, EmulationPacketIteratorClass))
-#define EMULATION_IS_PACKET_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_TYPE_PACKET_ITERATOR))
-#define EMULATION_IS_PACKET_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_TYPE_PACKET_ITERATOR))
-#define EMULATION_PACKET_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_TYPE_PACKET_ITERATOR, EmulationPacketIteratorClass))
-
-typedef struct _EmulationPacketIterator EmulationPacketIterator;
-typedef struct _EmulationPacketIteratorClass EmulationPacketIteratorClass;
typedef struct _EmulationPacketIteratorPrivate EmulationPacketIteratorPrivate;
-typedef struct _EmulationPacketBasePrivate EmulationPacketBasePrivate;
-typedef struct _EmulationParamSpecPacketIterator EmulationParamSpecPacketIterator;
+typedef struct _EmulationPacketParamSpecIterator EmulationPacketParamSpecIterator;
typedef struct _EmulationPacket0Private EmulationPacket0Private;
typedef struct _EmulationPacket1Private EmulationPacket1Private;
typedef struct _EmulationPacket2Private EmulationPacket2Private;
@@ -110,10 +109,34 @@ typedef struct _EmulationCSClass EmulationCSClass;
typedef struct _EmulationCSPrivate EmulationCSPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-typedef enum {
- EMULATION_CHIP_R300,
- EMULATION_CHIP_R500
-} EmulationChip;
+#define EMULATION_CS_TYPE_ITERATOR (emulation_cs_iterator_get_type ())
+#define EMULATION_CS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_CS_TYPE_ITERATOR, EmulationCSIterator))
+#define EMULATION_CS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_CS_TYPE_ITERATOR, EmulationCSIteratorClass))
+#define EMULATION_CS_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_CS_TYPE_ITERATOR))
+#define EMULATION_CS_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_CS_TYPE_ITERATOR))
+#define EMULATION_CS_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_CS_TYPE_ITERATOR, EmulationCSIteratorClass))
+
+typedef struct _EmulationCSIterator EmulationCSIterator;
+typedef struct _EmulationCSIteratorClass EmulationCSIteratorClass;
+typedef struct _EmulationCSIteratorPrivate EmulationCSIteratorPrivate;
+typedef struct _EmulationCSParamSpecIterator EmulationCSParamSpecIterator;
+
+struct _EmulationPacket {
+ GObject parent_instance;
+ EmulationPacketPrivate * priv;
+ guint32* dwords;
+ gint dwords_length1;
+};
+
+struct _EmulationPacketClass {
+ GObjectClass parent_class;
+ guint32 (*target_addr) (EmulationPacket* self, guint index);
+ guint (*get_length) (EmulationPacket* self);
+};
+
+struct _EmulationPacketPrivate {
+ guint32 _header;
+};
struct _EmulationPacketIterator {
GTypeInstance parent_instance;
@@ -127,141 +150,155 @@ struct _EmulationPacketIteratorClass {
};
struct _EmulationPacketIteratorPrivate {
- EmulationPacketBase* m_packet;
- guint m_pos;
-};
-
-struct _EmulationPacketBase {
- GObject parent_instance;
- EmulationPacketBasePrivate * priv;
- guint32* dwords;
- guint32 header;
-};
-
-struct _EmulationPacketBaseClass {
- GObjectClass parent_class;
- guint (*get_length) (EmulationPacketBase* self);
+ EmulationPacket* packet;
+ guint pos;
};
-struct _EmulationParamSpecPacketIterator {
+struct _EmulationPacketParamSpecIterator {
GParamSpec parent_instance;
};
struct _EmulationPacket0 {
- EmulationPacketBase parent_instance;
+ EmulationPacket parent_instance;
EmulationPacket0Private * priv;
};
struct _EmulationPacket0Class {
- EmulationPacketBaseClass parent_class;
+ EmulationPacketClass parent_class;
};
struct _EmulationPacket1 {
- EmulationPacketBase parent_instance;
+ EmulationPacket parent_instance;
EmulationPacket1Private * priv;
};
struct _EmulationPacket1Class {
- EmulationPacketBaseClass parent_class;
+ EmulationPacketClass parent_class;
};
struct _EmulationPacket2 {
- EmulationPacketBase parent_instance;
+ EmulationPacket parent_instance;
EmulationPacket2Private * priv;
};
struct _EmulationPacket2Class {
- EmulationPacketBaseClass parent_class;
+ EmulationPacketClass parent_class;
};
struct _EmulationPacket3 {
- EmulationPacketBase parent_instance;
+ EmulationPacket parent_instance;
EmulationPacket3Private * priv;
};
struct _EmulationPacket3Class {
- EmulationPacketBaseClass parent_class;
+ EmulationPacketClass parent_class;
};
struct _EmulationCS {
GObject parent_instance;
EmulationCSPrivate * priv;
- EmulationPacketBase** packets;
- gint packets_length1;
- guint32* dwords;
- gint dwords_length1;
};
struct _EmulationCSClass {
GObjectClass parent_class;
};
+struct _EmulationCSPrivate {
+ EmulationPacket** packets;
+ gint packets_length1;
+ gint packets_size;
+};
+
+struct _EmulationCSIterator {
+ GTypeInstance parent_instance;
+ volatile int ref_count;
+ EmulationCSIteratorPrivate * priv;
+};
+
+struct _EmulationCSIteratorClass {
+ GTypeClass parent_class;
+ void (*finalize) (EmulationCSIterator *self);
+};
+
+struct _EmulationCSIteratorPrivate {
+ EmulationCS* cs;
+ guint pos;
+};
+
+struct _EmulationCSParamSpecIterator {
+ GParamSpec parent_instance;
+};
+
static gpointer emulation_packet_iterator_parent_class = NULL;
-static gpointer emulation_packet_base_parent_class = NULL;
+static gpointer emulation_packet_parent_class = NULL;
static gpointer emulation_packet0_parent_class = NULL;
static gpointer emulation_packet1_parent_class = NULL;
static gpointer emulation_packet2_parent_class = NULL;
static gpointer emulation_packet3_parent_class = NULL;
+static gpointer emulation_cs_iterator_parent_class = NULL;
static gpointer emulation_cs_parent_class = NULL;
-GType emulation_chip_get_type (void);
-guint emulation_packet_typeid (guint32 header);
+GType emulation_packet_get_type (void);
+#define EMULATION_PACKET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EMULATION_TYPE_PACKET, EmulationPacketPrivate))
+enum {
+ EMULATION_PACKET_DUMMY_PROPERTY,
+ EMULATION_PACKET_HEADER,
+ EMULATION_PACKET_TYPE_ID,
+ EMULATION_PACKET_LENGTH
+};
+EmulationPacketIterator* emulation_packet_iterator_new (EmulationPacket* p);
+EmulationPacketIterator* emulation_packet_iterator_construct (GType object_type, EmulationPacket* p);
+gpointer emulation_packet_iterator_ref (gpointer instance);
+void emulation_packet_iterator_unref (gpointer instance);
+GParamSpec* emulation_packet_param_spec_iterator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
+void emulation_packet_value_set_iterator (GValue* value, gpointer v_object);
+gpointer emulation_packet_value_get_iterator (const GValue* value);
+GType emulation_packet_iterator_get_type (void);
+EmulationPacketIterator* emulation_packet_iterator (EmulationPacket* self);
+guint32 emulation_packet_target_addr (EmulationPacket* self, guint index);
+static guint32 emulation_packet_real_target_addr (EmulationPacket* self, guint index);
+guint32 emulation_packet_get (EmulationPacket* self, guint index);
+guint32 emulation_packet_get_header (EmulationPacket* self);
+guint32 emulation_packet_extract_bits (EmulationPacket* self, guint high, guint low);
EmulationPacket0* emulation_packet0_new (guint32 header, guint32* dwords);
EmulationPacket0* emulation_packet0_construct (GType object_type, guint32 header, guint32* dwords);
-GType emulation_packet_base_get_type (void);
GType emulation_packet0_get_type (void);
EmulationPacket1* emulation_packet1_new (guint32 header, guint32* dwords);
EmulationPacket1* emulation_packet1_construct (GType object_type, guint32 header, guint32* dwords);
GType emulation_packet1_get_type (void);
-EmulationPacket2* emulation_packet2_new (guint32 header, guint32* dwords);
-EmulationPacket2* emulation_packet2_construct (GType object_type, guint32 header, guint32* dwords);
+EmulationPacket2* emulation_packet2_new (guint32 header);
+EmulationPacket2* emulation_packet2_construct (GType object_type, guint32 header);
GType emulation_packet2_get_type (void);
EmulationPacket3* emulation_packet3_new (guint32 header, guint32* dwords);
EmulationPacket3* emulation_packet3_construct (GType object_type, guint32 header, guint32* dwords);
GType emulation_packet3_get_type (void);
-EmulationPacketBase* emulation_packet_base_new (void);
-EmulationPacketBase* emulation_packet_base_construct (GType object_type);
-EmulationPacketBase* emulation_make_packet (guint32 header, guint32* dwords);
-gpointer emulation_packet_iterator_ref (gpointer instance);
-void emulation_packet_iterator_unref (gpointer instance);
-GParamSpec* emulation_param_spec_packet_iterator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-void emulation_value_set_packet_iterator (GValue* value, gpointer v_object);
-gpointer emulation_value_get_packet_iterator (const GValue* value);
-GType emulation_packet_iterator_get_type (void);
-#define EMULATION_PACKET_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EMULATION_TYPE_PACKET_ITERATOR, EmulationPacketIteratorPrivate))
+EmulationPacket* emulation_packet_make (guint32 header, guint32* dwords);
+EmulationPacket* emulation_packet_construct (GType object_type);
+void emulation_packet_set_header (EmulationPacket* self, guint32 value);
+guint emulation_packet_get_type_id (EmulationPacket* self);
+guint emulation_packet_get_length (EmulationPacket* self);
+#define EMULATION_PACKET_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EMULATION_PACKET_TYPE_ITERATOR, EmulationPacketIteratorPrivate))
enum {
EMULATION_PACKET_ITERATOR_DUMMY_PROPERTY
};
-EmulationPacketIterator* emulation_packet_iterator_new (EmulationPacketBase* p);
-EmulationPacketIterator* emulation_packet_iterator_construct (GType object_type, EmulationPacketBase* p);
-guint emulation_packet_base_get_length (EmulationPacketBase* self);
gboolean emulation_packet_iterator_next (EmulationPacketIterator* self);
guint32 emulation_packet_iterator_get (EmulationPacketIterator* self);
static void emulation_packet_iterator_finalize (EmulationPacketIterator* obj);
-enum {
- EMULATION_PACKET_BASE_DUMMY_PROPERTY,
- 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_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);
+static void emulation_packet_finalize (GObject* obj);
+static void emulation_packet_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
+static void emulation_packet_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
enum {
EMULATION_PACKET0_DUMMY_PROPERTY,
EMULATION_PACKET0_ADDR,
EMULATION_PACKET0_ONE_REG_WR,
EMULATION_PACKET0_LENGTH
};
-guint32 emulation_packet0_get__ADDR (EmulationPacket0* self);
+gboolean emulation_packet0_get_one_reg_wr (EmulationPacket0* self);
guint32 emulation_packet0_get_addr (EmulationPacket0* self);
+static guint32 emulation_packet0_real_target_addr (EmulationPacket* base, guint index);
+guint32 emulation_packet0_get__ADDR (EmulationPacket0* self);
guint32 emulation_packet0_get__ONE_REG_WR (EmulationPacket0* self);
-gboolean emulation_packet0_get_one_reg_wr (EmulationPacket0* self);
guint32 emulation_packet0_get__COUNT (EmulationPacket0* self);
static void emulation_packet0_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
enum {
@@ -270,107 +307,187 @@ enum {
EMULATION_PACKET1_ADDR2,
EMULATION_PACKET1_LENGTH
};
-guint32 emulation_packet1_get__ADDR1 (EmulationPacket1* self);
guint32 emulation_packet1_get_addr1 (EmulationPacket1* self);
-guint32 emulation_packet1_get__ADDR2 (EmulationPacket1* self);
guint32 emulation_packet1_get_addr2 (EmulationPacket1* self);
+static guint32 emulation_packet1_real_target_addr (EmulationPacket* base, guint index);
+guint32 emulation_packet1_get__ADDR1 (EmulationPacket1* self);
+guint32 emulation_packet1_get__ADDR2 (EmulationPacket1* self);
static void emulation_packet1_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
enum {
EMULATION_PACKET2_DUMMY_PROPERTY,
EMULATION_PACKET2_LENGTH
};
+static guint32 emulation_packet2_real_target_addr (EmulationPacket* base, guint index);
static void emulation_packet2_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
enum {
EMULATION_PACKET3_DUMMY_PROPERTY,
EMULATION_PACKET3_OPCODE,
- EMULATION_PACKET3_LENGTH
+ EMULATION_PACKET3_LENGTH,
+ EMULATION_PACKET3_OPCODE_NAME
};
+static guint32 emulation_packet3_real_target_addr (EmulationPacket* base, guint index);
guint32 emulation_packet3_get__IT_OPCODE (EmulationPacket3* self);
guint32 emulation_packet3_get_opcode (EmulationPacket3* self);
guint32 emulation_packet3_get__COUNT (EmulationPacket3* self);
+const char* emulation_packet3_get_opcode_name (EmulationPacket3* self);
static void emulation_packet3_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
GType emulation_cs_get_type (void);
+#define EMULATION_CS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EMULATION_TYPE_CS, EmulationCSPrivate))
+enum {
+ EMULATION_CS_DUMMY_PROPERTY,
+ EMULATION_CS_ELEMENT_TYPE,
+ EMULATION_CS_LENGTH
+};
+static guint emulation_cs_check (guint32* dwords, guint len);
+EmulationCSIterator* emulation_cs_iterator_new (EmulationCS* cs);
+EmulationCSIterator* emulation_cs_iterator_construct (GType object_type, EmulationCS* cs);
+gpointer emulation_cs_iterator_ref (gpointer instance);
+void emulation_cs_iterator_unref (gpointer instance);
+GParamSpec* emulation_cs_param_spec_iterator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
+void emulation_cs_value_set_iterator (GValue* value, gpointer v_object);
+gpointer emulation_cs_value_get_iterator (const GValue* value);
+GType emulation_cs_iterator_get_type (void);
+EmulationCSIterator* emulation_cs_iterator (EmulationCS* self);
+EmulationPacket* emulation_cs_get (EmulationCS* self, guint index);
+static EmulationPacket** _vala_array_dup1 (EmulationPacket** self, int length);
+EmulationCS* emulation_cs_new (guint32* dwords, guint len);
+EmulationCS* emulation_cs_construct (GType object_type, guint32* dwords, guint len);
+GType emulation_cs_get_element_type (EmulationCS* self);
+guint emulation_cs_get_length (EmulationCS* self);
+#define EMULATION_CS_ITERATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EMULATION_CS_TYPE_ITERATOR, EmulationCSIteratorPrivate))
enum {
- EMULATION_CS_DUMMY_PROPERTY
+ EMULATION_CS_ITERATOR_DUMMY_PROPERTY
};
-static guint emulation_cs_check (guint32* cs, guint len);
-static guint32* _vala_array_dup1 (guint32* self, int length);
-static EmulationPacketBase** _vala_array_dup2 (EmulationPacketBase** self, int length);
-EmulationCS* emulation_cs_new (guint32* cs, guint len);
-EmulationCS* emulation_cs_construct (GType object_type, guint32* cs, guint len);
+gboolean emulation_cs_iterator_next (EmulationCSIterator* self);
+EmulationPacket* emulation_cs_iterator_get (EmulationCSIterator* self);
+static void emulation_cs_iterator_finalize (EmulationCSIterator* obj);
static void emulation_cs_finalize (GObject* obj);
+static void emulation_cs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
+EmulationPacketIterator* emulation_packet_iterator (EmulationPacket* self) {
+ EmulationPacketIterator* result;
+ g_return_val_if_fail (self != NULL, NULL);
+ result = emulation_packet_iterator_new (self);
+ return result;
+}
+
-GType emulation_chip_get_type (void) {
- static GType emulation_chip_type_id = 0;
- if (G_UNLIKELY (emulation_chip_type_id == 0)) {
- static const GEnumValue values[] = {{EMULATION_CHIP_R300, "EMULATION_CHIP_R300", "r300"}, {EMULATION_CHIP_R500, "EMULATION_CHIP_R500", "r500"}, {0, NULL, NULL}};
- emulation_chip_type_id = g_enum_register_static ("EmulationChip", values);
- }
- return emulation_chip_type_id;
+static guint32 emulation_packet_real_target_addr (EmulationPacket* self, guint index) {
+ g_return_val_if_fail (self != NULL, 0U);
+ g_critical ("Type `%s' does not implement abstract method `emulation_packet_target_addr'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
+ return 0U;
}
-inline guint emulation_packet_typeid (guint32 header) {
- guint result;
- result = (guint) ((header >> 30) & 3);
+guint32 emulation_packet_target_addr (EmulationPacket* self, guint index) {
+ return EMULATION_PACKET_GET_CLASS (self)->target_addr (self, index);
+}
+
+
+guint32 emulation_packet_get (EmulationPacket* self, guint index) {
+ guint32 result;
+ g_return_val_if_fail (self != NULL, 0U);
+ result = self->dwords[index];
+ return result;
+}
+
+
+inline guint32 emulation_packet_extract_bits (EmulationPacket* self, guint high, guint low) {
+ guint32 result;
+ g_return_val_if_fail (self != NULL, 0U);
+ result = (self->priv->_header >> low) & ((1 << ((high - low) + 1)) - 1);
return result;
}
-inline EmulationPacketBase* emulation_make_packet (guint32 header, guint32* dwords) {
- EmulationPacketBase* result;
- switch (emulation_packet_typeid (header)) {
+EmulationPacket* emulation_packet_make (guint32 header, guint32* dwords) {
+ EmulationPacket* result;
+ switch ((header >> 30) & 3) {
case 0:
{
- result = (EmulationPacketBase*) emulation_packet0_new (header, dwords);
+ result = (EmulationPacket*) emulation_packet0_new (header, dwords);
return result;
}
case 1:
{
- result = (EmulationPacketBase*) emulation_packet1_new (header, dwords);
+ result = (EmulationPacket*) emulation_packet1_new (header, dwords);
return result;
}
case 2:
{
- result = (EmulationPacketBase*) emulation_packet2_new (header, dwords);
+ result = (EmulationPacket*) emulation_packet2_new (header);
return result;
}
case 3:
{
- result = (EmulationPacketBase*) emulation_packet3_new (header, dwords);
+ result = (EmulationPacket*) emulation_packet3_new (header, dwords);
return result;
}
}
g_assert (FALSE);
- result = emulation_packet_base_new ();
+ result = (EmulationPacket*) emulation_packet2_new (header);
return result;
}
-EmulationPacketIterator* emulation_packet_iterator_construct (GType object_type, EmulationPacketBase* p) {
+EmulationPacket* emulation_packet_construct (GType object_type) {
+ EmulationPacket * self;
+ self = (EmulationPacket*) g_object_new (object_type, NULL);
+ return self;
+}
+
+
+guint32 emulation_packet_get_header (EmulationPacket* self) {
+ guint32 result;
+ g_return_val_if_fail (self != NULL, 0U);
+ result = self->priv->_header;
+ return result;
+}
+
+
+void emulation_packet_set_header (EmulationPacket* self, guint32 value) {
+ g_return_if_fail (self != NULL);
+ self->priv->_header = value;
+ g_object_notify ((GObject *) self, "header");
+}
+
+
+guint emulation_packet_get_type_id (EmulationPacket* self) {
+ guint result;
+ g_return_val_if_fail (self != NULL, 0U);
+ result = (guint) ((self->priv->_header >> 30) & 3);
+ return result;
+}
+
+
+guint emulation_packet_get_length (EmulationPacket* self) {
+ return EMULATION_PACKET_GET_CLASS (self)->get_length (self);
+}
+
+
+EmulationPacketIterator* emulation_packet_iterator_construct (GType object_type, EmulationPacket* p) {
EmulationPacketIterator* self;
g_return_val_if_fail (p != NULL, NULL);
self = (EmulationPacketIterator*) g_type_create_instance (object_type);
- self->priv->m_packet = p;
- self->priv->m_pos = (guint) 0;
+ self->priv->packet = p;
+ self->priv->pos = (guint) 0;
return self;
}
-EmulationPacketIterator* emulation_packet_iterator_new (EmulationPacketBase* p) {
- return emulation_packet_iterator_construct (EMULATION_TYPE_PACKET_ITERATOR, p);
+EmulationPacketIterator* emulation_packet_iterator_new (EmulationPacket* p) {
+ return emulation_packet_iterator_construct (EMULATION_PACKET_TYPE_ITERATOR, p);
}
gboolean emulation_packet_iterator_next (EmulationPacketIterator* self) {
gboolean result;
g_return_val_if_fail (self != NULL, FALSE);
- result = self->priv->m_pos < emulation_packet_base_get_length (self->priv->m_packet);
+ result = (self->priv->pos++) < emulation_packet_get_length (self->priv->packet);
return result;
}
@@ -378,24 +495,24 @@ gboolean emulation_packet_iterator_next (EmulationPacketIterator* self) {
guint32 emulation_packet_iterator_get (EmulationPacketIterator* self) {
guint32 result;
g_return_val_if_fail (self != NULL, 0U);
- result = self->priv->m_packet->dwords[self->priv->m_pos++];
+ result = emulation_packet_get (self->priv->packet, self->priv->pos - 1);
return result;
}
-static void emulation_value_packet_iterator_init (GValue* value) {
+static void emulation_packet_value_iterator_init (GValue* value) {
value->data[0].v_pointer = NULL;
}
-static void emulation_value_packet_iterator_free_value (GValue* value) {
+static void emulation_packet_value_iterator_free_value (GValue* value) {
if (value->data[0].v_pointer) {
emulation_packet_iterator_unref (value->data[0].v_pointer);
}
}
-static void emulation_value_packet_iterator_copy_value (const GValue* src_value, GValue* dest_value) {
+static void emulation_packet_value_iterator_copy_value (const GValue* src_value, GValue* dest_value) {
if (src_value->data[0].v_pointer) {
dest_value->data[0].v_pointer = emulation_packet_iterator_ref (src_value->data[0].v_pointer);
} else {
@@ -404,12 +521,12 @@ static void emulation_value_packet_iterator_copy_value (const GValue* src_value,
}
-static gpointer emulation_value_packet_iterator_peek_pointer (const GValue* value) {
+static gpointer emulation_packet_value_iterator_peek_pointer (const GValue* value) {
return value->data[0].v_pointer;
}
-static gchar* emulation_value_packet_iterator_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
+static gchar* emulation_packet_value_iterator_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
if (collect_values[0].v_pointer) {
EmulationPacketIterator* object;
object = collect_values[0].v_pointer;
@@ -426,7 +543,7 @@ static gchar* emulation_value_packet_iterator_collect_value (GValue* value, guin
}
-static gchar* emulation_value_packet_iterator_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
+static gchar* emulation_packet_value_iterator_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
EmulationPacketIterator** object_p;
object_p = collect_values[0].v_pointer;
if (!object_p) {
@@ -443,27 +560,27 @@ static gchar* emulation_value_packet_iterator_lcopy_value (const GValue* value,
}
-GParamSpec* emulation_param_spec_packet_iterator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
- EmulationParamSpecPacketIterator* spec;
- g_return_val_if_fail (g_type_is_a (object_type, EMULATION_TYPE_PACKET_ITERATOR), NULL);
+GParamSpec* emulation_packet_param_spec_iterator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
+ EmulationPacketParamSpecIterator* spec;
+ g_return_val_if_fail (g_type_is_a (object_type, EMULATION_PACKET_TYPE_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_packet_iterator (const GValue* value) {
- g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, EMULATION_TYPE_PACKET_ITERATOR), NULL);
+gpointer emulation_packet_value_get_iterator (const GValue* value) {
+ g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, EMULATION_PACKET_TYPE_ITERATOR), NULL);
return value->data[0].v_pointer;
}
-void emulation_value_set_packet_iterator (GValue* value, gpointer v_object) {
+void emulation_packet_value_set_iterator (GValue* value, gpointer v_object) {
EmulationPacketIterator* old;
- g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, EMULATION_TYPE_PACKET_ITERATOR));
+ g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, EMULATION_PACKET_TYPE_ITERATOR));
old = value->data[0].v_pointer;
if (v_object) {
- g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, EMULATION_TYPE_PACKET_ITERATOR));
+ g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, EMULATION_PACKET_TYPE_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_packet_iterator_ref (value->data[0].v_pointer);
@@ -498,7 +615,7 @@ static void emulation_packet_iterator_finalize (EmulationPacketIterator* obj) {
GType emulation_packet_iterator_get_type (void) {
static GType emulation_packet_iterator_type_id = 0;
if (emulation_packet_iterator_type_id == 0) {
- static const GTypeValueTable g_define_type_value_table = { emulation_value_packet_iterator_init, emulation_value_packet_iterator_free_value, emulation_value_packet_iterator_copy_value, emulation_value_packet_iterator_peek_pointer, "p", emulation_value_packet_iterator_collect_value, "p", emulation_value_packet_iterator_lcopy_value };
+ static const GTypeValueTable g_define_type_value_table = { emulation_packet_value_iterator_init, emulation_packet_value_iterator_free_value, emulation_packet_value_iterator_copy_value, emulation_packet_value_iterator_peek_pointer, "p", emulation_packet_value_iterator_collect_value, "p", emulation_packet_value_iterator_lcopy_value };
static const GTypeInfo g_define_type_info = { sizeof (EmulationPacketIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) emulation_packet_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EmulationPacketIterator), 0, (GInstanceInitFunc) emulation_packet_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_packet_iterator_type_id = g_type_register_fundamental (g_type_fundamental_next (), "EmulationPacketIterator", &g_define_type_info, &g_define_type_fundamental_info, 0);
@@ -525,103 +642,65 @@ void emulation_packet_iterator_unref (gpointer instance) {
}
-EmulationPacketIterator* emulation_packet_base_iterator (EmulationPacketBase* self) {
- EmulationPacketIterator* result;
- g_return_val_if_fail (self != NULL, NULL);
- result = emulation_packet_iterator_new (self);
- return result;
-}
-
-
-guint32 emulation_packet_base_get (EmulationPacketBase* self, guint index) {
- guint32 result;
- g_return_val_if_fail (self != NULL, 0U);
- result = self->dwords[index];
- return result;
-}
-
-
-inline guint32 emulation_packet_base_extract_bits (EmulationPacketBase* self, guint high, guint low) {
- guint32 result;
- g_return_val_if_fail (self != NULL, 0U);
- result = (self->header >> low) & ((1 << ((high - low) + 1)) - 1);
- return result;
-}
-
-
-EmulationPacketBase* emulation_packet_base_construct (GType object_type) {
- EmulationPacketBase * self;
- self = (EmulationPacketBase*) g_object_new (object_type, NULL);
- return self;
-}
-
-
-EmulationPacketBase* emulation_packet_base_new (void) {
- return emulation_packet_base_construct (EMULATION_TYPE_PACKET_BASE);
-}
-
-
-GType emulation_packet_base_get_element_type (EmulationPacketBase* self) {
- GType result;
- g_return_val_if_fail (self != NULL, 0UL);
- result = G_TYPE_UINT;
- return result;
-}
-
-
-guint emulation_packet_base_get_type_id (EmulationPacketBase* self) {
- guint result;
- g_return_val_if_fail (self != NULL, 0U);
- result = emulation_packet_typeid (self->header);
- return result;
+static void emulation_packet_class_init (EmulationPacketClass * klass) {
+ emulation_packet_parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (EmulationPacketPrivate));
+ EMULATION_PACKET_CLASS (klass)->target_addr = emulation_packet_real_target_addr;
+ G_OBJECT_CLASS (klass)->get_property = emulation_packet_get_property;
+ G_OBJECT_CLASS (klass)->set_property = emulation_packet_set_property;
+ G_OBJECT_CLASS (klass)->finalize = emulation_packet_finalize;
+ g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_PACKET_HEADER, g_param_spec_uint ("header", "header", "header", 0, G_MAXUINT, 0U, 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_PACKET_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_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));
}
-guint emulation_packet_base_get_length (EmulationPacketBase* self) {
- return EMULATION_PACKET_BASE_GET_CLASS (self)->get_length (self);
+static void emulation_packet_instance_init (EmulationPacket * self) {
+ self->priv = EMULATION_PACKET_GET_PRIVATE (self);
}
-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_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));
-}
-
-
-static void emulation_packet_base_instance_init (EmulationPacketBase * self) {
+static void emulation_packet_finalize (GObject* obj) {
+ EmulationPacket * self;
+ self = EMULATION_PACKET (obj);
+ self->dwords = (g_free (self->dwords), NULL);
+ G_OBJECT_CLASS (emulation_packet_parent_class)->finalize (obj);
}
-static void emulation_packet_base_finalize (GObject* obj) {
- EmulationPacketBase * self;
- self = EMULATION_PACKET_BASE (obj);
- G_OBJECT_CLASS (emulation_packet_base_parent_class)->finalize (obj);
+GType emulation_packet_get_type (void) {
+ static GType emulation_packet_type_id = 0;
+ if (emulation_packet_type_id == 0) {
+ static const GTypeInfo g_define_type_info = { sizeof (EmulationPacketClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) emulation_packet_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EmulationPacket), 0, (GInstanceInitFunc) emulation_packet_instance_init, NULL };
+ emulation_packet_type_id = g_type_register_static (G_TYPE_OBJECT, "EmulationPacket", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
+ }
+ return emulation_packet_type_id;
}
-GType emulation_packet_base_get_type (void) {
- static GType emulation_packet_base_type_id = 0;
- if (emulation_packet_base_type_id == 0) {
- static const GTypeInfo g_define_type_info = { sizeof (EmulationPacketBaseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) emulation_packet_base_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EmulationPacketBase), 0, (GInstanceInitFunc) emulation_packet_base_instance_init, NULL };
- emulation_packet_base_type_id = g_type_register_static (G_TYPE_OBJECT, "EmulationPacketBase", &g_define_type_info, 0);
+static void emulation_packet_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
+ EmulationPacket * self;
+ self = EMULATION_PACKET (object);
+ switch (property_id) {
+ case EMULATION_PACKET_HEADER:
+ g_value_set_uint (value, emulation_packet_get_header (self));
+ break;
+ case EMULATION_PACKET_TYPE_ID:
+ g_value_set_uint (value, emulation_packet_get_type_id (self));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
}
- return emulation_packet_base_type_id;
}
-static void emulation_packet_base_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
- EmulationPacketBase * self;
- self = EMULATION_PACKET_BASE (object);
+static void emulation_packet_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
+ EmulationPacket * self;
+ self = EMULATION_PACKET (object);
switch (property_id) {
- 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));
+ case EMULATION_PACKET_HEADER:
+ emulation_packet_set_header (self, g_value_get_uint (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -630,11 +709,48 @@ static void emulation_packet_base_get_property (GObject * object, guint property
}
+static guint32 emulation_packet0_real_target_addr (EmulationPacket* base, guint index) {
+ EmulationPacket0 * self;
+ guint32 result;
+ guint32 _tmp0_ = 0U;
+ self = (EmulationPacket0*) base;
+ if (emulation_packet0_get_one_reg_wr (self)) {
+ _tmp0_ = emulation_packet0_get_addr (self);
+ } else {
+ _tmp0_ = emulation_packet0_get_addr (self) + (index * 4);
+ }
+ result = _tmp0_;
+ return result;
+}
+
+
EmulationPacket0* emulation_packet0_construct (GType object_type, guint32 header, guint32* dwords) {
EmulationPacket0 * self;
- self = (EmulationPacket0*) emulation_packet_base_construct (object_type);
- ((EmulationPacketBase*) self)->header = header;
- ((EmulationPacketBase*) self)->dwords = dwords;
+ self = (EmulationPacket0*) emulation_packet_construct (object_type);
+ emulation_packet_set_header ((EmulationPacket*) self, header);
+ if (dwords != NULL) {
+ guint32* _tmp1_;
+ gint _tmp0_;
+ ((EmulationPacket*) self)->dwords = (_tmp1_ = g_new0 (guint32, _tmp0_ = emulation_packet_get_length ((EmulationPacket*) self)), ((EmulationPacket*) self)->dwords = (g_free (((EmulationPacket*) self)->dwords), NULL), ((EmulationPacket*) self)->dwords_length1 = _tmp0_, _tmp1_);
+ {
+ guint i;
+ i = (guint) 0;
+ {
+ gboolean _tmp2_;
+ _tmp2_ = TRUE;
+ while (TRUE) {
+ if (!_tmp2_) {
+ i++;
+ }
+ _tmp2_ = FALSE;
+ if (!(i < emulation_packet_get_length ((EmulationPacket*) self))) {
+ break;
+ }
+ ((EmulationPacket*) self)->dwords[i] = dwords[i];
+ }
+ }
+ }
+ }
return self;
}
@@ -660,7 +776,7 @@ gboolean emulation_packet0_get_one_reg_wr (EmulationPacket0* self) {
}
-static guint emulation_packet0_real_get_length (EmulationPacketBase* base) {
+static guint emulation_packet0_real_get_length (EmulationPacket* base) {
guint result;
EmulationPacket0* self;
self = (EmulationPacket0*) base;
@@ -672,7 +788,7 @@ static guint emulation_packet0_real_get_length (EmulationPacketBase* base) {
guint32 emulation_packet0_get__ADDR (EmulationPacket0* self) {
guint32 result;
g_return_val_if_fail (self != NULL, 0U);
- result = emulation_packet_base_extract_bits ((EmulationPacketBase*) self, (guint) 12, (guint) 0);
+ result = emulation_packet_extract_bits ((EmulationPacket*) self, (guint) 12, (guint) 0);
return result;
}
@@ -680,7 +796,7 @@ guint32 emulation_packet0_get__ADDR (EmulationPacket0* self) {
guint32 emulation_packet0_get__ONE_REG_WR (EmulationPacket0* self) {
guint32 result;
g_return_val_if_fail (self != NULL, 0U);
- result = emulation_packet_base_extract_bits ((EmulationPacketBase*) self, (guint) 15, (guint) 15);
+ result = emulation_packet_extract_bits ((EmulationPacket*) self, (guint) 15, (guint) 15);
return result;
}
@@ -688,14 +804,15 @@ guint32 emulation_packet0_get__ONE_REG_WR (EmulationPacket0* self) {
guint32 emulation_packet0_get__COUNT (EmulationPacket0* self) {
guint32 result;
g_return_val_if_fail (self != NULL, 0U);
- result = emulation_packet_base_extract_bits ((EmulationPacketBase*) self, (guint) 29, (guint) 16);
+ result = emulation_packet_extract_bits ((EmulationPacket*) self, (guint) 29, (guint) 16);
return result;
}
static void emulation_packet0_class_init (EmulationPacket0Class * klass) {
emulation_packet0_parent_class = g_type_class_peek_parent (klass);
- EMULATION_PACKET_BASE_CLASS (klass)->get_length = emulation_packet0_real_get_length;
+ EMULATION_PACKET_CLASS (klass)->target_addr = emulation_packet0_real_target_addr;
+ EMULATION_PACKET_CLASS (klass)->get_length = emulation_packet0_real_get_length;
G_OBJECT_CLASS (klass)->get_property = emulation_packet0_get_property;
g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_PACKET0_ADDR, g_param_spec_uint ("addr", "addr", "addr", 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_PACKET0_ONE_REG_WR, g_param_spec_boolean ("one-reg-wr", "one-reg-wr", "one-reg-wr", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
@@ -711,7 +828,7 @@ GType emulation_packet0_get_type (void) {
static GType emulation_packet0_type_id = 0;
if (emulation_packet0_type_id == 0) {
static const GTypeInfo g_define_type_info = { sizeof (EmulationPacket0Class), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) emulation_packet0_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EmulationPacket0), 0, (GInstanceInitFunc) emulation_packet0_instance_init, NULL };
- emulation_packet0_type_id = g_type_register_static (EMULATION_TYPE_PACKET_BASE, "EmulationPacket0", &g_define_type_info, 0);
+ emulation_packet0_type_id = g_type_register_static (EMULATION_TYPE_PACKET, "EmulationPacket0", &g_define_type_info, 0);
}
return emulation_packet0_type_id;
}
@@ -728,7 +845,7 @@ static void emulation_packet0_get_property (GObject * object, guint property_id,
g_value_set_boolean (value, emulation_packet0_get_one_reg_wr (self));
break;
case EMULATION_PACKET0_LENGTH:
- g_value_set_uint (value, emulation_packet_base_get_length ((EmulationPacketBase*) self));
+ g_value_set_uint (value, emulation_packet_get_length ((EmulationPacket*) self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -737,11 +854,31 @@ static void emulation_packet0_get_property (GObject * object, guint property_id,
}
+static guint32 emulation_packet1_real_target_addr (EmulationPacket* base, guint index) {
+ EmulationPacket1 * self;
+ guint32 result;
+ guint32 _tmp0_ = 0U;
+ self = (EmulationPacket1*) base;
+ if (index == 0) {
+ _tmp0_ = emulation_packet1_get_addr1 (self);
+ } else {
+ _tmp0_ = emulation_packet1_get_addr2 (self);
+ }
+ result = _tmp0_;
+ return result;
+}
+
+
EmulationPacket1* emulation_packet1_construct (GType object_type, guint32 header, guint32* dwords) {
EmulationPacket1 * self;
- self = (EmulationPacket1*) emulation_packet_base_construct (object_type);
- ((EmulationPacketBase*) self)->header = header;
- ((EmulationPacketBase*) self)->dwords = dwords;
+ self = (EmulationPacket1*) emulation_packet_construct (object_type);
+ emulation_packet_set_header ((EmulationPacket*) self, header);
+ if (dwords != NULL) {
+ guint32* _tmp0_;
+ ((EmulationPacket*) self)->dwords = (_tmp0_ = g_new0 (guint32, 2), ((EmulationPacket*) self)->dwords = (g_free (((EmulationPacket*) self)->dwords), NULL), ((EmulationPacket*) self)->dwords_length1 = 2, _tmp0_);
+ ((EmulationPacket*) self)->dwords[0] = dwords[0];
+ ((EmulationPacket*) self)->dwords[1] = dwords[1];
+ }
return self;
}
@@ -767,7 +904,7 @@ guint32 emulation_packet1_get_addr2 (EmulationPacket1* self) {
}
-static guint emulation_packet1_real_get_length (EmulationPacketBase* base) {
+static guint emulation_packet1_real_get_length (EmulationPacket* base) {
guint result;
EmulationPacket1* self;
self = (EmulationPacket1*) base;
@@ -779,7 +916,7 @@ static guint emulation_packet1_real_get_length (EmulationPacketBase* base) {
guint32 emulation_packet1_get__ADDR1 (EmulationPacket1* self) {
guint32 result;
g_return_val_if_fail (self != NULL, 0U);
- result = emulation_packet_base_extract_bits ((EmulationPacketBase*) self, (guint) 10, (guint) 0);
+ result = emulation_packet_extract_bits ((EmulationPacket*) self, (guint) 10, (guint) 0);
return result;
}
@@ -787,14 +924,15 @@ guint32 emulation_packet1_get__ADDR1 (EmulationPacket1* self) {
guint32 emulation_packet1_get__ADDR2 (EmulationPacket1* self) {
guint32 result;
g_return_val_if_fail (self != NULL, 0U);
- result = emulation_packet_base_extract_bits ((EmulationPacketBase*) self, (guint) 21, (guint) 11);
+ result = emulation_packet_extract_bits ((EmulationPacket*) self, (guint) 21, (guint) 11);
return result;
}
static void emulation_packet1_class_init (EmulationPacket1Class * klass) {
emulation_packet1_parent_class = g_type_class_peek_parent (klass);
- EMULATION_PACKET_BASE_CLASS (klass)->get_length = emulation_packet1_real_get_length;
+ EMULATION_PACKET_CLASS (klass)->target_addr = emulation_packet1_real_target_addr;
+ EMULATION_PACKET_CLASS (klass)->get_length = emulation_packet1_real_get_length;
G_OBJECT_CLASS (klass)->get_property = emulation_packet1_get_property;
g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_PACKET1_ADDR1, g_param_spec_uint ("addr1", "addr1", "addr1", 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_PACKET1_ADDR2, g_param_spec_uint ("addr2", "addr2", "addr2", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
@@ -810,7 +948,7 @@ GType emulation_packet1_get_type (void) {
static GType emulation_packet1_type_id = 0;
if (emulation_packet1_type_id == 0) {
static const GTypeInfo g_define_type_info = { sizeof (EmulationPacket1Class), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) emulation_packet1_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EmulationPacket1), 0, (GInstanceInitFunc) emulation_packet1_instance_init, NULL };
- emulation_packet1_type_id = g_type_register_static (EMULATION_TYPE_PACKET_BASE, "EmulationPacket1", &g_define_type_info, 0);
+ emulation_packet1_type_id = g_type_register_static (EMULATION_TYPE_PACKET, "EmulationPacket1", &g_define_type_info, 0);
}
return emulation_packet1_type_id;
}
@@ -827,7 +965,7 @@ static void emulation_packet1_get_property (GObject * object, guint property_id,
g_value_set_uint (value, emulation_packet1_get_addr2 (self));
break;
case EMULATION_PACKET1_LENGTH:
- g_value_set_uint (value, emulation_packet_base_get_length ((EmulationPacketBase*) self));
+ g_value_set_uint (value, emulation_packet_get_length ((EmulationPacket*) self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -836,21 +974,31 @@ static void emulation_packet1_get_property (GObject * object, guint property_id,
}
-EmulationPacket2* emulation_packet2_construct (GType object_type, guint32 header, guint32* dwords) {
+static guint32 emulation_packet2_real_target_addr (EmulationPacket* base, guint index) {
EmulationPacket2 * self;
- self = (EmulationPacket2*) emulation_packet_base_construct (object_type);
- ((EmulationPacketBase*) self)->header = header;
- ((EmulationPacketBase*) self)->dwords = dwords;
+ guint32 result;
+ self = (EmulationPacket2*) base;
+ result = (guint32) 0;
+ return result;
+}
+
+
+EmulationPacket2* emulation_packet2_construct (GType object_type, guint32 header) {
+ EmulationPacket2 * self;
+ guint32* _tmp0_;
+ self = (EmulationPacket2*) emulation_packet_construct (object_type);
+ emulation_packet_set_header ((EmulationPacket*) self, header);
+ ((EmulationPacket*) self)->dwords = (_tmp0_ = NULL, ((EmulationPacket*) self)->dwords = (g_free (((EmulationPacket*) self)->dwords), NULL), ((EmulationPacket*) self)->dwords_length1 = 0, _tmp0_);
return self;
}
-EmulationPacket2* emulation_packet2_new (guint32 header, guint32* dwords) {
- return emulation_packet2_construct (EMULATION_TYPE_PACKET2, header, dwords);
+EmulationPacket2* emulation_packet2_new (guint32 header) {
+ return emulation_packet2_construct (EMULATION_TYPE_PACKET2, header);
}
-static guint emulation_packet2_real_get_length (EmulationPacketBase* base) {
+static guint emulation_packet2_real_get_length (EmulationPacket* base) {
guint result;
EmulationPacket2* self;
self = (EmulationPacket2*) base;
@@ -861,7 +1009,8 @@ static guint emulation_packet2_real_get_length (EmulationPacketBase* base) {
static void emulation_packet2_class_init (EmulationPacket2Class * klass) {
emulation_packet2_parent_class = g_type_class_peek_parent (klass);
- EMULATION_PACKET_BASE_CLASS (klass)->get_length = emulation_packet2_real_get_length;
+ EMULATION_PACKET_CLASS (klass)->target_addr = emulation_packet2_real_target_addr;
+ EMULATION_PACKET_CLASS (klass)->get_length = emulation_packet2_real_get_length;
G_OBJECT_CLASS (klass)->get_property = emulation_packet2_get_property;
g_object_class_override_property (G_OBJECT_CLASS (klass), EMULATION_PACKET2_LENGTH, "length");
}
@@ -875,7 +1024,7 @@ GType emulation_packet2_get_type (void) {
static GType emulation_packet2_type_id = 0;
if (emulation_packet2_type_id == 0) {
static const GTypeInfo g_define_type_info = { sizeof (EmulationPacket2Class), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) emulation_packet2_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EmulationPacket2), 0, (GInstanceInitFunc) emulation_packet2_instance_init, NULL };
- emulation_packet2_type_id = g_type_register_static (EMULATION_TYPE_PACKET_BASE, "EmulationPacket2", &g_define_type_info, 0);
+ emulation_packet2_type_id = g_type_register_static (EMULATION_TYPE_PACKET, "EmulationPacket2", &g_define_type_info, 0);
}
return emulation_packet2_type_id;
}
@@ -886,7 +1035,7 @@ static void emulation_packet2_get_property (GObject * object, guint property_id,
self = EMULATION_PACKET2 (object);
switch (property_id) {
case EMULATION_PACKET2_LENGTH:
- g_value_set_uint (value, emulation_packet_base_get_length ((EmulationPacketBase*) self));
+ g_value_set_uint (value, emulation_packet_get_length ((EmulationPacket*) self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -895,11 +1044,42 @@ static void emulation_packet2_get_property (GObject * object, guint property_id,
}
+static guint32 emulation_packet3_real_target_addr (EmulationPacket* base, guint index) {
+ EmulationPacket3 * self;
+ guint32 result;
+ self = (EmulationPacket3*) base;
+ result = (guint32) 0;
+ return result;
+}
+
+
EmulationPacket3* emulation_packet3_construct (GType object_type, guint32 header, guint32* dwords) {
EmulationPacket3 * self;
- self = (EmulationPacket3*) emulation_packet_base_construct (object_type);
- ((EmulationPacketBase*) self)->header = header;
- ((EmulationPacketBase*) self)->dwords = dwords;
+ self = (EmulationPacket3*) emulation_packet_construct (object_type);
+ emulation_packet_set_header ((EmulationPacket*) self, header);
+ if (dwords != NULL) {
+ guint32* _tmp1_;
+ gint _tmp0_;
+ ((EmulationPacket*) self)->dwords = (_tmp1_ = g_new0 (guint32, _tmp0_ = emulation_packet_get_length ((EmulationPacket*) self)), ((EmulationPacket*) self)->dwords = (g_free (((EmulationPacket*) self)->dwords), NULL), ((EmulationPacket*) self)->dwords_length1 = _tmp0_, _tmp1_);
+ {
+ guint i;
+ i = (guint) 0;
+ {
+ gboolean _tmp2_;
+ _tmp2_ = TRUE;
+ while (TRUE) {
+ if (!_tmp2_) {
+ i++;
+ }
+ _tmp2_ = FALSE;
+ if (!(i < emulation_packet_get_length ((EmulationPacket*) self))) {
+ break;
+ }
+ ((EmulationPacket*) self)->dwords[i] = dwords[i];
+ }
+ }
+ }
+ }
return self;
}
@@ -917,7 +1097,7 @@ guint32 emulation_packet3_get_opcode (EmulationPacket3* self) {
}
-static guint emulation_packet3_real_get_length (EmulationPacketBase* base) {
+static guint emulation_packet3_real_get_length (EmulationPacket* base) {
guint result;
EmulationPacket3* self;
self = (EmulationPacket3*) base;
@@ -929,7 +1109,7 @@ static guint emulation_packet3_real_get_length (EmulationPacketBase* base) {
guint32 emulation_packet3_get__IT_OPCODE (EmulationPacket3* self) {
guint32 result;
g_return_val_if_fail (self != NULL, 0U);
- result = emulation_packet_base_extract_bits ((EmulationPacketBase*) self, (guint) 15, (guint) 8);
+ result = emulation_packet_extract_bits ((EmulationPacket*) self, (guint) 15, (guint) 8);
return result;
}
@@ -937,17 +1117,27 @@ guint32 emulation_packet3_get__IT_OPCODE (EmulationPacket3* self) {
guint32 emulation_packet3_get__COUNT (EmulationPacket3* self) {
guint32 result;
g_return_val_if_fail (self != NULL, 0U);
- result = emulation_packet_base_extract_bits ((EmulationPacketBase*) self, (guint) 29, (guint) 16);
+ result = emulation_packet_extract_bits ((EmulationPacket*) self, (guint) 29, (guint) 16);
+ return result;
+}
+
+
+const char* emulation_packet3_get_opcode_name (EmulationPacket3* self) {
+ const char* result;
+ g_return_val_if_fail (self != NULL, NULL);
+ result = "TODO";
return result;
}
static void emulation_packet3_class_init (EmulationPacket3Class * klass) {
emulation_packet3_parent_class = g_type_class_peek_parent (klass);
- EMULATION_PACKET_BASE_CLASS (klass)->get_length = emulation_packet3_real_get_length;
+ EMULATION_PACKET_CLASS (klass)->target_addr = emulation_packet3_real_target_addr;
+ EMULATION_PACKET_CLASS (klass)->get_length = emulation_packet3_real_get_length;
G_OBJECT_CLASS (klass)->get_property = emulation_packet3_get_property;
g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_PACKET3_OPCODE, g_param_spec_uint ("opcode", "opcode", "opcode", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
g_object_class_override_property (G_OBJECT_CLASS (klass), EMULATION_PACKET3_LENGTH, "length");
+ g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_PACKET3_OPCODE_NAME, g_param_spec_string ("opcode-name", "opcode-name", "opcode-name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}
@@ -959,7 +1149,7 @@ GType emulation_packet3_get_type (void) {
static GType emulation_packet3_type_id = 0;
if (emulation_packet3_type_id == 0) {
static const GTypeInfo g_define_type_info = { sizeof (EmulationPacket3Class), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) emulation_packet3_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EmulationPacket3), 0, (GInstanceInitFunc) emulation_packet3_instance_init, NULL };
- emulation_packet3_type_id = g_type_register_static (EMULATION_TYPE_PACKET_BASE, "EmulationPacket3", &g_define_type_info, 0);
+ emulation_packet3_type_id = g_type_register_static (EMULATION_TYPE_PACKET, "EmulationPacket3", &g_define_type_info, 0);
}
return emulation_packet3_type_id;
}
@@ -973,7 +1163,10 @@ static void emulation_packet3_get_property (GObject * object, guint property_id,
g_value_set_uint (value, emulation_packet3_get_opcode (self));
break;
case EMULATION_PACKET3_LENGTH:
- g_value_set_uint (value, emulation_packet_base_get_length ((EmulationPacketBase*) self));
+ g_value_set_uint (value, emulation_packet_get_length ((EmulationPacket*) self));
+ break;
+ case EMULATION_PACKET3_OPCODE_NAME:
+ g_value_set_string (value, emulation_packet3_get_opcode_name (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -982,7 +1175,7 @@ static void emulation_packet3_get_property (GObject * object, guint property_id,
}
-static guint emulation_cs_check (guint32* cs, guint len) {
+static guint emulation_cs_check (guint32* dwords, guint len) {
guint result;
gint pkt_count;
pkt_count = 0;
@@ -993,7 +1186,7 @@ static guint emulation_cs_check (guint32* cs, guint len) {
gboolean _tmp0_;
_tmp0_ = TRUE;
while (TRUE) {
- EmulationPacketBase* _tmp1_;
+ EmulationPacket* _tmp1_;
if (!_tmp0_) {
i++;
pkt_count++;
@@ -1002,7 +1195,7 @@ static guint emulation_cs_check (guint32* cs, guint len) {
if (!(i < len)) {
break;
}
- i = i + emulation_packet_base_get_length (_tmp1_ = emulation_make_packet (cs[i], NULL));
+ i = i + emulation_packet_get_length (_tmp1_ = emulation_packet_make (dwords[i], NULL));
_g_object_unref0 (_tmp1_);
if ((i + 1) > len) {
result = (guint) 0;
@@ -1016,8 +1209,11 @@ static guint emulation_cs_check (guint32* cs, guint len) {
}
-static guint32* _vala_array_dup1 (guint32* self, int length) {
- return g_memdup (self, length * sizeof (guint32));
+EmulationCSIterator* emulation_cs_iterator (EmulationCS* self) {
+ EmulationCSIterator* result;
+ g_return_val_if_fail (self != NULL, NULL);
+ result = emulation_cs_iterator_new (self);
+ return result;
}
@@ -1026,10 +1222,18 @@ static gpointer _g_object_ref0 (gpointer self) {
}
-static EmulationPacketBase** _vala_array_dup2 (EmulationPacketBase** self, int length) {
- EmulationPacketBase** result;
+EmulationPacket* emulation_cs_get (EmulationCS* self, guint index) {
+ EmulationPacket* result;
+ g_return_val_if_fail (self != NULL, NULL);
+ result = _g_object_ref0 (self->priv->packets[index]);
+ return result;
+}
+
+
+static EmulationPacket** _vala_array_dup1 (EmulationPacket** self, int length) {
+ EmulationPacket** result;
int i;
- result = g_new0 (EmulationPacketBase*, length + 1);
+ result = g_new0 (EmulationPacket*, length + 1);
for (i = 0; i < length; i++) {
result[i] = _g_object_ref0 (self[i]);
}
@@ -1037,101 +1241,276 @@ static EmulationPacketBase** _vala_array_dup2 (EmulationPacketBase** self, int l
}
-EmulationCS* emulation_cs_construct (GType object_type, guint32* cs, guint len) {
+EmulationCS* emulation_cs_construct (GType object_type, guint32* dwords, guint len) {
EmulationCS * self;
+ guint pkt_count;
gint _tmp0__size;
gint _tmp0__length1;
- guint32* _tmp0_;
- guint32* _tmp4_;
- guint32* _tmp3_;
- guint pkt_count;
- gint _tmp5__size;
- gint _tmp5__length1;
- EmulationPacketBase** _tmp5_;
- EmulationPacketBase** _tmp9_;
- EmulationPacketBase** _tmp8_;
+ EmulationPacket** _tmp0_;
+ EmulationPacket** _tmp4_;
+ EmulationPacket** _tmp3_;
self = (EmulationCS*) g_object_new (object_type, NULL);
if (len > 0) {
- g_assert (cs != NULL);
+ g_assert (dwords != NULL);
}
+ pkt_count = emulation_cs_check (dwords, len);
_tmp0_ = (_tmp0__length1 = 0, NULL);
- if (len > 0) {
- guint32* _tmp1_;
- _tmp0_ = (_tmp1_ = g_new0 (guint32, len), _tmp0_ = (g_free (_tmp0_), NULL), _tmp0__length1 = len, _tmp0__size = _tmp0__length1, _tmp1_);
- } else {
- guint32* _tmp2_;
- _tmp0_ = (_tmp2_ = NULL, _tmp0_ = (g_free (_tmp0_), NULL), _tmp0__length1 = 0, _tmp0__size = _tmp0__length1, _tmp2_);
- }
- self->dwords = (_tmp4_ = (_tmp3_ = _tmp0_, (_tmp3_ == NULL) ? ((gpointer) _tmp3_) : _vala_array_dup1 (_tmp3_, _tmp0__length1)), self->dwords = (g_free (self->dwords), NULL), self->dwords_length1 = _tmp0__length1, _tmp4_);
- if (len > 0) {
- memcpy (self->dwords, cs, (gsize) (len * sizeof (guint32)));
- }
- pkt_count = emulation_cs_check (cs, len);
- _tmp5_ = (_tmp5__length1 = 0, NULL);
if (pkt_count > 0) {
- EmulationPacketBase** _tmp6_;
- _tmp5_ = (_tmp6_ = g_new0 (EmulationPacketBase*, pkt_count + 1), _tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_object_unref), NULL), _tmp5__length1 = pkt_count, _tmp5__size = _tmp5__length1, _tmp6_);
+ EmulationPacket** _tmp1_;
+ _tmp0_ = (_tmp1_ = g_new0 (EmulationPacket*, pkt_count + 1), _tmp0_ = (_vala_array_free (_tmp0_, _tmp0__length1, (GDestroyNotify) g_object_unref), NULL), _tmp0__length1 = pkt_count, _tmp0__size = _tmp0__length1, _tmp1_);
} else {
- EmulationPacketBase** _tmp7_;
- _tmp5_ = (_tmp7_ = NULL, _tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_object_unref), NULL), _tmp5__length1 = 0, _tmp5__size = _tmp5__length1, _tmp7_);
+ EmulationPacket** _tmp2_;
+ _tmp0_ = (_tmp2_ = NULL, _tmp0_ = (_vala_array_free (_tmp0_, _tmp0__length1, (GDestroyNotify) g_object_unref), NULL), _tmp0__length1 = 0, _tmp0__size = _tmp0__length1, _tmp2_);
}
- self->packets = (_tmp9_ = (_tmp8_ = _tmp5_, (_tmp8_ == NULL) ? ((gpointer) _tmp8_) : _vala_array_dup2 (_tmp8_, _tmp5__length1)), self->packets = (_vala_array_free (self->packets, self->packets_length1, (GDestroyNotify) g_object_unref), NULL), self->packets_length1 = _tmp5__length1, _tmp9_);
+ self->priv->packets = (_tmp4_ = (_tmp3_ = _tmp0_, (_tmp3_ == NULL) ? ((gpointer) _tmp3_) : _vala_array_dup1 (_tmp3_, _tmp0__length1)), self->priv->packets = (_vala_array_free (self->priv->packets, self->priv->packets_length1, (GDestroyNotify) g_object_unref), NULL), self->priv->packets_length1 = _tmp0__length1, self->priv->packets_size = self->priv->packets_length1, _tmp4_);
if (pkt_count > 0) {
- guint pkt;
- pkt = (guint) 0;
{
guint i;
+ guint pkt;
i = (guint) 0;
+ pkt = (guint) 0;
{
- gboolean _tmp10_;
- _tmp10_ = TRUE;
+ gboolean _tmp5_;
+ _tmp5_ = TRUE;
while (TRUE) {
- guint32* _tmp11_ = NULL;
- EmulationPacketBase* _tmp12_;
- if (!_tmp10_) {
+ EmulationPacket* _tmp6_;
+ if (!_tmp5_) {
i++;
}
- _tmp10_ = FALSE;
+ _tmp5_ = FALSE;
if (!(i < len)) {
break;
}
- if (i < (len - 1)) {
- _tmp11_ = &self->dwords[i + 1];
- } else {
- _tmp11_ = NULL;
- }
- self->packets[pkt] = (_tmp12_ = emulation_make_packet (self->dwords[i], _tmp11_), _g_object_unref0 (self->packets[pkt]), _tmp12_);
- i = i + emulation_packet_base_get_length (self->packets[pkt++]);
+ self->priv->packets[pkt] = (_tmp6_ = emulation_packet_make (dwords[i], (dwords + i) + 1), _g_object_unref0 (self->priv->packets[pkt]), _tmp6_);
+ i = i + emulation_packet_get_length (self->priv->packets[pkt++]);
}
}
}
}
- _tmp0_ = (g_free (_tmp0_), NULL);
- _tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_object_unref), NULL);
+ _tmp0_ = (_vala_array_free (_tmp0_, _tmp0__length1, (GDestroyNotify) g_object_unref), NULL);
return self;
}
-EmulationCS* emulation_cs_new (guint32* cs, guint len) {
- return emulation_cs_construct (EMULATION_TYPE_CS, cs, len);
+EmulationCS* emulation_cs_new (guint32* dwords, guint len) {
+ return emulation_cs_construct (EMULATION_TYPE_CS, dwords, len);
+}
+
+
+GType emulation_cs_get_element_type (EmulationCS* self) {
+ GType result;
+ g_return_val_if_fail (self != NULL, 0UL);
+ result = EMULATION_TYPE_PACKET;
+ return result;
+}
+
+
+guint emulation_cs_get_length (EmulationCS* self) {
+ guint result;
+ gint _tmp0_ = 0;
+ g_return_val_if_fail (self != NULL, 0U);
+ if (self->priv->packets != NULL) {
+ _tmp0_ = self->priv->packets_length1;
+ } else {
+ _tmp0_ = 0;
+ }
+ result = (guint) _tmp0_;
+ return result;
+}
+
+
+EmulationCSIterator* emulation_cs_iterator_construct (GType object_type, EmulationCS* cs) {
+ EmulationCSIterator* self;
+ g_return_val_if_fail (cs != NULL, NULL);
+ self = (EmulationCSIterator*) g_type_create_instance (object_type);
+ self->priv->cs = cs;
+ self->priv->pos = (guint) 0;
+ return self;
+}
+
+
+EmulationCSIterator* emulation_cs_iterator_new (EmulationCS* cs) {
+ return emulation_cs_iterator_construct (EMULATION_CS_TYPE_ITERATOR, cs);
+}
+
+
+gboolean emulation_cs_iterator_next (EmulationCSIterator* self) {
+ gboolean result;
+ g_return_val_if_fail (self != NULL, FALSE);
+ result = (self->priv->pos++) < emulation_cs_get_length (self->priv->cs);
+ return result;
+}
+
+
+EmulationPacket* emulation_cs_iterator_get (EmulationCSIterator* self) {
+ EmulationPacket* result;
+ g_return_val_if_fail (self != NULL, NULL);
+ result = emulation_cs_get (self->priv->cs, self->priv->pos - 1);
+ return result;
+}
+
+
+static void emulation_cs_value_iterator_init (GValue* value) {
+ value->data[0].v_pointer = NULL;
+}
+
+
+static void emulation_cs_value_iterator_free_value (GValue* value) {
+ if (value->data[0].v_pointer) {
+ emulation_cs_iterator_unref (value->data[0].v_pointer);
+ }
+}
+
+
+static void emulation_cs_value_iterator_copy_value (const GValue* src_value, GValue* dest_value) {
+ if (src_value->data[0].v_pointer) {
+ dest_value->data[0].v_pointer = emulation_cs_iterator_ref (src_value->data[0].v_pointer);
+ } else {
+ dest_value->data[0].v_pointer = NULL;
+ }
+}
+
+
+static gpointer emulation_cs_value_iterator_peek_pointer (const GValue* value) {
+ return value->data[0].v_pointer;
+}
+
+
+static gchar* emulation_cs_value_iterator_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
+ if (collect_values[0].v_pointer) {
+ EmulationCSIterator* 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_cs_iterator_ref (object);
+ } else {
+ value->data[0].v_pointer = NULL;
+ }
+ return NULL;
+}
+
+
+static gchar* emulation_cs_value_iterator_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
+ EmulationCSIterator** 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_cs_iterator_ref (value->data[0].v_pointer);
+ }
+ return NULL;
+}
+
+
+GParamSpec* emulation_cs_param_spec_iterator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
+ EmulationCSParamSpecIterator* spec;
+ g_return_val_if_fail (g_type_is_a (object_type, EMULATION_CS_TYPE_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_cs_value_get_iterator (const GValue* value) {
+ g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, EMULATION_CS_TYPE_ITERATOR), NULL);
+ return value->data[0].v_pointer;
+}
+
+
+void emulation_cs_value_set_iterator (GValue* value, gpointer v_object) {
+ EmulationCSIterator* old;
+ g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, EMULATION_CS_TYPE_ITERATOR));
+ old = value->data[0].v_pointer;
+ if (v_object) {
+ g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, EMULATION_CS_TYPE_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_cs_iterator_ref (value->data[0].v_pointer);
+ } else {
+ value->data[0].v_pointer = NULL;
+ }
+ if (old) {
+ emulation_cs_iterator_unref (old);
+ }
+}
+
+
+static void emulation_cs_iterator_class_init (EmulationCSIteratorClass * klass) {
+ emulation_cs_iterator_parent_class = g_type_class_peek_parent (klass);
+ EMULATION_CS_ITERATOR_CLASS (klass)->finalize = emulation_cs_iterator_finalize;
+ g_type_class_add_private (klass, sizeof (EmulationCSIteratorPrivate));
+}
+
+
+static void emulation_cs_iterator_instance_init (EmulationCSIterator * self) {
+ self->priv = EMULATION_CS_ITERATOR_GET_PRIVATE (self);
+ self->ref_count = 1;
+}
+
+
+static void emulation_cs_iterator_finalize (EmulationCSIterator* obj) {
+ EmulationCSIterator * self;
+ self = EMULATION_CS_ITERATOR (obj);
+}
+
+
+GType emulation_cs_iterator_get_type (void) {
+ static GType emulation_cs_iterator_type_id = 0;
+ if (emulation_cs_iterator_type_id == 0) {
+ static const GTypeValueTable g_define_type_value_table = { emulation_cs_value_iterator_init, emulation_cs_value_iterator_free_value, emulation_cs_value_iterator_copy_value, emulation_cs_value_iterator_peek_pointer, "p", emulation_cs_value_iterator_collect_value, "p", emulation_cs_value_iterator_lcopy_value };
+ static const GTypeInfo g_define_type_info = { sizeof (EmulationCSIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) emulation_cs_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EmulationCSIterator), 0, (GInstanceInitFunc) emulation_cs_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_cs_iterator_type_id = g_type_register_fundamental (g_type_fundamental_next (), "EmulationCSIterator", &g_define_type_info, &g_define_type_fundamental_info, 0);
+ }
+ return emulation_cs_iterator_type_id;
+}
+
+
+gpointer emulation_cs_iterator_ref (gpointer instance) {
+ EmulationCSIterator* self;
+ self = instance;
+ g_atomic_int_inc (&self->ref_count);
+ return instance;
+}
+
+
+void emulation_cs_iterator_unref (gpointer instance) {
+ EmulationCSIterator* self;
+ self = instance;
+ if (g_atomic_int_dec_and_test (&self->ref_count)) {
+ EMULATION_CS_ITERATOR_GET_CLASS (self)->finalize (self);
+ g_type_free_instance ((GTypeInstance *) self);
+ }
}
static void emulation_cs_class_init (EmulationCSClass * klass) {
emulation_cs_parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (EmulationCSPrivate));
+ G_OBJECT_CLASS (klass)->get_property = emulation_cs_get_property;
G_OBJECT_CLASS (klass)->finalize = emulation_cs_finalize;
+ g_object_class_install_property (G_OBJECT_CLASS (klass), EMULATION_CS_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_CS_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));
}
static void emulation_cs_instance_init (EmulationCS * self) {
+ self->priv = EMULATION_CS_GET_PRIVATE (self);
}
static void emulation_cs_finalize (GObject* obj) {
EmulationCS * self;
self = EMULATION_CS (obj);
- self->packets = (_vala_array_free (self->packets, self->packets_length1, (GDestroyNotify) g_object_unref), NULL);
- self->dwords = (g_free (self->dwords), NULL);
+ self->priv->packets = (_vala_array_free (self->priv->packets, self->priv->packets_length1, (GDestroyNotify) g_object_unref), NULL);
G_OBJECT_CLASS (emulation_cs_parent_class)->finalize (obj);
}
@@ -1146,6 +1525,23 @@ GType emulation_cs_get_type (void) {
}
+static void emulation_cs_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
+ EmulationCS * self;
+ self = EMULATION_CS (object);
+ switch (property_id) {
+ case EMULATION_CS_ELEMENT_TYPE:
+ g_value_set_gtype (value, emulation_cs_get_element_type (self));
+ break;
+ case EMULATION_CS_LENGTH:
+ g_value_set_uint (value, emulation_cs_get_length (self));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
if ((array != NULL) && (destroy_func != NULL)) {
int i;
diff --git a/src/cs.vala b/src/cs.vala
index d178ba7..ff8a168 100644
--- a/src/cs.vala
+++ b/src/cs.vala
@@ -22,49 +22,34 @@
namespace Emulation
{
- public enum Chip {
- R300,
- R500
- }
-
- private static inline uint packet_typeid(uint32 header) { return (header >> 30) & 3; }
-
- public static inline PacketBase make_packet(uint32 header, uint32 *dwords = null)
+ /* Packet is very tolerant and will allow you to specify null for it's
+ * DWORDs. This feature is very useful when checking a CS, as you can
+ * simply pawn off the work on the Packetn classes. */
+ public abstract class Packet : Object
{
- switch (packet_typeid(header)) {
- case 0: return new Packet0(header, dwords);
- case 1: return new Packet1(header, dwords);
- case 2: return new Packet2(header, dwords);
- case 3: return new Packet3(header, dwords);
- }
- assert(false);
- return new PacketBase();
- }
+ public class Iterator
+ {
+ private weak Packet packet;
+ private uint pos;
- public class PacketIterator
- {
- private weak PacketBase m_packet;
- private uint m_pos;
+ public Iterator(Packet p)
+ {
+ packet = p;
+ pos = 0;
+ }
- public PacketIterator(PacketBase p)
- {
- m_packet = p;
- m_pos = 0;
+ public bool next() { return pos++ < packet.length; }
+ public new uint32 get() { return packet[pos-1]; }
}
- public bool next() { return m_pos < m_packet.length; }
- public new uint32 get() { return m_packet.dwords[m_pos++]; }
- }
-
- public class PacketBase : Object
- {
- public uint32 *dwords;
- public Type element_type { get { return typeof(uint32); } }
- public PacketIterator iterator() { return new PacketIterator(this); }
+ protected uint32[] dwords;
+ public uint32 header { get; internal set; }
+ public uint type_id { get { return (header >> 30) & 3; } }
- public uint32 header;
- public uint type_id { get { return packet_typeid(header); } }
+ //public Type element_type { get { return typeof(uint32); } }
+ public Iterator iterator() { return new Iterator(this); }
+ public abstract uint32 target_addr(uint index);
public abstract uint length { get; }
public new uint32 get(uint index) { return dwords[index]; }
@@ -72,9 +57,22 @@ namespace Emulation
{
return (header >> low) & ((1 << (high-low+1))-1);
}
+
+ public static Packet make(uint32 header, uint32 *dwords = null)
+ {
+ switch ((header >> 30) & 3) {
+ case 0: return new Packet0(header, dwords);
+ case 1: return new Packet1(header, dwords);
+ case 2: return new Packet2(header);
+ case 3: return new Packet3(header, dwords);
+ }
+ /* we can't ever get here, but appease the compiler. */
+ assert(false);
+ return new Packet2(header);
+ }
}
- public class Packet0 : PacketBase
+ public class Packet0 : Packet
{
public uint32 addr { get { return _ADDR << 2; } }
public bool one_reg_wr { get { return (bool)_ONE_REG_WR; } }
@@ -84,14 +82,21 @@ namespace Emulation
public uint32 _ONE_REG_WR { get { return extract_bits(15, 15); } }
public uint32 _COUNT { get { return extract_bits(29, 16); } }
- public Packet0(uint32 header, uint32 *dwords = null)
+ public override uint32 target_addr(uint index) { return (one_reg_wr) ? addr : (addr + index*4); }
+
+ public Packet0(uint32 header, uint32 *dwords)
{
this.header = header;
- this.dwords = dwords;
+ if (dwords != null) {
+ this.dwords = new uint32[length];
+ for (uint i = 0; i < length; i++) {
+ this.dwords[i] = dwords[i];
+ }
+ }
}
}
- public class Packet1 : PacketBase
+ public class Packet1 : Packet
{
public uint32 addr1 { get { return _ADDR1 << 2; } }
public uint32 addr2 { get { return _ADDR2 << 2; } }
@@ -100,25 +105,32 @@ namespace Emulation
public uint32 _ADDR1 { get { return extract_bits(10, 0); } }
public uint32 _ADDR2 { get { return extract_bits(21, 11); } }
- public Packet1(uint32 header, uint32 *dwords = null)
+ public override uint32 target_addr(uint index) { return (index == 0) ? addr1 : addr2; }
+
+ public Packet1(uint32 header, uint32 *dwords)
{
this.header = header;
- this.dwords = dwords;
+ if (dwords != null) {
+ this.dwords = new uint32[2];
+ this.dwords[0] = dwords[0];
+ this.dwords[1] = dwords[1];
+ }
}
}
- public class Packet2 : PacketBase
+ public class Packet2 : Packet
{
public override uint length { get { return 0; } }
+ public override uint32 target_addr(uint index) { return 0; }
- public Packet2(uint32 header, uint32 *dwords = null)
+ public Packet2(uint32 header)
{
this.header = header;
- this.dwords = dwords;
+ this.dwords = null;
}
}
- public class Packet3 : PacketBase
+ public class Packet3 : Packet
{
public uint32 opcode { get { return _IT_OPCODE; } }
public override uint length { get { return (uint)_COUNT+1; } }
@@ -126,43 +138,65 @@ namespace Emulation
public uint32 _IT_OPCODE { get { return extract_bits(15, 8); } }
public uint32 _COUNT { get { return extract_bits(29, 16); } }
- public Packet3(uint32 header, uint32 *dwords = null)
+ public override uint32 target_addr(uint index) { return 0; /* XXX todo */ }
+ public string opcode_name { get { return "TODO"; } }
+
+ public Packet3(uint32 header, uint32 *dwords)
{
this.header = header;
- this.dwords = dwords;
+ if (dwords != null) {
+ this.dwords = new uint32[length];
+ for (uint i = 0; i < length; i++) {
+ this.dwords[i] = dwords[i];
+ }
+ }
}
}
public class CS : Object
{
- public PacketBase[] packets;
- public uint32[] dwords;
+ public class Iterator
+ {
+ private weak CS cs;
+ private uint pos;
- private static uint check(uint32 *cs, uint len)
+ public Iterator(CS cs)
+ {
+ this.cs = cs;
+ this.pos = 0;
+ }
+
+ public bool next() { return pos++ < cs.length; }
+ public new Packet get() { return cs[pos-1]; }
+ }
+
+ private static uint check(uint32 *dwords, uint len)
{
int pkt_count = 0;
for (uint i = 0; i < len; i++, pkt_count++) {
- i += make_packet(cs[i]).length;
+ i += Packet.make(dwords[i]).length;
if (i+1 > len) { return 0; }
}
return pkt_count;
}
- public CS(uint32 *cs, uint len)
- {
- if (len > 0) { assert(cs != null); }
+ private Packet[] packets;
- dwords = (len > 0) ? new uint32[len] : null;
- if (len > 0) {
- Memory.copy(dwords, cs, len*sizeof(uint32));
- }
+ public Type element_type { get { return typeof(Packet); } }
+ public Iterator iterator() { return new Iterator(this); }
+
+ public uint length { get { return (packets != null) ? packets.length : 0; } }
+ public new Packet get(uint index) { return packets[index]; }
+
+ public CS(uint32 *dwords, uint len)
+ {
+ if (len > 0) { assert(dwords != null); }
- var pkt_count = check(cs, len);
- packets = (pkt_count > 0) ? new PacketBase[pkt_count] : null;
+ var pkt_count = check(dwords, len);
+ packets = (pkt_count > 0) ? new Packet[pkt_count] : null;
if (pkt_count > 0) {
- uint pkt = 0;
- for (uint i = 0; i < len; i++) {
- packets[pkt] = make_packet(dwords[i], (i < (len-1)) ? &dwords[i+1] : null);
+ for (uint i = 0, pkt = 0; i < len; i++) {
+ packets[pkt] = Packet.make(dwords[i], dwords+i+1);
i += packets[pkt++].length;
}
}
diff --git a/src/csexport.c b/src/csexport.c
index 0af42e0..ab623fc 100644
--- a/src/csexport.c
+++ b/src/csexport.c
@@ -78,17 +78,38 @@ typedef struct _EmulationSpecClass EmulationSpecClass;
typedef struct _EmulationSpecEntry EmulationSpecEntry;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _fclose0(var) ((var == NULL) ? NULL : (var = (fclose (var), NULL)))
-typedef struct _EmulationCSPrivate EmulationCSPrivate;
-#define EMULATION_TYPE_PACKET_BASE (emulation_packet_base_get_type ())
-#define EMULATION_PACKET_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_PACKET_BASE, EmulationPacketBase))
-#define EMULATION_PACKET_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_TYPE_PACKET_BASE, EmulationPacketBaseClass))
-#define EMULATION_IS_PACKET_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_TYPE_PACKET_BASE))
-#define EMULATION_IS_PACKET_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_TYPE_PACKET_BASE))
-#define EMULATION_PACKET_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_TYPE_PACKET_BASE, EmulationPacketBaseClass))
-
-typedef struct _EmulationPacketBase EmulationPacketBase;
-typedef struct _EmulationPacketBaseClass EmulationPacketBaseClass;
+#define EMULATION_CS_TYPE_ITERATOR (emulation_cs_iterator_get_type ())
+#define EMULATION_CS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_CS_TYPE_ITERATOR, EmulationCSIterator))
+#define EMULATION_CS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_CS_TYPE_ITERATOR, EmulationCSIteratorClass))
+#define EMULATION_CS_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_CS_TYPE_ITERATOR))
+#define EMULATION_CS_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_CS_TYPE_ITERATOR))
+#define EMULATION_CS_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_CS_TYPE_ITERATOR, EmulationCSIteratorClass))
+
+typedef struct _EmulationCSIterator EmulationCSIterator;
+typedef struct _EmulationCSIteratorClass EmulationCSIteratorClass;
+
+#define EMULATION_TYPE_PACKET (emulation_packet_get_type ())
+#define EMULATION_PACKET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_PACKET, EmulationPacket))
+#define EMULATION_PACKET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_TYPE_PACKET, EmulationPacketClass))
+#define EMULATION_IS_PACKET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_TYPE_PACKET))
+#define EMULATION_IS_PACKET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_TYPE_PACKET))
+#define EMULATION_PACKET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_TYPE_PACKET, EmulationPacketClass))
+
+typedef struct _EmulationPacket EmulationPacket;
+typedef struct _EmulationPacketClass EmulationPacketClass;
+
+#define EMULATION_PACKET_TYPE_ITERATOR (emulation_packet_iterator_get_type ())
+#define EMULATION_PACKET_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_PACKET_TYPE_ITERATOR, EmulationPacketIterator))
+#define EMULATION_PACKET_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_PACKET_TYPE_ITERATOR, EmulationPacketIteratorClass))
+#define EMULATION_PACKET_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_PACKET_TYPE_ITERATOR))
+#define EMULATION_PACKET_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_PACKET_TYPE_ITERATOR))
+#define EMULATION_PACKET_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_PACKET_TYPE_ITERATOR, EmulationPacketIteratorClass))
+
+typedef struct _EmulationPacketIterator EmulationPacketIterator;
+typedef struct _EmulationPacketIteratorClass EmulationPacketIteratorClass;
+#define _emulation_packet_iterator_unref0(var) ((var == NULL) ? NULL : (var = (emulation_packet_iterator_unref (var), NULL)))
+#define _emulation_cs_iterator_unref0(var) ((var == NULL) ? NULL : (var = (emulation_cs_iterator_unref (var), NULL)))
#define EMULATION_TYPE_PACKET0 (emulation_packet0_get_type ())
#define EMULATION_PACKET0(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_PACKET0, EmulationPacket0))
@@ -212,19 +233,6 @@ struct _EmulationSpecEntry {
char* name;
};
-struct _EmulationCS {
- GObject parent_instance;
- EmulationCSPrivate * priv;
- EmulationPacketBase** packets;
- gint packets_length1;
- guint32* dwords;
- gint dwords_length1;
-};
-
-struct _EmulationCSClass {
- GObjectClass parent_class;
-};
-
static char* gui_cs_export_ui_xml;
static char* gui_cs_export_ui_xml = NULL;
@@ -251,32 +259,51 @@ void emulation_spec_entry_copy (const EmulationSpecEntry* self, EmulationSpecEnt
void emulation_spec_entry_destroy (EmulationSpecEntry* self);
static void gui_cs_export_on_response (GUICSExport* self, GtkDialog* source, gint response_id);
static void _gui_cs_export_on_response_gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self);
-GUICSExport* gui_cs_export_new (EmulationCS* _cs);
-GUICSExport* gui_cs_export_construct (GType object_type, EmulationCS* _cs);
+GUICSExport* gui_cs_export_new (EmulationCS* cs);
+GUICSExport* gui_cs_export_construct (GType object_type, EmulationCS* cs);
static void gui_cs_export_export_plain (GUICSExport* self, FILE* fs);
static void gui_cs_export_export_tree (GUICSExport* self, FILE* fs);
-GType emulation_packet_base_get_type (void);
-guint emulation_packet_base_get_type_id (EmulationPacketBase* self);
+gpointer emulation_cs_iterator_ref (gpointer instance);
+void emulation_cs_iterator_unref (gpointer instance);
+GParamSpec* emulation_cs_param_spec_iterator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
+void emulation_cs_value_set_iterator (GValue* value, gpointer v_object);
+gpointer emulation_cs_value_get_iterator (const GValue* value);
+GType emulation_cs_iterator_get_type (void);
+EmulationCSIterator* emulation_cs_iterator (EmulationCS* self);
+gboolean emulation_cs_iterator_next (EmulationCSIterator* self);
+GType emulation_packet_get_type (void);
+EmulationPacket* emulation_cs_iterator_get (EmulationCSIterator* self);
+gpointer emulation_packet_iterator_ref (gpointer instance);
+void emulation_packet_iterator_unref (gpointer instance);
+GParamSpec* emulation_packet_param_spec_iterator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
+void emulation_packet_value_set_iterator (GValue* value, gpointer v_object);
+gpointer emulation_packet_value_get_iterator (const GValue* value);
+GType emulation_packet_iterator_get_type (void);
+EmulationPacketIterator* emulation_packet_iterator (EmulationPacket* self);
+gboolean emulation_packet_iterator_next (EmulationPacketIterator* self);
+guint32 emulation_packet_iterator_get (EmulationPacketIterator* self);
+guint emulation_packet_get_type_id (EmulationPacket* self);
GType emulation_packet0_get_type (void);
guint32 emulation_packet0_get_addr (EmulationPacket0* self);
gboolean emulation_packet0_get_one_reg_wr (EmulationPacket0* self);
-guint emulation_packet_base_get_length (EmulationPacketBase* self);
+guint emulation_packet_get_length (EmulationPacket* self);
GType emulation_packet1_get_type (void);
guint32 emulation_packet1_get_addr1 (EmulationPacket1* self);
guint32 emulation_packet1_get_addr2 (EmulationPacket1* self);
GType emulation_packet3_get_type (void);
guint32 emulation_packet3_get_opcode (EmulationPacket3* self);
+guint32 emulation_packet_target_addr (EmulationPacket* self, guint index);
GType emulation_register_list_get_type (void);
-static guint32 gui_cs_export_dword_addr (GUICSExport* self, EmulationPacketBase* p, guint d);
EmulationRegisterList* emulation_spec_translate_addr (EmulationSpec* self, guint addr);
-guint32 emulation_packet_base_get (EmulationPacketBase* self, guint index);
+guint emulation_cs_get_length (EmulationCS* self);
+guint32 emulation_packet_get (EmulationPacket* self, guint index);
guint emulation_register_list_get_length (EmulationRegisterList* self);
GType emulation_register_iterator_get_type (void);
EmulationRegisterIterator* emulation_register_list_iterator (EmulationRegisterList* self);
gboolean emulation_register_iterator_next (EmulationRegisterIterator* self);
GType emulation_register_get_type (void);
EmulationRegister* emulation_register_iterator_get (EmulationRegisterIterator* self);
-static void gui_cs_export_print_dest_reg (GUICSExport* self, FILE* fs, gchar nextpkg, gchar nextdw, gchar nextreg, EmulationRegister* reg, guint32 dword);
+static inline void gui_cs_export_print_dest_reg (GUICSExport* self, FILE* fs, gchar nextpkg, gchar nextdw, gchar nextreg, EmulationRegister* reg, guint32 dword);
GType emulation_register_info_get_type (void);
EmulationRegisterInfo* emulation_register_get_info (EmulationRegister* self);
const char* emulation_register_info_get_name (EmulationRegisterInfo* self);
@@ -327,7 +354,7 @@ static void _gui_cs_export_on_response_gtk_dialog_response (GtkDialog* _sender,
}
-GUICSExport* gui_cs_export_construct (GType object_type, EmulationCS* _cs) {
+GUICSExport* gui_cs_export_construct (GType object_type, EmulationCS* cs) {
GError * _inner_error_;
GUICSExport * self;
GtkBuilder* builder;
@@ -361,7 +388,7 @@ GUICSExport* gui_cs_export_construct (GType object_type, EmulationCS* _cs) {
GtkAlignment* chip_combo_align;
GtkComboBox* _tmp26_;
EmulationCS* _tmp28_;
- g_return_val_if_fail (_cs != NULL, NULL);
+ g_return_val_if_fail (cs != NULL, NULL);
_inner_error_ = NULL;
self = g_object_newv (object_type, 0, NULL);
builder = gtk_builder_new ();
@@ -432,7 +459,7 @@ GUICSExport* gui_cs_export_construct (GType object_type, EmulationCS* _cs) {
}
gtk_combo_box_set_active (self->priv->chip_combo, (gint) emulation_spec_default);
gtk_widget_set_visible ((GtkWidget*) self->priv->chip_combo, TRUE);
- self->priv->cs = (_tmp28_ = _g_object_ref0 (_cs), _g_object_unref0 (self->priv->cs), _tmp28_);
+ self->priv->cs = (_tmp28_ = _g_object_ref0 (cs), _g_object_unref0 (self->priv->cs), _tmp28_);
g_signal_connect_object ((GtkDialog*) self, "response", (GCallback) _gui_cs_export_on_response_gtk_dialog_response, self, 0);
_g_object_unref0 (builder);
_g_object_unref0 (mainbox);
@@ -441,8 +468,8 @@ GUICSExport* gui_cs_export_construct (GType object_type, EmulationCS* _cs) {
}
-GUICSExport* gui_cs_export_new (EmulationCS* _cs) {
- return gui_cs_export_construct (GUI_TYPE_CS_EXPORT, _cs);
+GUICSExport* gui_cs_export_new (EmulationCS* cs) {
+ return gui_cs_export_construct (GUI_TYPE_CS_EXPORT, cs);
}
@@ -492,22 +519,30 @@ static void gui_cs_export_export_plain (GUICSExport* self, FILE* fs) {
g_return_if_fail (self != NULL);
g_return_if_fail (fs != NULL);
{
- guint i;
- i = (guint) 0;
- {
- gboolean _tmp0_;
- _tmp0_ = TRUE;
- while (TRUE) {
- if (!_tmp0_) {
- i++;
- }
- _tmp0_ = FALSE;
- if (!(i < self->priv->cs->dwords_length1)) {
- break;
+ EmulationCSIterator* _p_it;
+ _p_it = emulation_cs_iterator (self->priv->cs);
+ while (TRUE) {
+ EmulationPacket* p;
+ if (!emulation_cs_iterator_next (_p_it)) {
+ break;
+ }
+ p = emulation_cs_iterator_get (_p_it);
+ {
+ EmulationPacketIterator* _dw_it;
+ _dw_it = emulation_packet_iterator (p);
+ while (TRUE) {
+ guint32 dw;
+ if (!emulation_packet_iterator_next (_dw_it)) {
+ break;
+ }
+ dw = emulation_packet_iterator_get (_dw_it);
+ fprintf (fs, "%08X\n", (guint) dw);
}
- fprintf (fs, "%08X\n", (guint) self->priv->cs->dwords[i]);
+ _emulation_packet_iterator_unref0 (_dw_it);
}
+ _g_object_unref0 (p);
}
+ _emulation_cs_iterator_unref0 (_p_it);
}
}
@@ -538,192 +573,196 @@ static void gui_cs_export_export_tree (GUICSExport* self, FILE* fs) {
spec = _g_object_ref0 (emulation_specs[gtk_combo_box_get_active (self->priv->chip_combo)].spec);
pkgn = (guint) 0;
{
- EmulationPacketBase** p_collection;
- int p_collection_length1;
- int p_it;
- p_collection = self->priv->cs->packets;
- p_collection_length1 = self->priv->cs->packets_length1;
- for (p_it = 0; p_it < self->priv->cs->packets_length1; p_it = p_it + 1) {
- EmulationPacketBase* p;
- p = _g_object_ref0 (p_collection[p_it]);
- {
- fprintf (fs, "+-+- Packet");
- if (pkt_type) {
- fprintf (fs, "%u", emulation_packet_base_get_type_id (p));
+ EmulationCSIterator* _p_it;
+ _p_it = emulation_cs_iterator (self->priv->cs);
+ while (TRUE) {
+ EmulationPacket* p;
+ if (!emulation_cs_iterator_next (_p_it)) {
+ break;
+ }
+ p = emulation_cs_iterator_get (_p_it);
+ fprintf (fs, "+-+- Packet");
+ if (pkt_type) {
+ fprintf (fs, "%u", emulation_packet_get_type_id (p));
+ }
+ switch (emulation_packet_get_type_id (p)) {
+ case 0:
+ {
+ EmulationPacket* _tmp0_;
+ EmulationPacket0* p0;
+ p0 = _g_object_ref0 ((_tmp0_ = p, EMULATION_IS_PACKET0 (_tmp0_) ? ((EmulationPacket0*) _tmp0_) : NULL));
+ if (pkt0_addr) {
+ fprintf (fs, " - Addr: 0x%04X", (guint) emulation_packet0_get_addr (p0));
+ }
+ if (pkt0_one) {
+ const char* _tmp1_;
+ _tmp1_ = NULL;
+ if (emulation_packet0_get_one_reg_wr (p0)) {
+ _tmp1_ = "true";
+ } else {
+ _tmp1_ = "false";
+ }
+ fprintf (fs, " - ONE_REG_WR: %s", _tmp1_);
+ }
+ if (pkt0_count) {
+ fprintf (fs, " (%u DWORDs)", emulation_packet_get_length ((EmulationPacket*) p0));
+ }
+ _g_object_unref0 (p0);
+ break;
+ }
+ case 1:
+ {
+ EmulationPacket* _tmp2_;
+ EmulationPacket1* p1;
+ p1 = _g_object_ref0 ((_tmp2_ = p, EMULATION_IS_PACKET1 (_tmp2_) ? ((EmulationPacket1*) _tmp2_) : NULL));
+ if (pkt1_addr1) {
+ fprintf (fs, " - Addr1: 0x%04X", (guint) emulation_packet1_get_addr1 (p1));
+ }
+ if (pkt1_addr2) {
+ fprintf (fs, " - Addr2: 0x%04X", (guint) emulation_packet1_get_addr2 (p1));
+ }
+ _g_object_unref0 (p1);
+ break;
+ }
+ case 2:
+ {
+ break;
+ }
+ case 3:
+ {
+ EmulationPacket* _tmp3_;
+ EmulationPacket3* p3;
+ p3 = _g_object_ref0 ((_tmp3_ = p, EMULATION_IS_PACKET3 (_tmp3_) ? ((EmulationPacket3*) _tmp3_) : NULL));
+ if (pkt3_opcode) {
+ fprintf (fs, " - Opcode: 0x%02X", (guint) emulation_packet3_get_opcode (p3));
+ }
+ if (pkt3_opcode_text) {
+ fprintf (fs, " - TODO");
+ }
+ if (pkt3_count) {
+ fprintf (fs, " (%u DWORDs)", emulation_packet_get_length ((EmulationPacket*) p3));
+ }
+ _g_object_unref0 (p3);
+ break;
+ }
+ default:
+ {
+ fprintf (stderr, "Implementation error in CSExport.export_tree()\n");
+ break;
}
- switch (emulation_packet_base_get_type_id (p)) {
- case 0:
- {
- EmulationPacketBase* _tmp0_;
- EmulationPacket0* p0;
- p0 = _g_object_ref0 ((_tmp0_ = p, EMULATION_IS_PACKET0 (_tmp0_) ? ((EmulationPacket0*) _tmp0_) : NULL));
- if (pkt0_addr) {
- fprintf (fs, " - Addr: 0x%04X", (guint) emulation_packet0_get_addr (p0));
+ }
+ fprintf (fs, "\n");
+ {
+ guint i;
+ i = (guint) 0;
+ {
+ gboolean _tmp4_;
+ _tmp4_ = TRUE;
+ while (TRUE) {
+ guint32 addr;
+ EmulationRegisterList* _tmp5_;
+ EmulationRegisterList* list;
+ gchar _tmp8_ = '\0';
+ gchar nextpkg;
+ gchar _tmp9_ = '\0';
+ gboolean _tmp10_ = FALSE;
+ gchar _tmp11_ = '\0';
+ gchar _tmp12_ = '\0';
+ gchar nextdw;
+ if (!_tmp4_) {
+ i++;
}
- if (pkt0_one) {
- const char* _tmp1_;
- _tmp1_ = NULL;
- if (emulation_packet0_get_one_reg_wr (p0)) {
- _tmp1_ = "true";
- } else {
- _tmp1_ = "false";
- }
- fprintf (fs, " - ONE_REG_WR: %s", _tmp1_);
+ _tmp4_ = FALSE;
+ if (!(i < emulation_packet_get_length (p))) {
+ break;
}
- if (pkt0_count) {
- fprintf (fs, " (%u DWORDs)", emulation_packet_base_get_length ((EmulationPacketBase*) p0));
+ addr = emulation_packet_target_addr (p, i);
+ _tmp5_ = NULL;
+ if (addr != 0) {
+ EmulationRegisterList* _tmp6_;
+ _tmp5_ = (_tmp6_ = emulation_spec_translate_addr (spec, (guint) addr), _g_object_unref0 (_tmp5_), _tmp6_);
+ } else {
+ EmulationRegisterList* _tmp7_;
+ _tmp5_ = (_tmp7_ = NULL, _g_object_unref0 (_tmp5_), _tmp7_);
}
- _g_object_unref0 (p0);
- break;
- }
- case 1:
- {
- EmulationPacketBase* _tmp2_;
- EmulationPacket1* p1;
- p1 = _g_object_ref0 ((_tmp2_ = p, EMULATION_IS_PACKET1 (_tmp2_) ? ((EmulationPacket1*) _tmp2_) : NULL));
- if (pkt1_addr1) {
- fprintf (fs, " - Addr1: 0x%04X", (guint) emulation_packet1_get_addr1 (p1));
+ list = _g_object_ref0 (_tmp5_);
+ if (pkgn != (emulation_cs_get_length (self->priv->cs) - 1)) {
+ _tmp8_ = '|';
+ } else {
+ _tmp8_ = ' ';
}
- if (pkt1_addr2) {
- fprintf (fs, " - Addr2: 0x%04X", (guint) emulation_packet1_get_addr2 (p1));
+ nextpkg = _tmp8_;
+ if (list == NULL) {
+ _tmp10_ = i != (emulation_packet_get_length (p) - 1);
+ } else {
+ _tmp10_ = FALSE;
}
- _g_object_unref0 (p1);
- break;
- }
- case 2:
- {
- break;
- }
- case 3:
- {
- EmulationPacketBase* _tmp3_;
- EmulationPacket3* p3;
- p3 = _g_object_ref0 ((_tmp3_ = p, EMULATION_IS_PACKET3 (_tmp3_) ? ((EmulationPacket3*) _tmp3_) : NULL));
- if (pkt3_opcode) {
- fprintf (fs, " - Opcode: 0x%02X", (guint) emulation_packet3_get_opcode (p3));
+ if (_tmp10_) {
+ _tmp9_ = '|';
+ } else {
+ _tmp9_ = '+';
}
- if (pkt3_opcode_text) {
- fprintf (fs, " - TODO");
+ if (list == NULL) {
+ _tmp11_ = '-';
+ } else {
+ _tmp11_ = '+';
}
- if (pkt3_count) {
- fprintf (fs, " (%u DWORDs)", emulation_packet_base_get_length ((EmulationPacketBase*) p3));
+ fprintf (fs, "%c %c-%c- 0x%08X", (gint) nextpkg, (gint) _tmp9_, (gint) _tmp11_, (guint) emulation_packet_get (p, i));
+ if (addr != 0) {
+ fprintf (fs, " -> 0x%04X\n", (guint) addr);
+ } else {
+ fprintf (fs, "\n");
}
- _g_object_unref0 (p3);
- break;
- }
- default:
- {
- fprintf (stderr, "Implementation error in CSExport.export_tree()\n");
- break;
- }
- }
- fprintf (fs, "\n");
- {
- guint i;
- i = (guint) 0;
- {
- gboolean _tmp4_;
- _tmp4_ = TRUE;
- while (TRUE) {
- EmulationRegisterList* list;
- guint32 addr;
- gchar _tmp6_ = '\0';
- gchar nextpkg;
- gchar _tmp7_ = '\0';
- gboolean _tmp8_ = FALSE;
- gchar _tmp9_ = '\0';
- gchar _tmp10_ = '\0';
- gchar nextdw;
- if (!_tmp4_) {
- i++;
- }
- _tmp4_ = FALSE;
- if (!(i < emulation_packet_base_get_length (p))) {
- break;
- }
- list = NULL;
- addr = (guint32) 0;
- if (emulation_packet_base_get_type_id (p) != 3) {
- EmulationRegisterList* _tmp5_;
- addr = gui_cs_export_dword_addr (self, p, i);
- list = (_tmp5_ = emulation_spec_translate_addr (spec, (guint) addr), _g_object_unref0 (list), _tmp5_);
- }
- if (pkgn != (self->priv->cs->packets_length1 - 1)) {
- _tmp6_ = '|';
- } else {
- _tmp6_ = ' ';
- }
- nextpkg = _tmp6_;
- if (list == NULL) {
- _tmp8_ = i != (emulation_packet_base_get_length (p) - 1);
- } else {
- _tmp8_ = FALSE;
- }
- if (_tmp8_) {
- _tmp7_ = '|';
- } else {
- _tmp7_ = '+';
- }
- if (list == NULL) {
- _tmp9_ = '-';
- } else {
- _tmp9_ = '+';
- }
- fprintf (fs, "%c %c-%c- 0x%08X", (gint) nextpkg, (gint) _tmp7_, (gint) _tmp9_, (guint) emulation_packet_base_get (p, i));
- if (addr != 0) {
- fprintf (fs, " -> 0x%04X\n", (guint) addr);
- } else {
- fprintf (fs, "\n");
- }
- if (i != (emulation_packet_base_get_length (p) - 1)) {
- _tmp10_ = '|';
- } else {
- _tmp10_ = ' ';
- }
- nextdw = _tmp10_;
- if (list != NULL) {
- guint length;
- guint j;
- length = emulation_register_list_get_length (list);
- j = (guint) 0;
- {
- EmulationRegisterIterator* _reg_it;
- _reg_it = emulation_register_list_iterator (list);
- while (TRUE) {
- EmulationRegister* reg;
- gchar _tmp11_ = '\0';
- gchar nextreg;
- if (!emulation_register_iterator_next (_reg_it)) {
- break;
- }
- reg = emulation_register_iterator_get (_reg_it);
- if ((j++) != (length - 1)) {
- _tmp11_ = '|';
- } else {
- _tmp11_ = ' ';
- }
- nextreg = _tmp11_;
- gui_cs_export_print_dest_reg (self, fs, nextpkg, nextdw, nextreg, reg, emulation_packet_base_get (p, i));
+ if (i != (emulation_packet_get_length (p) - 1)) {
+ _tmp12_ = '|';
+ } else {
+ _tmp12_ = ' ';
+ }
+ nextdw = _tmp12_;
+ if (list != NULL) {
+ guint length;
+ guint j;
+ length = emulation_register_list_get_length (list);
+ j = (guint) 0;
+ {
+ EmulationRegisterIterator* _reg_it;
+ _reg_it = emulation_register_list_iterator (list);
+ while (TRUE) {
+ EmulationRegister* reg;
+ gchar _tmp13_ = '\0';
+ gchar nextreg;
+ if (!emulation_register_iterator_next (_reg_it)) {
+ break;
}
- _g_object_unref0 (_reg_it);
+ reg = emulation_register_iterator_get (_reg_it);
+ if ((j++) != (length - 1)) {
+ _tmp13_ = '|';
+ } else {
+ _tmp13_ = ' ';
+ }
+ nextreg = _tmp13_;
+ gui_cs_export_print_dest_reg (self, fs, nextpkg, nextdw, nextreg, reg, emulation_packet_get (p, i));
}
+ _g_object_unref0 (_reg_it);
}
- _g_object_unref0 (list);
}
+ _g_object_unref0 (_tmp5_);
+ _g_object_unref0 (list);
}
}
- if ((pkgn++) != (self->priv->cs->packets_length1 - 1)) {
- fprintf (fs, "|\n");
- }
- _g_object_unref0 (p);
}
+ if ((pkgn++) != (emulation_cs_get_length (self->priv->cs) - 1)) {
+ fprintf (fs, "|\n");
+ }
+ _g_object_unref0 (p);
}
+ _emulation_cs_iterator_unref0 (_p_it);
}
_g_object_unref0 (spec);
}
-static void gui_cs_export_print_dest_reg (GUICSExport* self, FILE* fs, gchar nextpkg, gchar nextdw, gchar nextreg, EmulationRegister* reg, guint32 dword) {
+static inline void gui_cs_export_print_dest_reg (GUICSExport* self, FILE* fs, gchar nextpkg, gchar nextdw, gchar nextreg, EmulationRegister* reg, guint32 dword) {
guint length;
guint i;
g_return_if_fail (self != NULL);
@@ -761,47 +800,6 @@ static void gui_cs_export_print_dest_reg (GUICSExport* self, FILE* fs, gchar nex
}
-static guint32 gui_cs_export_dword_addr (GUICSExport* self, EmulationPacketBase* p, guint d) {
- guint32 result;
- g_return_val_if_fail (self != NULL, 0U);
- g_return_val_if_fail (p != NULL, 0U);
- switch (emulation_packet_base_get_type_id (p)) {
- case 0:
- {
- EmulationPacketBase* _tmp0_;
- EmulationPacket0* p0;
- guint _tmp1_ = 0U;
- p0 = _g_object_ref0 ((_tmp0_ = p, EMULATION_IS_PACKET0 (_tmp0_) ? ((EmulationPacket0*) _tmp0_) : NULL));
- if (emulation_packet0_get_one_reg_wr (p0)) {
- _tmp1_ = (guint) 0;
- } else {
- _tmp1_ = 4 * d;
- }
- result = emulation_packet0_get_addr (p0) + _tmp1_;
- _g_object_unref0 (p0);
- return result;
- }
- case 1:
- {
- EmulationPacketBase* _tmp2_;
- EmulationPacket1* p1;
- guint32 _tmp3_ = 0U;
- p1 = _g_object_ref0 ((_tmp2_ = p, EMULATION_IS_PACKET1 (_tmp2_) ? ((EmulationPacket1*) _tmp2_) : NULL));
- if (d == 1) {
- _tmp3_ = emulation_packet1_get_addr1 (p1);
- } else {
- _tmp3_ = emulation_packet1_get_addr2 (p1);
- }
- result = _tmp3_;
- _g_object_unref0 (p1);
- return result;
- }
- }
- result = (guint32) 0;
- return result;
-}
-
-
static void gui_cs_export_class_init (GUICSExportClass * klass) {
gui_cs_export_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (GUICSExportPrivate));
diff --git a/src/csexport.vala b/src/csexport.vala
index e6889c9..5da3f58 100644
--- a/src/csexport.vala
+++ b/src/csexport.vala
@@ -369,7 +369,7 @@ namespace GUI
private CS cs;
- public CSExport(CS _cs)
+ public CSExport(CS cs)
{
var builder = new Builder();
try {
@@ -412,7 +412,7 @@ namespace GUI
chip_combo.set_active((int)spec_default);
chip_combo.visible = true;
- cs = _cs;
+ this.cs = cs;
response.connect(on_response);
}
@@ -455,8 +455,10 @@ namespace GUI
private void export_plain(FileStream fs)
{
- for (uint i = 0; i < cs.dwords.length; i++) {
- fs.printf("%08X\n", cs.dwords[i]);
+ foreach (Packet p in cs) {
+ foreach (uint32 dw in p) {
+ fs.printf("%08X\n", dw);
+ }
}
}
@@ -475,7 +477,7 @@ namespace GUI
Spec spec = specs[chip_combo.get_active()].spec;
uint pkgn = 0;
- foreach (PacketBase p in cs.packets) {
+ foreach (Packet p in cs) {
fs.printf("+-+- Packet");
if (pkt_type) { fs.printf("%u", p.type_id); }
@@ -510,16 +512,13 @@ namespace GUI
fs.printf("\n");
for (uint i = 0; i < p.length; i++) {
- RegisterList? list = null;
- uint32 addr = 0;
-
- if (p.type_id != 3) {
- addr = dword_addr(p, i);
- list = spec.translate_addr(addr);
- }
+ uint32 addr = p.target_addr(i);
+ RegisterList? list = (addr != 0) ? spec.translate_addr(addr) : null;
- char nextpkg = (pkgn != cs.packets.length-1) ? '|' : ' ';
- fs.printf("%c %c-%c- 0x%08X", nextpkg, (list == null && i != p.length-1) ? '|' : '+', (list == null) ? '-' : '+', p[i]);
+ char nextpkg = (pkgn != cs.length-1) ? '|' : ' ';
+ fs.printf("%c %c-%c- 0x%08X", nextpkg,
+ (list == null && i != p.length-1) ? '|' : '+',
+ (list == null) ? '-' : '+', p[i]);
if (addr != 0) {
fs.printf(" -> 0x%04X\n", addr);
} else {
@@ -536,11 +535,11 @@ namespace GUI
}
}
}
- if (pkgn++ != cs.packets.length-1) { fs.printf("|\n"); }
+ if (pkgn++ != cs.length-1) { fs.printf("|\n"); }
}
}
- private void print_dest_reg(FileStream fs, char nextpkg, char nextdw, char nextreg, Register reg, uint32 dword)
+ private inline void print_dest_reg(FileStream fs, char nextpkg, char nextdw, char nextreg, Register reg, uint32 dword)
{
fs.printf("%c %c +-+- %s\n", nextpkg, nextdw, reg.info.name);
@@ -555,18 +554,5 @@ namespace GUI
fs.printf("%c %c %c +--- %u -> DATA_REGISTER\n", nextpkg, nextdw, nextreg, dword);
}
}
-
- private uint32 dword_addr(PacketBase p, uint d)
- {
- switch (p.type_id) {
- case 0:
- var p0 = p as Packet0;
- return p0.addr + ((p0.one_reg_wr) ? 0 : 4*d);
- case 1:
- var p1 = p as Packet1;
- return (d == 1) ? p1.addr1 : p1.addr2;
- }
- return 0;
- }
}
}
diff --git a/src/csimport.c b/src/csimport.c
index 4cb5b37..fd77744 100644
--- a/src/csimport.c
+++ b/src/csimport.c
@@ -69,15 +69,15 @@ typedef struct _EmulationCS EmulationCS;
typedef struct _EmulationCSClass EmulationCSClass;
#define _fclose0(var) ((var == NULL) ? NULL : (var = (fclose (var), NULL)))
-#define EMULATION_TYPE_PACKET_BASE (emulation_packet_base_get_type ())
-#define EMULATION_PACKET_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_PACKET_BASE, EmulationPacketBase))
-#define EMULATION_PACKET_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_TYPE_PACKET_BASE, EmulationPacketBaseClass))
-#define EMULATION_IS_PACKET_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_TYPE_PACKET_BASE))
-#define EMULATION_IS_PACKET_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_TYPE_PACKET_BASE))
-#define EMULATION_PACKET_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_TYPE_PACKET_BASE, EmulationPacketBaseClass))
+#define EMULATION_TYPE_PACKET (emulation_packet_get_type ())
+#define EMULATION_PACKET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_PACKET, EmulationPacket))
+#define EMULATION_PACKET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_TYPE_PACKET, EmulationPacketClass))
+#define EMULATION_IS_PACKET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_TYPE_PACKET))
+#define EMULATION_IS_PACKET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_TYPE_PACKET))
+#define EMULATION_PACKET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_TYPE_PACKET, EmulationPacketClass))
-typedef struct _EmulationPacketBase EmulationPacketBase;
-typedef struct _EmulationPacketBaseClass EmulationPacketBaseClass;
+typedef struct _EmulationPacket EmulationPacket;
+typedef struct _EmulationPacketClass EmulationPacketClass;
struct _GUICSImport {
GtkDialog parent_instance;
@@ -123,16 +123,16 @@ static void gui_cs_import_update_ok_button (GUICSImport* self);
static void _gui_cs_import_update_ok_button_gtk_editable_changed (GtkEditable* _sender, gpointer self);
GType emulation_cs_get_type (void);
void gui_main_window_add_cs (GUIMainWindow* self, const char* name, EmulationCS* cs);
-EmulationCS* emulation_cs_new (guint32* cs, guint len);
-EmulationCS* emulation_cs_construct (GType object_type, guint32* cs, guint len);
+EmulationCS* emulation_cs_new (guint32* dwords, guint len);
+EmulationCS* emulation_cs_construct (GType object_type, guint32* dwords, guint len);
static void _lambda19_ (GtkDialog* source, gint id, GUICSImport* self);
static void __lambda19__gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self);
GUICSImport* gui_cs_import_new (void);
GUICSImport* gui_cs_import_construct (GType object_type);
-GType emulation_packet_base_get_type (void);
-EmulationPacketBase* emulation_make_packet (guint32 header, guint32* dwords);
-guint emulation_packet_base_get_length (EmulationPacketBase* self);
-guint emulation_packet_base_get_type_id (EmulationPacketBase* self);
+GType emulation_packet_get_type (void);
+EmulationPacket* emulation_packet_make (guint32 header, guint32* dwords);
+guint emulation_packet_get_length (EmulationPacket* self);
+guint emulation_packet_get_type_id (EmulationPacket* self);
static void gui_cs_import_finalize (GObject* obj);
@@ -343,10 +343,10 @@ static void gui_cs_import_open_cs (GUICSImport* self, const char* filename) {
dword_count--;
gtk_list_store_set (self->priv->meta_store, &iter, 0, NULL, -1, -1);
} else {
- EmulationPacketBase* p;
- p = emulation_make_packet (dword, NULL);
- dword_count = emulation_packet_base_get_length (p);
- gtk_list_store_set (self->priv->meta_store, &iter, 0, gui_cs_import_packets[emulation_packet_base_get_type_id (p)], -1, -1);
+ EmulationPacket* p;
+ p = emulation_packet_make (dword, NULL);
+ dword_count = emulation_packet_get_length (p);
+ gtk_list_store_set (self->priv->meta_store, &iter, 0, gui_cs_import_packets[emulation_packet_get_type_id (p)], -1, -1);
_g_object_unref0 (p);
}
}
diff --git a/src/csimport.vala b/src/csimport.vala
index 6925b7a..9d601e4 100644
--- a/src/csimport.vala
+++ b/src/csimport.vala
@@ -287,7 +287,7 @@ namespace GUI
dword_count--;
meta_store.set(iter, 0, null, -1);
} else {
- Emulation.PacketBase p = Emulation.make_packet(dword);
+ Emulation.Packet p = Emulation.Packet.make(dword);
dword_count = p.length;
meta_store.set(iter, 0, packets[p.type_id], -1);
}
diff --git a/src/csview.c b/src/csview.c
index 1937f4d..d27dc03 100644
--- a/src/csview.c
+++ b/src/csview.c
@@ -107,18 +107,17 @@ typedef struct _EmulationRegisterInfoClass EmulationRegisterInfoClass;
typedef struct _GUICSListModelCSIter GUICSListModelCSIter;
typedef struct _GUICSListModelCSIterClass GUICSListModelCSIterClass;
-typedef struct _EmulationCSPrivate EmulationCSPrivate;
+#define _gui_cs_list_model_cs_iter_unref0(var) ((var == NULL) ? NULL : (var = (gui_cs_list_model_cs_iter_unref (var), NULL)))
-#define EMULATION_TYPE_PACKET_BASE (emulation_packet_base_get_type ())
-#define EMULATION_PACKET_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_PACKET_BASE, EmulationPacketBase))
-#define EMULATION_PACKET_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_TYPE_PACKET_BASE, EmulationPacketBaseClass))
-#define EMULATION_IS_PACKET_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_TYPE_PACKET_BASE))
-#define EMULATION_IS_PACKET_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_TYPE_PACKET_BASE))
-#define EMULATION_PACKET_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_TYPE_PACKET_BASE, EmulationPacketBaseClass))
+#define EMULATION_TYPE_PACKET (emulation_packet_get_type ())
+#define EMULATION_PACKET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_PACKET, EmulationPacket))
+#define EMULATION_PACKET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_TYPE_PACKET, EmulationPacketClass))
+#define EMULATION_IS_PACKET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_TYPE_PACKET))
+#define EMULATION_IS_PACKET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_TYPE_PACKET))
+#define EMULATION_PACKET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_TYPE_PACKET, EmulationPacketClass))
-typedef struct _EmulationPacketBase EmulationPacketBase;
-typedef struct _EmulationPacketBaseClass EmulationPacketBaseClass;
-#define _gui_cs_list_model_cs_iter_unref0(var) ((var == NULL) ? NULL : (var = (gui_cs_list_model_cs_iter_unref (var), NULL)))
+typedef struct _EmulationPacket EmulationPacket;
+typedef struct _EmulationPacketClass EmulationPacketClass;
#define EMULATION_TYPE_PACKET0 (emulation_packet0_get_type ())
#define EMULATION_PACKET0(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_PACKET0, EmulationPacket0))
@@ -150,7 +149,6 @@ typedef struct _EmulationPacket1Class EmulationPacket1Class;
typedef struct _EmulationBitfield EmulationBitfield;
typedef struct _EmulationBitfieldClass EmulationBitfieldClass;
-typedef struct _EmulationPacketBasePrivate EmulationPacketBasePrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define EMULATION_TYPE_PACKET3 (emulation_packet3_get_type ())
@@ -211,31 +209,6 @@ typedef enum {
GUI_CS_LIST_MODEL_ROW_TYPE_HEADER_BITFIELD
} GUICSListModelRowType;
-struct _EmulationCS {
- GObject parent_instance;
- EmulationCSPrivate * priv;
- EmulationPacketBase** packets;
- gint packets_length1;
- guint32* dwords;
- gint dwords_length1;
-};
-
-struct _EmulationCSClass {
- GObjectClass parent_class;
-};
-
-struct _EmulationPacketBase {
- GObject parent_instance;
- EmulationPacketBasePrivate * priv;
- guint32* dwords;
- guint32 header;
-};
-
-struct _EmulationPacketBaseClass {
- GObjectClass parent_class;
- guint (*get_length) (EmulationPacketBase* self);
-};
-
struct _GUICSListModelCSIter {
GTypeInstance parent_instance;
volatile int ref_count;
@@ -333,10 +306,10 @@ enum {
};
GType gui_cs_list_model_columns_get_type (void);
GType gui_cs_list_model_row_type_get_type (void);
+static char** _vala_array_dup2 (char** self, int length);
static char** _vala_array_dup3 (char** self, int length);
static char** _vala_array_dup4 (char** self, int length);
static char** _vala_array_dup5 (char** self, int length);
-static char** _vala_array_dup6 (char** self, int length);
GUICSListModel* gui_cs_list_model_new (EmulationCS* cs, EmulationSpec* spec);
GUICSListModel* gui_cs_list_model_construct (GType object_type, EmulationCS* cs, EmulationSpec* spec);
static GtkTreeModelFlags gui_cs_list_model_real_get_flags (GtkTreeModel* base);
@@ -361,14 +334,16 @@ void gui_cs_list_model_value_set_cs_iter (GValue* value, gpointer v_object);
gpointer gui_cs_list_model_value_get_cs_iter (const GValue* value);
GType gui_cs_list_model_cs_iter_get_type (void);
void gui_cs_list_model_cs_iter_reset (GUICSListModelCSIter* self);
-GType emulation_packet_base_get_type (void);
+guint emulation_cs_get_length (EmulationCS* self);
void gui_cs_list_model_cs_iter_set_packet (GUICSListModelCSIter* self, guint32 value);
+GType emulation_packet_get_type (void);
+EmulationPacket* emulation_cs_get (EmulationCS* self, guint index);
guint32 gui_cs_list_model_cs_iter_get_packet (GUICSListModelCSIter* self);
-guint emulation_packet_base_get_length (EmulationPacketBase* self);
+guint emulation_packet_get_length (EmulationPacket* self);
void gui_cs_list_model_cs_iter_set_dword (GUICSListModelCSIter* self, guint32 value);
void gui_cs_list_model_cs_iter_set_in_dwords (GUICSListModelCSIter* self, gboolean value);
guint32 gui_cs_list_model_cs_iter_get_dword (GUICSListModelCSIter* self);
-guint emulation_packet_base_get_type_id (EmulationPacketBase* self);
+guint emulation_packet_get_type_id (EmulationPacket* self);
void gui_cs_list_model_cs_iter_set_bitfield (GUICSListModelCSIter* self, guint32 value);
void gui_cs_list_model_cs_iter_set_in_bitfields (GUICSListModelCSIter* self, gboolean value);
GType emulation_packet0_get_type (void);
@@ -396,8 +371,9 @@ guint8 emulation_bitfield_get_high (EmulationBitfield* self);
guint8 emulation_bitfield_get_low (EmulationBitfield* self);
static guint32 gui_cs_list_model_bitfield_value (GUICSListModel* self, guint32 addr, guint variant, guint bitfield, guint32 dword);
GUICSListModelRowType gui_cs_list_model_cs_iter_get_row_type (GUICSListModelCSIter* self);
+guint32 emulation_packet_get_header (EmulationPacket* self);
static guint32 gui_cs_list_model_dword_addr (GUICSListModel* self, guint p, guint d);
-guint32 emulation_packet_base_get (EmulationPacketBase* self, guint index);
+guint32 emulation_packet_get (EmulationPacket* self, guint index);
guint32 emulation_packet0_get__ADDR (EmulationPacket0* self);
guint32 emulation_packet0_get__ONE_REG_WR (EmulationPacket0* self);
guint32 emulation_packet0_get__COUNT (EmulationPacket0* self);
@@ -468,7 +444,7 @@ GType gui_cs_list_model_row_type_get_type (void) {
}
-static char** _vala_array_dup3 (char** self, int length) {
+static char** _vala_array_dup2 (char** self, int length) {
char** result;
int i;
result = g_new0 (char*, length + 1);
@@ -479,7 +455,7 @@ static char** _vala_array_dup3 (char** self, int length) {
}
-static char** _vala_array_dup4 (char** self, int length) {
+static char** _vala_array_dup3 (char** self, int length) {
char** result;
int i;
char** _tmp5_;
@@ -491,7 +467,7 @@ static char** _vala_array_dup4 (char** self, int length) {
}
-static char** _vala_array_dup5 (char** self, int length) {
+static char** _vala_array_dup4 (char** self, int length) {
char** result;
int i;
char** _tmp6_;
@@ -504,7 +480,7 @@ static char** _vala_array_dup5 (char** self, int length) {
}
-static char** _vala_array_dup6 (char** self, int length) {
+static char** _vala_array_dup5 (char** self, int length) {
char** result;
int i;
char** _tmp7_;
@@ -619,7 +595,7 @@ static gboolean gui_cs_list_model_real_get_iter (GtkTreeModel* base, GtkTreeIter
it = gui_cs_list_model_cs_iter_new (iter);
gui_cs_list_model_cs_iter_reset (it);
indices = gtk_tree_path_get_indices (path);
- if (indices[0] >= self->priv->m_cs->packets_length1) {
+ if (indices[0] >= emulation_cs_get_length (self->priv->m_cs)) {
_tmp0_ = TRUE;
} else {
_tmp0_ = indices[0] < 0;
@@ -632,7 +608,9 @@ static gboolean gui_cs_list_model_real_get_iter (GtkTreeModel* base, GtkTreeIter
gui_cs_list_model_cs_iter_set_packet (it, (guint32) indices[0]);
if (depth >= 2) {
gboolean _tmp1_ = FALSE;
- if (indices[1] > emulation_packet_base_get_length (self->priv->m_cs->packets[gui_cs_list_model_cs_iter_get_packet (it)])) {
+ EmulationPacket* _tmp2_;
+ gboolean _tmp3_;
+ if ((_tmp3_ = indices[1] > emulation_packet_get_length (_tmp2_ = emulation_cs_get (self->priv->m_cs, (guint) gui_cs_list_model_cs_iter_get_packet (it))), _g_object_unref0 (_tmp2_), _tmp3_)) {
_tmp1_ = TRUE;
} else {
_tmp1_ = indices[1] < 0;
@@ -652,7 +630,9 @@ static gboolean gui_cs_list_model_real_get_iter (GtkTreeModel* base, GtkTreeIter
return result;
}
if (gui_cs_list_model_cs_iter_get_dword (it) == 0) {
- if (indices[2] >= gui_cs_list_model_packet_headers_length[emulation_packet_base_get_type_id (self->priv->m_cs->packets[gui_cs_list_model_cs_iter_get_packet (it)])]) {
+ EmulationPacket* _tmp4_;
+ gboolean _tmp5_;
+ if ((_tmp5_ = indices[2] >= gui_cs_list_model_packet_headers_length[emulation_packet_get_type_id (_tmp4_ = emulation_cs_get (self->priv->m_cs, (guint) gui_cs_list_model_cs_iter_get_packet (it)))], _g_object_unref0 (_tmp4_), _tmp5_)) {
result = FALSE;
_gui_cs_list_model_cs_iter_unref0 (it);
return result;
@@ -666,29 +646,31 @@ static gboolean gui_cs_list_model_real_get_iter (GtkTreeModel* base, GtkTreeIter
gui_cs_list_model_cs_iter_set_in_bitfields (it, TRUE);
} else {
guint32 addr;
+ EmulationPacket* _tmp6_;
+ guint _tmp7_;
addr = (guint32) 0;
- switch (emulation_packet_base_get_type_id (self->priv->m_cs->packets[gui_cs_list_model_cs_iter_get_packet (it)])) {
+ switch ((_tmp7_ = emulation_packet_get_type_id (_tmp6_ = emulation_cs_get (self->priv->m_cs, (guint) gui_cs_list_model_cs_iter_get_packet (it))), _g_object_unref0 (_tmp6_), _tmp7_)) {
case 0:
{
- EmulationPacketBase* _tmp2_;
+ EmulationPacket* _tmp8_;
EmulationPacket0* p0;
- p0 = _g_object_ref0 ((_tmp2_ = self->priv->m_cs->packets[gui_cs_list_model_cs_iter_get_packet (it)], EMULATION_IS_PACKET0 (_tmp2_) ? ((EmulationPacket0*) _tmp2_) : NULL));
+ p0 = (_tmp8_ = emulation_cs_get (self->priv->m_cs, (guint) gui_cs_list_model_cs_iter_get_packet (it)), EMULATION_IS_PACKET0 (_tmp8_) ? ((EmulationPacket0*) _tmp8_) : NULL);
addr = emulation_packet0_get_addr (p0);
_g_object_unref0 (p0);
break;
}
case 1:
{
- EmulationPacketBase* _tmp3_;
+ EmulationPacket* _tmp9_;
EmulationPacket1* p1;
- guint32 _tmp4_ = 0U;
- p1 = _g_object_ref0 ((_tmp3_ = self->priv->m_cs->packets[gui_cs_list_model_cs_iter_get_packet (it)], EMULATION_IS_PACKET1 (_tmp3_) ? ((EmulationPacket1*) _tmp3_) : NULL));
+ guint32 _tmp10_ = 0U;
+ p1 = (_tmp9_ = emulation_cs_get (self->priv->m_cs, (guint) gui_cs_list_model_cs_iter_get_packet (it)), EMULATION_IS_PACKET1 (_tmp9_) ? ((EmulationPacket1*) _tmp9_) : NULL);
if (gui_cs_list_model_cs_iter_get_dword (it) == 1) {
- _tmp4_ = emulation_packet1_get_addr1 (p1);
+ _tmp10_ = emulation_packet1_get_addr1 (p1);
} else {
- _tmp4_ = emulation_packet1_get_addr2 (p1);
+ _tmp10_ = emulation_packet1_get_addr2 (p1);
}
- addr = _tmp4_;
+ addr = _tmp10_;
_g_object_unref0 (p1);
break;
}
@@ -844,13 +826,13 @@ static guint32 gui_cs_list_model_bitfield_value (GUICSListModel* self, guint32 a
static void gui_cs_list_model_real_get_value (GtkTreeModel* base, GtkTreeIter* iter, gint column, GValue* val) {
GUICSListModel * self;
GUICSListModelCSIter* it;
- EmulationPacketBase* p;
+ EmulationPacket* p;
self = (GUICSListModel*) base;
if ((*iter).stamp != self->priv->m_stamp) {
return;
}
it = gui_cs_list_model_cs_iter_new (iter);
- p = _g_object_ref0 (self->priv->m_cs->packets[gui_cs_list_model_cs_iter_get_packet (it)]);
+ p = emulation_cs_get (self->priv->m_cs, (guint) gui_cs_list_model_cs_iter_get_packet (it));
g_value_init (val, G_TYPE_STRING);
switch (gui_cs_list_model_cs_iter_get_row_type (it)) {
case GUI_CS_LIST_MODEL_ROW_TYPE_PACKET:
@@ -858,19 +840,19 @@ static void gui_cs_list_model_real_get_value (GtkTreeModel* base, GtkTreeIter* i
switch (column) {
case GUI_CS_LIST_MODEL_COLUMNS_NAME:
{
- g_value_set_static_string (val, gui_cs_list_model_packet_strings[emulation_packet_base_get_type_id (p)]);
+ g_value_set_static_string (val, gui_cs_list_model_packet_strings[emulation_packet_get_type_id (p)]);
break;
}
case GUI_CS_LIST_MODEL_COLUMNS_VALUE:
{
char* _tmp0_;
- g_value_set_string (val, _tmp0_ = g_strdup_printf ("0x%08X", p->header));
+ g_value_set_string (val, _tmp0_ = g_strdup_printf ("0x%08X", emulation_packet_get_header (p)));
_g_free0 (_tmp0_);
break;
}
case GUI_CS_LIST_MODEL_COLUMNS_TARGET:
{
- switch (emulation_packet_base_get_type_id (p)) {
+ switch (emulation_packet_get_type_id (p)) {
case 0:
{
char* _tmp1_;
@@ -920,13 +902,13 @@ static void gui_cs_list_model_real_get_value (GtkTreeModel* base, GtkTreeIter* i
case GUI_CS_LIST_MODEL_COLUMNS_VALUE:
{
char* _tmp7_;
- g_value_set_string (val, _tmp7_ = g_strdup_printf ("0x%08X", emulation_packet_base_get (p, (guint) (gui_cs_list_model_cs_iter_get_dword (it) - 1))));
+ g_value_set_string (val, _tmp7_ = g_strdup_printf ("0x%08X", emulation_packet_get (p, (guint) (gui_cs_list_model_cs_iter_get_dword (it) - 1))));
_g_free0 (_tmp7_);
break;
}
case GUI_CS_LIST_MODEL_COLUMNS_TARGET:
{
- switch (emulation_packet_base_get_type_id (p)) {
+ switch (emulation_packet_get_type_id (p)) {
case 0:
{
char* _tmp8_;
@@ -968,7 +950,7 @@ static void gui_cs_list_model_real_get_value (GtkTreeModel* base, GtkTreeIter* i
case GUI_CS_LIST_MODEL_COLUMNS_VALUE:
{
char* _tmp10_;
- g_value_set_string (val, _tmp10_ = g_strdup_printf ("0x%08X", p->header));
+ g_value_set_string (val, _tmp10_ = g_strdup_printf ("0x%08X", emulation_packet_get_header (p)));
_g_free0 (_tmp10_);
break;
}
@@ -1012,7 +994,7 @@ static void gui_cs_list_model_real_get_value (GtkTreeModel* base, GtkTreeIter* i
case GUI_CS_LIST_MODEL_COLUMNS_VALUE:
{
char* _tmp11_;
- g_value_set_string (val, _tmp11_ = g_strdup_printf ("%u", gui_cs_list_model_bitfield_value (self, gui_cs_list_model_dword_addr (self, (guint) gui_cs_list_model_cs_iter_get_packet (it), (guint) gui_cs_list_model_cs_iter_get_dword (it)), (guint) gui_cs_list_model_cs_iter_get_variant (it), (guint) gui_cs_list_model_cs_iter_get_bitfield (it), emulation_packet_base_get (p, (guint) (gui_cs_list_model_cs_iter_get_dword (it) - 1)))));
+ g_value_set_string (val, _tmp11_ = g_strdup_printf ("%u", gui_cs_list_model_bitfield_value (self, gui_cs_list_model_dword_addr (self, (guint) gui_cs_list_model_cs_iter_get_packet (it), (guint) gui_cs_list_model_cs_iter_get_dword (it)), (guint) gui_cs_list_model_cs_iter_get_variant (it), (guint) gui_cs_list_model_cs_iter_get_bitfield (it), emulation_packet_get (p, (guint) (gui_cs_list_model_cs_iter_get_dword (it) - 1)))));
_g_free0 (_tmp11_);
break;
}
@@ -1029,7 +1011,7 @@ static void gui_cs_list_model_real_get_value (GtkTreeModel* base, GtkTreeIter* i
switch (column) {
case GUI_CS_LIST_MODEL_COLUMNS_NAME:
{
- g_value_set_static_string (val, gui_cs_list_model_packet_headers[emulation_packet_base_get_type_id (p)][gui_cs_list_model_cs_iter_get_bitfield (it)]);
+ g_value_set_static_string (val, gui_cs_list_model_packet_headers[emulation_packet_get_type_id (p)][gui_cs_list_model_cs_iter_get_bitfield (it)]);
break;
}
case GUI_CS_LIST_MODEL_COLUMNS_TARGET:
@@ -1039,10 +1021,10 @@ static void gui_cs_list_model_real_get_value (GtkTreeModel* base, GtkTreeIter* i
}
case GUI_CS_LIST_MODEL_COLUMNS_VALUE:
{
- switch (emulation_packet_base_get_type_id (p)) {
+ switch (emulation_packet_get_type_id (p)) {
case 0:
{
- EmulationPacketBase* _tmp12_;
+ EmulationPacket* _tmp12_;
EmulationPacket0* p0;
p0 = _g_object_ref0 ((_tmp12_ = p, EMULATION_IS_PACKET0 (_tmp12_) ? ((EmulationPacket0*) _tmp12_) : NULL));
switch (gui_cs_list_model_cs_iter_get_bitfield (it)) {
@@ -1070,7 +1052,7 @@ static void gui_cs_list_model_real_get_value (GtkTreeModel* base, GtkTreeIter* i
case 3:
{
char* _tmp16_;
- g_value_set_string (val, _tmp16_ = g_strdup_printf ("%u", emulation_packet_base_get_type_id (p)));
+ g_value_set_string (val, _tmp16_ = g_strdup_printf ("%u", emulation_packet_get_type_id (p)));
_g_free0 (_tmp16_);
break;
}
@@ -1080,7 +1062,7 @@ static void gui_cs_list_model_real_get_value (GtkTreeModel* base, GtkTreeIter* i
}
case 1:
{
- EmulationPacketBase* _tmp17_;
+ EmulationPacket* _tmp17_;
EmulationPacket1* p1;
p1 = _g_object_ref0 ((_tmp17_ = p, EMULATION_IS_PACKET1 (_tmp17_) ? ((EmulationPacket1*) _tmp17_) : NULL));
switch (gui_cs_list_model_cs_iter_get_bitfield (it)) {
@@ -1101,7 +1083,7 @@ static void gui_cs_list_model_real_get_value (GtkTreeModel* base, GtkTreeIter* i
case 2:
{
char* _tmp20_;
- g_value_set_string (val, _tmp20_ = g_strdup_printf ("%u", emulation_packet_base_get_type_id (p)));
+ g_value_set_string (val, _tmp20_ = g_strdup_printf ("%u", emulation_packet_get_type_id (p)));
_g_free0 (_tmp20_);
break;
}
@@ -1115,7 +1097,7 @@ static void gui_cs_list_model_real_get_value (GtkTreeModel* base, GtkTreeIter* i
case 0:
{
char* _tmp21_;
- g_value_set_string (val, _tmp21_ = g_strdup_printf ("%u", emulation_packet_base_get_type_id (p)));
+ g_value_set_string (val, _tmp21_ = g_strdup_printf ("%u", emulation_packet_get_type_id (p)));
_g_free0 (_tmp21_);
break;
}
@@ -1124,7 +1106,7 @@ static void gui_cs_list_model_real_get_value (GtkTreeModel* base, GtkTreeIter* i
}
case 3:
{
- EmulationPacketBase* _tmp22_;
+ EmulationPacket* _tmp22_;
EmulationPacket3* p3;
p3 = _g_object_ref0 ((_tmp22_ = p, EMULATION_IS_PACKET3 (_tmp22_) ? ((EmulationPacket3*) _tmp22_) : NULL));
switch (gui_cs_list_model_cs_iter_get_bitfield (it)) {
@@ -1145,7 +1127,7 @@ static void gui_cs_list_model_real_get_value (GtkTreeModel* base, GtkTreeIter* i
case 2:
{
char* _tmp25_;
- g_value_set_string (val, _tmp25_ = g_strdup_printf ("%u", emulation_packet_base_get_type_id (p)));
+ g_value_set_string (val, _tmp25_ = g_strdup_printf ("%u", emulation_packet_get_type_id (p)));
_g_free0 (_tmp25_);
break;
}
@@ -1167,36 +1149,38 @@ static void gui_cs_list_model_real_get_value (GtkTreeModel* base, GtkTreeIter* i
static guint32 gui_cs_list_model_dword_addr (GUICSListModel* self, guint p, guint d) {
guint32 result;
+ EmulationPacket* _tmp0_;
+ guint _tmp1_;
g_return_val_if_fail (self != NULL, 0U);
- g_assert (p < self->priv->m_cs->packets_length1);
- switch (emulation_packet_base_get_type_id (self->priv->m_cs->packets[p])) {
+ g_assert (p < emulation_cs_get_length (self->priv->m_cs));
+ switch ((_tmp1_ = emulation_packet_get_type_id (_tmp0_ = emulation_cs_get (self->priv->m_cs, p)), _g_object_unref0 (_tmp0_), _tmp1_)) {
case 0:
{
- EmulationPacketBase* _tmp0_;
+ EmulationPacket* _tmp2_;
EmulationPacket0* p0;
- guint _tmp1_ = 0U;
- p0 = _g_object_ref0 ((_tmp0_ = self->priv->m_cs->packets[p], EMULATION_IS_PACKET0 (_tmp0_) ? ((EmulationPacket0*) _tmp0_) : NULL));
+ guint _tmp3_ = 0U;
+ p0 = (_tmp2_ = emulation_cs_get (self->priv->m_cs, p), EMULATION_IS_PACKET0 (_tmp2_) ? ((EmulationPacket0*) _tmp2_) : NULL);
if (emulation_packet0_get_one_reg_wr (p0)) {
- _tmp1_ = (guint) 0;
+ _tmp3_ = (guint) 0;
} else {
- _tmp1_ = 4 * (d - 1);
+ _tmp3_ = 4 * (d - 1);
}
- result = emulation_packet0_get_addr (p0) + _tmp1_;
+ result = emulation_packet0_get_addr (p0) + _tmp3_;
_g_object_unref0 (p0);
return result;
}
case 1:
{
- EmulationPacketBase* _tmp2_;
+ EmulationPacket* _tmp4_;
EmulationPacket1* p1;
- guint32 _tmp3_ = 0U;
- p1 = _g_object_ref0 ((_tmp2_ = self->priv->m_cs->packets[p], EMULATION_IS_PACKET1 (_tmp2_) ? ((EmulationPacket1*) _tmp2_) : NULL));
+ guint32 _tmp5_ = 0U;
+ p1 = (_tmp4_ = emulation_cs_get (self->priv->m_cs, p), EMULATION_IS_PACKET1 (_tmp4_) ? ((EmulationPacket1*) _tmp4_) : NULL);
if (d == 1) {
- _tmp3_ = emulation_packet1_get_addr1 (p1);
+ _tmp5_ = emulation_packet1_get_addr1 (p1);
} else {
- _tmp3_ = emulation_packet1_get_addr2 (p1);
+ _tmp5_ = emulation_packet1_get_addr2 (p1);
}
- result = _tmp3_;
+ result = _tmp5_;
_g_object_unref0 (p1);
return result;
}
@@ -1223,7 +1207,7 @@ static gboolean gui_cs_list_model_real_iter_next (GtkTreeModel* base, GtkTreeIte
case GUI_CS_LIST_MODEL_ROW_TYPE_PACKET:
{
p++;
- if (p >= self->priv->m_cs->packets_length1) {
+ if (p >= emulation_cs_get_length (self->priv->m_cs)) {
result = FALSE;
_gui_cs_list_model_cs_iter_unref0 (it);
return result;
@@ -1235,8 +1219,10 @@ static gboolean gui_cs_list_model_real_iter_next (GtkTreeModel* base, GtkTreeIte
case GUI_CS_LIST_MODEL_ROW_TYPE_DWORD:
{
guint32 d;
+ EmulationPacket* _tmp0_;
+ gboolean _tmp1_;
d = gui_cs_list_model_cs_iter_get_dword (it) + 1;
- if (d >= (emulation_packet_base_get_length (self->priv->m_cs->packets[p]) + 1)) {
+ if ((_tmp1_ = d >= (emulation_packet_get_length (_tmp0_ = emulation_cs_get (self->priv->m_cs, (guint) p)) + 1), _g_object_unref0 (_tmp0_), _tmp1_)) {
result = FALSE;
_gui_cs_list_model_cs_iter_unref0 (it);
return result;
@@ -1271,8 +1257,10 @@ static gboolean gui_cs_list_model_real_iter_next (GtkTreeModel* base, GtkTreeIte
case GUI_CS_LIST_MODEL_ROW_TYPE_HEADER_BITFIELD:
{
guint32 b;
+ EmulationPacket* _tmp2_;
+ gboolean _tmp3_;
b = gui_cs_list_model_cs_iter_get_bitfield (it) + 1;
- if (b >= gui_cs_list_model_packet_headers_length[emulation_packet_base_get_type_id (self->priv->m_cs->packets[p])]) {
+ if ((_tmp3_ = b >= gui_cs_list_model_packet_headers_length[emulation_packet_get_type_id (_tmp2_ = emulation_cs_get (self->priv->m_cs, (guint) p))], _g_object_unref0 (_tmp2_), _tmp3_)) {
result = FALSE;
_gui_cs_list_model_cs_iter_unref0 (it);
return result;
@@ -1297,7 +1285,7 @@ static gboolean gui_cs_list_model_real_iter_children (GtkTreeModel* base, GtkTre
it = gui_cs_list_model_cs_iter_new (iter);
(*iter).stamp = 0;
if (parent == NULL) {
- if (self->priv->m_cs->packets_length1 == 0) {
+ if (emulation_cs_get_length (self->priv->m_cs) == 0) {
result = FALSE;
_gui_cs_list_model_cs_iter_unref0 (it);
return result;
@@ -1423,7 +1411,7 @@ static gint gui_cs_list_model_real_iter_n_children (GtkTreeModel* base, GtkTreeI
GUICSListModelCSIter* it;
self = (GUICSListModel*) base;
if (iter == NULL) {
- result = self->priv->m_cs->packets_length1;
+ result = (gint) emulation_cs_get_length (self->priv->m_cs);
return result;
}
if ((*iter).stamp != self->priv->m_stamp) {
@@ -1434,13 +1422,17 @@ static gint gui_cs_list_model_real_iter_n_children (GtkTreeModel* base, GtkTreeI
switch (gui_cs_list_model_cs_iter_get_row_type (it)) {
case GUI_CS_LIST_MODEL_ROW_TYPE_PACKET:
{
- result = ((gint) emulation_packet_base_get_length (self->priv->m_cs->packets[gui_cs_list_model_cs_iter_get_packet (it)])) + 1;
+ EmulationPacket* _tmp0_;
+ gint _tmp1_;
+ result = (_tmp1_ = ((gint) emulation_packet_get_length (_tmp0_ = emulation_cs_get (self->priv->m_cs, (guint) gui_cs_list_model_cs_iter_get_packet (it)))) + 1, _g_object_unref0 (_tmp0_), _tmp1_);
_gui_cs_list_model_cs_iter_unref0 (it);
return result;
}
case GUI_CS_LIST_MODEL_ROW_TYPE_HEADER:
{
- result = (gint) gui_cs_list_model_packet_headers_length[emulation_packet_base_get_type_id (self->priv->m_cs->packets[gui_cs_list_model_cs_iter_get_packet (it)])];
+ EmulationPacket* _tmp2_;
+ gint _tmp3_;
+ result = (_tmp3_ = (gint) gui_cs_list_model_packet_headers_length[emulation_packet_get_type_id (_tmp2_ = emulation_cs_get (self->priv->m_cs, (guint) gui_cs_list_model_cs_iter_get_packet (it)))], _g_object_unref0 (_tmp2_), _tmp3_);
_gui_cs_list_model_cs_iter_unref0 (it);
return result;
}
@@ -1485,7 +1477,7 @@ static gboolean gui_cs_list_model_real_iter_nth_child (GtkTreeModel* base, GtkTr
(*iter).stamp = 0;
if (parent == NULL) {
gboolean _tmp0_ = FALSE;
- if (n >= self->priv->m_cs->packets_length1) {
+ if (n >= emulation_cs_get_length (self->priv->m_cs)) {
_tmp0_ = TRUE;
} else {
_tmp0_ = n < 0;
@@ -1517,7 +1509,9 @@ static gboolean gui_cs_list_model_real_iter_nth_child (GtkTreeModel* base, GtkTr
switch (gui_cs_list_model_cs_iter_get_row_type (pa)) {
case GUI_CS_LIST_MODEL_ROW_TYPE_PACKET:
{
- if (n > emulation_packet_base_get_length (self->priv->m_cs->packets[gui_cs_list_model_cs_iter_get_packet (pa)])) {
+ EmulationPacket* _tmp1_;
+ gboolean _tmp2_;
+ if ((_tmp2_ = n > emulation_packet_get_length (_tmp1_ = emulation_cs_get (self->priv->m_cs, (guint) gui_cs_list_model_cs_iter_get_packet (pa))), _g_object_unref0 (_tmp1_), _tmp2_)) {
result = FALSE;
_gui_cs_list_model_cs_iter_unref0 (it);
_gui_cs_list_model_cs_iter_unref0 (pa);
@@ -1529,7 +1523,9 @@ static gboolean gui_cs_list_model_real_iter_nth_child (GtkTreeModel* base, GtkTr
}
case GUI_CS_LIST_MODEL_ROW_TYPE_HEADER:
{
- if (n >= gui_cs_list_model_packet_headers_length[emulation_packet_base_get_type_id (self->priv->m_cs->packets[gui_cs_list_model_cs_iter_get_packet (pa)])]) {
+ EmulationPacket* _tmp3_;
+ gboolean _tmp4_;
+ if ((_tmp4_ = n >= gui_cs_list_model_packet_headers_length[emulation_packet_get_type_id (_tmp3_ = emulation_cs_get (self->priv->m_cs, (guint) gui_cs_list_model_cs_iter_get_packet (pa)))], _g_object_unref0 (_tmp3_), _tmp4_)) {
result = FALSE;
_gui_cs_list_model_cs_iter_unref0 (it);
_gui_cs_list_model_cs_iter_unref0 (pa);
@@ -2035,7 +2031,7 @@ static void gui_cs_list_model_class_init (GUICSListModelClass * klass) {
gui_cs_list_model_packet2_headers_length1 = 1;
gui_cs_list_model_packet3_headers = (_tmp4_ = g_new0 (char*, 3 + 1), _tmp4_[0] = g_strdup ("IT_OPCODE"), _tmp4_[1] = g_strdup ("COUNT"), _tmp4_[2] = g_strdup ("TYPE"), _tmp4_);
gui_cs_list_model_packet3_headers_length1 = 3;
- gui_cs_list_model_packet_headers = (_tmp9_ = g_new0 (char**, 4), _tmp9_[0] = (_tmp5_ = gui_cs_list_model_packet0_headers, (_tmp5_ == NULL) ? ((gpointer) _tmp5_) : _vala_array_dup3 (_tmp5_, gui_cs_list_model_packet0_headers_length1)), _tmp9_[1] = (_tmp6_ = gui_cs_list_model_packet1_headers, (_tmp6_ == NULL) ? ((gpointer) _tmp6_) : _vala_array_dup4 (_tmp6_, gui_cs_list_model_packet1_headers_length1)), _tmp9_[2] = (_tmp7_ = gui_cs_list_model_packet2_headers, (_tmp7_ == NULL) ? ((gpointer) _tmp7_) : _vala_array_dup5 (_tmp7_, gui_cs_list_model_packet2_headers_length1)), _tmp9_[3] = (_tmp8_ = gui_cs_list_model_packet3_headers, (_tmp8_ == NULL) ? ((gpointer) _tmp8_) : _vala_array_dup6 (_tmp8_, gui_cs_list_model_packet3_headers_length1)), _tmp9_);
+ gui_cs_list_model_packet_headers = (_tmp9_ = g_new0 (char**, 4), _tmp9_[0] = (_tmp5_ = gui_cs_list_model_packet0_headers, (_tmp5_ == NULL) ? ((gpointer) _tmp5_) : _vala_array_dup2 (_tmp5_, gui_cs_list_model_packet0_headers_length1)), _tmp9_[1] = (_tmp6_ = gui_cs_list_model_packet1_headers, (_tmp6_ == NULL) ? ((gpointer) _tmp6_) : _vala_array_dup3 (_tmp6_, gui_cs_list_model_packet1_headers_length1)), _tmp9_[2] = (_tmp7_ = gui_cs_list_model_packet2_headers, (_tmp7_ == NULL) ? ((gpointer) _tmp7_) : _vala_array_dup4 (_tmp7_, gui_cs_list_model_packet2_headers_length1)), _tmp9_[3] = (_tmp8_ = gui_cs_list_model_packet3_headers, (_tmp8_ == NULL) ? ((gpointer) _tmp8_) : _vala_array_dup5 (_tmp8_, gui_cs_list_model_packet3_headers_length1)), _tmp9_);
gui_cs_list_model_packet_headers_length1 = 4;
gui_cs_list_model_packet_headers_length = (_tmp10_ = g_new0 (guint, 4), _tmp10_[0] = (guint) 4, _tmp10_[1] = (guint) 3, _tmp10_[2] = (guint) 1, _tmp10_[3] = (guint) 3, _tmp10_);
gui_cs_list_model_packet_headers_length_length1 = 4;
diff --git a/src/csview.vala b/src/csview.vala
index 9d6087f..7d873db 100644
--- a/src/csview.vala
+++ b/src/csview.vala
@@ -256,11 +256,11 @@ namespace GUI
it.reset();
int *indices = path.get_indices();
- if (indices[0] >= m_cs.packets.length || indices[0] < 0) { return false; }
+ if (indices[0] >= m_cs.length || indices[0] < 0) { return false; }
it.packet = indices[0];
if (depth >= 2) {
- if (indices[1] > m_cs.packets[it.packet].length || indices[1] < 0) { return false; }
+ if (indices[1] > m_cs[it.packet].length || indices[1] < 0) { return false; }
it.dword = indices[1];
it.in_dwords = true;
}
@@ -269,21 +269,21 @@ namespace GUI
if (indices[2] < 0) { return false; }
if (it.dword == 0) {
/* Header bitfield */
- if (indices[2] >= packet_headers_length[m_cs.packets[it.packet].type_id]) { return false; }
+ if (indices[2] >= packet_headers_length[m_cs[it.packet].type_id]) { return false; }
if (depth > 3) { return false; }
it.bitfield = indices[2];
it.in_bitfields = true;
} else {
/* Variant */
uint32 addr = 0;
- switch (m_cs.packets[it.packet].type_id) {
+ switch (m_cs[it.packet].type_id) {
case 0:
- Packet0 p0 = m_cs.packets[it.packet] as Packet0;
+ Packet0 p0 = m_cs[it.packet] as Packet0;
addr = p0.addr;
break;
case 1:
- Packet1 p1 = m_cs.packets[it.packet] as Packet1;
+ Packet1 p1 = m_cs[it.packet] as Packet1;
addr = (it.dword == 1) ? p1.addr1 : p1.addr2; // 0 = header
break;
@@ -372,7 +372,7 @@ namespace GUI
{
if (iter.stamp != m_stamp) { return; }
CSIter it = new CSIter(iter);
- PacketBase p = m_cs.packets[it.packet];
+ Packet p = m_cs[it.packet];
val.init(typeof(string));
switch (it.row_type) {
@@ -475,13 +475,13 @@ namespace GUI
private uint32 dword_addr(uint p, uint d)
{
- assert(p < m_cs.packets.length);
- switch (m_cs.packets[p].type_id) {
+ assert(p < m_cs.length);
+ switch (m_cs[p].type_id) {
case 0:
- Packet0 p0 = m_cs.packets[p] as Packet0;
+ Packet0 p0 = m_cs[p] as Packet0;
return p0.addr + ((p0.one_reg_wr) ? 0 : 4*(d-1));
case 1:
- Packet1 p1 = m_cs.packets[p] as Packet1;
+ Packet1 p1 = m_cs[p] as Packet1;
return (d == 1) ? p1.addr1 : p1.addr2;
}
return 0;
@@ -497,14 +497,14 @@ namespace GUI
switch (it.row_type) {
case RowType.PACKET:
p++;
- if (p >= m_cs.packets.length) { return false; }
+ if (p >= m_cs.length) { return false; }
it.packet = p;
break;
case RowType.HEADER:
case RowType.DWORD:
var d = it.dword+1;
- if (d >= m_cs.packets[p].length+1) { return false; }
+ if (d >= m_cs[p].length+1) { return false; }
it.dword = d;
break;
@@ -522,7 +522,7 @@ namespace GUI
case RowType.HEADER_BITFIELD:
var b = it.bitfield+1;
- if (b >= packet_headers_length[m_cs.packets[p].type_id]) { return false; }
+ if (b >= packet_headers_length[m_cs[p].type_id]) { return false; }
it.bitfield = b;
break;
}
@@ -537,7 +537,7 @@ namespace GUI
iter.stamp = 0;
if (parent == null) {
- if (m_cs.packets.length == 0) {
+ if (m_cs.length == 0) {
return false;
}
it.reset();
@@ -594,15 +594,13 @@ namespace GUI
public int iter_n_children(TreeIter? iter)
{
- if (iter == null) {
- return m_cs.packets.length;
- }
+ if (iter == null) { return (int)m_cs.length; }
if (iter.stamp != m_stamp) { return 0; }
CSIter it = new CSIter(iter);
switch (it.row_type) {
- case RowType.PACKET: return (int)m_cs.packets[it.packet].length+1;
- case RowType.HEADER: return (int)packet_headers_length[m_cs.packets[it.packet].type_id];
+ case RowType.PACKET: return (int)m_cs[it.packet].length+1;
+ case RowType.HEADER: return (int)packet_headers_length[m_cs[it.packet].type_id];
case RowType.DWORD: return (int)get_variant_count(dword_addr(it.packet, it.dword));
case RowType.VARIANT: return (int)get_bitfield_count(dword_addr(it.packet, it.dword), it.variant);
case RowType.BITFIELD: return 0;
@@ -618,7 +616,7 @@ namespace GUI
iter.stamp = 0;
if (parent == null) {
- if (n >= m_cs.packets.length || n < 0) {
+ if (n >= m_cs.length || n < 0) {
return false;
}
iter.stamp = m_stamp;
@@ -633,13 +631,13 @@ namespace GUI
it.copy(pa);
switch (pa.row_type) {
case RowType.PACKET:
- if (n > m_cs.packets[pa.packet].length) { return false; }
+ if (n > m_cs[pa.packet].length) { return false; }
it.in_dwords = true;
it.dword = n;
break;
case RowType.HEADER:
- if (n >= packet_headers_length[m_cs.packets[pa.packet].type_id]) { return false; }
+ if (n >= packet_headers_length[m_cs[pa.packet].type_id]) { return false; }
it.in_bitfields = true;
it.bitfield = n;
break;
diff --git a/src/main.c b/src/main.c
index 1967ef4..70b66ca 100644
--- a/src/main.c
+++ b/src/main.c
@@ -74,17 +74,6 @@ typedef struct _GUICSViewClass GUICSViewClass;
typedef struct _GUICSExport GUICSExport;
typedef struct _GUICSExportClass GUICSExportClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
-typedef struct _EmulationCSPrivate EmulationCSPrivate;
-
-#define EMULATION_TYPE_PACKET_BASE (emulation_packet_base_get_type ())
-#define EMULATION_PACKET_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_PACKET_BASE, EmulationPacketBase))
-#define EMULATION_PACKET_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_TYPE_PACKET_BASE, EmulationPacketBaseClass))
-#define EMULATION_IS_PACKET_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_TYPE_PACKET_BASE))
-#define EMULATION_IS_PACKET_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_TYPE_PACKET_BASE))
-#define EMULATION_PACKET_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_TYPE_PACKET_BASE, EmulationPacketBaseClass))
-
-typedef struct _EmulationPacketBase EmulationPacketBase;
-typedef struct _EmulationPacketBaseClass EmulationPacketBaseClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define GUI_TYPE_CS_IMPORT (gui_cs_import_get_type ())
@@ -96,7 +85,6 @@ typedef struct _EmulationPacketBaseClass EmulationPacketBaseClass;
typedef struct _GUICSImport GUICSImport;
typedef struct _GUICSImportClass GUICSImportClass;
-typedef struct _Block1Data Block1Data;
#define EMULATION_TYPE_SPEC_ENTRY (emulation_spec_entry_get_type ())
@@ -128,25 +116,6 @@ struct _GUIMainWindowPrivate {
GtkAction* action_removecs;
};
-struct _EmulationCS {
- GObject parent_instance;
- EmulationCSPrivate * priv;
- EmulationPacketBase** packets;
- gint packets_length1;
- guint32* dwords;
- gint dwords_length1;
-};
-
-struct _EmulationCSClass {
- GObjectClass parent_class;
-};
-
-struct _Block1Data {
- int _ref_count_;
- GUIMainWindow * self;
- GtkCellRendererText* cell;
-};
-
struct _EmulationSpecEntry {
EmulationSpec* spec;
char* name;
@@ -179,14 +148,14 @@ 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_main_window_open_csview (GUIMainWindow* self);
-GUICSExport* gui_cs_export_new (EmulationCS* _cs);
-GUICSExport* gui_cs_export_construct (GType object_type, EmulationCS* _cs);
+GUICSExport* gui_cs_export_new (EmulationCS* cs);
+GUICSExport* gui_cs_export_construct (GType object_type, EmulationCS* cs);
GType gui_cs_export_get_type (void);
static void gui_main_window_open_csexport (GUIMainWindow* self);
GUIMainWindow* gui_main_window_new (void);
GUIMainWindow* gui_main_window_construct (GType object_type);
-GType emulation_packet_base_get_type (void);
-static void _lambda10_ (GtkCellLayout* coll, GtkCellRenderer* celll, GtkTreeModel* model, GtkTreeIter* iter, Block1Data* _data1_);
+guint emulation_cs_get_length (EmulationCS* self);
+static void _lambda10_ (GtkCellLayout* col, GtkCellRenderer* cell, GtkTreeModel* model, GtkTreeIter* iter, GUIMainWindow* self);
static void __lambda10__gtk_cell_layout_data_func (GtkCellLayout* cell_layout, GtkCellRenderer* cell, GtkTreeModel* tree_model, GtkTreeIter* iter, gpointer self);
GUICSImport* gui_cs_import_new (void);
GUICSImport* gui_cs_import_construct (GType object_type);
@@ -204,8 +173,6 @@ static gboolean __lambda15__gtk_widget_button_press_event (GtkWidget* _sender, G
static void _lambda16_ (GtkTreeView* source, GUIMainWindow* 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 Block1Data* block1_data_ref (Block1Data* _data1_);
-static void block1_data_unref (Block1Data* _data1_);
static GObject * gui_main_window_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void gui_main_window_finalize (GObject* obj);
GType emulation_spec_entry_get_type (void);
@@ -327,19 +294,17 @@ static glong string_get_length (const char* self) {
}
-static void _lambda10_ (GtkCellLayout* coll, GtkCellRenderer* celll, GtkTreeModel* model, GtkTreeIter* iter, Block1Data* _data1_) {
- GUIMainWindow * self;
+static void _lambda10_ (GtkCellLayout* col, GtkCellRenderer* cell, GtkTreeModel* model, GtkTreeIter* iter, GUIMainWindow* self) {
EmulationCS* cs;
char* _tmp0_;
- GtkCellRendererText* _tmp1_;
- self = _data1_->self;
- g_return_if_fail (coll != NULL);
- g_return_if_fail (celll != NULL);
+ GtkCellRenderer* _tmp1_;
+ g_return_if_fail (col != NULL);
+ g_return_if_fail (cell != NULL);
g_return_if_fail (model != NULL);
cs = NULL;
gtk_tree_model_get (model, iter, 1, &cs, -1, -1);
g_assert (cs != NULL);
- g_object_set ((_tmp1_ = _data1_->cell, GTK_IS_CELL_RENDERER_TEXT (_tmp1_) ? ((GtkCellRendererText*) _tmp1_) : NULL), "text", _tmp0_ = g_strdup_printf ("%i", cs->dwords_length1), NULL);
+ g_object_set ((_tmp1_ = cell, GTK_IS_CELL_RENDERER_TEXT (_tmp1_) ? ((GtkCellRendererText*) _tmp1_) : NULL), "text", _tmp0_ = g_strdup_printf ("%u", emulation_cs_get_length (cs)), NULL);
_g_free0 (_tmp0_);
_g_object_unref0 (cs);
}
@@ -442,21 +407,6 @@ static void _gtk_main_quit_gtk_object_destroy (GtkObject* _sender, gpointer self
}
-static Block1Data* block1_data_ref (Block1Data* _data1_) {
- ++_data1_->_ref_count_;
- return _data1_;
-}
-
-
-static void block1_data_unref (Block1Data* _data1_) {
- if ((--_data1_->_ref_count_) == 0) {
- _g_object_unref0 (_data1_->self);
- _g_object_unref0 (_data1_->cell);
- g_slice_free (Block1Data, _data1_);
- }
-}
-
-
static GObject * gui_main_window_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
GObject * obj;
GObjectClass * parent_class;
@@ -467,11 +417,11 @@ static GObject * gui_main_window_constructor (GType type, guint n_construct_prop
self = GUI_MAIN_WINDOW (obj);
_inner_error_ = NULL;
{
- Block1Data* _data1_;
GtkBuilder* builder;
GObject* _tmp0_;
GtkTreeViewColumn* col;
GObject* _tmp1_;
+ GtkCellRendererText* cell;
GtkAction* _tmp3_;
GObject* _tmp2_;
GtkAction* _tmp5_;
@@ -485,9 +435,6 @@ static GObject * gui_main_window_constructor (GType type, guint n_construct_prop
GtkMenu* _tmp12_;
GObject* _tmp11_;
GObject* _tmp13_;
- _data1_ = g_slice_new0 (Block1Data);
- _data1_->_ref_count_ = 1;
- _data1_->self = g_object_ref (self);
builder = gtk_builder_new ();
{
gtk_builder_add_from_string (builder, gui_main_window_xml_ui, (gsize) string_get_length (gui_main_window_xml_ui), &_inner_error_);
@@ -510,15 +457,14 @@ static GObject * gui_main_window_constructor (GType type, guint n_construct_prop
__finally3:
if (_inner_error_ != NULL) {
_g_object_unref0 (builder);
- block1_data_unref (_data1_);
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_);
}
gtk_widget_set_size_request ((GtkWidget*) self, 400, 200);
gtk_window_set_title ((GtkWindow*) self, "Radeon Simulator");
- col = _g_object_ref0 ((_tmp0_ = gtk_builder_get_object (builder, "dwords_column"), GTK_IS_TREE_VIEW_COLUMN (_tmp0_) ? ((GtkTreeViewColumn*) _tmp0_) : NULL));
- _data1_->cell = _g_object_ref0 ((_tmp1_ = gtk_builder_get_object (builder, "dwords_cell"), GTK_IS_CELL_RENDERER_TEXT (_tmp1_) ? ((GtkCellRendererText*) _tmp1_) : NULL));
- gtk_cell_layout_set_cell_data_func ((GtkCellLayout*) col, (GtkCellRenderer*) _data1_->cell, __lambda10__gtk_cell_layout_data_func, block1_data_ref (_data1_), block1_data_unref);
+ col = _g_object_ref0 ((_tmp0_ = gtk_builder_get_object (builder, "pkts_column"), GTK_IS_TREE_VIEW_COLUMN (_tmp0_) ? ((GtkTreeViewColumn*) _tmp0_) : NULL));
+ cell = _g_object_ref0 ((_tmp1_ = gtk_builder_get_object (builder, "pkts_cell"), GTK_IS_CELL_RENDERER_TEXT (_tmp1_) ? ((GtkCellRendererText*) _tmp1_) : NULL));
+ gtk_cell_layout_set_cell_data_func ((GtkCellLayout*) col, (GtkCellRenderer*) cell, __lambda10__gtk_cell_layout_data_func, g_object_ref (self), g_object_unref);
self->priv->action_exportcs = (_tmp3_ = _g_object_ref0 ((_tmp2_ = gtk_builder_get_object (builder, "ExportCS"), GTK_IS_ACTION (_tmp2_) ? ((GtkAction*) _tmp2_) : NULL)), _g_object_unref0 (self->priv->action_exportcs), _tmp3_);
self->priv->action_removecs = (_tmp5_ = _g_object_ref0 ((_tmp4_ = gtk_builder_get_object (builder, "RemoveCS"), GTK_IS_ACTION (_tmp4_) ? ((GtkAction*) _tmp4_) : NULL)), _g_object_unref0 (self->priv->action_removecs), _tmp5_);
action_importcs = _g_object_ref0 ((_tmp6_ = gtk_builder_get_object (builder, "ImportCS"), GTK_IS_ACTION (_tmp6_) ? ((GtkAction*) _tmp6_) : NULL));
@@ -554,15 +500,15 @@ static GObject * gui_main_window_constructor (GType type, guint n_construct_prop
if (_inner_error_ != NULL) {
_g_object_unref0 (builder);
_g_object_unref0 (col);
+ _g_object_unref0 (cell);
_g_object_unref0 (action_importcs);
- block1_data_unref (_data1_);
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_);
}
_g_object_unref0 (builder);
_g_object_unref0 (col);
+ _g_object_unref0 (cell);
_g_object_unref0 (action_importcs);
- block1_data_unref (_data1_);
}
return obj;
}
@@ -573,7 +519,7 @@ static void gui_main_window_class_init (GUIMainWindowClass * klass) {
g_type_class_add_private (klass, sizeof (GUIMainWindowPrivate));
G_OBJECT_CLASS (klass)->constructor = gui_main_window_constructor;
G_OBJECT_CLASS (klass)->finalize = gui_main_window_finalize;
- gui_main_window_xml_ui = g_strdup ("\n <?xml version=\"1.0\"?>\n <interface>\n <requires lib=\"gtk+\" version=\"2.16\"/>\n <!-- interface-naming-policy project-wide -->\n <object class=\"GtkUIManager\" id=\"uimanager1\">\n <child>\n <object class=\"GtkActionGroup\" id=\"actiongroup1\">\n <child>\n <object class=\"GtkAction\" id=\"New\">\n <property name=\"name\">New</property>\n <property name=\"stock_id\">gtk-new</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"Open\">\n <property name=\"name\">Open</property>\n <property name=\"stock_id\">gtk-open</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"Save\">\n <property name=\"name\">Save</property>\n <property name=\"stock_id\">gtk-save</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"SaveAs\">\n <property name=\"name\">SaveAs</property>\n <property name=\"stock_id\">gtk-save-as</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"Quit\">\n <property name=\"name\">Quit</property>\n <property name=\"stock_id\">gtk-quit</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"RemoveCS\">\n <property name=\"name\">RemoveCS</property>\n <property name=\"label\">Remove CS</property>\n <property name=\"tooltip\">Remove the selected command stream from the current project.</property>\n <property name=\"stock_id\">gtk-delete</property>\n </object>\n <accelerator key=\"Delete\"/>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"ImportCS\">\n <property name=\"name\">ImportCS</property>\n <property name=\"label\">Import CS</property>\n <property name=\"tooltip\">Import a new command stream to the current project.</property>\n <property name=\"stock_id\">gtk-add</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"ExportCS\">\n <property name=\"name\">ExportCS</property>\n <property name=\"label\">Export CS</property>\n <property name=\"tooltip\">Export the selected command stream to a file.</property>\n <property name=\"stock_id\">gtk-convert</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"About\">\n <property name=\"name\">About</property>\n <property name=\"stock_id\">gtk-about</property>\n </object>\n <accelerator key=\"F1\"/>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"FileMenu\">\n <property name=\"name\">FileMenu</property>\n <property name=\"label\" translatable=\"yes\">_File</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"EditMenu\">\n <property name=\"name\">EditMenu</property>\n <property name=\"label\" translatable=\"yes\">_Edit</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"HelpMenu\">\n <property name=\"name\">HelpMenu</property>\n <property name=\"label\" translatable=\"yes\">_Help</property>\n </object>\n </child>\n </object>\n </child>\n <ui>\n <menubar name=\"menubar1\">\n <menu action=\"FileMenu\" name=\"FileMenu\">\n <menuitem action=\"New\" name=\"New\"/>\n <menuitem action=\"Open\" name=\"Open\"/>\n <menuitem action=\"Save\" name=\"Save\"/>\n <menuitem action=\"SaveAs\" name=\"SaveAs\"/>\n <separator/>\n <menuitem action=\"Quit\" name=\"Quit\"/>\n </menu>\n <menu action=\"EditMenu\" name=\"EditMenu\">\n <menuitem action=\"ImportCS\" name=\"ImportCS\"/>\n <menuitem action=\"ExportCS\" name=\"ExportCS\"/>\n <separator/>\n <menuitem action=\"RemoveCS\" name=\"RemoveCS\"/>\n </menu>\n <menu action=\"HelpMenu\" name=\"HelpMenu\">\n <menuitem action=\"About\" name=\"About\"/>\n </menu>\n </menubar>\n <toolbar name=\"toolbar1\">\n <toolitem action=\"New\" name=\"New\"/>\n <toolitem action=\"Open\" name=\"Open\"/>\n <toolitem action=\"Save\" name=\"Save\"/>\n <separator/>\n <toolitem action=\"ImportCS\" name=\"ImportCS\"/>\n <toolitem action=\"ExportCS\" name=\"ExportCS\"/>\n <separator/>\n <toolitem action=\"RemoveCS\" name=\"RemoveCS\"/>\n </toolbar>\n <popup name=\"popup1\">\n <menuitem action=\"ExportCS\" name=\"ExportCS\"/>\n <menuitem action=\"RemoveCS\" name=\"RemoveCS\"/>\n </popup>\n </ui>\n </object>\n <object class=\"GtkVBox\" id=\"mainbox\">\n <property name=\"visible\">True</property>\n <property name=\"orientation\">vertical</property>\n <child>\n <object constructor=\"uimanager1\" class=\"GtkMenuBar\" id=\"menubar1\">\n <property name=\"visible\">True</property>\n <child internal-child=\"accessible\">\n <object class=\"AtkObject\" id=\"a11y-menubar\">\n <property name=\"AtkObject::accessible-name\">The menubar</property>\n </object>\n </child>\n </object>\n <packing>\n <property name=\"expand\">False</property>\n </packing>\n </child>\n <child>\n <object constructor=\"uimanager1\" class=\"GtkToolbar\" id=\"toolbar1\">\n <property name=\"visible\">True</property>\n <child internal-child=\"accessible\">\n <object class=\"AtkObject\" id=\"a11y-toolbar\">\n <property name=\"AtkObject::accessible-name\">The toolbar</property>\n </object>\n </child>\n </object>\n <packing>\n <property name=\"expand\">False</property>\n <property name=\"position\">1</property>\n </packing>\n </child>\n <child>\n <object class=\"GtkScrolledWindow\" id=\"scrolledwindow1\">\n <property name=\"visible\">True</property>\n <property name=\"can_focus\">True</property>\n <property name=\"hscrollbar_policy\">automatic</property>\n <property name=\"vscrollbar_policy\">automatic</property>\n <child>\n <object class=\"GtkTreeView\" id=\"cs_list\">\n <property name=\"visible\">True</property>\n <property name=\"can_focus\">True</property>\n <property name=\"model\">cs_store</property>\n <child>\n <object class=\"GtkTreeViewColumn\" id=\"dwords_column\">\n <property name=\"title\">DWORDs</property>\n <child>\n <object class=\"GtkCellRendererText\" id=\"dwords_cell\"/>\n </child>\n </object>\n </child>\n <child>\n <object class=\"GtkTreeViewColumn\" id=\"treeviewcolumn1\">\n <property name=\"title\">Name</property>\n <child>\n <object class=\"GtkCellRendererText\" id=\"cellrenderertext1\"/>\n <attributes>\n <attribute name=\"text\">0</attribute>\n </attributes>\n </child>\n </object>\n </child>\n </object>\n </child>\n </object>\n <packing>\n <property name=\"position\">2</property>\n </packing>\n </child>\n </object>\n <object class=\"GtkListStore\" id=\"cs_store\">\n <columns>\n <!-- column-name Name -->\n <column type=\"gchararray\"/>\n <!-- column-name CS -->\n <column type=\"GObject\"/>\n </columns>\n </object>\n <object constructor=\"uimanager1\" class=\"GtkMenu\" id=\"popup1\">\n <child internal-child=\"accessible\">\n <object class=\"AtkObject\" id=\"a11y-popup\">\n <property name=\"AtkObject::accessible-name\">The popup menu</property>\n </object>\n </child>\n </object>\n </interface>\n ");
+ gui_main_window_xml_ui = g_strdup ("\n <?xml version=\"1.0\"?>\n <interface>\n <requires lib=\"gtk+\" version=\"2.16\"/>\n <!-- interface-naming-policy project-wide -->\n <object class=\"GtkUIManager\" id=\"uimanager1\">\n <child>\n <object class=\"GtkActionGroup\" id=\"actiongroup1\">\n <child>\n <object class=\"GtkAction\" id=\"New\">\n <property name=\"name\">New</property>\n <property name=\"stock_id\">gtk-new</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"Open\">\n <property name=\"name\">Open</property>\n <property name=\"stock_id\">gtk-open</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"Save\">\n <property name=\"name\">Save</property>\n <property name=\"stock_id\">gtk-save</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"SaveAs\">\n <property name=\"name\">SaveAs</property>\n <property name=\"stock_id\">gtk-save-as</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"Quit\">\n <property name=\"name\">Quit</property>\n <property name=\"stock_id\">gtk-quit</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"RemoveCS\">\n <property name=\"name\">RemoveCS</property>\n <property name=\"label\">Remove CS</property>\n <property name=\"tooltip\">Remove the selected command stream from the current project.</property>\n <property name=\"stock_id\">gtk-delete</property>\n </object>\n <accelerator key=\"Delete\"/>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"ImportCS\">\n <property name=\"name\">ImportCS</property>\n <property name=\"label\">Import CS</property>\n <property name=\"tooltip\">Import a new command stream to the current project.</property>\n <property name=\"stock_id\">gtk-add</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"ExportCS\">\n <property name=\"name\">ExportCS</property>\n <property name=\"label\">Export CS</property>\n <property name=\"tooltip\">Export the selected command stream to a file.</property>\n <property name=\"stock_id\">gtk-convert</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"About\">\n <property name=\"name\">About</property>\n <property name=\"stock_id\">gtk-about</property>\n </object>\n <accelerator key=\"F1\"/>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"FileMenu\">\n <property name=\"name\">FileMenu</property>\n <property name=\"label\" translatable=\"yes\">_File</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"EditMenu\">\n <property name=\"name\">EditMenu</property>\n <property name=\"label\" translatable=\"yes\">_Edit</property>\n </object>\n </child>\n <child>\n <object class=\"GtkAction\" id=\"HelpMenu\">\n <property name=\"name\">HelpMenu</property>\n <property name=\"label\" translatable=\"yes\">_Help</property>\n </object>\n </child>\n </object>\n </child>\n <ui>\n <menubar name=\"menubar1\">\n <menu action=\"FileMenu\" name=\"FileMenu\">\n <menuitem action=\"New\" name=\"New\"/>\n <menuitem action=\"Open\" name=\"Open\"/>\n <menuitem action=\"Save\" name=\"Save\"/>\n <menuitem action=\"SaveAs\" name=\"SaveAs\"/>\n <separator/>\n <menuitem action=\"Quit\" name=\"Quit\"/>\n </menu>\n <menu action=\"EditMenu\" name=\"EditMenu\">\n <menuitem action=\"ImportCS\" name=\"ImportCS\"/>\n <menuitem action=\"ExportCS\" name=\"ExportCS\"/>\n <separator/>\n <menuitem action=\"RemoveCS\" name=\"RemoveCS\"/>\n </menu>\n <menu action=\"HelpMenu\" name=\"HelpMenu\">\n <menuitem action=\"About\" name=\"About\"/>\n </menu>\n </menubar>\n <toolbar name=\"toolbar1\">\n <toolitem action=\"New\" name=\"New\"/>\n <toolitem action=\"Open\" name=\"Open\"/>\n <toolitem action=\"Save\" name=\"Save\"/>\n <separator/>\n <toolitem action=\"ImportCS\" name=\"ImportCS\"/>\n <toolitem action=\"ExportCS\" name=\"ExportCS\"/>\n <separator/>\n <toolitem action=\"RemoveCS\" name=\"RemoveCS\"/>\n </toolbar>\n <popup name=\"popup1\">\n <menuitem action=\"ExportCS\" name=\"ExportCS\"/>\n <menuitem action=\"RemoveCS\" name=\"RemoveCS\"/>\n </popup>\n </ui>\n </object>\n <object class=\"GtkVBox\" id=\"mainbox\">\n <property name=\"visible\">True</property>\n <property name=\"orientation\">vertical</property>\n <child>\n <object constructor=\"uimanager1\" class=\"GtkMenuBar\" id=\"menubar1\">\n <property name=\"visible\">True</property>\n <child internal-child=\"accessible\">\n <object class=\"AtkObject\" id=\"a11y-menubar\">\n <property name=\"AtkObject::accessible-name\">The menubar</property>\n </object>\n </child>\n </object>\n <packing>\n <property name=\"expand\">False</property>\n </packing>\n </child>\n <child>\n <object constructor=\"uimanager1\" class=\"GtkToolbar\" id=\"toolbar1\">\n <property name=\"visible\">True</property>\n <child internal-child=\"accessible\">\n <object class=\"AtkObject\" id=\"a11y-toolbar\">\n <property name=\"AtkObject::accessible-name\">The toolbar</property>\n </object>\n </child>\n </object>\n <packing>\n <property name=\"expand\">False</property>\n <property name=\"position\">1</property>\n </packing>\n </child>\n <child>\n <object class=\"GtkScrolledWindow\" id=\"scrolledwindow1\">\n <property name=\"visible\">True</property>\n <property name=\"can_focus\">True</property>\n <property name=\"hscrollbar_policy\">automatic</property>\n <property name=\"vscrollbar_policy\">automatic</property>\n <child>\n <object class=\"GtkTreeView\" id=\"cs_list\">\n <property name=\"visible\">True</property>\n <property name=\"can_focus\">True</property>\n <property name=\"model\">cs_store</property>\n <child>\n <object class=\"GtkTreeViewColumn\" id=\"pkts_column\">\n <property name=\"title\">Packets</property>\n <child>\n <object class=\"GtkCellRendererText\" id=\"pkts_cell\"/>\n </child>\n </object>\n </child>\n <child>\n <object class=\"GtkTreeViewColumn\" id=\"treeviewcolumn1\">\n <property name=\"title\">Name</property>\n <child>\n <object class=\"GtkCellRendererText\" id=\"cellrenderertext1\"/>\n <attributes>\n <attribute name=\"text\">0</attribute>\n </attributes>\n </child>\n </object>\n </child>\n </object>\n </child>\n </object>\n <packing>\n <property name=\"position\">2</property>\n </packing>\n </child>\n </object>\n <object class=\"GtkListStore\" id=\"cs_store\">\n <columns>\n <!-- column-name Name -->\n <column type=\"gchararray\"/>\n <!-- column-name CS -->\n <column type=\"GObject\"/>\n </columns>\n </object>\n <object constructor=\"uimanager1\" class=\"GtkMenu\" id=\"popup1\">\n <child internal-child=\"accessible\">\n <object class=\"AtkObject\" id=\"a11y-popup\">\n <property name=\"AtkObject::accessible-name\">The popup menu</property>\n </object>\n </child>\n </object>\n </interface>\n ");
}
diff --git a/src/main.vala b/src/main.vala
index 08025ef..091da5d 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -195,10 +195,10 @@ namespace GUI
<property name="can_focus">True</property>
<property name="model">cs_store</property>
<child>
- <object class="GtkTreeViewColumn" id="dwords_column">
- <property name="title">DWORDs</property>
+ <object class="GtkTreeViewColumn" id="pkts_column">
+ <property name="title">Packets</property>
<child>
- <object class="GtkCellRendererText" id="dwords_cell"/>
+ <object class="GtkCellRendererText" id="pkts_cell"/>
</child>
</object>
</child>
@@ -257,14 +257,14 @@ namespace GUI
set_size_request(400, 200);
title = "Radeon Simulator";
- /* DWORDs column */
- var col = builder.get_object("dwords_column") as TreeViewColumn;
- var cell = builder.get_object("dwords_cell") as CellRendererText;
- col.set_cell_data_func(cell, (coll, celll, model, iter) => {
+ /* Packets column */
+ var col = builder.get_object("pkts_column") as TreeViewColumn;
+ var cell = builder.get_object("pkts_cell") as CellRendererText;
+ col.set_cell_data_func(cell, (col, cell, model, iter) => {
CS cs;
model.get(iter, 1, out cs, -1);
assert(cs != null);
- (cell as CellRendererText).text = cs.dwords.length.to_string();
+ (cell as CellRendererText).text = cs.length.to_string();
});
/* connect actions */