         "@inlinable public var intValue: Int { get { Int(rawValue) } set { rawValue = \(enumRawType)(newValue) } }\n" + indentation +
         "/// The equivalent raw `gint` value\n" + indentation +
         "@inlinable public var int: gint { get { gint(rawValue) } set { rawValue = \(enumRawType)(newValue) } }\n" + indentation +
-        "/// The equivalent underlying `\(bftype)` enum value\n" + indentation +
-        "@inlinable public var value: \(bftype) {\n" + doubleIndentation +
+        "/// The equivalent underlying `\(ctype)` enum value\n" + indentation +
+        "@inlinable public var value: \(ctype) {\n" + doubleIndentation +
           "get {\n" + tripleIndentation +
-            "func castTo\(bftype)Int<I: BinaryInteger, J: BinaryInteger>(_ param: I) -> J { J(param) }\n" + tripleIndentation +
-            bftype + "(rawValue: castTo\(bftype)Int(rawValue))\n" + doubleIndentation +
+            "func castTo\(ctype)Int<I: BinaryInteger, J: BinaryInteger>(_ param: I) -> J { J(param) }\n" + tripleIndentation +
+            ctype + "(rawValue: castTo\(ctype)Int(rawValue))\n" + doubleIndentation +
           "}\n" + doubleIndentation +
           "set { rawValue = \(enumRawType)(newValue.rawValue) }\n" + indentation +
         "}\n\n" + indentation +
         "/// Creates a new instance with the specified raw value\n" + indentation +
         "@inlinable public init(rawValue: \(enumRawType)) { self.rawValue = rawValue }\n" + indentation +
-        "/// Creates a new instance with the specified `\(bftype)` enum value\n" + indentation +
-        "@inlinable public init(_ enumValue: \(bftype)) { self.rawValue = \(enumRawType)(enumValue.rawValue) }\n" + indentation +
+        "/// Creates a new instance with the specified `\(ctype)` enum value\n" + indentation +
+        "@inlinable public init(_ enumValue: \(ctype)) { self.rawValue = \(enumRawType)(enumValue.rawValue) }\n" + indentation +
         "/// Creates a new instance with the specified Int value\n" + indentation +
         "@inlinable public init<I: BinaryInteger>(_ intValue: I) { self.rawValue = \(enumRawType)(intValue)  }\n\n"
     )

    let head = bitfieldTypeHead(bf, indentation: indent)
    let bitfields = bf.members
    let names = Set(bitfields.map(\.name.camelCase.swiftQuoted))
    let deprecated = bitfields.lazy.filter { !names.contains($0.name.swiftName) }
    let fields = bitfields.map(bitfieldValueCode(bf, indent)).joined(separator: "\n") + "\n\n"
                    + deprecated.map(bitfieldDeprecated(bf, indent)).joined(separator: "\n")
    let tail = "\n}\n\n"
    let code = head + fields + tail
    return code

/// Swift code representation of an enum value
public func valueCode(_ indentation: String) -> (GIR.Enumeration.Member) -> String {
    return { (m: GIR.Enumeration.Member) -> String in
        let value = String(m.value)
        let cID: String
        if let id = m.typeRef.identifier, !id.isEmpty {
            cID = id
        } else {
            cID = value
        }
        let comment = cID == value ? "" : (" // " + value)
        let code = swiftCode(m, indentation + "static let " + m.name.camelCase.swiftQuoted + " = " + cID + comment, indentation: indentation)
        return code
    }
}

///// Swift code representation of an enum value
//public func valueDeprecated(_ indentation: String, typeName: String) -> (GIR.Enumeration.Member) -> String {
//    return { (m: GIR.Enumeration.Member) -> String in
//        let value = String(m.value)
//        let cID: String
//        if let id = m.typeRef.identifier, !id.isEmpty {
//            cID = id
//        } else {
//            cID = value
//        }
//        let comment = cID == value ? "" : (" // " + value)
//        let code = swiftCode(m, indentation + "@available(*, deprecated) static let " + m.name.swiftName + " = " + typeName + "." + m.name.camelCase.swiftQuoted + comment, indentation: indentation)
//        return code
//    }
//}


/// Swift code type definition of a bitfield
public func bitfieldTypeHead(_ bf: GIR.Bitfield, enumRawType: String = "UInt32", indentation: String) -> String {
    let typeRef = bf.typeRef
    let type = typeRef.type
    let ctype = type.typeName
    let doubleIndentation = indentation + indentation
    let tripleIndentation = indentation + doubleIndentation
    return swiftCode(bf, "public struct \(bf.escapedName.swift): OptionSet {\n" + indentation +
