/* voc 2.1.0 [2025/05/18] for gcc LP64 on slackware xtspaF */

#ifndef oocChannel__h
#define oocChannel__h

#include "SYSTEM.h"
#include "oocMsg.h"
#include "oocTime.h"

typedef
	struct oocChannel_ChannelDesc *oocChannel_Channel;

typedef
	struct oocChannel_ChannelDesc {
		oocMsg_Msg res;
		BOOLEAN readable, writable, open;
	} oocChannel_ChannelDesc;

import void oocChannel_Channel_ClearError (oocChannel_Channel ch);
import void oocChannel_Channel_Close (oocChannel_Channel ch);
import void oocChannel_Channel_Flush (oocChannel_Channel ch);
import void oocChannel_Channel_GetModTime (oocChannel_Channel ch, oocTime_TimeStamp *mtime, ADDRESS *mtime__typ);
import INT32 oocChannel_Channel_Length (oocChannel_Channel ch);
typedef
	struct oocChannel_ReaderDesc *oocChannel_Reader;

import oocChannel_Reader oocChannel_Channel_NewReader (oocChannel_Channel ch);
typedef
	struct oocChannel_WriterDesc *oocChannel_Writer;

import oocChannel_Writer oocChannel_Channel_NewWriter (oocChannel_Channel ch);
#define __oocChannel_Channel_ClearError(ch) __SEND(__TYPEOF(ch), 0, void(*)(oocChannel_Channel), (ch))
#define __oocChannel_Channel_Close(ch) __SEND(__TYPEOF(ch), 1, void(*)(oocChannel_Channel), (ch))
#define __oocChannel_Channel_Flush(ch) __SEND(__TYPEOF(ch), 2, void(*)(oocChannel_Channel), (ch))
#define __oocChannel_Channel_GetModTime(ch, mtime, mtime__typ) __SEND(__TYPEOF(ch), 3, void(*)(oocChannel_Channel, oocTime_TimeStamp*, ADDRESS *), (ch, mtime, mtime__typ))
#define __oocChannel_Channel_Length(ch) __SEND(__TYPEOF(ch), 4, INT32(*)(oocChannel_Channel), (ch))
#define __oocChannel_Channel_NewReader(ch) __SEND(__TYPEOF(ch), 5, oocChannel_Reader(*)(oocChannel_Channel), (ch))
#define __oocChannel_Channel_NewWriter(ch) __SEND(__TYPEOF(ch), 6, oocChannel_Writer(*)(oocChannel_Channel), (ch))

typedef
	struct oocChannel_ErrorContextDesc *oocChannel_ErrorContext;

typedef
	struct oocChannel_ErrorContextDesc { /* oocMsg_ContextDesc */
		oocMsg_StringPtr id;
	} oocChannel_ErrorContextDesc;

import void oocChannel_ErrorContext_GetTemplate (oocChannel_ErrorContext context, oocMsg_Msg msg, CHAR *templ, ADDRESS templ__len);

typedef
	struct oocChannel_ReaderDesc {
		oocChannel_Channel base;
		oocMsg_Msg res;
		INT32 bytesRead;
		BOOLEAN positionable;
	} oocChannel_ReaderDesc;

import INT32 oocChannel_Reader_Available (oocChannel_Reader r);
import void oocChannel_Reader_ClearError (oocChannel_Reader r);
import INT32 oocChannel_Reader_Pos (oocChannel_Reader r);
import void oocChannel_Reader_ReadByte (oocChannel_Reader r, SYSTEM_BYTE *x);
import void oocChannel_Reader_ReadBytes (oocChannel_Reader r, SYSTEM_BYTE *x, ADDRESS x__len, INT32 start, INT32 n);
import void oocChannel_Reader_SetPos (oocChannel_Reader r, INT32 newPos);
#define __oocChannel_Reader_Available(r) __SEND(__TYPEOF(r), 0, INT32(*)(oocChannel_Reader), (r))
#define __oocChannel_Reader_ClearError(r) __SEND(__TYPEOF(r), 1, void(*)(oocChannel_Reader), (r))
#define __oocChannel_Reader_Pos(r) __SEND(__TYPEOF(r), 2, INT32(*)(oocChannel_Reader), (r))
#define __oocChannel_Reader_ReadByte(r, x) __SEND(__TYPEOF(r), 3, void(*)(oocChannel_Reader, SYSTEM_BYTE*), (r, x))
#define __oocChannel_Reader_ReadBytes(r, x, x__len, start, n) __SEND(__TYPEOF(r), 4, void(*)(oocChannel_Reader, SYSTEM_BYTE*, ADDRESS , INT32, INT32), (r, x, x__len, start, n))
#define __oocChannel_Reader_SetPos(r, newPos) __SEND(__TYPEOF(r), 5, void(*)(oocChannel_Reader, INT32), (r, newPos))

typedef
	struct oocChannel_WriterDesc {
		oocChannel_Channel base;
		oocMsg_Msg res;
		INT32 bytesWritten;
		BOOLEAN positionable;
	} oocChannel_WriterDesc;

import void oocChannel_Writer_ClearError (oocChannel_Writer w);
import INT32 oocChannel_Writer_Pos (oocChannel_Writer w);
import void oocChannel_Writer_SetPos (oocChannel_Writer w, INT32 newPos);
import void oocChannel_Writer_WriteByte (oocChannel_Writer w, SYSTEM_BYTE x);
import void oocChannel_Writer_WriteBytes (oocChannel_Writer w, SYSTEM_BYTE *x, ADDRESS x__len, INT32 start, INT32 n);
#define __oocChannel_Writer_ClearError(w) __SEND(__TYPEOF(w), 0, void(*)(oocChannel_Writer), (w))
#define __oocChannel_Writer_Pos(w) __SEND(__TYPEOF(w), 1, INT32(*)(oocChannel_Writer), (w))
#define __oocChannel_Writer_SetPos(w, newPos) __SEND(__TYPEOF(w), 2, void(*)(oocChannel_Writer, INT32), (w, newPos))
#define __oocChannel_Writer_WriteByte(w, x) __SEND(__TYPEOF(w), 3, void(*)(oocChannel_Writer, SYSTEM_BYTE), (w, x))
#define __oocChannel_Writer_WriteBytes(w, x, x__len, start, n) __SEND(__TYPEOF(w), 4, void(*)(oocChannel_Writer, SYSTEM_BYTE*, ADDRESS , INT32, INT32), (w, x, x__len, start, n))



import ADDRESS *oocChannel_ChannelDesc__typ;
import ADDRESS *oocChannel_ReaderDesc__typ;
import ADDRESS *oocChannel_WriterDesc__typ;
import ADDRESS *oocChannel_ErrorContextDesc__typ;

import void *oocChannel__init(void);


#endif // oocChannel
