#ifndef _MODULE_IO_
#define _MODULE_IO_

#include <__typemap.h>
#include <RT0.oh>
#include <Object.oh>
#include <Exception.oh>
#include <C.oh>
#include <RT0.oh>
#include <Object.oh>
#include <Exception.oh>
typedef struct IO__ChannelDesc *IO__Channel;
typedef struct IO__SelectionKeyDesc *IO__SelectionKey;
typedef IO__SelectionKey *IO__SelectionKeyList;
typedef struct IO__ChannelDesc {
  OOC_UINT32 readyOps;
  IO__SelectionKeyList keys;
} IO__ChannelDesc;
typedef struct IO__ByteChannelDesc *IO__ByteChannel;
typedef struct IO__ByteChannelDesc {
  OOC_UINT32 readyOps;
  IO__SelectionKeyList keys;
} IO__ByteChannelDesc;
typedef struct IO__SelectorDesc *IO__Selector;
typedef struct IO__SelectorDesc {
  IO__SelectionKey keys;
  OOC_CHAR8 cancel;
} IO__SelectorDesc;
typedef OOC_INT32 IO__FileDescriptor;
typedef struct IO__SelectionKeyDesc {
  OOC_INT32 fd;
  OOC_UINT32 interestOps;
  Object__Object attachment;
  IO__Selector selector;
  IO__Channel channel;
  IO__SelectionKey nextKey;
  OOC_CHAR8 cancel;
} IO__SelectionKeyDesc;
#define IO__opRead 0
#define IO__opWrite 1
#define IO__opAccept 2
#define IO__opConnect 3
typedef struct IO__ErrorDesc *IO__Error;
typedef struct IO__ErrorDesc {
  Object__String msg;
  OOC_PTR backtrace[21];
  OOC_INT32 backtraceSize;
} IO__ErrorDesc;
typedef struct IO__FileNotFoundDesc *IO__FileNotFound;
typedef struct IO__FileNotFoundDesc {
  Object__String msg;
  OOC_PTR backtrace[21];
  OOC_INT32 backtraceSize;
} IO__FileNotFoundDesc;
typedef struct IO__AccessDeniedDesc *IO__AccessDenied;
typedef struct IO__AccessDeniedDesc {
  Object__String msg;
  OOC_PTR backtrace[21];
  OOC_INT32 backtraceSize;
} IO__AccessDeniedDesc;
typedef struct IO__FileExistsDesc *IO__FileExists;
typedef struct IO__FileExistsDesc {
  Object__String msg;
  OOC_PTR backtrace[21];
  OOC_INT32 backtraceSize;
} IO__FileExistsDesc;
typedef struct IO__FileBusyDesc *IO__FileBusy;
typedef struct IO__FileBusyDesc {
  Object__String msg;
  OOC_PTR backtrace[21];
  OOC_INT32 backtraceSize;
} IO__FileBusyDesc;
typedef struct IO__InvalidArgumentDesc *IO__InvalidArgument;
typedef struct IO__InvalidArgumentDesc {
  Object__String msg;
  OOC_PTR backtrace[21];
  OOC_INT32 backtraceSize;
} IO__InvalidArgumentDesc;
typedef struct IO__OutOfRangeDesc *IO__OutOfRange;
typedef struct IO__OutOfRangeDesc {
  Object__String msg;
  OOC_PTR backtrace[21];
  OOC_INT32 backtraceSize;
} IO__OutOfRangeDesc;
typedef struct IO__NotImplementedDesc *IO__NotImplemented;
typedef struct IO__NotImplementedDesc {
  Object__String msg;
  OOC_PTR backtrace[21];
  OOC_INT32 backtraceSize;
} IO__NotImplementedDesc;
typedef struct IO__FormatErrorDesc *IO__FormatError;
typedef struct IO__FormatErrorDesc {
  Object__String msg;
  OOC_PTR backtrace[21];
  OOC_INT32 backtraceSize;
} IO__FormatErrorDesc;
typedef struct IO__ProtocolErrorDesc *IO__ProtocolError;
typedef struct IO__ProtocolErrorDesc {
  Object__String msg;
  OOC_PTR backtrace[21];
  OOC_INT32 backtraceSize;
} IO__ProtocolErrorDesc;
typedef struct IO__ErrorResponseDesc *IO__ErrorResponse;
typedef struct IO__ErrorResponseDesc {
  Object__String msg;
  OOC_PTR backtrace[21];
  OOC_INT32 backtraceSize;
} IO__ErrorResponseDesc;
extern void IO__ErrorDesc_INIT(IO__Error e, Object__String msg);
#define _TBN_IO__ErrorDesc_INIT 1
typedef void (*_TBP_IO__ErrorDesc_INIT)(IO__Error e, Object__String msg);
extern IO__FormatError IO__NewFormatError(Object__String msg);
extern void NORETURN IO__RaiseFormatError(Object__String msg) NORETURN2;
extern void NORETURN IO__RaiseNotImplemented(void) NORETURN2;
extern void IO__InitSelectionKey(IO__SelectionKey k, OOC_INT32 fd, IO__Selector selector, IO__Channel channel, OOC_UINT32 ops, Object__Object attachment);
extern void IO__SelectionKeyDesc_Attach(IO__SelectionKey k, Object__Object obj);
#define _TBN_IO__SelectionKeyDesc_Attach 3
typedef void (*_TBP_IO__SelectionKeyDesc_Attach)(IO__SelectionKey k, Object__Object obj);
extern void IO__SelectionKeyDesc_Cancel(IO__SelectionKey k);
#define _TBN_IO__SelectionKeyDesc_Cancel 4
typedef void (*_TBP_IO__SelectionKeyDesc_Cancel)(IO__SelectionKey k);
extern void IO__SelectionKeyDesc_SetInterestOps(IO__SelectionKey k, OOC_UINT32 ops);
#define _TBN_IO__SelectionKeyDesc_SetInterestOps 5
typedef void (*_TBP_IO__SelectionKeyDesc_SetInterestOps)(IO__SelectionKey k, OOC_UINT32 ops);
extern void IO__InitSelector(IO__Selector s);
extern void IO__SelectorDesc_Close(IO__Selector s);
#define _TBN_IO__SelectorDesc_Close 4
typedef void (*_TBP_IO__SelectorDesc_Close)(IO__Selector s);
extern OOC_INT32 IO__SelectorDesc_Select(IO__Selector s, OOC_INT32 sec, OOC_INT32 usec);
#define _TBN_IO__SelectorDesc_Select 8
typedef OOC_INT32 (*_TBP_IO__SelectorDesc_Select)(IO__Selector s, OOC_INT32 sec, OOC_INT32 usec);
extern IO__SelectionKey IO__SelectorDesc_NextKey(IO__Selector s);
#define _TBN_IO__SelectorDesc_NextKey 5
typedef IO__SelectionKey (*_TBP_IO__SelectorDesc_NextKey)(IO__Selector s);
extern IO__SelectionKey IO__SelectorDesc_AddSelectionKey(IO__Selector s, OOC_INT32 fd, IO__Channel channel, OOC_UINT32 ops, Object__Object attachment);
#define _TBN_IO__SelectorDesc_AddSelectionKey 3
typedef IO__SelectionKey (*_TBP_IO__SelectorDesc_AddSelectionKey)(IO__Selector s, OOC_INT32 fd, IO__Channel channel, OOC_UINT32 ops, Object__Object attachment);
extern void IO__SelectorDesc_RemoveSelectionKey(IO__Selector s, IO__SelectionKey k);
#define _TBN_IO__SelectorDesc_RemoveSelectionKey 7
typedef void (*_TBP_IO__SelectorDesc_RemoveSelectionKey)(IO__Selector s, IO__SelectionKey k);
extern void IO__SelectorDesc_RemoveCanceled(IO__Selector s);
#define _TBN_IO__SelectorDesc_RemoveCanceled 6
typedef void (*_TBP_IO__SelectorDesc_RemoveCanceled)(IO__Selector s);
extern void IO__InitChannel(IO__Channel ch);
extern OOC_INT32 IO__ChannelDesc_FileDescriptor(IO__Channel ch);
#define _TBN_IO__ChannelDesc_FileDescriptor 2
typedef OOC_INT32 (*_TBP_IO__ChannelDesc_FileDescriptor)(IO__Channel ch);
extern IO__SelectionKey IO__ChannelDesc_RegisterWithSelector(IO__Channel ch, IO__Selector sel, OOC_UINT32 ops, Object__Object attachment);
#define _TBN_IO__ChannelDesc_RegisterWithSelector 4
typedef IO__SelectionKey (*_TBP_IO__ChannelDesc_RegisterWithSelector)(IO__Channel ch, IO__Selector sel, OOC_UINT32 ops, Object__Object attachment);
extern IO__SelectionKey IO__ChannelDesc_KeyForSelector(IO__Channel ch, IO__Selector sel);
#define _TBN_IO__ChannelDesc_KeyForSelector 3
typedef IO__SelectionKey (*_TBP_IO__ChannelDesc_KeyForSelector)(IO__Channel ch, IO__Selector sel);
extern void IO__ChannelDesc_SetBlocking(IO__Channel ch, OOC_CHAR8 block);
#define _TBN_IO__ChannelDesc_SetBlocking 5
typedef void (*_TBP_IO__ChannelDesc_SetBlocking)(IO__Channel ch, OOC_CHAR8 block);
extern void IO__ChannelDesc_Close(IO__Channel ch);
#define _TBN_IO__ChannelDesc_Close 0
typedef void (*_TBP_IO__ChannelDesc_Close)(IO__Channel ch);
extern void IO__ChannelDesc_CloseAndRegister(IO__Channel ch);
#define _TBN_IO__ChannelDesc_CloseAndRegister 1
typedef void (*_TBP_IO__ChannelDesc_CloseAndRegister)(IO__Channel ch);
extern void IO__InitByteChannel(IO__ByteChannel ch);
extern void IO__ChannelDesc_SetPos(IO__Channel ch, OOC_INT32 pos);
#define _TBN_IO__ChannelDesc_SetPos 6
typedef void (*_TBP_IO__ChannelDesc_SetPos)(IO__Channel ch, OOC_INT32 pos);
extern OOC_INT32 IO__ByteChannelDesc_Read(IO__ByteChannel ch, OOC_CHAR8 buffer[], OOC_LEN buffer_0d, OOC_INT32 start, OOC_INT32 length);
#define _TBN_IO__ByteChannelDesc_Read 8
typedef OOC_INT32 (*_TBP_IO__ByteChannelDesc_Read)(IO__ByteChannel ch, OOC_CHAR8 buffer[], OOC_LEN buffer_0d, OOC_INT32 start, OOC_INT32 length);
extern OOC_INT32 IO__ByteChannelDesc_Write(IO__ByteChannel ch, const OOC_CHAR8 buffer[], OOC_LEN buffer_0d, OOC_INT32 start, OOC_INT32 length);
#define _TBN_IO__ByteChannelDesc_Write 10
typedef OOC_INT32 (*_TBP_IO__ByteChannelDesc_Write)(IO__ByteChannel ch, const OOC_CHAR8 buffer[], OOC_LEN buffer_0d, OOC_INT32 start, OOC_INT32 length);
extern void IO__ByteChannelDesc_Flush(IO__ByteChannel ch);
#define _TBN_IO__ByteChannelDesc_Flush 7
typedef void (*_TBP_IO__ByteChannelDesc_Flush)(IO__ByteChannel ch);
extern OOC_INT32 IO__ByteChannelDesc_TransferTo(IO__ByteChannel ch, OOC_INT32 length, IO__ByteChannel target);
#define _TBN_IO__ByteChannelDesc_TransferTo 9
typedef OOC_INT32 (*_TBP_IO__ByteChannelDesc_TransferTo)(IO__ByteChannel ch, OOC_INT32 length, IO__ByteChannel target);
extern void OOC_IO_init(void);
extern void OOC_IO_init0(void);

