/*---------------------------------------------------------------------------
  Copyright 2026, Microsoft Research, Daan Leijen, Tim Whiting.

  This is free software; you can redistribute it and/or modify it under the
  terms of the Apache License, Version 2.0. A copy of the License can be
  found in the LICENSE file at the root of this distribution.
---------------------------------------------------------------------------*/
module uv/filestd/async/api/uv/file

import std/num/int32std/num/int32
import std/num/int64std/num/int64
import uv/evloopuv/evloop

extern import
  c  file "file.c"
  js file "file.js" 

pub extern fd-flags-from-filemodestd/async/api/uv/file/fd-flags-from-filemode: (fmode : int32) -> int32( fmodefmode: int32 : int32std/core/types/int32: V ) : int32std/core/types/int32: V
  c  "kk_uv_fd_flags_from_filemode"
  js "kk_fd_flags_from_filemode"
  
pub extern fd-open-setupstd/async/api/uv/file/fd-open-setup: (evloop : any, fpath : string, flags : int32, mode : int32, cb : (error<ssize_t>) -> ioc ()) -> ioc error<() -> ioc ()>( evloopevloop: any : anystd/core/types/any: V, fpathfpath: string : stringstd/core/types/string: V, flagsflags: int32 : int32std/core/types/int32: V, modemode: int32 : int32std/core/types/int32: V, cbcb: (error<ssize_t>) -> ioc () : errorstd/core/exn/error: V -> V<ssize_tstd/core/types/ssize_t: V> -> iocstd/core/ioc: E (std/core/types/unit: V)std/core/types/unit: V ) : iocstd/core/ioc: E errorstd/core/exn/error: V -> V<() -> iocstd/core/ioc: E (std/core/types/unit: V)std/core/types/unit: V>
  c  "kk_uv_fd_open_setup"
  js "kk_fd_open_setup" 

pub extern fd-close-setupstd/async/api/uv/file/fd-close-setup: (evloop : any, fd : ssize_t, cb : (error<ssize_t>) -> ioc ()) -> ioc error<() -> ioc ()>( evloopevloop: any : anystd/core/types/any: V, fdfd: ssize_t : ssize_tstd/core/types/ssize_t: V, cbcb: (error<ssize_t>) -> ioc () : errorstd/core/exn/error: V -> V<ssize_tstd/core/types/ssize_t: V> -> iocstd/core/ioc: E (std/core/types/unit: V)std/core/types/unit: V ) : iocstd/core/ioc: E errorstd/core/exn/error: V -> V<() -> iocstd/core/ioc: E (std/core/types/unit: V)std/core/types/unit: V>
  c  "kk_uv_fd_close"
  js "kk_fd_close_setup"

pub extern fd-read-setupstd/async/api/uv/file/fd-read-setup: (evloop : any, fd : ssize_t, buf : bytes, offset : int64, cb : (error<ssize_t>) -> ioc ()) -> ioc error<() -> ioc ()>( evloopevloop: any : anystd/core/types/any: V, fdfd: ssize_t : ssize_tstd/core/types/ssize_t: V, bufbuf: bytes : bytesstd/core/types/bytes: V, offsetoffset: int64 : int64std/core/types/int64: V, cbcb: (error<ssize_t>) -> ioc () : errorstd/core/exn/error: V -> V<ssize_tstd/core/types/ssize_t: V> -> iocstd/core/ioc: E (std/core/types/unit: V)std/core/types/unit: V ) : iocstd/core/ioc: E errorstd/core/exn/error: V -> V<() -> iocstd/core/ioc: E (std/core/types/unit: V)std/core/types/unit: V>
  c  "kk_uv_fd_read"  
  js "kk_fd_read_setup"