2005-05-02 18:40:30 +00:00
|
|
|
// GtkSharp.Generation.FieldBase.cs - base class for struct and object
|
|
|
|
// fields
|
|
|
|
//
|
|
|
|
// Copyright (c) 2004 Novell, Inc.
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of version 2 of the GNU General Public
|
|
|
|
// License as published by the Free Software Foundation.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public
|
|
|
|
// License along with this program; if not, write to the
|
|
|
|
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
// Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
|
|
|
|
namespace GtkSharp.Generation {
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.IO;
|
|
|
|
using System.Xml;
|
|
|
|
|
|
|
|
public abstract class FieldBase : PropertyBase {
|
|
|
|
public FieldBase (XmlElement elem, ClassBase container_type) : base (elem, container_type) {}
|
|
|
|
|
2011-02-20 18:11:08 +00:00
|
|
|
public virtual bool Validate (LogWriter log)
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
{
|
2011-02-20 18:11:08 +00:00
|
|
|
log.Member = Name;
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
if (!Ignored && !Hidden && CSType == "") {
|
2013-08-12 09:17:09 +00:00
|
|
|
if (Name == "Priv")
|
|
|
|
return false;
|
2011-02-20 18:11:08 +00:00
|
|
|
log.Warn ("field has unknown type: " + CType);
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
Statistics.ThrottledCount++;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-10-09 11:40:56 +00:00
|
|
|
internal virtual bool Readable {
|
2005-05-02 18:40:30 +00:00
|
|
|
get {
|
2013-10-08 16:55:34 +00:00
|
|
|
if (Parser.GetVersion (elem.OwnerDocument.DocumentElement) <= 2)
|
|
|
|
return elem.GetAttribute ("readable") != "false";
|
2013-10-08 16:46:44 +00:00
|
|
|
return elem.HasAttribute ("readable") && elem.GetAttributeAsBoolean ("readable");
|
2005-05-02 18:40:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 11:40:56 +00:00
|
|
|
internal virtual bool Writable {
|
2005-05-02 18:40:30 +00:00
|
|
|
get {
|
2013-10-08 16:55:34 +00:00
|
|
|
if (Parser.GetVersion (elem.OwnerDocument.DocumentElement) <= 2)
|
|
|
|
return elem.GetAttribute ("writeable") != "false";
|
2013-10-08 16:46:44 +00:00
|
|
|
return elem.HasAttribute ("writeable") && elem.GetAttributeAsBoolean ("writeable");
|
2005-05-02 18:40:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected abstract string DefaultAccess { get; }
|
|
|
|
|
2013-10-09 11:40:56 +00:00
|
|
|
internal string Access {
|
2005-05-02 18:40:30 +00:00
|
|
|
get {
|
|
|
|
return elem.HasAttribute ("access") ? elem.GetAttribute ("access") : DefaultAccess;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsArray {
|
|
|
|
get {
|
2012-10-21 16:10:34 +00:00
|
|
|
return elem.HasAttribute ("array_len") || elem.GetAttributeAsBoolean ("array");
|
2005-05-02 18:40:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsBitfield {
|
|
|
|
get {
|
|
|
|
return elem.HasAttribute("bits");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool Ignored {
|
|
|
|
get {
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
if (container_type.GetProperty (Name) != null)
|
|
|
|
return true;
|
|
|
|
if (IsArray)
|
|
|
|
return true;
|
|
|
|
if (Access == "private" && (Getter == null) && (Setter == null))
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
string getterName, setterName;
|
|
|
|
string getOffsetName, offsetName;
|
|
|
|
|
|
|
|
void CheckGlue ()
|
|
|
|
{
|
|
|
|
getterName = setterName = getOffsetName = null;
|
|
|
|
if (Access != "public")
|
|
|
|
return;
|
|
|
|
|
2009-05-06 14:58:39 +00:00
|
|
|
string prefix = (container_type.NS + "Sharp_" + container_type.NS + "_" + container_type.Name).Replace(".", "__").ToLower ();
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
|
|
|
|
if (IsBitfield) {
|
|
|
|
if (Readable && Getter == null)
|
|
|
|
getterName = prefix + "_get_" + CName;
|
|
|
|
if (Writable && Setter == null)
|
|
|
|
setterName = prefix + "_set_" + CName;
|
|
|
|
} else {
|
|
|
|
if ((Readable && Getter == null) || (Writable && Setter == null)) {
|
|
|
|
offsetName = CName + "_offset";
|
|
|
|
getOffsetName = prefix + "_get_" + offsetName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void GenerateImports (GenerationInfo gen_info, string indent)
|
|
|
|
{
|
|
|
|
StreamWriter sw = gen_info.Writer;
|
|
|
|
SymbolTable table = SymbolTable.Table;
|
|
|
|
|
|
|
|
if (getterName != null) {
|
|
|
|
sw.WriteLine (indent + "[DllImport (\"{0}\")]", gen_info.GluelibName);
|
|
|
|
sw.WriteLine (indent + "extern static {0} {1} ({2} raw);",
|
2009-08-13 14:46:33 +00:00
|
|
|
table.GetMarshalType (CType), getterName,
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
container_type.MarshalType);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (setterName != null) {
|
|
|
|
sw.WriteLine (indent + "[DllImport (\"{0}\")]", gen_info.GluelibName);
|
|
|
|
sw.WriteLine (indent + "extern static void {0} ({1} raw, {2} value);",
|
|
|
|
setterName, container_type.MarshalType, table.GetMarshalType (CType));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (getOffsetName != null) {
|
|
|
|
sw.WriteLine (indent + "[DllImport (\"{0}\")]", gen_info.GluelibName);
|
|
|
|
sw.WriteLine (indent + "extern static uint {0} ();", getOffsetName);
|
|
|
|
sw.WriteLine ();
|
|
|
|
sw.WriteLine (indent + "static uint " + offsetName + " = " + getOffsetName + " ();");
|
|
|
|
}
|
|
|
|
|
|
|
|
base.GenerateImports (gen_info, indent);
|
|
|
|
}
|
|
|
|
|
2005-07-22 18:35:37 +00:00
|
|
|
public virtual void Generate (GenerationInfo gen_info, string indent)
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
{
|
|
|
|
if (Ignored || Hidden)
|
|
|
|
return;
|
|
|
|
|
|
|
|
CheckGlue ();
|
2011-02-20 18:11:08 +00:00
|
|
|
if ((getterName != null || setterName != null || getOffsetName != null) && gen_info.GlueWriter == null) {
|
|
|
|
LogWriter log = new LogWriter (container_type.QualifiedName);
|
|
|
|
log.Member = Name;
|
|
|
|
log.Warn ("needs glue for field access. Specify --glue-filename");
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
GenerateImports (gen_info, indent);
|
|
|
|
|
|
|
|
SymbolTable table = SymbolTable.Table;
|
2013-07-18 15:05:58 +00:00
|
|
|
IGeneratable gen = table [CType];
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
StreamWriter sw = gen_info.Writer;
|
2012-10-21 16:10:34 +00:00
|
|
|
string modifiers = elem.GetAttributeAsBoolean ("new_flag") ? "new " : "";
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
|
|
|
|
sw.WriteLine (indent + "public " + modifiers + CSType + " " + Name + " {");
|
|
|
|
|
|
|
|
if (Getter != null) {
|
|
|
|
sw.Write (indent + "\tget ");
|
2007-08-13 14:29:06 +00:00
|
|
|
Getter.GenerateBody (gen_info, container_type, "\t");
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
sw.WriteLine ("");
|
|
|
|
} else if (getterName != null) {
|
|
|
|
sw.WriteLine (indent + "\tget {");
|
2007-08-13 14:29:06 +00:00
|
|
|
container_type.Prepare (sw, indent + "\t\t");
|
2009-08-13 14:46:33 +00:00
|
|
|
sw.WriteLine (indent + "\t\t" + CSType + " result = " + table.FromNative (ctype, getterName + " (" + container_type.CallByName () + ")") + ";");
|
2007-08-13 14:29:06 +00:00
|
|
|
container_type.Finish (sw, indent + "\t\t");
|
|
|
|
sw.WriteLine (indent + "\t\treturn result;");
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
sw.WriteLine (indent + "\t}");
|
|
|
|
} else if (Readable && offsetName != null) {
|
|
|
|
sw.WriteLine (indent + "\tget {");
|
|
|
|
sw.WriteLine (indent + "\t\tunsafe {");
|
2013-07-18 15:05:58 +00:00
|
|
|
if (gen is CallbackGen) {
|
|
|
|
sw.WriteLine (indent + "\t\t\tIntPtr* raw_ptr = (IntPtr*)(((byte*)" + container_type.CallByName () + ") + " + offsetName + ");");
|
|
|
|
sw.WriteLine (indent + "\t\t\t {0} del = ({0})Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof({0}));", table.GetMarshalType (CType));
|
|
|
|
sw.WriteLine (indent + "\t\t\treturn " + table.FromNative (ctype, "(del)") + ";");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sw.WriteLine (indent + "\t\t\t" + table.GetMarshalType (CType) + "* raw_ptr = (" + table.GetMarshalType (CType) + "*)(((byte*)" + container_type.CallByName () + ") + " + offsetName + ");");
|
|
|
|
sw.WriteLine (indent + "\t\t\treturn " + table.FromNative (ctype, "(*raw_ptr)") + ";");
|
|
|
|
}
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
sw.WriteLine (indent + "\t\t}");
|
|
|
|
sw.WriteLine (indent + "\t}");
|
|
|
|
}
|
|
|
|
|
2009-08-13 14:46:33 +00:00
|
|
|
string to_native = (gen is IManualMarshaler) ? (gen as IManualMarshaler).AllocNative ("value") : gen.CallByName ("value");
|
|
|
|
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
if (Setter != null) {
|
|
|
|
sw.Write (indent + "\tset ");
|
2007-08-13 14:29:06 +00:00
|
|
|
Setter.GenerateBody (gen_info, container_type, "\t");
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
sw.WriteLine ("");
|
|
|
|
} else if (setterName != null) {
|
|
|
|
sw.WriteLine (indent + "\tset {");
|
2007-08-13 14:29:06 +00:00
|
|
|
container_type.Prepare (sw, indent + "\t\t");
|
2009-08-13 14:46:33 +00:00
|
|
|
sw.WriteLine (indent + "\t\t" + setterName + " (" + container_type.CallByName () + ", " + to_native + ");");
|
2007-08-13 14:29:06 +00:00
|
|
|
container_type.Finish (sw, indent + "\t\t");
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
sw.WriteLine (indent + "\t}");
|
|
|
|
} else if (Writable && offsetName != null) {
|
|
|
|
sw.WriteLine (indent + "\tset {");
|
|
|
|
sw.WriteLine (indent + "\t\tunsafe {");
|
2013-07-18 15:05:58 +00:00
|
|
|
if (gen is CallbackGen) {
|
|
|
|
sw.WriteLine (indent + "\t\t\t{0} wrapper = new {0} (value);", ((CallbackGen)gen).WrapperName);
|
|
|
|
sw.WriteLine (indent + "\t\t\tIntPtr* raw_ptr = (IntPtr*)(((byte*)" + container_type.CallByName () + ") + " + offsetName + ");");
|
|
|
|
sw.WriteLine (indent + "\t\t\t*raw_ptr = Marshal.GetFunctionPointerForDelegate (wrapper.NativeDelegate);");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sw.WriteLine (indent + "\t\t\t" + table.GetMarshalType (CType) + "* raw_ptr = (" + table.GetMarshalType (CType) + "*)(((byte*)" + container_type.CallByName () + ") + " + offsetName + ");");
|
|
|
|
sw.WriteLine (indent + "\t\t\t*raw_ptr = " + to_native + ";");
|
|
|
|
}
|
* generator/StructBase.cs: update field-generation logic a bit
* generator/CodeGenerator.cs: add a --glue-includes flag
* generator/GenerationInfo.cs: Accept glue_includes value from
Main and output it to the glue_filename.
* generator/FieldBase.cs (Ignored): handle more ignorable cases.
(CheckGlue): New method to figure out what kind of glue we'll need
for a field.
(GenerateImports): generate appropriate imports per CheckGlue.
(GenerateGlue): Generate C glue for accessing a struct field;
either a fully-C-based accessor, or a method to just return the
field's offset in the struct.
(Generate): Use the generated glue to read the field.
* generator/PropertyBase.cs (CType): if the field is a single bit,
set its type to gboolean.
* generator/ObjectGen.cs (Generate):
* generator/OpaqueGen.cs (Generate): Call GenFields.
* generator/StructField.cs: Use FieldBase's glue-generation code
to handle bitfields. [#54489]
* generator/ObjectField.cs: Generates accessors for public fields
of objects and opaque structs. [#69514]
* generator/ClassBase.cs (ClassBase): Parse <fields> nodes and
create ObjectField objects.
(GenFields): Output field properties
(IgnoreMethod): Ignore Get/Set methods that duplicate fields
* generator/Makefile.am (sources): update
* {gdk,gnome,gtk,pango}/*.metadata: Mark some additional fields as
public. Rename/retype some fields for consistency with earlier
hand-coded bindings.
* {gdk,gnome,gtk,pango}/*.custom: Remove custom methods that can
now be autogenerated.
* {gdk,gnome,gtk,pango}/glue/*.c: Remove glue methods that can now
be autogenerated
* {gdk,glade,gnome,gtk,pango,vte}/Makefile.am
* {gdk,glade,gnome,gtk,pango,vte}/glue/Makefile.am
* {gdk,gnome,gtk,pango}/glue/makefile.win32: Update
svn path=/trunk/gtk-sharp/; revision=44563
2005-05-16 14:28:55 +00:00
|
|
|
sw.WriteLine (indent + "\t\t}");
|
|
|
|
sw.WriteLine (indent + "\t}");
|
|
|
|
}
|
|
|
|
|
|
|
|
sw.WriteLine (indent + "}");
|
|
|
|
sw.WriteLine ("");
|
|
|
|
|
|
|
|
if (getterName != null || setterName != null || getOffsetName != null)
|
|
|
|
GenerateGlue (gen_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void GenerateGlue (GenerationInfo gen_info)
|
|
|
|
{
|
|
|
|
StreamWriter sw = gen_info.GlueWriter;
|
|
|
|
SymbolTable table = SymbolTable.Table;
|
|
|
|
|
|
|
|
string FieldCType = CType.Replace ("-", " ");
|
|
|
|
bool byref = table[CType] is ByRefGen || table[CType] is StructGen;
|
|
|
|
string GlueCType = byref ? FieldCType + " *" : FieldCType;
|
|
|
|
string ContainerCType = container_type.CName;
|
|
|
|
string ContainerCName = container_type.Name.ToLower ();
|
|
|
|
|
|
|
|
if (getterName != null) {
|
|
|
|
sw.WriteLine ("{0} {1} ({2} *{3});",
|
|
|
|
GlueCType, getterName, ContainerCType, ContainerCName);
|
|
|
|
}
|
|
|
|
if (setterName != null) {
|
|
|
|
sw.WriteLine ("void {0} ({1} *{2}, {3} value);",
|
|
|
|
setterName, ContainerCType, ContainerCName, GlueCType);
|
|
|
|
}
|
|
|
|
if (getOffsetName != null)
|
|
|
|
sw.WriteLine ("guint {0} (void);", getOffsetName);
|
|
|
|
sw.WriteLine ("");
|
|
|
|
|
|
|
|
if (getterName != null) {
|
|
|
|
sw.WriteLine (GlueCType);
|
|
|
|
sw.WriteLine ("{0} ({1} *{2})", getterName, ContainerCType, ContainerCName);
|
|
|
|
sw.WriteLine ("{");
|
|
|
|
sw.WriteLine ("\treturn ({0}){1}{2}->{3};", GlueCType,
|
|
|
|
byref ? "&" : "", ContainerCName, CName);
|
|
|
|
sw.WriteLine ("}");
|
|
|
|
sw.WriteLine ("");
|
|
|
|
}
|
|
|
|
if (setterName != null) {
|
|
|
|
sw.WriteLine ("void");
|
|
|
|
sw.WriteLine ("{0} ({1} *{2}, {3} value)",
|
|
|
|
setterName, ContainerCType, ContainerCName, GlueCType);
|
|
|
|
sw.WriteLine ("{");
|
|
|
|
sw.WriteLine ("\t{0}->{1} = ({2}){3}value;", ContainerCName, CName,
|
|
|
|
FieldCType, byref ? "*" : "");
|
|
|
|
sw.WriteLine ("}");
|
|
|
|
sw.WriteLine ("");
|
|
|
|
}
|
|
|
|
if (getOffsetName != null) {
|
|
|
|
sw.WriteLine ("guint");
|
|
|
|
sw.WriteLine ("{0} (void)", getOffsetName);
|
|
|
|
sw.WriteLine ("{");
|
|
|
|
sw.WriteLine ("\treturn (guint)G_STRUCT_OFFSET ({0}, {1});",
|
|
|
|
ContainerCType, CName);
|
|
|
|
sw.WriteLine ("}");
|
|
|
|
sw.WriteLine ("");
|
2005-05-02 18:40:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|