/*
 * arexxsyslib.h -- Header file to use when accessing the public
 *                  functions in the ARexx system library (rexxsyslib).
 */

#ifndef AREXXSYSLIB_H_INCLUDED
#define AREXXSYSLIB_H_INCLUDED

#ifndef EXEC_TYPES_H
#include <exec/types.h>
#include <exec/nodes.h>
#include <exec/lists.h>
#include <exec/ports.h>
#include <exec/memory.h>
#endif

#ifndef REXX_STORAGE_H
#include <rexx/storage.h>
#include <rexx/rxslib.h>
#include <rexx/errors.h>
#endif

/*
 * When you open the rexxsyslib library, store the library pointer in
 * this variable.  If you use another variable, be sure to change the
 * pragma statements below.  Don't forget to actually define the variable
 * in one of your source files...
 */

extern struct Library *RexxSysBase;

/*
 * Prototypes for the public functions.
 */

extern char           *CreateArgstring( char *str, ULONG length );
extern void            DeleteArgstring( char *argstr );
extern ULONG           LengthArgstring( char *argstr );
extern struct RexxMsg *CreateRexxMsg( struct MsgPort *replyport,
                                      char *extension, char *hostaddress );
extern void            DeleteRexxMsg( struct RexxMsg *msg );
extern void            ClearRexxMsg( struct RexxMsg *msg, ULONG numargs );
extern long            FillRexxMsg( struct RexxMsg *msg, ULONG numargs,
                                    ULONG mask );
extern long            IsRexxMsg( struct RexxMsg *msg );

/*
 * This section defines the pragmas required to access the functions
 * in the shared library.  Note that Manx and SAS use different syntax.
 */

#if defined( AZTEC_C )

    #pragma amicall( RexxSysBase, 0x9c, ClearRexxMsg(a0,d0) )
    #pragma amicall( RexxSysBase, 0x7e, CreateArgstring(a0,d0) )
    #pragma amicall( RexxSysBase, 0x90, CreateRexxMsg(a0,a1,d0) )
    #pragma amicall( RexxSysBase, 0x84, DeleteArgstring(a0) )
    #pragma amicall( RexxSysBase, 0x96, DeleteRexxMsg(a0) )
    #pragma amicall( RexxSysBase, 0xa2, FillRexxMsg(a0,d0,d1) )
    #pragma amicall( RexxSysBase, 0xa8, IsRexxMsg(a0) )
    #pragma amicall( RexxSysBase, 0x8a, LengthArgstring(a0) )

#elif defined( LATTICE )

    #pragma libcall RexxSysBase ClearRexxMsg 9c 0802
    #pragma libcall RexxSysBase CreateArgstring 7e 0802
    #pragma libcall RexxSysBase CreateRexxMsg 90 09803
    #pragma libcall RexxSysBase DeleteArgstring 84 801
    #pragma libcall RexxSysBase DeleteRexxMsg 96 801
    #pragma libcall RexxSysBase FillRexxMsg a2 10803
    #pragma libcall RexxSysBase IsRexxMsg a8 801
    #pragma libcall RexxSysBase LengthArgstring 8a 801

#endif

#endif /* AREXXSYSLIB_H_INCLUDED */
