final class · System.Bindings

CStruct

public final class CStruct

A C struct (or union) with its layout: a value type of the binding.

Kind
final class
Namespace
System.Bindings
Assembly
System.Bindings
Access
public, final
Source file
Model.ant

Inheritance

Base classes
Any CStruct

Constructors

new(str cName, str header, bool isUnion, i32 pack)
#

Methods

Add(str cName, str type, str typedef) : CStruct
#

Fields

str CName
#
str Name
#
str Namespace
#
str File
#
bool IsUnion
#
i32 Pack
#

C's #pragma pack (0: natural alignment).

List<CField> Fields
#

Inherited members (5)

Source

CStruct as Antril, decompiled from its Larva HIR.

System.Bindings.CStruct.ant
// System.Bindings.CStruct — System.Bindings (decompiled from Larva HIR)

import System;

into namespace System.Bindings
{
	/// A C struct (or union) with its layout: a value type of the binding.
	public final class CStruct
	{
		public:
			str CName;
			str Name;
			str Header;
			str Namespace;
			str File;
			bool IsUnion;

			/// C's `#pragma pack` (0: natural alignment).
			i32 Pack;
			List<CField> Fields;

			new(str cName, str header, bool isUnion, i32 pack)
			{
				Namespace = "";
				File = "";
				Fields = new List<CField>();
				CName = cName;
				Name = cName;
				Header = header;
				IsUnion = isUnion;
				Pack = pack;
			}

			Add(str cName, str type, str typedef) : CStruct
			{
				Fields.Add(new CField(cName, new CType(type, typedef)));
				return this;
			}
	}
}
Esc