/*
 * Source generated with ARexxBox 1.00 (Jun 19 1992)
 * which is Copyright (c) 1992 Michael Balzer
 */

#include <exec/types.h>
#include <exec/memory.h>
#include <dos/dos.h>
#include <rexx/storage.h>
#include <rexx/rxslib.h>

#ifdef __GNUC__
/* GCC needs all struct defs */
#include <dos/exall.h>
#include <graphics/graphint.h>
#include <intuition/classes.h>
#include <devices/keymap.h>
#include <exec/semaphores.h>
#endif

#include <clib/alib_protos.h>
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
#include <clib/rexxsyslib_protos.h>

#ifndef __NO_PRAGMAS

#ifdef AZTEC_C
#include <pragmas/exec_lib.h>
#include <pragmas/dos_lib.h>
#include <pragmas/rexxsyslib_lib.h>
#endif

#ifdef LATTICE
#include <pragmas/exec_pragmas.h>
#include <pragmas/dos_pragmas.h>
#include <pragmas/rexxsyslib_pragmas.h>
#endif

#endif /* __NO_PRAGMAS */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

#ifndef _toupper
#define _toupper(x) ((x) & 0x5f)
#endif

#include "rx_test.h"


extern struct Library *SysBase, *DOSBase, *RexxSysBase;


#include "/rxif/rx_help.c"

void rx_inout( struct RexxHost *host, struct rxd_inout **rxd, long action )
{
	struct rxd_inout *rd = *rxd;
	static long a1 = 4711;

	switch( action )
	{
		case RXIF_INIT:
			*rxd = calloc( sizeof *rd, 1 );
			if( rd = *rxd )
			{
				/* set your DEFAULTS here */
				rd->arg.arg1 = &a1;
			}
			break;
			
		case RXIF_ACTION:
			/* Insert your CODE here */
			printf( "\ninout var=%s, stem=%s, arg1=%ld\n",
				rd->arg.var ? rd->arg.var : "<n.a.>",
				rd->arg.stem ? rd->arg.stem : "<n.a.>",
				*rd->arg.arg1 );
			
			rd->res.res1 = "Dies ist das Resultat!";
			break;
		
		case RXIF_FREE:
			/* FREE your local data here */
			free( rd );
			break;
	}
	return;
}

void rx_multi_in_num( struct RexxHost *host, struct rxd_multi_in_num **rxd, long action )
{
	struct rxd_multi_in_num *rd = *rxd;
	long **s;

	switch( action )
	{
		case RXIF_INIT:
			*rxd = calloc( sizeof *rd, 1 );
			break;
			
		case RXIF_ACTION:
			/* Insert your CODE here */
			printf( "\nmulti_in_num: liste=%lx\n", rd->arg.liste );
			if( s = rd->arg.liste )
				for( ; *s; s++ )
					printf( "Liste: %ld\n", **s );
			break;
		
		case RXIF_FREE:
			/* FREE your local data here */
			free( rd );
			break;
	}
	return;
}

void rx_multi_in_str( struct RexxHost *host, struct rxd_multi_in_str **rxd, long action )
{
	struct rxd_multi_in_str *rd = *rxd;
	char **s;

	switch( action )
	{
		case RXIF_INIT:
			*rxd = calloc( sizeof *rd, 1 );
			break;
			
		case RXIF_ACTION:
			/* Insert your CODE here */
			printf( "\nmulti_in_str: liste=%lx\n", rd->arg.liste );
			if( s = rd->arg.liste )
				for( ; *s; s++ )
					printf( "Liste: %s\n", *s );
			break;
		
		case RXIF_FREE:
			/* FREE your local data here */
			free( rd );
			break;
	}
	return;
}

void rx_multi_out_num( struct RexxHost *host, struct rxd_multi_out_num **rxd, long action )
{
	struct rxd_multi_out_num *rd = *rxd;
	static long a=123, b=234, c=345;
	static long *aa[4];

	switch( action )
	{
		case RXIF_INIT:
			*rxd = calloc( sizeof *rd, 1 );
			break;
			
		case RXIF_ACTION:
			/* Insert your CODE here */
			aa[0] = &a;
			aa[1] = &b;
			aa[2] = &c;
			aa[3] = NULL;
			rd->res.liste = aa;
			break;
		
		case RXIF_FREE:
			/* FREE your local data here */
			free( rd );
			break;
	}
	return;
}

void rx_multi_out_str( struct RexxHost *host, struct rxd_multi_out_str **rxd, long action )
{
	struct rxd_multi_out_str *rd = *rxd;
	static char *a[] = { "abc","bcd","cde","def","huhu", NULL };

	switch( action )
	{
		case RXIF_INIT:
			*rxd = calloc( sizeof *rd, 1 );
			break;
			
		case RXIF_ACTION:
			/* Insert your CODE here */
			rd->res.liste = a;
			break;
		
		case RXIF_FREE:
			/* FREE your local data here */
			free( rd );
			break;
	}
	return;
}

void rx_open( struct RexxHost *host, struct rxd_open **rxd, long action )
{
	struct rxd_open *rd = *rxd;

	switch( action )
	{
		case RXIF_INIT:
			*rxd = calloc( sizeof *rd, 1 );
			if( rd = *rxd )
			{
				/* set your DEFAULTS here */
				rd->arg.file = "default_file";
			}
			break;
			
		case RXIF_ACTION:
			/* Insert your CODE here */
			printf( "\nopen file=%s prompt=%ld\n",
				rd->arg.file, rd->arg.prompt );
			break;
		
		case RXIF_FREE:
			/* FREE your local data here */
			free( rd );
			break;
	}
	return;
}


#ifndef RX_ALIAS_C
char *ExpandRXCommand( struct RexxHost *host, char *command )
{
	/* Insert your ALIAS-HANDLER here */
	return( NULL );
}
#endif

