Skip to content

Instantly share code, notes, and snippets.

@zacharycarter
Created March 1, 2017 00:38
Show Gist options
  • Save zacharycarter/0fd027b20efe2ffd23354fb89e5b0b79 to your computer and use it in GitHub Desktop.
Save zacharycarter/0fd027b20efe2ffd23354fb89e5b0b79 to your computer and use it in GitHub Desktop.
# NON NIMIAN - C LIKE
proc buffer_init_default(a2: ptr buffer) {.importc: "nk_buffer_init_default".}
# NIMIAN - NIM LIKE
proc init*(b: var buffer) =
buffer_init_default(addr b)
proc buffer_init(a2: ptr buffer; a3: ptr allocator; size: uint) {.importc: "nk_buffer_init".}
proc init*(b: var buffer, a: var allocator, size: uint) =
buffer_init(addr b, addr a, size)
proc buffer_init_fixed(a2: ptr buffer; memory: pointer; size: uint) {.importc: "nk_buffer_init_fixed".}
proc init*(b: var buffer, memory: pointer, size:uint) =
buffer_init_fixed(addr b, memory, size)
proc buffer_info(a2: ptr memory_status; a3: ptr buffer) {.importc: "nk_buffer_info".}
proc info*(b: var buffer, ms: var memory_status) =
buffer_info(addr ms, addr b)
proc buffer_push(a2: ptr buffer; typ: buffer_allocation_type;
memory: pointer; size: uint; align: uint) {.importc: "nk_buffer_push".}
proc push*(b: var buffer, `type`: buffer_allocation_type, memory: pointer, size, align: uint) =
buffer_push(addr b, `type`, memory, size, align)
proc buffer_mark*(a2: ptr buffer; typ: buffer_allocation_type) {.importc: "nk_buffer_mark".}
proc mark*(b: var buffer, `type`: buffer_allocation_type) =
buffer_mark(addr b, `type`)
proc buffer_reset(a2: ptr buffer; typ: buffer_allocation_type) {.importc: "nk_buffer_reset".}
proc reset*(b: var buffer, `type`: buffer_allocation_type) =
buffer_reset(addr b, `type`)
proc buffer_clear(a2: ptr buffer) {.importc: "nk_buffer_clear".}
proc clear*(b: var buffer) =
buffer_clear(addr b)
proc buffer_free(a2: ptr buffer) {.importc: "nk_buffer_free".}
proc free*(b: var buffer) =
buffer_free(addr b)
proc buffer_memory(a2: ptr buffer): pointer {.importc: "nk_buffer_memory".}
proc bufferMemory*(b: var buffer): pointer =
buffer_memory(addr b)
proc buffer_memory_const(a2: ptr buffer): pointer {.importc: "nk_buffer_memory_const".}
proc bufferMemoryConst*(b: var buffer): pointer =
buffer_memory_const(addr b)
proc buffer_total*(a2: ptr buffer): uint {.importc: "nk_buffer_total".}
proc total*(b: var buffer): uint =
buffer_total(addr b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment