UNIT AMARQUEE;

INTERFACE
USES Exec;

VAR AMarqueeBase : pLibrary;

FUNCTION QFreeSession(session : pQSession) : int32INT;
FUNCTION QDebugOp(session : pQSession; string : pSHORTINT) : int32INT;
FUNCTION QGetOp(session : pQSession; path : pSHORTINT; maxBytes : int32INT) : int32INT;
FUNCTION QDeleteOp(session : pQSession; path : pSHORTINT) : int32INT;
FUNCTION QRenameOp(session : pQSession; path : pSHORTINT; label : pSHORTINT) : int32INT;
FUNCTION QSubscribeOp(session : pQSession; path : pSHORTINT; maxBytes : int32INT) : int32INT;
FUNCTION QSetOp(session : pQSession; path : pSHORTINT; buf : POINTER; len : CARDINAL) : int32INT;
FUNCTION QClearSubscriptionsOp(session : pQSession; which : int32INT) : int32INT;
FUNCTION QPingOp(session : pQSession) : int32INT;
FUNCTION QInfoOp(session : pQSession) : int32INT;
FUNCTION QSetAccessOp(session : pQSession; hosts : pSHORTINT) : int32INT;
PROCEDURE FreeQMessage(session : pQSession; qmsg : pQMessage);
FUNCTION QGo(session : pQSession; sync : CARDINAL) : int32INT;
FUNCTION QStreamOp(session : pQSession; path : pSHORTINT; buf : POINTER; len : CARDINAL) : int32INT;
FUNCTION QSetMessageAccessOp(session : pQSession; access : pSHORTINT; maxbytes : int32INT) : int32INT;
FUNCTION QMessageOp(session : pQSession; hosts : pSHORTINT; buffer : POINTER; len : CARDINAL) : int32INT;
FUNCTION QNumQueuedPackets(session : pQSession) : CARDINAL;
FUNCTION QNumQueuedBytes(session : pQSession) : CARDINAL;
FUNCTION QErrorName(session : int32INT) : pSHORTINT;
FUNCTION QRequestPrivilegesOp(session : pQSession; privBits : CARDINAL) : int32INT;
FUNCTION QReleasePrivilegesOp(session : pQSession; privBits : CARDINAL) : int32INT;
FUNCTION QKillClientsOp(session : pQSession; hosts : pSHORTINT) : int32INT;
FUNCTION QSetParameterOp(session : pQSession; paramName : pSHORTINT; newValue : pSHORTINT) : int32INT;
FUNCTION QGetParameterOp(session : pQSession; paramName : pSHORTINT) : int32INT;
FUNCTION QSysMessageOp(session : pQSession; hosts : pSHORTINT; message : pSHORTINT) : int32INT;
FUNCTION QGetAndSubscribeOp(session : pQSession; path : pSHORTINT; maxBytes : int32INT) : int32INT;
FUNCTION QDetachSession(session : pQSession; flags : CARDINAL) : BOOLEAN;
FUNCTION QReattachSession(session : pQSession; flags : CARDINAL) : BOOLEAN;
FUNCTION QNewSocketSession(host : pSHORTINT; port : int32INT; tags : pTagItem) : pQSession;
FUNCTION QSendRawOp(session : pQSession; buf : POINTER; len : CARDINAL) : int32INT;
FUNCTION QNewSocketSessionAsync(host : pSHORTINT; port : int32INT; tags : pTagItem) : pQSession;
FUNCTION QNewSocketServerSession(VAR port : int32INT; tags : pTagItem) : pQSession;
FUNCTION QSetKeyAccessOp(session : pQSession; path : pSHORTINT; hosts : pSHORTINT) : int32INT;
FUNCTION QGetHostName(session : pQSession) : pSHORTINT;
FUNCTION QGetProgName(session : pQSession) : pSHORTINT;
PROCEDURE QSetMaxRawBufSize(session : pQSession; maxBufSize : CARDINAL);
FUNCTION QNewSession(host : pSHORTINT; port : int32INT; name : pSHORTINT; taglist : pTagItem) : pQSession;
FUNCTION QNewSessionAsync(host : pSHORTINT; port : int32INT; name : pSHORTINT; taglist : pTagItem) : pQSession;
FUNCTION QNewHostSession(hostnames : pSHORTINT; VAR port : int32INT; names : pSHORTINT; taglist : pTagItem) : pQSession;
FUNCTION QNewServerSession(hostNames : pSHORTINT; progNames : pSHORTINT; taglist : pTagItem) : pQSession;
FUNCTION QCreateSharedMessagePort : pQSharedMessagePort;
PROCEDURE QDeleteSharedMessagePort(mp : pQSharedMessagePort);
FUNCTION QGetLocalIP(session : pQSession) : pSHORTINT;

