#ifndef __rts_h_
#define __rts_h_
typedef enum
{
UNUSED,
Process,
Signal,
Buffer,
Event,
Synonym,
Exception,
LAST_AND_UNUSED,
} TaskingEnum;
typedef void (*EntryPoint) ();
typedef struct
{
char *name;
short *value;
int value_defined;
EntryPoint entry;
unsigned char type;
} TaskingStruct;
typedef struct
{
short ptype;
short pcopy;
} INSTANCE;
typedef enum
{
wait_wait,
wait_buffer_send,
wait_buffer_receive,
wait_buffer_free,
wait_event_delay,
wait_event_free,
} Delay_Reason;
extern INSTANCE __whoami ();
extern void *__xmalloc_ ();
#define THIS __whoami()
#define MALLOC(ADDR,SIZE) ADDR = __xmalloc_(SIZE)
#define FREE(ADDR) free (ADDR)
typedef struct EVENTQUEUE
{
struct EVENTQUEUE *forward;
struct EVENTQUEUE **listhead;
int priority;
INSTANCE this;
struct EVENTQUEUE *startlist;
struct EVENTQUEUE *chain;
int is_continued;
INSTANCE who_continued;
} Event_Queue;
typedef struct
{
Event_Queue **ev;
unsigned long maxqueuelength;
} Event_Descr;
struct BUFFERQUEUE;
typedef struct BUFFER_WAIT_QUEUE
{
struct BUFFER_WAIT_QUEUE *forward;
struct BUFFERQUEUE **bufferaddr;
INSTANCE this;
struct BUFFER_WAIT_QUEUE *startlist;
struct BUFFER_WAIT_QUEUE *chain;
int is_sent;
INSTANCE who_sent;
unsigned long datalen;
void *dataptr;
} Buffer_Wait_Queue;
typedef struct BUFFER_SEND_QUEUE
{
struct BUFFER_SEND_QUEUE *forward;
int priority;
INSTANCE this;
int is_delayed;
unsigned long datalen;
void *dataptr;
} Buffer_Send_Queue;
typedef struct BUFFERQUEUE
{
Buffer_Wait_Queue *waitqueue;
unsigned long waitqueuelength;
Buffer_Send_Queue *sendqueue;
unsigned long sendqueuelength;
} Buffer_Queue;
typedef struct
{
Buffer_Queue **buf;
unsigned long maxqueuelength;
} Buffer_Descr;
typedef struct
{
void *ptr;
int length;
} Data_Descr;
typedef struct
{
unsigned long secs;
unsigned long nanosecs;
} RtsTime;
extern void __rtstime (RtsTime *t);
extern int __delay_this (Delay_Reason reason, RtsTime *t, char *file, int lineno);
extern void __continue_that (INSTANCE ins, int prio, char *file, int lineno);
#endif