VSL - The prelude.libc Structure

# Copyright 2011  Petter Urkedal
#
# This file is part of the Viz Standard Library <http://www.vizlang.org/>.
#
# The Viz Standard Library (VSL) is free software: you can redistribute it
# and/or modify it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# The VSL is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
# more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with the VSL.  If not, see <http://www.gnu.org/licenses/>.

# This module will only contain libc bindings used in the prelude.

open prereq
open cabi.record
open record_sigs.phantoms

open:c "string.h"
open:c "unistd.h"
open:c "fcntl.h"
open:c "iconv.h"

val:c memmove : lens.r ψ uint8_t.ph  lens.r ψ uint8_t.ph  int  effect ψ unit

val:c getenv : string  io (option string)

val:c O_APPEND : int := "O_APPEND"
val:c O_ASYNC : int := "O_ASYNC"
val:c O_CREAT : int := "O_CREAT"
val:c O_EXCL : int := "O_EXCL"
val:c O_SYNC : int := "O_SYNC"
val:c O_TRUNC : int := "O_TRUNC"

val:c open2 : string  int  io int := "open"
val:c open3 : string  int  int  io int := "open"
val:c unsafe_read : int  lens.r ψ uint8_t.ph  int  io int := "read"
val:c close : int  io int

type:c iconv_t ψ := "iconv_t"
val:c iconv_open : string  string  effect ψ (iconv_t ψ)
val:c iconv_close : iconv_t ψ  effect ψ unit
val:c iconv : iconv_t ψ 
	lens.r ψ (ptr_ph uint8_t.ph)  lens.r ψ size_t.ph 
	lens.r ψ (ptr_ph uint8_t.ph)  lens.r ψ size_t.ph 
	effect ψ nint