Functions

The following functions are available globally.

  • Wrapper for POSIX getopt() to return a Swift tuple. Returns nil if the getopt() returned -1, otherwise returns a tuple of the option character with an optional argument

    Declaration

    Swift

    public func get_opt(_ options: String) -> (Character, String?)?
  • Comparator to check whether two Things are equal

    Declaration

    Swift

    public func == (lhs: GIR.Thing, rhs: GIR.Thing) -> Bool

    Parameters

    lhs

    Thing to compare

    rhs

    Thing to compare with

  • Comparator to check the ordering of two Things

    Declaration

    Swift

    public func < (lhs: GIR.Thing, rhs: GIR.Thing) -> Bool

    Parameters

    lhs

    first Thing to compare

    rhs

    second Thing to compare

  • Convert the given String to SwiftDoc

    Declaration

    Swift

    public func gtkDoc2SwiftDoc(_ gtkDoc: String, linePrefix: String = "/// ") -> String

    Parameters

    gtkDoc

    String in gtk-doc format

    linePrefix

    string to prefix each line with (e.g. indentation and/or ///)

    Return Value

    String in SwiftDoc format

  • memory map the given file with the given protection and flags, then call the process function with the memory address of the mapped file

    Declaration

    Swift

    public func with_mmap(_ file: String, protection: Int32 = PROT_READ, flags: Int32 = MAP_PRIVATE, process: (UnsafeMutableRawPointer, Int) -> Void)

    Parameters

    file

    Name of the file to open() and mmap()

    protection

    memory protection flags to use

    flags

    memory mapping flags to use

    process

    callback for processing the content of the file while memory mapped

  • memory map the given file to an unsafe buffer pointer then call the process function with the memory address of the mapped file

    Declaration

    Swift

    public func with_mmap<Element>(_ file: String, protection p: Int32 = PROT_READ, flags f: Int32 = MAP_PRIVATE, process: (UnsafeBufferPointer<Element>) -> Void)

    Parameters

    file

    Name of the file to open() and mmap() to memory pointing to the given Element type

    p

    memory protection flags to use

    f

    memory mapping flags to use

    process

    callback for processing the content of the file while memory mapped and bound to Element