<commit_before>/*
 * Copyright LWJGL. All rights reserved.
 * License terms: https://www.lwjgl.org/license
 */
package org.lwjgl.generator

import org.lwjgl.generator.ParameterType.*

/** A parameter or return value. */
interface QualifiedType {
    val nativeType: NativeType
}

internal val QualifiedType.hasUnsafe
    get() = (nativeType is PointerType && (nativeType.mapping !== PointerMapping.OPAQUE_POINTER || nativeType is CallbackType)) || nativeType is StructType

internal val QualifiedType.isBufferPointer
    get() = nativeType.let { it is PointerType && it.mapping !== PointerMapping.OPAQUE_POINTER && it.elementType !is StructType }

internal val QualifiedType.javaMethodType
    get() = nativeType.javaMethodType

class ReturnValue(override val nativeType: NativeType) : QualifiedType {

    override fun hashCode() = RESULT.hashCode()

    override fun equals(other: Any?) = other === this || (other is ReturnValue && other.nativeType == this.nativeType)

    // --- [ Helper functions & properties ] ---

    internal val isSpecial
        get() = (hasUnsafe && nativeType !is ArrayType)

    internal val isVoid
        get() = nativeType.mapping === TypeMapping.VOID

    internal val isStructValue
        get() = nativeType is StructType

    internal fun toNativeType(hasConst: Boolean, binding: APIBinding?) =
        if (binding == null || isStructValue) {
            nativeType.name.let {
                if (nativeType is PointerType && !nativeType.includesPointer) {
                    if (!it.endsWith('*')) "$it *" else "$it*"<commit_msg>fix(generator): generate Java wrapper for simple functions returning BOOLEAN4<commit_after>/*
 * Copyright LWJGL. All rights reserved.
 * License terms: https://www.lwjgl.org/license
 */
package org.lwjgl.generator

import org.lwjgl.generator.ParameterType.*

/** A parameter or return value. */
interface QualifiedType {
    val nativeType: NativeType
}

internal val QualifiedType.hasUnsafe
    get() = (nativeType is PointerType && (nativeType.mapping !== PointerMapping.OPAQUE_POINTER || nativeType is CallbackType)) || nativeType is StructType

internal val QualifiedType.isBufferPointer
    get() = nativeType.let { it is PointerType && it.mapping !== PointerMapping.OPAQUE_POINTER && it.elementType !is StructType }

internal val QualifiedType.javaMethodType
    get() = nativeType.javaMethodType

class ReturnValue(override val nativeType: NativeType) : QualifiedType {

    override fun hashCode() = RESULT.hashCode()

    override fun equals(other: Any?) = other === this || (other is ReturnValue && other.nativeType == this.nativeType)

    // --- [ Helper functions & properties ] ---

    internal val isSpecial
        get() = (hasUnsafe && nativeType !is ArrayType) || nativeType.mapping === PrimitiveMapping.BOOLEAN4

    internal val isVoid
        get() = nativeType.mapping === TypeMapping.VOID

    internal val isStructValue
        get() = nativeType is StructType

    internal fun toNativeType(hasConst: Boolean, binding: APIBinding?) =
        if (binding == null || isStructValue) {
            nativeType.name.let {
                if (nativeType is PointerType && !nativeType.includesPointer) {
                    if (!it.endsWith('*')) "$it *" else "$it*"
{'fraction_non_alphanumeric': 0.11124769514443761, 'fraction_numerical': 0.0006146281499692685, 'mean_word_length': 3.5271210013908205, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '16499', 'n_tokens_mistral': 903, 'n_tokens_neox': 888, 'n_words': 253}