/* run-time meta data */
extern RT0__StructDesc _td_IO__Channel;
extern RT0__StructDesc _td_IO__SelectionKey;
extern RT0__StructDesc _td_IO__2046;
extern RT0__StructDesc _td_IO__SelectionKeyList;
extern RT0__StructDesc _td_IO__ChannelDesc;
extern RT0__StructDesc _td_IO__ByteChannel;
extern RT0__StructDesc _td_IO__ByteChannelDesc;
extern RT0__StructDesc _td_IO__Selector;
extern RT0__StructDesc _td_IO__SelectorDesc;
extern RT0__StructDesc _td_IO__SelectionKeyDesc;
extern RT0__StructDesc _td_IO__Error;
extern RT0__StructDesc _td_IO__ErrorDesc;
extern RT0__StructDesc _td_IO__FileNotFound;
extern RT0__StructDesc _td_IO__FileNotFoundDesc;
extern RT0__StructDesc _td_IO__AccessDenied;
extern RT0__StructDesc _td_IO__AccessDeniedDesc;
extern RT0__StructDesc _td_IO__FileExists;
extern RT0__StructDesc _td_IO__FileExistsDesc;
extern RT0__StructDesc _td_IO__FileBusy;
extern RT0__StructDesc _td_IO__FileBusyDesc;
extern RT0__StructDesc _td_IO__InvalidArgument;
extern RT0__StructDesc _td_IO__InvalidArgumentDesc;
extern RT0__StructDesc _td_IO__OutOfRange;
extern RT0__StructDesc _td_IO__OutOfRangeDesc;
extern RT0__StructDesc _td_IO__NotImplemented;
extern RT0__StructDesc _td_IO__NotImplementedDesc;
extern RT0__StructDesc _td_IO__FormatError;
extern RT0__StructDesc _td_IO__FormatErrorDesc;
extern RT0__StructDesc _td_IO__ProtocolError;
extern RT0__StructDesc _td_IO__ProtocolErrorDesc;
extern RT0__StructDesc _td_IO__ErrorResponse;
extern RT0__StructDesc _td_IO__ErrorResponseDesc;
extern RT0__StructDesc _td_IO__15225;
extern RT0__StructDesc _td_IO__16553;
extern RT0__StructDesc _td_IO__17905;
#endif /* _MODULE_IO_ */

/* --- */
