@database "rexxsyslib"

@Node Main "rexxsyslib.doc"
@toc "Includes_&_Autodocs/Main"
    @{" ClearRexxMsg() " Link "ClearRexxMsg()"}
    @{" CreateArgstring() " Link "CreateArgstring()"}
    @{" CreateRexxMsg() " Link "CreateRexxMsg()"}
    @{" DeleteArgstring() " Link "DeleteArgstring()"}
    @{" DeleteRexxMsg() " Link "DeleteRexxMsg()"}
    @{" FillRexxMsg() " Link "FillRexxMsg()"}
    @{" IsRexxMsg() " Link "IsRexxMsg()"}
    @{" LengthArgstring() " Link "LengthArgstring()"}
    @{" LockRexxBase() " Link "LockRexxBase()"}
    @{" UnlockRexxBase() " Link "UnlockRexxBase()"}
@EndNode

@Node "ClearRexxMsg()" "rexxsyslib.library/ClearRexxMsg"

@{b}    NAME@{ub}
	ClearRexxMsg - Releases and clears the argument array in a @{"RexxMsg" Link "includes/rexx/storage.h/Main" 97}

@{b}    SYNOPSIS@{ub}
	ClearRexxMsg(msgptr, count)
	             A0      D0

	VOID ClearRexxMsg(struct @{"RexxMsg" Link "includes/rexx/storage.h/Main" 97} *,ULONG);

@{b}    FUNCTION@{ub}
	This function will @{"DeleteArgstring()" Link "DeleteArgstring()"} one or more argstrings from
	the @{"RexxMsg" Link "includes/rexx/storage.h/Main" 97} and clear the slot.  The count is used to select the
	number of slots to clear.

@{b}    INPUTS@{ub}
	msgptr - A pointer to a @{"RexxMsg" Link "includes/rexx/storage.h/Main" 97}
	count - The number of slots to be cleared.  The number can be from
	        1 to 16.  (There are 16 slots)

@{b}    RESULTS@{ub}
	All of the slots in the given count will be cleared and the argstring
	will have been released.

@{b}    SEE ALSO@{ub}
	@{"FillRexxMsg()" Link "FillRexxMsg()"}, @{"DeleteRexxMsg()" Link "DeleteRexxMsg()"}, @{"DeleteArgstring()" Link "DeleteArgstring()"}, @{"CreateArgstring()" Link "CreateArgstring()"}

@{b}    BUGS@{ub}
@EndNode

@Node "CreateArgstring()" "rexxsyslib.library/CreateArgstring"

@{b}    NAME@{ub}
	CreateArgstring - Create an argument string structure

@{b}    SYNOPSIS@{ub}
	argstr = CreateArgstring(string, length)
	D0,A0                    A0      D0

	@{"UBYTE" Link "includes/exec/types.h/Main" 46} *CreateArgstring(UBYTE *, ULONG);

@{b}    FUNCTION@{ub}
	Allocates a @{"RexxArg" Link "includes/rexx/storage.h/Main" 85} structure and copies the supplied string into it.
	The returned pointer points at the string part of the structure
	and can be treated like an ordinary string pointer.  (However, care
	must be taken that you do not change the string)

@{b}    INPUTS@{ub}
	string - A pointer at your input string
	length - The number of bytes of your input string you wish copied.
	         (NOTE:  You are limited to 65,535 byte strings)

@{b}    RESULTS@{ub}
	argstr - A pointer to the argument string.  The results are returned
	         in both A0 and D0.  You should always check the result
	         as an allocation failure would cause an error.

@{b}    SEE ALSO@{ub}
	@{"DeleteArgstring()" Link "DeleteArgstring()"}, @{"LengthArgstring()" Link "LengthArgstring()"}, @{"ClearRexxMsg()" Link "ClearRexxMsg()"}, @{"FillRexxMsg()" Link "FillRexxMsg()"}

@{b}    BUGS@{ub}
@EndNode

@Node "CreateRexxMsg()" "rexxsyslib.library/CreateRexxMsg"

@{b}    NAME@{ub}
	CreateRexxMsg - Create an ARexx message structure

@{b}    SYNOPSIS@{ub}
	rexxmsg = CreateRexxMsg(port, extension, host)
	D0,A0                   A0    A1         D0

	struct @{"RexxMsg" Link "includes/rexx/storage.h/Main" 97} *CreateRexxMsg(struct @{"MsgPort" Link "includes/exec/ports.h/Main" 27} *, @{"UBYTE" Link "includes/exec/types.h/Main" 46} *, @{"UBYTE" Link "includes/exec/types.h/Main" 46} *);

@{b}    FUNCTION@{ub}
	This functions allocates an ARexx message packet.  The @{"RexxMsg" Link "includes/rexx/storage.h/Main" 97}
	consists of a standard EXEC message structure extended to include
	the ARexx specific information.

