From 19236e6b0c1831ec0c08fa1f19ff6b9b9cad777c Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Sun, 14 Oct 2012 19:04:42 +0400 Subject: [PATCH] GVala updated. --- vala/gvala/Makefile | 121 +++++++++++++++++++++++++++ vala/gvala/base.vala | 14 ---- vala/gvala/main.c | 137 ++++++++++++++++++++++++++++++ vala/gvala/main.vala | 21 ++--- vala/gvala/sub.vala | 15 ---- vala/gvala/subsub.vala | 15 ---- vala/gvala/txr-doc.c | 126 ++++++++++++++++++++++++++++ vala/gvala/txr-doc.vala | 11 +++ vala/gvala/txr-graphics.c | 156 +++++++++++++++++++++++++++++++++++ vala/gvala/txr-graphics.vala | 11 +++ vala/gvala/txr-object.c | 107 ++++++++++++++++++++++++ vala/gvala/txr-object.vala | 8 ++ 12 files changed, 685 insertions(+), 57 deletions(-) create mode 100644 vala/gvala/Makefile delete mode 100644 vala/gvala/base.vala create mode 100644 vala/gvala/main.c delete mode 100644 vala/gvala/sub.vala delete mode 100644 vala/gvala/subsub.vala create mode 100644 vala/gvala/txr-doc.c create mode 100644 vala/gvala/txr-doc.vala create mode 100644 vala/gvala/txr-graphics.c create mode 100644 vala/gvala/txr-graphics.vala create mode 100644 vala/gvala/txr-object.c create mode 100644 vala/gvala/txr-object.vala diff --git a/vala/gvala/Makefile b/vala/gvala/Makefile new file mode 100644 index 0000000..99de96c --- /dev/null +++ b/vala/gvala/Makefile @@ -0,0 +1,121 @@ +# Makefile generated by command: smake.sh -t main -Pglib-2.0 -Pgobject-2.0 +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# make # default mode is debug +# CFLAGS="-O2 -march=core2 -mtune=core2 -msse4.1 -mfpmath=sse -fomit-frame-pointer -pipe" LDFLAGS="-Wl,-O1" make mode=develop +# CFLAGS="-O2 -march=amdfam10 -mtune=amdfam10 -msse4a --mfpmath=sse -fomit-frame-pointer -pipe" LDFLAGS="-Wl,-O1" make mode=profile +# CFLAGS="-O2 -march=k6-2 -mtune=k6-2 -m3dnow --mfpmath=387 -fomit-frame-pointer -pipe" LDFLAGS="-Wl,-O1" make mode=release +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +TARGET0=main +TARGETS= $(TARGET0) +CC=cc +CXX=c++ +CFLAGS := $(CFLAGS) +CXXFLAGS := $(CXXFLAGS) +LDFLAGS := $(LDFLAGS) +LIBS=-lglib-2.0 -lgobject-2.0 +SRC= +INCLUDES=-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS := -O0 -g -DDEBUG -std=c99 -pedantic -Wextra -Wconversion $(CFLAGS) + LDFLAGS := $(LDFLAGS) +endif +ifeq ($(mode),profile) + CFLAGS := -O0 -g -DDEBUG -std=c99 -p -ftest-coverage -Wcoverage-mismatch $(CFLAGS) + LDFLAGS := -g -p $(LDFLAGS) +endif +ifeq ($(mode),develop) + CFLAGS := -O2 -g -DDEBUG -std=c99 $(CFLAGS) + LDFLAGS := -O1 $(LDFLAGS) +endif +ifeq ($(mode),release) + CFLAGS := -O2 -std=c99 $(CFLAGS) + LDFLAGS := -O1 $(LDFLAGS) +endif + +CFLAGS += -Wall $(INCLUDES) +LDFLAGS += -Wall + +all: + @make change_make_options &>/dev/null + +make $(TARGETS) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean + @echo "MODE=$(mode)" > make_options.out + @echo "CFLAGS=$(CFLAGS)" >> make_options.out + @echo "LDFLAGS=$(LDFLAGS)" >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(SRC) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGETS) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + main.o \ + txr-doc.o \ + txr-graphics.o \ + txr-object.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) $(LIBS) + + +main.o: \ + main.c \ + txr-doc.h \ + txr-graphics.h \ + txr-object.h + +txr-doc.o: \ + txr-doc.c + +txr-graphics.o: \ + txr-graphics.c + +txr-object.o: \ + txr-object.c + diff --git a/vala/gvala/base.vala b/vala/gvala/base.vala deleted file mode 100644 index fe16bd1..0000000 --- a/vala/gvala/base.vala +++ /dev/null @@ -1,14 +0,0 @@ -class Base : GLib.Object { - public int b; - - public new void copy_from (Base b) { - stdout.printf ("Base copy_from() called\n"); - this.b = b.b; - } - - public virtual Base clone () { - var b = new Base(); - b.copy_from (this); - return b; - } -} diff --git a/vala/gvala/main.c b/vala/gvala/main.c new file mode 100644 index 0000000..ac32a09 --- /dev/null +++ b/vala/gvala/main.c @@ -0,0 +1,137 @@ +/* main.c generated by valac 0.16.1, the Vala compiler + * generated from main.vala, do not modify */ + + +#include +#include +#include +#include + + +#define TYPE_GVALA (gvala_get_type ()) +#define GVALA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GVALA, GVala)) +#define GVALA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GVALA, GValaClass)) +#define IS_GVALA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GVALA)) +#define IS_GVALA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GVALA)) +#define GVALA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GVALA, GValaClass)) + +typedef struct _GVala GVala; +typedef struct _GValaClass GValaClass; +typedef struct _GValaPrivate GValaPrivate; + +#define TYPE_TXR_OBJECT (txr_object_get_type ()) +#define TXR_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TXR_OBJECT, TXRObject)) +#define TXR_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TXR_OBJECT, TXRObjectClass)) +#define IS_TXR_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TXR_OBJECT)) +#define IS_TXR_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TXR_OBJECT)) +#define TXR_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TXR_OBJECT, TXRObjectClass)) + +typedef struct _TXRObject TXRObject; +typedef struct _TXRObjectClass TXRObjectClass; + +#define TYPE_TXR_DOC (txr_doc_get_type ()) +#define TXR_DOC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TXR_DOC, TXRDoc)) +#define TXR_DOC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TXR_DOC, TXRDocClass)) +#define IS_TXR_DOC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TXR_DOC)) +#define IS_TXR_DOC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TXR_DOC)) +#define TXR_DOC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TXR_DOC, TXRDocClass)) + +typedef struct _TXRDoc TXRDoc; +typedef struct _TXRDocClass TXRDocClass; + +#define TYPE_TXR_GRAPHICS (txr_graphics_get_type ()) +#define TXR_GRAPHICS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TXR_GRAPHICS, TXRGraphics)) +#define TXR_GRAPHICS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TXR_GRAPHICS, TXRGraphicsClass)) +#define IS_TXR_GRAPHICS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TXR_GRAPHICS)) +#define IS_TXR_GRAPHICS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TXR_GRAPHICS)) +#define TXR_GRAPHICS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TXR_GRAPHICS, TXRGraphicsClass)) + +typedef struct _TXRGraphics TXRGraphics; +typedef struct _TXRGraphicsClass TXRGraphicsClass; +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) + +struct _GVala { + GObject parent_instance; + GValaPrivate * priv; +}; + +struct _GValaClass { + GObjectClass parent_class; +}; + + +static gpointer gvala_parent_class = NULL; + +GType gvala_get_type (void) G_GNUC_CONST; +enum { + GVALA_DUMMY_PROPERTY +}; +gint gvala_main (gchar** args, int args_length1); +TXRGraphics* txr_graphics_new (void); +TXRGraphics* txr_graphics_construct (GType object_type); +GType txr_object_get_type (void) G_GNUC_CONST; +GType txr_doc_get_type (void) G_GNUC_CONST; +GType txr_graphics_get_type (void) G_GNUC_CONST; +void txr_object_copy (TXRObject* self, TXRObject* copy); +GVala* gvala_new (void); +GVala* gvala_construct (GType object_type); + + +gint gvala_main (gchar** args, int args_length1) { + gint result = 0; + TXRGraphics* _tmp0_; + TXRGraphics* graphics1; + TXRGraphics* _tmp1_; + TXRGraphics* graphics2; + _tmp0_ = txr_graphics_new (); + graphics1 = _tmp0_; + _tmp1_ = txr_graphics_new (); + graphics2 = _tmp1_; + txr_object_copy ((TXRObject*) graphics1, (TXRObject*) graphics2); + result = 0; + _g_object_unref0 (graphics2); + _g_object_unref0 (graphics1); + return result; +} + + +int main (int argc, char ** argv) { + g_type_init (); + return gvala_main (argv, argc); +} + + +GVala* gvala_construct (GType object_type) { + GVala * self = NULL; + self = (GVala*) g_object_new (object_type, NULL); + return self; +} + + +GVala* gvala_new (void) { + return gvala_construct (TYPE_GVALA); +} + + +static void gvala_class_init (GValaClass * klass) { + gvala_parent_class = g_type_class_peek_parent (klass); +} + + +static void gvala_instance_init (GVala * self) { +} + + +GType gvala_get_type (void) { + static volatile gsize gvala_type_id__volatile = 0; + if (g_once_init_enter (&gvala_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GValaClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gvala_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GVala), 0, (GInstanceInitFunc) gvala_instance_init, NULL }; + GType gvala_type_id; + gvala_type_id = g_type_register_static (G_TYPE_OBJECT, "GVala", &g_define_type_info, 0); + g_once_init_leave (&gvala_type_id__volatile, gvala_type_id); + } + return gvala_type_id__volatile; +} + + + diff --git a/vala/gvala/main.vala b/vala/gvala/main.vala index 47b5cec..660ce5b 100644 --- a/vala/gvala/main.vala +++ b/vala/gvala/main.vala @@ -1,17 +1,12 @@ -class GVala : GLib.Object { +public class GVala : GLib.Object { public static int main (string[] args) { - var src = new SubSub(); - src.b = 1; - src.s = 2; - src.ss = 3; + var graphics1 = new TXRGraphics (); + var graphics2 = new TXRGraphics (); + //var doc = new TXRDoc (); + graphics1.copy (graphics2); + //doc.copy ((TXRObject) graphics); + //graphics.copy ((TXRObject) doc); - Base b = new SubSub(); - b = src.clone(); - - var ss = (SubSub) b; - - stdout.printf ("b = %d, s = %d, ss = %d\n", ss.b, ss.s, ss.ss); - - return 0; + return 0; } } diff --git a/vala/gvala/sub.vala b/vala/gvala/sub.vala deleted file mode 100644 index dc04261..0000000 --- a/vala/gvala/sub.vala +++ /dev/null @@ -1,15 +0,0 @@ -class Sub : Base { - public int s; - - public new void copy_from (Base b) { - stdout.printf ("Sub copy_from() called\n"); - ((Base)this).copy_from(b); - this.s = ((Sub)b).s; - } - - public override Base clone () { - var b = new Sub(); - b.copy_from (this); - return b; - } -} diff --git a/vala/gvala/subsub.vala b/vala/gvala/subsub.vala deleted file mode 100644 index 0d29dc4..0000000 --- a/vala/gvala/subsub.vala +++ /dev/null @@ -1,15 +0,0 @@ -class SubSub : Sub { - public int ss; - - public new void copy_from (Base b) { - stdout.printf ("SubSub copy_from() called\n"); - ((Sub)this).copy_from(b); - this.ss = ((SubSub)b).ss; - } - - public override Base clone () { - var b = new SubSub(); - b.copy_from (this); - return b; - } -} diff --git a/vala/gvala/txr-doc.c b/vala/gvala/txr-doc.c new file mode 100644 index 0000000..e72f35e --- /dev/null +++ b/vala/gvala/txr-doc.c @@ -0,0 +1,126 @@ +/* txr-doc.c generated by valac 0.16.1, the Vala compiler + * generated from txr-doc.vala, do not modify */ + + +#include +#include +#include + + +#define TYPE_TXR_OBJECT (txr_object_get_type ()) +#define TXR_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TXR_OBJECT, TXRObject)) +#define TXR_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TXR_OBJECT, TXRObjectClass)) +#define IS_TXR_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TXR_OBJECT)) +#define IS_TXR_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TXR_OBJECT)) +#define TXR_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TXR_OBJECT, TXRObjectClass)) + +typedef struct _TXRObject TXRObject; +typedef struct _TXRObjectClass TXRObjectClass; +typedef struct _TXRObjectPrivate TXRObjectPrivate; + +#define TYPE_TXR_DOC (txr_doc_get_type ()) +#define TXR_DOC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TXR_DOC, TXRDoc)) +#define TXR_DOC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TXR_DOC, TXRDocClass)) +#define IS_TXR_DOC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TXR_DOC)) +#define IS_TXR_DOC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TXR_DOC)) +#define TXR_DOC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TXR_DOC, TXRDocClass)) + +typedef struct _TXRDoc TXRDoc; +typedef struct _TXRDocClass TXRDocClass; +typedef struct _TXRDocPrivate TXRDocPrivate; + +struct _TXRObject { + GObject parent_instance; + TXRObjectPrivate * priv; + gint object_field; +}; + +struct _TXRObjectClass { + GObjectClass parent_class; + void (*copy) (TXRObject* self, TXRObject* copy); +}; + +struct _TXRDoc { + TXRObject parent_instance; + TXRDocPrivate * priv; + gint doc_field; +}; + +struct _TXRDocClass { + TXRObjectClass parent_class; +}; + + +static gpointer txr_doc_parent_class = NULL; + +GType txr_object_get_type (void) G_GNUC_CONST; +GType txr_doc_get_type (void) G_GNUC_CONST; +enum { + TXR_DOC_DUMMY_PROPERTY +}; +static void txr_doc_real_copy (TXRObject* base, TXRObject* copy); +TXRDoc* txr_doc_new (void); +TXRDoc* txr_doc_construct (GType object_type); +TXRObject* txr_object_new (void); +TXRObject* txr_object_construct (GType object_type); +static void txr_doc_finalize (GObject* obj); + + +static void txr_doc_real_copy (TXRObject* base, TXRObject* copy) { + TXRDoc * self; + FILE* _tmp0_; + TXRObject* _tmp1_; + gint _tmp2_; + self = (TXRDoc*) base; + g_return_if_fail (copy != NULL); + _tmp0_ = stdout; + fprintf (_tmp0_, "TXRDoc:copy() called\n"); + _tmp1_ = copy; + _tmp2_ = self->doc_field; + TXR_DOC (_tmp1_)->doc_field = _tmp2_; +} + + +TXRDoc* txr_doc_construct (GType object_type) { + TXRDoc * self = NULL; + self = (TXRDoc*) txr_object_construct (object_type); + return self; +} + + +TXRDoc* txr_doc_new (void) { + return txr_doc_construct (TYPE_TXR_DOC); +} + + +static void txr_doc_class_init (TXRDocClass * klass) { + txr_doc_parent_class = g_type_class_peek_parent (klass); + TXR_OBJECT_CLASS (klass)->copy = txr_doc_real_copy; + G_OBJECT_CLASS (klass)->finalize = txr_doc_finalize; +} + + +static void txr_doc_instance_init (TXRDoc * self) { +} + + +static void txr_doc_finalize (GObject* obj) { + TXRDoc * self; + self = TXR_DOC (obj); + G_OBJECT_CLASS (txr_doc_parent_class)->finalize (obj); +} + + +GType txr_doc_get_type (void) { + static volatile gsize txr_doc_type_id__volatile = 0; + if (g_once_init_enter (&txr_doc_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (TXRDocClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) txr_doc_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TXRDoc), 0, (GInstanceInitFunc) txr_doc_instance_init, NULL }; + GType txr_doc_type_id; + txr_doc_type_id = g_type_register_static (TYPE_TXR_OBJECT, "TXRDoc", &g_define_type_info, 0); + g_once_init_leave (&txr_doc_type_id__volatile, txr_doc_type_id); + } + return txr_doc_type_id__volatile; +} + + + diff --git a/vala/gvala/txr-doc.vala b/vala/gvala/txr-doc.vala new file mode 100644 index 0000000..4a87aad --- /dev/null +++ b/vala/gvala/txr-doc.vala @@ -0,0 +1,11 @@ +public class TXRDoc : TXRObject { + public int doc_field; + + public override void copy (TXRObject copy) { + stdout.printf ("TXRDoc:copy() called\n"); + if (copy is TXRObject) { + base.copy (copy); + ((TXRDoc)copy).doc_field = this.doc_field; + } + } +} diff --git a/vala/gvala/txr-graphics.c b/vala/gvala/txr-graphics.c new file mode 100644 index 0000000..f4bda6f --- /dev/null +++ b/vala/gvala/txr-graphics.c @@ -0,0 +1,156 @@ +/* txr-graphics.c generated by valac 0.16.1, the Vala compiler + * generated from txr-graphics.vala, do not modify */ + + +#include +#include +#include + + +#define TYPE_TXR_OBJECT (txr_object_get_type ()) +#define TXR_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TXR_OBJECT, TXRObject)) +#define TXR_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TXR_OBJECT, TXRObjectClass)) +#define IS_TXR_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TXR_OBJECT)) +#define IS_TXR_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TXR_OBJECT)) +#define TXR_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TXR_OBJECT, TXRObjectClass)) + +typedef struct _TXRObject TXRObject; +typedef struct _TXRObjectClass TXRObjectClass; +typedef struct _TXRObjectPrivate TXRObjectPrivate; + +#define TYPE_TXR_DOC (txr_doc_get_type ()) +#define TXR_DOC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TXR_DOC, TXRDoc)) +#define TXR_DOC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TXR_DOC, TXRDocClass)) +#define IS_TXR_DOC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TXR_DOC)) +#define IS_TXR_DOC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TXR_DOC)) +#define TXR_DOC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TXR_DOC, TXRDocClass)) + +typedef struct _TXRDoc TXRDoc; +typedef struct _TXRDocClass TXRDocClass; +typedef struct _TXRDocPrivate TXRDocPrivate; + +#define TYPE_TXR_GRAPHICS (txr_graphics_get_type ()) +#define TXR_GRAPHICS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TXR_GRAPHICS, TXRGraphics)) +#define TXR_GRAPHICS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TXR_GRAPHICS, TXRGraphicsClass)) +#define IS_TXR_GRAPHICS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TXR_GRAPHICS)) +#define IS_TXR_GRAPHICS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TXR_GRAPHICS)) +#define TXR_GRAPHICS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TXR_GRAPHICS, TXRGraphicsClass)) + +typedef struct _TXRGraphics TXRGraphics; +typedef struct _TXRGraphicsClass TXRGraphicsClass; +typedef struct _TXRGraphicsPrivate TXRGraphicsPrivate; + +struct _TXRObject { + GObject parent_instance; + TXRObjectPrivate * priv; + gint object_field; +}; + +struct _TXRObjectClass { + GObjectClass parent_class; + void (*copy) (TXRObject* self, TXRObject* copy); +}; + +struct _TXRDoc { + TXRObject parent_instance; + TXRDocPrivate * priv; + gint doc_field; +}; + +struct _TXRDocClass { + TXRObjectClass parent_class; +}; + +struct _TXRGraphics { + TXRDoc parent_instance; + TXRGraphicsPrivate * priv; + gint graphics_field; +}; + +struct _TXRGraphicsClass { + TXRDocClass parent_class; +}; + + +static gpointer txr_graphics_parent_class = NULL; + +GType txr_object_get_type (void) G_GNUC_CONST; +GType txr_doc_get_type (void) G_GNUC_CONST; +GType txr_graphics_get_type (void) G_GNUC_CONST; +enum { + TXR_GRAPHICS_DUMMY_PROPERTY +}; +static void txr_graphics_real_copy (TXRObject* base, TXRObject* copy); +void txr_object_copy (TXRObject* self, TXRObject* copy); +TXRGraphics* txr_graphics_new (void); +TXRGraphics* txr_graphics_construct (GType object_type); +TXRDoc* txr_doc_new (void); +TXRDoc* txr_doc_construct (GType object_type); +static void txr_graphics_finalize (GObject* obj); + + +static void txr_graphics_real_copy (TXRObject* base, TXRObject* copy) { + TXRGraphics * self; + FILE* _tmp0_; + TXRObject* _tmp1_; + self = (TXRGraphics*) base; + g_return_if_fail (copy != NULL); + _tmp0_ = stdout; + fprintf (_tmp0_, "TXRGraphics:copy() called\n"); + _tmp1_ = copy; + if (IS_TXR_GRAPHICS (_tmp1_)) { + TXRObject* _tmp2_; + TXRObject* _tmp3_; + gint _tmp4_; + _tmp2_ = copy; + TXR_OBJECT_CLASS (txr_graphics_parent_class)->copy ((TXRObject*) TXR_DOC (self), _tmp2_); + _tmp3_ = copy; + _tmp4_ = self->graphics_field; + TXR_GRAPHICS (_tmp3_)->graphics_field = _tmp4_; + } +} + + +TXRGraphics* txr_graphics_construct (GType object_type) { + TXRGraphics * self = NULL; + self = (TXRGraphics*) txr_doc_construct (object_type); + return self; +} + + +TXRGraphics* txr_graphics_new (void) { + return txr_graphics_construct (TYPE_TXR_GRAPHICS); +} + + +static void txr_graphics_class_init (TXRGraphicsClass * klass) { + txr_graphics_parent_class = g_type_class_peek_parent (klass); + TXR_OBJECT_CLASS (klass)->copy = txr_graphics_real_copy; + G_OBJECT_CLASS (klass)->finalize = txr_graphics_finalize; +} + + +static void txr_graphics_instance_init (TXRGraphics * self) { +} + + +static void txr_graphics_finalize (GObject* obj) { + TXRGraphics * self; + self = TXR_GRAPHICS (obj); + G_OBJECT_CLASS (txr_graphics_parent_class)->finalize (obj); +} + + +GType txr_graphics_get_type (void) { + static volatile gsize txr_graphics_type_id__volatile = 0; + if (g_once_init_enter (&txr_graphics_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (TXRGraphicsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) txr_graphics_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TXRGraphics), 0, (GInstanceInitFunc) txr_graphics_instance_init, NULL }; + GType txr_graphics_type_id; + txr_graphics_type_id = g_type_register_static (TYPE_TXR_DOC, "TXRGraphics", &g_define_type_info, 0); + g_once_init_leave (&txr_graphics_type_id__volatile, txr_graphics_type_id); + } + return txr_graphics_type_id__volatile; +} + + + diff --git a/vala/gvala/txr-graphics.vala b/vala/gvala/txr-graphics.vala new file mode 100644 index 0000000..8344fc5 --- /dev/null +++ b/vala/gvala/txr-graphics.vala @@ -0,0 +1,11 @@ +public class TXRGraphics : TXRDoc { + public int graphics_field; + + public override void copy (TXRObject copy) { + stdout.printf ("TXRGraphics:copy() called\n"); + if (copy is TXRGraphics) { + base.copy (copy); + ((TXRGraphics)copy).graphics_field = this.graphics_field; + } + } +} diff --git a/vala/gvala/txr-object.c b/vala/gvala/txr-object.c new file mode 100644 index 0000000..f83b14a --- /dev/null +++ b/vala/gvala/txr-object.c @@ -0,0 +1,107 @@ +/* txr-object.c generated by valac 0.16.1, the Vala compiler + * generated from txr-object.vala, do not modify */ + + +#include +#include +#include + + +#define TYPE_TXR_OBJECT (txr_object_get_type ()) +#define TXR_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TXR_OBJECT, TXRObject)) +#define TXR_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TXR_OBJECT, TXRObjectClass)) +#define IS_TXR_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TXR_OBJECT)) +#define IS_TXR_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TXR_OBJECT)) +#define TXR_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TXR_OBJECT, TXRObjectClass)) + +typedef struct _TXRObject TXRObject; +typedef struct _TXRObjectClass TXRObjectClass; +typedef struct _TXRObjectPrivate TXRObjectPrivate; + +struct _TXRObject { + GObject parent_instance; + TXRObjectPrivate * priv; + gint object_field; +}; + +struct _TXRObjectClass { + GObjectClass parent_class; + void (*copy) (TXRObject* self, TXRObject* copy); +}; + + +static gpointer txr_object_parent_class = NULL; + +GType txr_object_get_type (void) G_GNUC_CONST; +enum { + TXR_OBJECT_DUMMY_PROPERTY +}; +void txr_object_copy (TXRObject* self, TXRObject* copy); +static void txr_object_real_copy (TXRObject* self, TXRObject* copy); +TXRObject* txr_object_new (void); +TXRObject* txr_object_construct (GType object_type); +static void txr_object_finalize (GObject* obj); + + +static void txr_object_real_copy (TXRObject* self, TXRObject* copy) { + FILE* _tmp0_; + TXRObject* _tmp1_; + gint _tmp2_; + g_return_if_fail (copy != NULL); + _tmp0_ = stdout; + fprintf (_tmp0_, "TXRObject:copy() called\n"); + _tmp1_ = copy; + _tmp2_ = self->object_field; + _tmp1_->object_field = _tmp2_; +} + + +void txr_object_copy (TXRObject* self, TXRObject* copy) { + g_return_if_fail (self != NULL); + TXR_OBJECT_GET_CLASS (self)->copy (self, copy); +} + + +TXRObject* txr_object_construct (GType object_type) { + TXRObject * self = NULL; + self = (TXRObject*) g_object_new (object_type, NULL); + return self; +} + + +TXRObject* txr_object_new (void) { + return txr_object_construct (TYPE_TXR_OBJECT); +} + + +static void txr_object_class_init (TXRObjectClass * klass) { + txr_object_parent_class = g_type_class_peek_parent (klass); + TXR_OBJECT_CLASS (klass)->copy = txr_object_real_copy; + G_OBJECT_CLASS (klass)->finalize = txr_object_finalize; +} + + +static void txr_object_instance_init (TXRObject * self) { +} + + +static void txr_object_finalize (GObject* obj) { + TXRObject * self; + self = TXR_OBJECT (obj); + G_OBJECT_CLASS (txr_object_parent_class)->finalize (obj); +} + + +GType txr_object_get_type (void) { + static volatile gsize txr_object_type_id__volatile = 0; + if (g_once_init_enter (&txr_object_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (TXRObjectClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) txr_object_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TXRObject), 0, (GInstanceInitFunc) txr_object_instance_init, NULL }; + GType txr_object_type_id; + txr_object_type_id = g_type_register_static (G_TYPE_OBJECT, "TXRObject", &g_define_type_info, 0); + g_once_init_leave (&txr_object_type_id__volatile, txr_object_type_id); + } + return txr_object_type_id__volatile; +} + + + diff --git a/vala/gvala/txr-object.vala b/vala/gvala/txr-object.vala new file mode 100644 index 0000000..12ac98d --- /dev/null +++ b/vala/gvala/txr-object.vala @@ -0,0 +1,8 @@ +public class TXRObject : GLib.Object { + public int object_field; + + public virtual void copy (TXRObject copy) { + stdout.printf ("TXRObject:copy() called\n"); + copy.object_field = this.object_field; + } +}