ATSLIB/libats/stkarray

This package implements array-based linear stacks.


  • stkarray
  • stkarray_vtype
  • stkarray_make_cap
  • stkarray_make_ngc__tsz
  • stkarray_free_nil
  • stkarray_is_nil
  • stkarray_isnot_nil
  • stkarray_is_full
  • stkarray_isnot_full
  • stkarray_get_size
  • stkarray_get_capacity
  • stkarray_insert
  • stkarray_insert_opt
  • stkarray_takeout
  • stkarray_takeout_opt
  • fprint_stkarray
  • Overloaded Symbols
  • fprint

  • stkarray

    Synopsis

    stadef stkarray = stkarray_vtype
    vtypedef
    stkarray
      (a:vt0p) = [m,n:int] stkarray_vtype (a, m, n)

    stkarray_vtype

    Synopsis

    absvtype
    stkarray_vtype (a:vt@ype+, m:int, n:int) = ptr

    stkarray_make_cap

    Synopsis

    fun{a:vt0p}
    stkarray_make_cap
      {m:int} (cap: size_t(m)):<!wrt> stkarray (a, m, 0)

    stkarray_make_ngc__tsz

    Synopsis

    fun
    stkarray_make_ngc__tsz
      {a:vt0p}
      {l:addr}{m:int}
    (
      stkarray_tsize? @ l
    | ptr(l), arrayptr(a?, m), size_t(m), sizeof_t(a)
    ) :<!wrt> (mfree_ngc_v (l) | stkarray (a, m, 0)) = "mac#%"

    stkarray_free_nil

    Synopsis

    fun
    stkarray_free_nil
      {a:vt0p}{m:int}
      (stk: stkarray (a, m, 0)):<!wrt> void = "mac#%"

    stkarray_is_nil

    Synopsis

    fun
    stkarray_is_nil
      {a:vt0p}{m,n:int}
      (stk: !stkarray (INV(a), m, n)):<> bool (n==0) = "mac#%"

    stkarray_isnot_nil

    Synopsis

    fun
    stkarray_isnot_nil
      {a:vt0p}{m,n:int}
      (stk: !stkarray (INV(a), m, n)):<> bool (n > 0) = "mac#%"

    stkarray_is_full

    Synopsis

    fun
    stkarray_is_full
      {a:vt0p}{m,n:int}
      (stk: !stkarray (INV(a), m, n)):<> bool (m==n) = "mac#%"

    stkarray_isnot_full

    Synopsis

    fun
    stkarray_isnot_full
      {a:vt0p}{m,n:int}
      (stk: !stkarray (INV(a), m, n)):<> bool (m > n) = "mac#%"

    stkarray_get_size

    Synopsis

    fun{a:vt0p}
    stkarray_get_size
      {m,n:int} (stk: !stkarray (INV(a), m, n)):<> size_t(n)

    stkarray_get_capacity

    Synopsis

    fun{a:vt0p}
    stkarray_get_capacity
      {m,n:int} (stk: !stkarray (INV(a), m, n)):<> size_t(m)

    stkarray_insert

    Synopsis

    fun{a:vt0p}
    stkarray_insert
      {m,n:int | m > n}
    (
      stk: !stkarray (INV(a), m, n) >> stkarray (a, m, n+1), x0: a
    ) :<!wrt> void // endfun

    stkarray_insert_opt

    Synopsis

    fun{a:vt0p}
    stkarray_insert_opt
      (stk: !stkarray (INV(a)) >> _, x0: a):<!wrt> Option_vt (a)

    stkarray_takeout

    Synopsis

    fun{a:vt0p}
    stkarray_takeout
      {m,n:int | n > 0}
    (
      stk: !stkarray (INV(a), m, n) >> stkarray (a, m, n-1)
    ) :<!wrt> (a) // endfun

    stkarray_takeout_opt

    Synopsis

    fun{a:vt0p}
    stkarray_takeout_opt
      (stk: !stkarray (INV(a)) >> _):<!wrt> Option_vt (a)

    fprint_stkarray

    Synopsis

    fun{a:vt0p}
    fprint_stkarray
      (out: FILEref, stk: !stkarray (INV(a))): void

    Overloaded Symbols


    fprint

    Synopsis

    overload fprint with fprint_stkarray
    overload fprint with fprint_stkarray_sep

    This page is created with ATS by Hongwei Xi and also maintained by Hongwei Xi. SourceForge.net Logo