ATSLIB/contrib/libats-hwxi/cstream

This package implements streams of characters.


  • cstream
  • cstream_vtype
  • cstream_get_char
  • cstream_getv_char
  • cstream_get_charlst
  • cstream_make_fun
  • cstream_make_cloref
  • cstream_get_range
  • cstream_string_get_range
  • cstream_strptr_get_range
  • cstream_make_string
  • cstream_make_strptr
  • cstream_make_fileref
  • cstream_make_fileptr
  • cstream_tokener.sats

  • cstream

    Synopsis

    vtypedef
    cstream(tk:tkind) = cstream_vtype(tk)
    vtypedef cstream = [tk:tkind] cstream(tk)

    cstream_vtype

    Synopsis

    absvtype
    cstream_vtype(tkind) = ptr

    cstream_get_char

    Synopsis

    fun{}
    cstream_get_char (!cstream): int

    Description

    If the current position in the character stream represented by a given cstream-value is not at the end, then this function returns the character at the position while advancing the position by 1. Otherwise, the function returns -1.

    cstream_getv_char

    Synopsis

    fun{tk:tk}
    cstream_getv_char{n:nat}
      (!cstream(tk), &bytes(n) >> _, n: int(n)): natLte(n)

    Description

    A reference implementation of this function calls cstream_get_char repeatedly until either the number of calls reaches the value of its third argument or -1 is returned, and it stores the characters returned by calls to cstream_get_char in its second (call-by-reference) argument. The return value of cstream_getv_char indicates how many characters are actually stored.

    cstream_get_charlst

    Synopsis

    fun{}
    cstream_get_charlst (!cstream, n: int): List0_vt(char)

    Description

    This function calls cstream_get_char repeatedly until either the number of calls reaches the value of its second argument or -1 is returned, and it returns a list consisting of all the characters returned by calls to cstream_get_char. Note that this function returns a list consisting of all the characters in the character stream associated with its first argument if its second argument is a negative integer.

    cstream_make_fun

    Synopsis

    fun cstream_make_fun (() -> int): cstream(TKfun)

    cstream_make_cloref

    Synopsis

    fun cstream_make_cloref (() -<cloref1> int): cstream(TKcloref)

    cstream_get_range

    Synopsis

    overload cstream_get_range with cstream_string_get_range 
    overload cstream_get_range with cstream_strptr_get_range 

    cstream_string_get_range

    Synopsis

    fun
    cstream_string_get_range
      {i,j:nat | i <= j} (!cstream(TKstring), int i, int j): Strptr1

    cstream_strptr_get_range

    Synopsis

    fun
    cstream_strptr_get_range
      {i,j:nat | i <= j} (!cstream(TKstrptr), int i, int j): Strptr1

    cstream_make_string

    Synopsis

    fun cstream_make_string (string): cstream(TKstring)

    cstream_make_strptr

    Synopsis

    fun cstream_make_strptr (Strptr1): cstream(TKstrptr)

    cstream_make_fileref

    Synopsis

    fun
    cstream_make_fileref (FILEref): cstream(TKfileref)

    cstream_make_fileptr

    Synopsis

    fun
    cstream_make_fileptr
      {l:agz}{m:fmode}
      (file_mode_lte (m, r) | FILEptr(l, m)): cstream(TKfileptr)

    cstream_tokener.sats


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