/* 
 * This is an automatically-generated file.
 * Source file  : test/input/timer.idl
 * Output file  : -
 * Platform     : V4 Generic
 * Mapping      : CORBA C
 *
 * Generated by Magpie VERSION_REMOVED
*/

#define IDL4_OMIT_FRAME_POINTER 0 /* Unimplemented */
#define IDL4_USE_FASTCALL 0 /* Unimplemented */
#define IDL4_NEED_MALLOC 0 /* Unimplemented */
#define IDL4_API v4
#define IDL4_ARCH generic

#define MAGPIE_BYTES_PER_WORD (sizeof(L4_Word_t))

#ifdef __cplusplus
extern "C" {
#endif
#include "idl4/idl4.h"
#ifdef __cplusplus
}
#endif





#if !defined(__-__)
#define __-__




/* Interface timer_ */
void timer__server(void);
void timer__discard(void);


#define TIMER__DEFAULT_VTABLE { service_timer__request, service_timer__current_time }
#define TIMER__DEFAULT_VTABLE_SIZE 2


#define TIMER__MAX_FID 1
#define TIMER__MSGBUF_SIZE 0 /* Unimplemented */
#define TIMER__STRBUF_SIZE 0 /* Unimplemented */
#define TIMER__FID_MASK 0x1







typedef union {
	struct {
		long _msgtag;
		int timer_obj;
		long long time;
		int flags;
		
	} _in;
	struct {
		long _spacer[__L4_NUM_MRS];
		long _msgtag;
		long __retval;
		
	} _out;
	struct {
		long _spacer[__L4_NUM_MRS*2];
		idl4_inverse_stringitem _str[16];
		long _acceptor;
	} _buf;
} _param_timer__request;

long service_timer__request(L4_ThreadId_t _caller, _param_timer__request *_par);

inline long timer__request_implementation (CORBA_Object _caller, int timer_obj, long long time, int flags, idl4_server_environment *_env);


/* Number of output words is the size of the structure minus padding and message tag. */

#define _MAGPIE_TIMER__REQUEST_OUTPUT_BYTES (sizeof(_par->_out) - (sizeof(long) * __L4_NUM_MRS) - (sizeof(long)))



#define IDL4_PUBLISH_TIMER__REQUEST(_func) long service_timer__request(L4_ThreadId_t _caller, _param_timer__request *_par) { \
	idl4_server_environment _env; \
	_env._action = 0;\
\
	/* invoke service */ \
	_par->_out.__retval = _func(_caller, _par->_in.timer_obj, _par->_in.time, _par->_in.flags, &_env); \
\
	if (IDL4_EXPECT_TRUE(_env._action == 0)) {\
		/* Why marshal things to themselves? */ \
		/* jump back */ \
		/* the weird numbers: (2 * num fpages) << 6 + (num output words ) */ \
		_par->_out._msgtag = (0 << 6) + \
			(_MAGPIE_TIMER__REQUEST_OUTPUT_BYTES / MAGPIE_BYTES_PER_WORD); \
		return (0 << 6) + \
			(_MAGPIE_TIMER__REQUEST_OUTPUT_BYTES / MAGPIE_BYTES_PER_WORD); \
	} \
	return -1; \
}




#define IDL4_PUBLISH_timer__request IDL4_PUBLISH_TIMER__REQUEST
static inline void timer__request_reply(CORBA_Object _client , long __retval )
{
	struct _reply_buffer {
		struct {
			long _msgtag;
			
			long __retval;
		} _out;
	} _buf;
	struct _reply_buffer *_par = &_buf;

	/* Marshal reply */
	
	_par->_out.__retval = __retval;
	
	/* send message */
	_buf._out._msgtag = ((sizeof(_buf._out) - sizeof(long)) / MAGPIE_BYTES_PER_WORD) + (0 << 6);
	L4_MsgLoad((L4_Msg_t *)((void *)_par));
	L4_Reply(_client);
}





typedef union {
	struct {
		long _msgtag;
		
	} _in;
	struct {
		long _spacer[__L4_NUM_MRS];
		long _msgtag;
		long __retval;
		
	} _out;
	struct {
		long _spacer[__L4_NUM_MRS*2];
		idl4_inverse_stringitem _str[16];
		long _acceptor;
	} _buf;
} _param_timer__current_time;

long service_timer__current_time(L4_ThreadId_t _caller, _param_timer__current_time *_par);

inline long timer__current_time_implementation (CORBA_Object _caller, idl4_server_environment *_env);


/* Number of output words is the size of the structure minus padding and message tag. */

#define _MAGPIE_TIMER__CURRENT_TIME_OUTPUT_BYTES (sizeof(_par->_out) - (sizeof(long) * __L4_NUM_MRS) - (sizeof(long)))



#define IDL4_PUBLISH_TIMER__CURRENT_TIME(_func) long service_timer__current_time(L4_ThreadId_t _caller, _param_timer__current_time *_par) { \
	idl4_server_environment _env; \
	_env._action = 0;\
\
	/* invoke service */ \
	_par->_out.__retval = _func(_caller, &_env); \
\
	if (IDL4_EXPECT_TRUE(_env._action == 0)) {\
		/* Why marshal things to themselves? */ \
		/* jump back */ \
		/* the weird numbers: (2 * num fpages) << 6 + (num output words ) */ \
		_par->_out._msgtag = (0 << 6) + \
			(_MAGPIE_TIMER__CURRENT_TIME_OUTPUT_BYTES / MAGPIE_BYTES_PER_WORD); \
		return (0 << 6) + \
			(_MAGPIE_TIMER__CURRENT_TIME_OUTPUT_BYTES / MAGPIE_BYTES_PER_WORD); \
	} \
	return -1; \
}




#define IDL4_PUBLISH_timer__current_time IDL4_PUBLISH_TIMER__CURRENT_TIME
static inline void timer__current_time_reply(CORBA_Object _client , long __retval )
{
	struct _reply_buffer {
		struct {
			long _msgtag;
			
			long __retval;
		} _out;
	} _buf;
	struct _reply_buffer *_par = &_buf;

	/* Marshal reply */
	
	_par->_out.__retval = __retval;
	
	/* send message */
	_buf._out._msgtag = ((sizeof(_buf._out) - sizeof(long)) / MAGPIE_BYTES_PER_WORD) + (0 << 6);
	L4_MsgLoad((L4_Msg_t *)((void *)_par));
	L4_Reply(_client);
}





#endif //__-__
