Skip to content

VariadicArray

IsaacShelton edited this page Nov 13, 2022 · 6 revisions

VariadicArray

VariadicArray represents the type of a variadic argument list.

Specifications

Type Size Possible Values Memory Management Model File
VariadicArray 40-48 bytes Array of arguments None 2.7/VariadicArray.adept

Definition

#if !variadic_array_use_typeinfo
    struct VariadicArray (items ptr, next ptr, bytes usize, length usize, index usize)
#else
    struct VariadicArray (items ptr, next ptr, bytes usize, length usize, index usize, types **AnyType)
#end

Fields

Name Type Description
items ptr Pointer to raw byte array
next ptr Pointer to next element
bytes usize Size of items buffer in bytes
length usize Number of arguments in items
types **AnyType Type information for each argument

Value Management Definitions

  • func __variadic_array__(pointer ptr, bytes usize, length usize, _maybe_types ptr) VariadicArray

Memory Management

VariadicArray does not perform any memory management. The items array points to a byte buffer on the stack, and all memory management of the contained values is up to the consumer of the VariadicArray.

Conditionally Included Methods

#if variadic_array_use_typeinfo
  • func read(this *VariadicArray) Anything

    NOTE: It is the callee's responsibility to ensure __defer__ is called for values that need it. The returned Anything has Ownership::REFERENCE, and so does not handle this.

    Reads the next item from a variadic array and returns an Anything that references it.

    [view src]

  • func getNextType(this *VariadicArray) *AnyType

    Returns the type of the next item in a variadic array. When variadic_array_use_typeinfo is false, null is returned.

    [view src]

#if !variadic_array_use_typeinfo
  • func getNextType(this *VariadicArray) ptr = null

    Returns the type of the next item in a variadic array. When variadic_array_use_typeinfo is false, null is returned.

    [view src]

Methods

  • func hasNext(this *VariadicArray) bool

    Returns whether another item exists in the variadic array.

    [view src]

  • func reset(this *VariadicArray) void

    Resets a variadic array to read from the beginning.

    [view src]

  • func read(this *VariadicArray, out item *$T) void

    NOTE: It is the callee's responsibility to ensure __defer__ is called for values that need it

    Reads the next value from a variadic array.

    [view src]

  • func readString(this *VariadicArray) String

    Reads the next value from a variadic array as a String.

    [view src]

  • func readCString(this *VariadicArray) *ubyte

    Reads the next value from a variadic array as a c-string.

    [view src]

  • func readPtr(this *VariadicArray) ptr

    Reads the next value from a variadic array as a pointer.

    [view src]

  • func readBool(this *VariadicArray) bool

    Reads the next value from a variadic array as a bool.

    [view src]

  • func readByte(this *VariadicArray) byte

    Reads the next value from a variadic array as a byte.

    [view src]

  • func readUbyte(this *VariadicArray) ubyte

    Reads the next value from a variadic array as a ubyte.

    [view src]

  • func readShort(this *VariadicArray) short

    Reads the next value from a variadic array as a short.

    [view src]

  • func readUshort(this *VariadicArray) ushort

    Reads the next value from a variadic array as a ushort.

    [view src]

  • func readInt(this *VariadicArray) int

    Reads the next value from a variadic array as an int.

    [view src]

  • func readUint(this *VariadicArray) uint

    Reads the next value from a variadic array as a uint.

    [view src]

  • func readLong(this *VariadicArray) long

    Reads the next value from a variadic array as a long.

    [view src]

  • func readUlong(this *VariadicArray) ulong

    Reads the next value from a variadic array as a ulong.

    [view src]

  • func readUsize(this *VariadicArray) usize

    Reads the next value from a variadic array as a usize.

    [view src]

  • func readFloat(this *VariadicArray) float

    Reads the next value from a variadic array as a float.

    [view src]

  • func readDouble(this *VariadicArray) double

    Reads the next value from a variadic array as a double.

    [view src]

Settings

#default variadic_array_sanity_checks    true
#default variadic_array_use_typeinfo     __typeinfo__
Clone this wiki locally