(* ****** ****** *)
//
// API in ATS for SDL2
//
(* ****** ****** *)

(*
** Permission to use, copy, modify, and distribute this software for any
** purpose with or without fee is hereby granted, provided that the above
** copyright notice and this permission notice appear in all copies.
** 
** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
** WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
** MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
** ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
** WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
** ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
** OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)

(* ****** ****** *)

(*
** Author: Hongwei Xi
** Authoremail: gmhwxiDOTgmailDOTcom
*)

(* ****** ****** *)

#include "./mybasis.sats"

(* ****** ****** *)
//
castfn
SDL_RWops_ptr2ptr
  {l:addr}(!SDL_RWops_ptr(l)):<> ptr(l)
//
overload ptrcast with SDL_RWops_ptr2ptr
//
(* ****** ****** *)
//
macdef
SDL_RWOPS_UNKNOWN = $extval (int, "SDL_RWOPS_UNKNOWN")
//
macdef
SDL_RWOPS_WINFILE = $extval (int, "SDL_RWOPS_WINFILE")
macdef
SDL_RWOPS_STDFILE = $extval (int, "SDL_RWOPS_STDFILE")
macdef
SDL_RWOPS_JNIFILE = $extval (int, "SDL_RWOPS_JNIFILE")
//
macdef SDL_RWOPS_MEMORY = $extval (int, "SDL_RWOPS_MEMORY")
macdef SDL_RWOPS_MEMORY_RO = $extval (int, "SDL_RWOPS_MEMORY_RO")
//
(* ****** ****** *)

fun SDL_RWFromFP
  (inp: FILEref, autoclose: bool): SDL_RWops_ptr0 = "mac#%"
// end of [SDL_RWFromFP]

(* ****** ****** *)

fun SDL_RWFromFile
  (path: NSH(string), mode: file_mode): SDL_RWops_ptr0 = "mac#%"
// end of [SDL_RWFromFile]

(* ****** ****** *)

fun SDL_RWFromMem (mem: ptr, size: int): SDL_RWops_ptr0 = "mac#%"
fun SDL_RWFromConstMem (mem: ptr, size: int): SDL_RWops_ptr0 = "mac#%"

(* ****** ****** *)

fun SDL_RWclose (rw: SDL_RWops_ptr0): void = "mac#%"

(* ****** ****** *)

fun SDL_RWread
(
  rw: !SDL_RWops_ptr1, bufp: ptr, size: size_t, nmemb: size_t
) : size_t = "mac#%" // end of [SDL_RWread]

fun SDL_RWwrite
(
  rw: !SDL_RWops_ptr1, bufp: ptr, size: size_t, nmemb: size_t
) : size_t = "mac#%" // end of [SDL_RWwrite]

(* ****** ****** *)

fun SDL_RWseek
(
  rw: !SDL_RWops_ptr1, ofs: Sint64, whence: int
) : Sint64 = "mac#%" // end of [SDL_RWseek]

fun SDL_RWtell (rw: !SDL_RWops_ptr1): Sint64 = "mac#%"

(* ****** ****** *)

(* end of [SDL_rwops.sats] *)