IMPLEMENTATION

FUNCTION QFreeSession(session : pQSession) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	AMarqueeBase,A6
	JSR	-036(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QDebugOp(session : pQSession; string : pSHORTINT) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	string,A1
	MOVEA.L	AMarqueeBase,A6
	JSR	-042(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QGetOp(session : pQSession; path : pSHORTINT; maxBytes : int32INT) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	path,A1
	MOVE.L	maxBytes,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-048(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QDeleteOp(session : pQSession; path : pSHORTINT) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	path,A1
	MOVEA.L	AMarqueeBase,A6
	JSR	-054(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QRenameOp(session : pQSession; path : pSHORTINT; label : pSHORTINT) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	path,A1
	MOVE.L	label,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-060(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QSubscribeOp(session : pQSession; path : pSHORTINT; maxBytes : int32INT) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	path,A1
	MOVE.L	maxBytes,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-066(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QSetOp(session : pQSession; path : pSHORTINT; buf : POINTER; len : CARDINAL) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	path,A1
	MOVE.L	buf,D0
	MOVE.L	len,D1
	MOVEA.L	AMarqueeBase,A6
	JSR	-072(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QClearSubscriptionsOp(session : pQSession; which : int32INT) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVE.L	which,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-078(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QPingOp(session : pQSession) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	AMarqueeBase,A6
	JSR	-084(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QInfoOp(session : pQSession) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	AMarqueeBase,A6
	JSR	-090(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QSetAccessOp(session : pQSession; hosts : pSHORTINT) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	hosts,A1
	MOVEA.L	AMarqueeBase,A6
	JSR	-096(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

PROCEDURE FreeQMessage(session : pQSession; qmsg : pQMessage);
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	qmsg,A1
	MOVEA.L	AMarqueeBase,A6
	JSR	-102(A6)
	MOVEA.L	(A7)+,A6
  END;
END;

FUNCTION QGo(session : pQSession; sync : CARDINAL) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVE.L	sync,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-108(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QStreamOp(session : pQSession; path : pSHORTINT; buf : POINTER; len : CARDINAL) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	path,A1
	MOVE.L	buf,D0
	MOVE.L	len,D1
	MOVEA.L	AMarqueeBase,A6
	JSR	-120(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QSetMessageAccessOp(session : pQSession; access : pSHORTINT; maxbytes : int32INT) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	access,A1
	MOVE.L	maxbytes,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-132(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QMessageOp(session : pQSession; hosts : pSHORTINT; buffer : POINTER; len : CARDINAL) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	hosts,A1
	MOVE.L	buffer,D0
	MOVE.L	len,D1
	MOVEA.L	AMarqueeBase,A6
	JSR	-138(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QNumQueuedPackets(session : pQSession) : CARDINAL;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	AMarqueeBase,A6
	JSR	-150(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QNumQueuedBytes(session : pQSession) : CARDINAL;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	AMarqueeBase,A6
	JSR	-156(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QErrorName(session : int32INT) : pSHORTINT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVE.L	session,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-162(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QRequestPrivilegesOp(session : pQSession; privBits : CARDINAL) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVE.L	privBits,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-168(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QReleasePrivilegesOp(session : pQSession; privBits : CARDINAL) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVE.L	privBits,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-174(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QKillClientsOp(session : pQSession; hosts : pSHORTINT) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	hosts,A1
	MOVEA.L	AMarqueeBase,A6
	JSR	-180(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QSetParameterOp(session : pQSession; paramName : pSHORTINT; newValue : pSHORTINT) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	paramName,A1
	MOVE.L	newValue,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-186(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QGetParameterOp(session : pQSession; paramName : pSHORTINT) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	paramName,A1
	MOVEA.L	AMarqueeBase,A6
	JSR	-192(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QSysMessageOp(session : pQSession; hosts : pSHORTINT; message : pSHORTINT) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	hosts,A1
	MOVE.L	message,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-198(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QGetAndSubscribeOp(session : pQSession; path : pSHORTINT; maxBytes : int32INT) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	path,A1
	MOVE.L	maxBytes,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-210(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QDetachSession(session : pQSession; flags : CARDINAL) : BOOLEAN;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVE.L	flags,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-216(A6)
	MOVEA.L	(A7)+,A6
	TST.W	D0
	BEQ.B	@end
	MOVEQ	#1,D0
  @end:	MOVE.B	D0,@RESULT
  END;
END;

FUNCTION QReattachSession(session : pQSession; flags : CARDINAL) : BOOLEAN;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVE.L	flags,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-222(A6)
	MOVEA.L	(A7)+,A6
	TST.W	D0
	BEQ.B	@end
	MOVEQ	#1,D0
  @end:	MOVE.B	D0,@RESULT
  END;
END;

FUNCTION QNewSocketSession(host : pSHORTINT; port : int32INT; tags : pTagItem) : pQSession;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	host,A0
	MOVE.L	port,D0
	MOVEA.L	tags,A1
	MOVEA.L	AMarqueeBase,A6
	JSR	-228(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QSendRawOp(session : pQSession; buf : POINTER; len : CARDINAL) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	buf,A1
	MOVE.L	len,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-234(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QNewSocketSessionAsync(host : pSHORTINT; port : int32INT; tags : pTagItem) : pQSession;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	host,A0
	MOVE.L	port,D0
	MOVEA.L	tags,A1
	MOVEA.L	AMarqueeBase,A6
	JSR	-240(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QNewSocketServerSession(VAR port : int32INT; tags : pTagItem) : pQSession;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	port,A0
	MOVEA.L	tags,A1
	MOVEA.L	AMarqueeBase,A6
	JSR	-246(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QSetKeyAccessOp(session : pQSession; path : pSHORTINT; hosts : pSHORTINT) : int32INT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	path,A1
	MOVE.L	hosts,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-252(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QGetHostName(session : pQSession) : pSHORTINT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	AMarqueeBase,A6
	JSR	-258(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QGetProgName(session : pQSession) : pSHORTINT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	AMarqueeBase,A6
	JSR	-264(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

PROCEDURE QSetMaxRawBufSize(session : pQSession; maxBufSize : CARDINAL);
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVE.L	maxBufSize,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-270(A6)
	MOVEA.L	(A7)+,A6
  END;
END;

FUNCTION QNewSession(host : pSHORTINT; port : int32INT; name : pSHORTINT; taglist : pTagItem) : pQSession;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	host,A0
	MOVE.L	port,D0
	MOVEA.L	name,A1
	MOVE.L	taglist,D1
	MOVEA.L	AMarqueeBase,A6
	JSR	-276(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QNewSessionAsync(host : pSHORTINT; port : int32INT; name : pSHORTINT; taglist : pTagItem) : pQSession;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	host,A0
	MOVE.L	port,D0
	MOVEA.L	name,A1
	MOVE.L	taglist,D1
	MOVEA.L	AMarqueeBase,A6
	JSR	-282(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QNewHostSession(hostnames : pSHORTINT; VAR port : int32INT; names : pSHORTINT; taglist : pTagItem) : pQSession;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	hostnames,A0
	MOVEA.L	port,A1
	MOVE.L	names,D0
	MOVE.L	taglist,D1
	MOVEA.L	AMarqueeBase,A6
	JSR	-288(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QNewServerSession(hostNames : pSHORTINT; progNames : pSHORTINT; taglist : pTagItem) : pQSession;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	hostNames,A0
	MOVEA.L	progNames,A1
	MOVE.L	taglist,D0
	MOVEA.L	AMarqueeBase,A6
	JSR	-294(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

FUNCTION QCreateSharedMessagePort : pQSharedMessagePort;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	AMarqueeBase,A6
	JSR	-300(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

PROCEDURE QDeleteSharedMessagePort(mp : pQSharedMessagePort);
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	mp,A0
	MOVEA.L	AMarqueeBase,A6
	JSR	-306(A6)
	MOVEA.L	(A7)+,A6
  END;
END;

FUNCTION QGetLocalIP(session : pQSession) : pSHORTINT;
BEGIN
  ASM
	MOVE.L	A6,-(A7)
	MOVEA.L	session,A0
	MOVEA.L	AMarqueeBase,A6
	JSR	-312(A6)
	MOVEA.L	(A7)+,A6
	MOVE.L	D0,@RESULT
  END;
END;

END. (* UNIT AMARQUEE *)