@{b}    INPUTS@{ub}
	port - A pointer to a public or private message port.  This *MUST*
	       be a valid port as this is where the message will be replied.

	extension - A pointer to a NULL terminated string that is to be used
	            as the default extension for the REXX scripts.  If this
	            is NULL, the default is "REXX"

	host - A pointer to a NULL terminated string that is to be used
	       as the default host port.  The name must be the same as the
	       name of the public message port that is to be the default host.
	       If this field is NULL, the default is REXX.

@{b}    RESULTS@{ub}
	rexxmsg - A @{"RexxMsg" Link "includes/rexx/storage.h/Main" 97} structure

@{b}    NOTES@{ub}
	The extension and host strings must remain valid for as long as the
	@{"RexxMsg" Link "includes/rexx/storage.h/Main" 97} exists as only the pointer to those strings are stored.

@{b}    SEE ALSO@{ub}
	@{"DeleteRexxMsg()" Link "DeleteRexxMsg()"}, @{"ClearRexxMsg()" Link "ClearRexxMsg()"}, @{"FillRexxMsg()" Link "FillRexxMsg()"}

@{b}    BUGS@{ub}
@EndNode

@Node "DeleteArgstring()" "rexxsyslib.library/DeleteArgstring"

@{b}    NAME@{ub}
	DeleteArgstring - Releases an Argstring created by @{"CreateArgstring()" Link "CreateArgstring()"}

@{b}    SYNOPSIS@{ub}
	DeleteArgstring(argstring)
	                A0

	VOID DeleteArgstring(UBYTE *);

@{b}    FUNCTION@{ub}
	Releases an argstring.  The argstring must have been created by ARexx

@{b}    INPUTS@{ub}
	argstring - A pointer to the string buffer of an argstring.

@{b}    RESULTS@{ub}

@{b}    SEE ALSO@{ub}
	@{"CreateArgstring()" Link "CreateArgstring()"}, @{"ClearRexxMsg()" Link "ClearRexxMsg()"}, @{"FillRexxMsg()" Link "FillRexxMsg()"}

@{b}    BUGS@{ub}
@EndNode

@Node "DeleteRexxMsg()" "rexxsyslib.library/DeleteRexxMsg"

@{b}    NAME@{ub}
	DeleteRexxMsg - Releases a @{"RexxMsg" Link "includes/rexx/storage.h/Main" 97} structure created by @{"CreateRexxMsg()" Link "CreateRexxMsg()"}

@{b}    SYNOPSIS@{ub}
	DeleteRexxMsg(packet)
	              A0

	VOID DeleteRexxMsg(struct @{"RexxMsg" Link "includes/rexx/storage.h/Main" 97} *);

@{b}    FUNCTION@{ub}
	The function releases an ARexx message packet that was allocated
	with @{"CreateRexxMsg()" Link "CreateRexxMsg()"}.  Any argument fields in the @{"RexxMsg" Link "includes/rexx/storage.h/Main" 97} structure
	should be cleared before calling this function as it does
	not release them for you.

@{b}    INPUTS@{ub}
	packet - A pointer to a @{"RexxMsg" Link "includes/rexx/storage.h/Main" 97} structure allocated by @{"CreateRexxMsg()" Link "CreateRexxMsg()"}

@{b}    EXAMPLE@{ub}
	if (rmsg=CreateRexxMsg(myport,"myapp","MYAPP_PORT"))
	{
		/* Do my think with rmsg */
		ClearRexxMsg(rmsg,16);	/* We may not want to clear all 16 */
		DeleteRexxMsg(rmsg);
	}

@{b}    SEE ALSO@{ub}
	@{"CreateRexxMsg()" Link "CreateRexxMsg()"}, @{"ClearRexxMsg()" Link "ClearRexxMsg()"}

@{b}    BUGS@{ub}
@EndNode

@Node "FillRexxMsg()" "rexxsyslib.library/FillRexxMsg"

@{b}    NAME@{ub}
	FillRexxMsg - Fill the argument strings as needed

@{b}    SYNOPSIS@{ub}
	result = FillRexxMsg(msgptr, count, mask)
	D0                   A0      D0     D1 [0:15]

	@{"BOOL" Link "includes/exec/types.h/Main" 68} FillRexxMsg(struct @{"RexxMsg" Link "includes/rexx/storage.h/Main" 97} *,ULONG,ULONG);

@{b}    FUNCTION@{ub}
	This function will convert and install up to 16 argument strings into
	a @{"RexxMsg" Link "includes/rexx/storage.h/Main" 97} structure.  The message packet's argument fields must be
	set to either a pointer to a NULL terminated string or an integer value
	The mask, bits 0 to 15, correspond to the type of value is stored
	in the argument slot.  If the bit is cleared, the argument is a
	string pointer; if the bit is set, the argument is an integer.

@{b}    INPUTS@{ub}
	msgptr - Pointer to a @{"RexxMsg" Link "includes/rexx/storage.h/Main" 97} (allocated via CreateRexxMsg)
	count - The number of argument slots to fill in.  This number should
	        be from 1 to 16.

	mask - A bit mask corresponding to the 16 fields that is used to
	       determine the type of the field.

@{b}    RESULTS@{ub}
	result - A boolean.  If it is TRUE, the call worked.  If it is false,
	         some allocation did not work.  All argstrings that were
	         created will be released.

@{b}    SEE ALSO@{ub}
	@{"ClearRexxMsg()" Link "ClearRexxMsg()"}, @{"CreateArgstring()" Link "CreateArgstring()"}, @{"DeleteArgstring()" Link "DeleteArgstring()"}, @{"CreateRexxMsg()" Link "CreateRexxMsg()"}

@{b}    BUGS@{ub}
@EndNode

@Node "IsRexxMsg()" "rexxsyslib.library/IsRexxMsg"

@{b}    NAME@{ub}
	IsRexxMsg - Function to determine if a message came from ARexx

@{b}    SYNOPSIS@{ub}
	result = IsRexxMsg(msgptr)
	D0                 A0

	@{"BOOL" Link "includes/exec/types.h/Main" 68} IsRexxMsg(struct @{"RexxMsg" Link "includes/rexx/storage.h/Main" 97} *);

@{b}    FUNCTION@{ub}
	This function can be used to determine if a message came from an
	ARexx program.

@{b}    INPUTS@{ub}
	msgptr - A pointer to the suspected @{"RexxMsg" Link "includes/rexx/storage.h/Main" 97}.

@{b}    RESULTS@{ub}
	result - A boolean:  TRUE if it is an ARexx message, FALSE if not.

@{b}    SEE ALSO@{ub}
	@{"CreateRexxMsg()" Link "CreateRexxMsg()"}

@{b}    BUGS@{ub}
@EndNode

@Node "LengthArgstring()" "rexxsyslib.library/LengthArgstring"

@{b}    NAME@{ub}
	LengthArgstring - Returns the length value stored in the argstring

@{b}    SYNOPSIS@{ub}
	length = LengthArgstring(argstring)
	D0                       A0

	ULONG LengthArgstring(UBYTE *);

@{b}    FUNCTION@{ub}
	This function returns the length value stored in the argstring.
	This is *NOT* the same as doing a strlen() type call on the
	argstring.  (Note that argstrings may contain NULLs)

@{b}    INPUTS@{ub}
	argstring - A pointer to an argstring that was created by ARexx

@{b}    RESULTS@{ub}
	length - The length of the argstring.

@{b}    EXAMPLE@{ub}

@{b}    SEE ALSO@{ub}
	@{"CreateArgstring()" Link "CreateArgstring()"}

@{b}    BUGS@{ub}
@EndNode

@Node "LockRexxBase()" "rexxsyslib.library/LockRexxBase"

@{b}    NAME@{ub}
	LockRexxBase - Obtain a semaphore lock on the RexxBase structure

@{b}    SYNOPSIS@{ub}
	LockRexxBase(resource)
	             D0

	VOID LockRexxBase(ULONG);

@{b}    FUNCTION@{ub}
	Secures the specified resource in the ARexx library base.

@{b}    INPUTS@{ub}
	resource - A manifest constant defining which resource to lock.
	           ZERO locks all resources.

@{b}    NOTES@{ub}
	Currently, only ZERO resource type is available.  You *MUST* make
	sure that you do not call this function with an undefined value
	as it may become defined at some future date and cause unwanted
	behavior.

@{b}    SEE ALSO@{ub}
	@{"UnlockRexxBase()" Link "UnlockRexxBase()"}

@{b}    BUGS@{ub}
@EndNode

@Node "UnlockRexxBase()" "rexxsyslib.library/UnlockRexxBase"

@{b}    NAME@{ub}
	UnlockRexxBase - Release a semaphore lock on the RexxBase structure

@{b}    SYNOPSIS@{ub}
	UnlockRexxBase(resource)
	               D0

	VOID UnlockRexxBase(ULONG);

@{b}    FUNCTION@{ub}
	Releases the specified resource in the ARexx library base.

@{b}    INPUTS@{ub}
	resource - A manifest constant defining which resource to unlock.
	           This value *MUST* match the value used in the matching
	           @{"LockRexxBase()" Link "LockRexxBase()"} call.

@{b}    NOTES@{ub}
	Currently, only ZERO resource type is available.  You *MUST* make
	sure that you do not call this function with an undefined value
	as it may become defined at some future date and cause unwanted
	behavior.  You *MUST* make sure that you only call this function
	after a matching call to @{"LockRexxBase()" Link "LockRexxBase()"} was made.

@{b}    SEE ALSO@{ub}
	@{"LockRexxBase()" Link "LockRexxBase()"}

@{b}    BUGS@{ub}
@EndNode

